std/fs: File.owner, the owner id of a file (native, step 1 of #293) #496
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 1 of #293 (the owner half of #288 criterion 3). Commit 1 of the two-commit rule (
compiler/CONTRIBUTING.md, "Two commits for a breaking change"): the native is added and not used by the compiler; the seed is refreshed from it by the owner; step 2 (use inuploadDirectory, theregistry.trbbody writes) follows from #293 afterwards.Goal.
std/fscan answer who owns a file or directory, so a later change can refuse an upload directory of another user. TodayMetadatacarries kind, size, modification time and permissions only, andstd/oshas only the process's ownPosix.effectiveUserIdentifier().Design (decided by the loop). A new native beside
fileMetadatainstd/fs/src/lib.trb(not a changed signature offileMetadata: the seed's compiler reaches it), implemented inruntime/for POSIX (st_uidoflstat/statper afollowflag, same asfileMetadata), and a method onFilein std naming, e.g.File.owner(path)answeringResult<Int64, IoError>(same type asPosix.effectiveUserIdentifier). Where there is no owner id (Windows, the browser) it answers an unsupportedIoError, the way the other platform-limitedFileoperations do.Acceptance criteria
std/fs/src/lib.trb, implemented inruntime/(POSIX), entered indocs/design/NATIVES.mdand the natives manifest, with the generated table regenerated.File.owneranswers the owner id of a file, of a directory, and of a symbolic link perfollow; anIoErrornaming the path for a missing path; an unsupported error on Windows and in the browser.Posix.effectiveUserIdentifier(); a missing path fails) and a runtime test.compiler/src/calls the new function (the seed must know it first).Seed. Yes: a new native, commit 1 of two. The seed refresh is the owner's step; #293 stays open for step 2 (waits on the refreshed seed).
[loop:torbscript] claim implement by session:loop-torbscript-20261026-1044 until 2026-10-26T16:05:05Z
[loop:torbscript] implement: checkpoint, context guard reached; branch
loop/496-file-ownerpushed (no PR yet).Done (commit "feat(std/fs): add File.owner and File.linkOwner", checkpoint, to be amended before the PR):
torb_platform_owner(platform.c: POSIXst_uidvia stat/lstat perfollow; Windows and emscripten answer "Operation not supported"),torb_file_owner(file.c), prototypes inruntime/include/torb.h, C testthe_owner_of_a_file_a_directory_and_a_link_is_the_user_who_made_theminruntime/tests/file_test.c.native fn fileOwner(path, follow, var owner: Int64, var failure): Bool,File.owner/File.linkOwner(Result<Int64, IoError>) instd/fs/src/lib.trb.Still open:
compiler/src/backend/c/natives.trbafterfileMetadata:runtimeOf("fileOwner", "torb_file_owner", "bool torb_file_owner(torb_text path, bool follow, int64_t *owner, torb_text *failure);").runtime/include/torb_natives.handruntime/machine_natives.c(no torb binary in the worker exec: insert the prototype/thunk in the sorted position and renumber the thunks and the table by script;compiler/tests/natives.test.trbin CI asserts the files equal the render).docs/design/NATIVES.md: rowfileOwner | Runtime | keep | fileand the audit counts (keep +1, total +1).std/fs/tests/files.test.trb(group "metadata"/new "owner": fresh temp file equalsPosix.effectiveUserIdentifier()viause Posix from "std/os/posix/native", arm perOperatingSystem.current; missing path fails; Windows/Browser unsupported).skills/regeneration (CItorb docs skill --check), then PR (Part of #293,Closes #496),ci-wait.sh.Next: implement (continue), worktree: ~/workspaces/orion/code/tmp-496 on branch loop/496-file-owner. Rough usage so far: ~100k tokens.
[loop:torbscript] claim implement (continuation 1) by session:loop-torbscript-20261026-1044 until 2026-10-26T16:15:10Z
[loop:torbscript] implement: PR #499 opened (one commit
feat(std/fs): add File.owner and File.linkOwner,Part of #293/Closes #496); forge CI green on8fefad3b(gates, tier A and B, bootstrap, every host emits the same C, pdisc, commit messages; the hand-generated natives table matched the render). Nothing under compiler/src/ calls the new native (seed refresh stays the owner's step), next: review (Argus). Rough usage of this continuation: ~120k tokens.