feat(std/fs): add File.owner and File.linkOwner #499

Merged
argus merged 1 commit from loop/496-file-owner into main 2026-10-26 11:43:15 +00:00
Collaborator

Part of #293

Closes #496

Adds File.owner and File.linkOwner (Result<Int64, IoError>): the id of the user who owns a path (st_uid; linkOwner of a symbolic link itself). Windows and the browser answer Operation not supported.

Seed: a new native, so this is commit 1 of the two-commit rule (compiler/CONTRIBUTING.md, "Two commits for a breaking change"). Nothing under compiler/src/ calls it; the seed refresh is the owner's step, and step 2 (use in uploadDirectory, #293) follows after it.

Changes

  • runtime/: torb_file_owner, torb_platform_owner (POSIX, Windows/emscripten unsupported), C test in runtime/tests/file_test.c
  • std/fs: native fileOwner, File.owner, File.linkOwner, tests in std/fs/tests/files.test.trb
  • natives manifest row, docs/design/NATIVES.md (keep 186, total 542), torb_natives.h and machine_natives.c regenerated by script (no torb binary of this commit available to the worker; compiler/tests/natives.test.trb in CI asserts equality with the render)
  • docs std/fs and regenerated skills/

Test: forge CI (tools/gates.sh a, b); locally only torb format --check of the touched files.

Part of #293 Closes #496 Adds `File.owner` and `File.linkOwner` (`Result<Int64, IoError>`): the id of the user who owns a path (`st_uid`; `linkOwner` of a symbolic link itself). Windows and the browser answer `Operation not supported`. **Seed:** a new native, so this is commit 1 of the two-commit rule (`compiler/CONTRIBUTING.md`, "Two commits for a breaking change"). Nothing under `compiler/src/` calls it; the seed refresh is the owner's step, and step 2 (use in `uploadDirectory`, #293) follows after it. **Changes** - `runtime/`: `torb_file_owner`, `torb_platform_owner` (POSIX, Windows/emscripten unsupported), C test in `runtime/tests/file_test.c` - `std/fs`: native `fileOwner`, `File.owner`, `File.linkOwner`, tests in `std/fs/tests/files.test.trb` - natives manifest row, `docs/design/NATIVES.md` (keep 186, total 542), `torb_natives.h` and `machine_natives.c` regenerated by script (no torb binary of this commit available to the worker; `compiler/tests/natives.test.trb` in CI asserts equality with the render) - docs `std/fs` and regenerated `skills/` **Test:** forge CI (`tools/gates.sh a`, `b`); locally only `torb format --check` of the touched files.
feat(std/fs): add File.owner and File.linkOwner
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m28s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier A (linux-x64) (pull_request) Successful in 27m3s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m41s
ci / tier B (linux-x64) (pull_request) Successful in 28m4s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 5m17s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m24s
ci / gates (pull_request) Successful in 0s
8fefad3b48
A new native, fileOwner, answers the id of the user who owns a path (st_uid, of a link itself without following). Commit 1 of the two-commit rule of compiler/CONTRIBUTING.md: nothing under compiler/src/ calls it yet. Part of #293.
argus approved these changes 2026-10-26 11:43:14 +00:00
argus left a comment

Approved at 8fefad3.

  • Tests: ok. C runtime test (file, directory, link, dangling link, missing path, Windows branch) and std/fs tests (per-OS match, dangling link, IoError path). CI green on this head (tier A/B, bootstrap, same-C, playground, gates, pdisc).
  • Correctness: ok. stat/lstat by follow, st_uid to Int64, Windows/emscripten answer Operation not supported; errors carry the path via IoError.
  • Scope: ok. Task #496/#293 only; the seed rule is respected (nothing in compiler/src/ calls the new native). Generated machine_natives.c/torb_natives.h are covered by the render-equality test in CI.
  • Security/data/docs: ok. Read-only metadata call, no new permissions or dependencies; NATIVES.md counts (186/542), std/fs docs and the skills copy are updated.

Non-blocking:

  • The doc comment of File.owner ends "and so does a path that is not there, with the system's own words". The "so does" reads as if a missing path also says Operation not supported; the system's own message is meant.
Approved at 8fefad3. - Tests: ok. C runtime test (file, directory, link, dangling link, missing path, Windows branch) and std/fs tests (per-OS match, dangling link, IoError path). CI green on this head (tier A/B, bootstrap, same-C, playground, gates, pdisc). - Correctness: ok. `stat`/`lstat` by `follow`, `st_uid` to Int64, Windows/emscripten answer `Operation not supported`; errors carry the path via `IoError`. - Scope: ok. Task #496/#293 only; the seed rule is respected (nothing in `compiler/src/` calls the new native). Generated `machine_natives.c`/`torb_natives.h` are covered by the render-equality test in CI. - Security/data/docs: ok. Read-only metadata call, no new permissions or dependencies; NATIVES.md counts (186/542), std/fs docs and the skills copy are updated. Non-blocking: - The doc comment of `File.owner` ends "and so does a path that is not there, with the system's own words". The "so does" reads as if a missing path also says `Operation not supported`; the system's own message is meant.
argus merged commit 6eed6e7f4f into main 2026-10-26 11:43:15 +00:00
argus deleted branch loop/496-file-owner 2026-10-26 11:43:16 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!499
No description provided.