os: volumes (OS slice 4) #128

Closed
opened 2026-10-05 21:07:23 +00:00 by orion · 19 comments
Collaborator

Goal

Slice 4 of docs/design/OS.md (section 5.4 and the slice table in section 10): std/os answers which file systems are mounted and how full they are, as Volume, VolumeKind and VolumeSpace, on Windows, Linux and macOS. FreeBSD and the browser answer OsError.Unsupported until slice 7, like Memory.current does.

Specification

  • Design record: OS.md section 5.4 (Volumes) and slice 4 of section 10. docs/ROADMAP.md lists std/os "the rest of their slices" (#126 to #131); this issue is slice 4.
  • Dependency: the slice table says slice 4 depends on slice 2 (memory, ByteSize), which is done. The earlier "depends on #127" is dropped: slice 3 (processors, #127) shares no code with volumes, and space is not a ByteSize consumer of anything in slice 3. Only the shared files (lib.trb, natives.trb, os.md) can conflict; a rebase settles that.

Acceptance criteria

  1. std/os/src/volumes.trb declares Volume, VolumeKind, VolumeSpace exactly as in OS.md 5.4 (fields, isRemovable(), used(), Volume.all(includeVirtual: Bool = false), Volume.containing(path), Volume.space()), exported from std/os/src/lib.trb and listed in its doc comment. space and containing return Task<Result<...>> but run synchronously until milestone 7.7 (the body calls the native directly, as File.readText does), as OS.md slice 4 says.
  2. Volume.all is a match OperatingSystem.current handing to per-system directories: windows/volumes.trb (FindFirstVolumeW/GetVolumePathNamesForVolumeNameW, kind from GetDriveTypeW), linux/volumes.trb (/proc/self/mountinfo via the existing readSystemFile, kind from the file system name and /sys/block/<device>/removable), macos/volumes.trb over bsd/ (getmntinfo(MNT_NOWAIT), kind from MNT_LOCAL/MNT_REMOVABLE). FreeBSD and Browser arms: Fail OsError.Unsupported("the volumes", ...).
  3. space and containing use GetDiskFreeSpaceExW (Windows) and statvfs (Linux, macOS, through posix/); available is what the caller may still write, free what the system holds free, available <= free <= total.
  4. The mountinfo parser is public and pure. Tests in std/os/tests/volumes.test.trb run on every machine with captured text and cover: a plain ext4 root, an escaped mount point (\040 space, \011 tab, \134 backslash) decoded to the real path, the optional fields before the - separator, a tmpfs kind Memory, an nfs4 kind Network, proc/sysfs kind Virtual left out unless includeVirtual: true, a read-only mount (ro in the options) giving readOnly, and a line missing the separator giving OsError.Malformed.
  5. A host test (std/os/tests/host.test.trb style, per system with the guarded arms): Volume.all() is non-empty and holds a volume whose mount point is a prefix of the current directory; Volume.containing(Directories.temporary()) answers a volume with space().total > 0 and available <= total; containing of a missing path is an OsError, not a panic.
  6. C: Windows natives in runtime/os/windows.c (volume enumeration, drive type, free space), statvfs in runtime/os/posix.c, getmntinfo in runtime/os/bsd.c, each declared in compiler/src/backend/c/natives.trb with the outcome-code convention of the memory natives. torb check --every-target is clean (FreeBSD's C stays uncompiled here, as OS.md slice 7 says).
  7. docs/standard-library/os.md documents the three types with an example; docs check is clean and skills/ is regenerated. OS.md slice 4 is marked Done (date) with a short "How the volumes landed" note of what differed from the design.

Seed impact

No. No syntax change, no new driver flag, no std name the compiler looks up by string; the new natives are declared in natives.trb like the processors' and memory's. The compiler does not import Volume itself.

Size

One PR, two Conventional Commits:

  1. feat(os): Volume, VolumeKind, VolumeSpace and Volume.all (types, the three all halves, the mountinfo parser and its tests)
  2. feat(os): Volume.space, Volume.containing and the volumes docs (statvfs and GetDiskFreeSpaceEx, host tests, docs, OS.md marked done)

Three runtime files (windows.c, posix.c, bsd.c), the same footprint as processors step 1 (#488). If the PR grows past that when implemented, commit 2 becomes the follow-up issue.

## Goal Slice 4 of `docs/design/OS.md` (section 5.4 and the slice table in section 10): `std/os` answers which file systems are mounted and how full they are, as `Volume`, `VolumeKind` and `VolumeSpace`, on Windows, Linux and macOS. FreeBSD and the browser answer `OsError.Unsupported` until slice 7, like `Memory.current` does. ## Specification - Design record: [OS.md section 5.4 (Volumes)](https://git.torb.dev/torbscript/language/src/branch/main/docs/design/OS.md#54-volumes) and slice 4 of section 10. [docs/ROADMAP.md](https://git.torb.dev/torbscript/language/src/branch/main/docs/ROADMAP.md) lists `std/os` "the rest of their slices" (#126 to #131); this issue is slice 4. - Dependency: the slice table says slice 4 depends on slice 2 (memory, `ByteSize`), which is done. The earlier "depends on #127" is dropped: slice 3 (processors, #127) shares no code with volumes, and `space` is not a `ByteSize` consumer of anything in slice 3. Only the shared files (`lib.trb`, `natives.trb`, `os.md`) can conflict; a rebase settles that. ## Acceptance criteria 1. `std/os/src/volumes.trb` declares `Volume`, `VolumeKind`, `VolumeSpace` exactly as in OS.md 5.4 (fields, `isRemovable()`, `used()`, `Volume.all(includeVirtual: Bool = false)`, `Volume.containing(path)`, `Volume.space()`), exported from `std/os/src/lib.trb` and listed in its doc comment. `space` and `containing` return `Task<Result<...>>` but run synchronously until milestone 7.7 (the body calls the native directly, as `File.readText` does), as OS.md slice 4 says. 2. `Volume.all` is a `match OperatingSystem.current` handing to per-system directories: `windows/volumes.trb` (`FindFirstVolumeW`/`GetVolumePathNamesForVolumeNameW`, kind from `GetDriveTypeW`), `linux/volumes.trb` (`/proc/self/mountinfo` via the existing `readSystemFile`, kind from the file system name and `/sys/block/<device>/removable`), `macos/volumes.trb` over `bsd/` (`getmntinfo(MNT_NOWAIT)`, kind from `MNT_LOCAL`/`MNT_REMOVABLE`). FreeBSD and Browser arms: `Fail OsError.Unsupported("the volumes", ...)`. 3. `space` and `containing` use `GetDiskFreeSpaceExW` (Windows) and `statvfs` (Linux, macOS, through `posix/`); `available` is what the caller may still write, `free` what the system holds free, `available <= free <= total`. 4. The mountinfo parser is public and pure. Tests in `std/os/tests/volumes.test.trb` run on every machine with captured text and cover: a plain `ext4` root, an escaped mount point (`\040` space, `\011` tab, `\134` backslash) decoded to the real path, the optional fields before the `-` separator, a `tmpfs` kind `Memory`, an `nfs4` kind `Network`, `proc`/`sysfs` kind `Virtual` left out unless `includeVirtual: true`, a read-only mount (`ro` in the options) giving `readOnly`, and a line missing the separator giving `OsError.Malformed`. 5. A host test (`std/os/tests/host.test.trb` style, per system with the guarded arms): `Volume.all()` is non-empty and holds a volume whose mount point is a prefix of the current directory; `Volume.containing(Directories.temporary())` answers a volume with `space().total > 0` and `available <= total`; `containing` of a missing path is an `OsError`, not a panic. 6. C: Windows natives in `runtime/os/windows.c` (volume enumeration, drive type, free space), `statvfs` in `runtime/os/posix.c`, `getmntinfo` in `runtime/os/bsd.c`, each declared in `compiler/src/backend/c/natives.trb` with the outcome-code convention of the memory natives. `torb check --every-target` is clean (FreeBSD's C stays uncompiled here, as OS.md slice 7 says). 7. `docs/standard-library/os.md` documents the three types with an example; `docs check` is clean and `skills/` is regenerated. OS.md slice 4 is marked **Done (date)** with a short "How the volumes landed" note of what differed from the design. ## Seed impact No. No syntax change, no new driver flag, no std name the compiler looks up by string; the new natives are declared in `natives.trb` like the processors' and memory's. The compiler does not import `Volume` itself. ## Size One PR, two Conventional Commits: 1. `feat(os): Volume, VolumeKind, VolumeSpace and Volume.all` (types, the three `all` halves, the mountinfo parser and its tests) 2. `feat(os): Volume.space, Volume.containing and the volumes docs` (statvfs and GetDiskFreeSpaceEx, host tests, docs, OS.md marked done) Three runtime files (`windows.c`, `posix.c`, `bsd.c`), the same footprint as processors step 1 (#488). If the PR grows past that when implemented, commit 2 becomes the follow-up issue.
Author
Collaborator

[loop:torbscript] intake: in scope (author orion, label loop), source OS.md slice 4, not a duplicate. Depends on #127. next: waiting (dependency #127) until 2026-10-10T04:00:00Z

[loop:torbscript] intake: in scope (author orion, label loop), source OS.md slice 4, not a duplicate. Depends on #127. next: waiting (dependency #127) until 2026-10-10T04:00:00Z
Author
Collaborator

[loop:torbscript] claim refine by session:loop-torbscript-20261027 until 2026-10-27T03:00Z

[loop:torbscript] claim refine by session:loop-torbscript-20261027 until 2026-10-27T03:00Z
Author
Collaborator

[loop:torbscript] decided by the loop: dropped the dependency on #127. Why: OS.md section 10 lists slice 4 as depending on slice 2 (memory, ByteSize), which is done (2026-10-09); processors share no code with volumes. Kept as one issue, not an epic: three runtime files (windows.c, posix.c, bsd.c), the same footprint as processors step 1 (#488), landed as two commits (types + all + mountinfo parser; space + containing + docs). space runs synchronously until 7.7, as the slice says. Seed impact: none. No duplicate among open issues (keyword search: volume, mount, statvfs).

[loop:torbscript] decided by the loop: dropped the dependency on #127. Why: OS.md section 10 lists slice 4 as depending on slice 2 (memory, `ByteSize`), which is done (2026-10-09); processors share no code with volumes. Kept as one issue, not an epic: three runtime files (`windows.c`, `posix.c`, `bsd.c`), the same footprint as processors step 1 (#488), landed as two commits (types + `all` + mountinfo parser; `space` + `containing` + docs). `space` runs synchronously until 7.7, as the slice says. Seed impact: none. No duplicate among open issues (keyword search: volume, mount, statvfs).
Author
Collaborator

[loop:torbscript] refine: body rewritten to the definition of ready (goal, 7 testable criteria, OS.md 5.4 / slice 4 and ROADMAP point, seed impact none, size one PR in two commits); label ready set. Claim 7151 released. next: implement. Worker usage: about 60k tokens (sonnet).

[loop:torbscript] refine: body rewritten to the definition of ready (goal, 7 testable criteria, OS.md 5.4 / slice 4 and ROADMAP point, seed impact none, size one PR in two commits); label `ready` set. Claim 7151 released. next: implement. Worker usage: about 60k tokens (sonnet).
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:23Z

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:23Z
Author
Collaborator

[loop:torbscript] release implement: worker hit its context budget after reading, before the first edit. Nothing is committed or pushed; branch loop/128-os-volumes exists only as an empty local worktree (ws wt name torbscript-language-128, from main at b81b31f4). Next implementer starts clean.

Checkpoint (read so far, so the next worker need not redo it):

  • Template: commit f12a2a4d (processors, #488, 24 files). Same footprint applies: natives.trb rows (systemRuntimeOf(...) in windowsEntries/systemEntries), prototypes in runtime/include/torb_os.h, C in runtime/os/{windows,posix,bsd}.c, std/os/src/*/native.trb declarations, docs/design/NATIVES.md rows (keep/total counters) and the generated runtime/machine_natives.c + runtime/include/torb_natives.h (tools/land.sh regenerates both; no torb binary exists on the worker host, so write the generated rows by hand to match the generator's output exactly and let CI's drift check confirm).
  • Native shapes are fixed in OS.md section 7: Windows volumeMountPoints, volumeInformation, volumeSpace; POSIX fileSystemSpace(path, var blockSize, var blocks, var free, var available, var readOnly, var failure); BSD mountedFileSystems(...). A native cannot hand a list to the program, so return one text with a line per entry, as processorTimesOfEach does, and parse it in TorbScript.
  • Module pattern: memory.trb (a match OperatingSystem.current handing to windows/, linux/, macos/; FreeBSD and Browser Fail OsError.Unsupported("the volumes", ...)), linux/memory.trb (public pure parser + readSystemFile), outcome(...) from error.trb for natives. Tests: std/os/tests/memory.test.trb style plus host.test.trb.
  • Commit 1 (types, three all halves, mountinfo parser + tests) needs only the enumeration natives; commit 2 adds the space natives, host tests, docs (docs/standard-library/os.md, skills regenerated, OS.md slice 4 marked Done).

next: implement (re-claim needed). Worker usage: about 100k tokens (sonnet), no code written.

[loop:torbscript] release implement: worker hit its context budget after reading, before the first edit. Nothing is committed or pushed; branch `loop/128-os-volumes` exists only as an empty local worktree (`ws wt` name `torbscript-language-128`, from `main` at b81b31f4). Next implementer starts clean. Checkpoint (read so far, so the next worker need not redo it): - Template: commit f12a2a4d (processors, #488, 24 files). Same footprint applies: `natives.trb` rows (`systemRuntimeOf(...)` in `windowsEntries`/`systemEntries`), prototypes in `runtime/include/torb_os.h`, C in `runtime/os/{windows,posix,bsd}.c`, `std/os/src/*/native.trb` declarations, `docs/design/NATIVES.md` rows (keep/total counters) and the generated `runtime/machine_natives.c` + `runtime/include/torb_natives.h` (`tools/land.sh` regenerates both; no `torb` binary exists on the worker host, so write the generated rows by hand to match the generator's output exactly and let CI's drift check confirm). - Native shapes are fixed in OS.md section 7: Windows `volumeMountPoints`, `volumeInformation`, `volumeSpace`; POSIX `fileSystemSpace(path, var blockSize, var blocks, var free, var available, var readOnly, var failure)`; BSD `mountedFileSystems(...)`. A native cannot hand a list to the program, so return one text with a line per entry, as `processorTimesOfEach` does, and parse it in TorbScript. - Module pattern: `memory.trb` (a `match OperatingSystem.current` handing to `windows/`, `linux/`, `macos/`; FreeBSD and Browser `Fail OsError.Unsupported("the volumes", ...)`), `linux/memory.trb` (public pure parser + `readSystemFile`), `outcome(...)` from `error.trb` for natives. Tests: `std/os/tests/memory.test.trb` style plus `host.test.trb`. - Commit 1 (types, three `all` halves, mountinfo parser + tests) needs only the enumeration natives; commit 2 adds the space natives, host tests, docs (`docs/standard-library/os.md`, skills regenerated, OS.md slice 4 marked Done). next: implement (re-claim needed). Worker usage: about 100k tokens (sonnet), no code written.
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:35Z

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:35Z
Author
Collaborator

[loop:torbscript] implement: checkpoint 2, not finished. Nothing committed or pushed yet; the files below sit uncommitted in the worktree torbscript-language-128 (branch loop/128-os-volumes, ws wt new torbscript/language 128 reuses it). The worker hit its context guard right after writing them. Next worker: git status, review these files, commit 1 at once, push, then the rest.

Written, unchecked (no torb on the host, so none was compiled):

  • std/os/src/volumes.trb: Volume (isRemovable, isVirtual, all filtering mounted()), VolumeKind, VolumeSpace (used = total - free). space and containing are for commit 2 (the body returns a plain Result like Processor.usage, no offload yet).
  • std/os/src/linux/volumes.trb: volumes(), public pure parseMountInfo, kindOfFileSystem, diskOf, \040-style unescape; a Fixed disk is upgraded to Removable via readSystemFile("/sys/block/<disk>/removable").
  • std/os/src/windows/volumes.trb: volumes() over Windows.volumeMountPoints(var text, var failure) (one path per line) and Windows.volumeInformation(root, var device, var label, var fileSystem, var driveType: Int64, var readOnly: Int64, var failure); pure mountPointsOf, kindOfDriveType.
  • std/os/src/bsd/volumes.trb: volumes() over Bsd.mountedFileSystems(var text, var failure), lines flags<TAB>fileSystem<TAB>device<TAB>mountPoint (flags bits 1 read-only, 2 local, 4 removable, translated in C); public pure parseMountedFileSystems, kindOf. std/os/src/macos/volumes.trb just calls it.

To verify first (guesses without a compiler): fields.dropping(4) on a List in bsd/volumes.trb (grep found no such method: use a loop or skip), break inside while, top-level const lists used in functions, else { [] }-free typing, torb format layout (120 columns; one match outcome(...) line in windows/volumes.trb is too long).

Still to do for commit 1: use ... from "./volumes" line and doc bullet in std/os/src/lib.trb; native declarations in windows/native.trb, bsd/native.trb; C in runtime/os/windows.c (FindFirstVolumeW, GetVolumePathNamesForVolumeNameW, GetVolumeInformationW, GetDriveTypeW, GetVolumeNameForVolumeMountPointW for the device) and runtime/os/bsd.c (getmntinfo), prototypes in runtime/include/torb_os.h and torb_natives.h, systemRuntimeOf rows in compiler/src/backend/c/natives.trb (Windows.volumeMountPoints, Windows.volumeInformation, Bsd.mountedFileSystems), docs/design/NATIVES.md rows and counters, and runtime/machine_natives.c; tests/volumes.test.trb (criterion 4).
Generated-file rule, seen in f12a2a4d: machine_natives.c holds one thunk per runtime native in sorted order of the C name, numbered from 0, with the table and torb_machine_native_count at the end, so an insert renumbers every later thunk; use a script that parses the blocks (/* torb_os_... */), inserts the new ones, renumbers and rewrites the table. torb_natives.h is a list of /* Type.name */ plus prototype, sorted by that key.
Commit 2: Windows.volumeSpace(root, var total, var free, var available, var failure), Posix.fileSystemSpace(path, var blockSize, var blocks, var free, var available, var readOnly, var failure), Volume.space, Volume.containing, host tests, docs/standard-library/os.md, skills regeneration by hand, OS.md slice 4 Done.

Worker usage: about 120k tokens (sonnet) in this retry; the first retry read about 100k and wrote nothing.

next: implement (re-claim needed)

[loop:torbscript] release implement: the worker hit its context guard with the first files written but not committed; the next worker continues in the same worktree.

[loop:torbscript] implement: checkpoint 2, not finished. Nothing committed or pushed yet; the files below sit uncommitted in the worktree `torbscript-language-128` (branch `loop/128-os-volumes`, `ws wt new torbscript/language 128` reuses it). The worker hit its context guard right after writing them. Next worker: `git status`, review these files, commit 1 at once, push, then the rest. Written, unchecked (no `torb` on the host, so none was compiled): - `std/os/src/volumes.trb`: `Volume` (`isRemovable`, `isVirtual`, `all` filtering `mounted()`), `VolumeKind`, `VolumeSpace` (`used` = total - free). `space` and `containing` are for commit 2 (the body returns a plain `Result` like `Processor.usage`, no `offload` yet). - `std/os/src/linux/volumes.trb`: `volumes()`, public pure `parseMountInfo`, `kindOfFileSystem`, `diskOf`, `\040`-style unescape; a Fixed disk is upgraded to Removable via `readSystemFile("/sys/block/<disk>/removable")`. - `std/os/src/windows/volumes.trb`: `volumes()` over `Windows.volumeMountPoints(var text, var failure)` (one path per line) and `Windows.volumeInformation(root, var device, var label, var fileSystem, var driveType: Int64, var readOnly: Int64, var failure)`; pure `mountPointsOf`, `kindOfDriveType`. - `std/os/src/bsd/volumes.trb`: `volumes()` over `Bsd.mountedFileSystems(var text, var failure)`, lines `flags<TAB>fileSystem<TAB>device<TAB>mountPoint` (flags bits 1 read-only, 2 local, 4 removable, translated in C); public pure `parseMountedFileSystems`, `kindOf`. `std/os/src/macos/volumes.trb` just calls it. To verify first (guesses without a compiler): `fields.dropping(4)` on a `List` in `bsd/volumes.trb` (grep found no such method: use a loop or `skip`), `break` inside `while`, top-level `const` lists used in functions, `else { [] }`-free typing, `torb format` layout (120 columns; one `match outcome(...)` line in `windows/volumes.trb` is too long). Still to do for commit 1: `use ... from "./volumes"` line and doc bullet in `std/os/src/lib.trb`; native declarations in `windows/native.trb`, `bsd/native.trb`; C in `runtime/os/windows.c` (`FindFirstVolumeW`, `GetVolumePathNamesForVolumeNameW`, `GetVolumeInformationW`, `GetDriveTypeW`, `GetVolumeNameForVolumeMountPointW` for the device) and `runtime/os/bsd.c` (`getmntinfo`), prototypes in `runtime/include/torb_os.h` and `torb_natives.h`, `systemRuntimeOf` rows in `compiler/src/backend/c/natives.trb` (`Windows.volumeMountPoints`, `Windows.volumeInformation`, `Bsd.mountedFileSystems`), `docs/design/NATIVES.md` rows and counters, and `runtime/machine_natives.c`; `tests/volumes.test.trb` (criterion 4). Generated-file rule, seen in f12a2a4d: `machine_natives.c` holds one thunk per runtime native in sorted order of the C name, numbered from 0, with the table and `torb_machine_native_count` at the end, so an insert renumbers every later thunk; use a script that parses the blocks (`/* torb_os_... */`), inserts the new ones, renumbers and rewrites the table. `torb_natives.h` is a list of `/* Type.name */` plus prototype, sorted by that key. Commit 2: `Windows.volumeSpace(root, var total, var free, var available, var failure)`, `Posix.fileSystemSpace(path, var blockSize, var blocks, var free, var available, var readOnly, var failure)`, `Volume.space`, `Volume.containing`, host tests, `docs/standard-library/os.md`, skills regeneration by hand, OS.md slice 4 Done. Worker usage: about 120k tokens (sonnet) in this retry; the first retry read about 100k and wrote nothing. next: implement (re-claim needed) [loop:torbscript] release implement: the worker hit its context guard with the first files written but not committed; the next worker continues in the same worktree.
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:40Z

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:40Z
Author
Collaborator

[loop:torbscript] implement: checkpoint 3, not finished. Pushed to loop/128-os-volumes (head 2286420c, two WIP commits to be squashed into the two Conventional Commits; no PR yet). Worktree: /home/node/workspaces/orion/code/wt/torbscript-language-128 (ws wt new torbscript/language 128 reuses it).

Done for commit 1, unverified by any compiler (no torb on the host):

  • std/os/src/volumes.trb (Volume, VolumeKind, VolumeSpace, Volume.all), {linux,windows,bsd,macos}/volumes.trb; fixed fields.dropping (now an index loop) and the long line in windows/volumes.trb; lib.trb exports and doc bullet.
  • Native declarations Windows.volumeMountPoints, Windows.volumeInformation (windows/native.trb), Bsd.mountedFileSystems (bsd/native.trb).
  • C: torb_os_windows_volume_mount_points, torb_os_windows_volume_information in runtime/os/windows.c, torb_os_bsd_mounted_file_systems in runtime/os/bsd.c; prototypes in torb_os.h and torb_natives.h; manifest rows in compiler/src/backend/c/natives.trb; NATIVES.md rows and counters (keep 194, total 550); runtime/machine_natives.c regenerated by script (idempotent on the old file; thunks 320 -> 323).

Left for commit 1: std/os/tests/volumes.test.trb (criterion 4: parseMountInfo with a mountinfo copy incl. \040 and optional fields and malformed lines, kindOfFileSystem, diskOf, parseMountedFileSystems, kindOfDriveType, mountPointsOf, Volume.all host shape). Test pattern: std/os/tests/processor.test.trb (group/test, assert(parse(...) == Fail OsError.Malformed(src, detail)), imports from ../src/...). Then push, squash, open PR.
Commit 2 untouched: Windows.volumeSpace(root, var total, var free, var available, var failure), Posix.fileSystemSpace(path, var blockSize, var blocks, var free, var available, var readOnly, var failure) (statvfs; thunk guard defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)), Volume.space, Volume.containing, host tests, docs/standard-library/os.md + the four skills/torbscript-standard-library copies (see the diff of f12a2a4d for what to touch), OS.md slice 4 Done, keep/total +2.
Generator script for machine_natives.c: /home/node/workspaces/orion/tmp/gen/natives.py <machine_natives.c> <spec.py>; spec is a dict {cname: (guard, kinds)}, kinds t text by value, T text pointer, i int64 pointer (see c1.py); it renumbers and rewrites the table. Also add the header rows to torb_natives.h by hand (sorted by Type.name).

Worker usage: about 100k tokens (sonnet).

[loop:torbscript] release implement: worker context guard reached, work pushed; next worker continues in the same worktree.

[loop:torbscript] implement: checkpoint 3, not finished. Pushed to `loop/128-os-volumes` (head 2286420c, two WIP commits to be squashed into the two Conventional Commits; no PR yet). Worktree: `/home/node/workspaces/orion/code/wt/torbscript-language-128` (`ws wt new torbscript/language 128` reuses it). Done for commit 1, unverified by any compiler (no `torb` on the host): - `std/os/src/volumes.trb` (`Volume`, `VolumeKind`, `VolumeSpace`, `Volume.all`), `{linux,windows,bsd,macos}/volumes.trb`; fixed `fields.dropping` (now an index loop) and the long line in `windows/volumes.trb`; `lib.trb` exports and doc bullet. - Native declarations `Windows.volumeMountPoints`, `Windows.volumeInformation` (`windows/native.trb`), `Bsd.mountedFileSystems` (`bsd/native.trb`). - C: `torb_os_windows_volume_mount_points`, `torb_os_windows_volume_information` in `runtime/os/windows.c`, `torb_os_bsd_mounted_file_systems` in `runtime/os/bsd.c`; prototypes in `torb_os.h` and `torb_natives.h`; manifest rows in `compiler/src/backend/c/natives.trb`; NATIVES.md rows and counters (keep 194, total 550); `runtime/machine_natives.c` regenerated by script (idempotent on the old file; thunks 320 -> 323). Left for commit 1: `std/os/tests/volumes.test.trb` (criterion 4: `parseMountInfo` with a mountinfo copy incl. `\040` and optional fields and malformed lines, `kindOfFileSystem`, `diskOf`, `parseMountedFileSystems`, `kindOfDriveType`, `mountPointsOf`, `Volume.all` host shape). Test pattern: `std/os/tests/processor.test.trb` (`group`/`test`, `assert(parse(...) == Fail OsError.Malformed(src, detail))`, imports from `../src/...`). Then push, squash, open PR. Commit 2 untouched: `Windows.volumeSpace(root, var total, var free, var available, var failure)`, `Posix.fileSystemSpace(path, var blockSize, var blocks, var free, var available, var readOnly, var failure)` (statvfs; thunk guard `defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)`), `Volume.space`, `Volume.containing`, host tests, `docs/standard-library/os.md` + the four `skills/torbscript-standard-library` copies (see the diff of f12a2a4d for what to touch), OS.md slice 4 Done, keep/total +2. Generator script for `machine_natives.c`: `/home/node/workspaces/orion/tmp/gen/natives.py <machine_natives.c> <spec.py>`; spec is a dict `{cname: (guard, kinds)}`, kinds `t` text by value, `T` text pointer, `i` int64 pointer (see `c1.py`); it renumbers and rewrites the table. Also add the header rows to `torb_natives.h` by hand (sorted by `Type.name`). Worker usage: about 100k tokens (sonnet). [loop:torbscript] release implement: worker context guard reached, work pushed; next worker continues in the same worktree.
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:47Z

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:47Z
Author
Collaborator

[loop:torbscript] implement: checkpoint 4, not finished. No PR yet. Pushed to loop/128-os-volumes (head cb28dd30): commit 1 is squashed into one Conventional Commit, 2a77608d feat(os): volumes and mount enumeration (tools/check-commits.sh clean), plus one WIP commit cb28dd30 (commit-2 C natives). Worktree /home/node/workspaces/orion/code/wt/torbscript-language-128. Push needs git -c http.extraHeader="Authorization: Basic $(printf orion:%s "$(cat ~/.secrets/torbdev-token)" | base64 -w0)" push --force-with-lease origin loop/128-os-volumes (plain push has no credentials).

Done this session: std/os/tests/volumes.test.trb (mountinfo parser incl. \040/\134, optional fields, malformed lines, kindOfFileSystem, diskOf, parseMountedFileSystems, kindOfDriveType, mountPointsOf, Volume.all host shape, VolumeSpace.used); one 120-column line fixed in linux/volumes.trb; the commit-1 squash and push; C for commit 2: torb_os_windows_volume_space(torb_text root, int64_t *total, int64_t *free_bytes, int64_t *available, torb_text *failure) at the end of runtime/os/windows.c, torb_os_posix_file_system_space(torb_text path, int64_t *block_size, int64_t *blocks, int64_t *free_blocks, int64_t *available_blocks, int64_t *read_only, torb_text *failure) (statvfs, <sys/statvfs.h> added) in runtime/os/posix.c. Nothing was compiled; no torb on the host.

Remaining for commit 2 (then squash cb28dd30 into it, subject feat(os): Volume.space, Volume.containing and the volumes docs):

  1. Prototypes in runtime/include/torb_os.h; systemRuntimeOf rows in compiler/src/backend/c/natives.trb (Windows.volumeSpace in windowsEntries, [.Windows]; Posix.fileSystemSpace in posixEntries, posix); rows in runtime/include/torb_natives.h (sorted by Type.name: Posix.fileSystemSpace after Posix.effectiveUserIdentifier, Windows.volumeSpace after Windows.volumeMountPoints); NATIVES.md rows (Windows table after volumeInformation, Posix table) and counters keep 196 / total 552.
  2. runtime/machine_natives.c via /home/node/workspaces/orion/tmp/gen/natives.py runtime/machine_natives.c spec.py with spec {"torb_os_windows_volume_space": ("defined(_WIN32)", "tiiiT"), "torb_os_posix_file_system_space": ("defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)", "tiiiiiT")} (kinds t text by value, T text pointer, i int64 pointer).
  3. Native declarations: Windows.volumeSpace(root: String, var total: Int64, var free: Int64, var available: Int64, var failure: String): Int in std/os/src/windows/native.trb; Posix.fileSystemSpace(path: String, var blockSize: Int64, var blocks: Int64, var free: Int64, var available: Int64, var readOnly: Int64, var failure: String): Int in std/os/src/posix/native.trb.
  4. TorbScript: windows/volumes.trb public fn spaceAt(root: String): Result<VolumeSpace, OsError>, new posix/volumes.trb spaceAt(path: String) (total = blocks*blockSize etc., ByteSize(n), outcome(code, "the space of {path}", failure)?); in volumes.trb: fn space(): Task<Result<VolumeSpace, OsError>> (match OperatingSystem.current: Windows to windows, Linux/MacOs to posix, FreeBsd/Browser Fail OsError.Unsupported("the volume space", ...); body returns plainly like Processor.usage), and static fn containing(path: Path): Task<Result<Volume, OsError>>: absolute-ize with CurrentProcess.workingDirectory()?.joined(path) then normalized(), probe the path with spaceAt (a missing path fails here as OsError.Missing, never a panic), then pick the volume of Volume.all(includeVirtual: true) with the longest mount point that startsWith-prefixes the path (Windows: compare lower-cased show() text). Put the pure pick in a public fn (e.g. volumeContaining(volumes, path, caseSensitive)) and test it in volumes.test.trb.
  5. Host tests in std/os/tests/host.test.trb (see criterion 5; use a top-level const x = Volume.containing(...).await() like shortUsage), docs/standard-library/os.md (+ index counters if the processors commit touched them) and the four skills/torbscript-standard-library copies (SKILL.md, references/index.md, references/standard-library/index.md, references/standard-library/os.md: see git show f12a2a4d --stat), OS.md slice 4 Done (2026-10-27) with a "How the volumes landed" note (differences: containing is a mount-prefix match plus a statvfs probe; volumes of Windows with no path or an empty drive are skipped).
  6. Squash, tools/check-commits.sh origin/main HEAD, force-push with lease, open the PR against main (Closes #128; Task, What, Verification: CI only), ci-wait.sh per dev-workflow step 5, fix red CI (commit 1 is unverified by any compiler: expect fixes in volumes.trb files, mountinfo tests).

Worker usage: about 100k tokens (sonnet).

next: implement (re-claim needed)

CONTINUE: torbscript/language#128

[loop:torbscript] implement: checkpoint 4, not finished. No PR yet. Pushed to `loop/128-os-volumes` (head cb28dd30): commit 1 is squashed into one Conventional Commit, `2a77608d feat(os): volumes and mount enumeration` (`tools/check-commits.sh` clean), plus one WIP commit `cb28dd30` (commit-2 C natives). Worktree `/home/node/workspaces/orion/code/wt/torbscript-language-128`. Push needs `git -c http.extraHeader="Authorization: Basic $(printf orion:%s "$(cat ~/.secrets/torbdev-token)" | base64 -w0)" push --force-with-lease origin loop/128-os-volumes` (plain push has no credentials). Done this session: `std/os/tests/volumes.test.trb` (mountinfo parser incl. `\040`/`\134`, optional fields, malformed lines, `kindOfFileSystem`, `diskOf`, `parseMountedFileSystems`, `kindOfDriveType`, `mountPointsOf`, `Volume.all` host shape, `VolumeSpace.used`); one 120-column line fixed in `linux/volumes.trb`; the commit-1 squash and push; C for commit 2: `torb_os_windows_volume_space(torb_text root, int64_t *total, int64_t *free_bytes, int64_t *available, torb_text *failure)` at the end of `runtime/os/windows.c`, `torb_os_posix_file_system_space(torb_text path, int64_t *block_size, int64_t *blocks, int64_t *free_blocks, int64_t *available_blocks, int64_t *read_only, torb_text *failure)` (statvfs, `<sys/statvfs.h>` added) in `runtime/os/posix.c`. Nothing was compiled; no `torb` on the host. Remaining for commit 2 (then squash `cb28dd30` into it, subject `feat(os): Volume.space, Volume.containing and the volumes docs`): 1. Prototypes in `runtime/include/torb_os.h`; `systemRuntimeOf` rows in `compiler/src/backend/c/natives.trb` (`Windows.volumeSpace` in `windowsEntries`, `[.Windows]`; `Posix.fileSystemSpace` in `posixEntries`, `posix`); rows in `runtime/include/torb_natives.h` (sorted by `Type.name`: `Posix.fileSystemSpace` after `Posix.effectiveUserIdentifier`, `Windows.volumeSpace` after `Windows.volumeMountPoints`); NATIVES.md rows (`Windows` table after `volumeInformation`, `Posix` table) and counters keep 196 / total 552. 2. `runtime/machine_natives.c` via `/home/node/workspaces/orion/tmp/gen/natives.py runtime/machine_natives.c spec.py` with spec `{"torb_os_windows_volume_space": ("defined(_WIN32)", "tiiiT"), "torb_os_posix_file_system_space": ("defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)", "tiiiiiT")}` (kinds t text by value, T text pointer, i int64 pointer). 3. Native declarations: `Windows.volumeSpace(root: String, var total: Int64, var free: Int64, var available: Int64, var failure: String): Int` in `std/os/src/windows/native.trb`; `Posix.fileSystemSpace(path: String, var blockSize: Int64, var blocks: Int64, var free: Int64, var available: Int64, var readOnly: Int64, var failure: String): Int` in `std/os/src/posix/native.trb`. 4. TorbScript: `windows/volumes.trb` `public fn spaceAt(root: String): Result<VolumeSpace, OsError>`, new `posix/volumes.trb` `spaceAt(path: String)` (total = blocks*blockSize etc., `ByteSize(n)`, `outcome(code, "the space of {path}", failure)?`); in `volumes.trb`: `fn space(): Task<Result<VolumeSpace, OsError>>` (match OperatingSystem.current: Windows to windows, Linux/MacOs to posix, FreeBsd/Browser `Fail OsError.Unsupported("the volume space", ...)`; body returns plainly like `Processor.usage`), and `static fn containing(path: Path): Task<Result<Volume, OsError>>`: absolute-ize with `CurrentProcess.workingDirectory()?.joined(path)` then `normalized()`, probe the path with `spaceAt` (a missing path fails here as `OsError.Missing`, never a panic), then pick the volume of `Volume.all(includeVirtual: true)` with the longest mount point that `startsWith`-prefixes the path (Windows: compare lower-cased `show()` text). Put the pure pick in a public fn (e.g. `volumeContaining(volumes, path, caseSensitive)`) and test it in `volumes.test.trb`. 5. Host tests in `std/os/tests/host.test.trb` (see criterion 5; use a top-level `const x = Volume.containing(...).await()` like `shortUsage`), `docs/standard-library/os.md` (+ index counters if the processors commit touched them) and the four `skills/torbscript-standard-library` copies (`SKILL.md`, `references/index.md`, `references/standard-library/index.md`, `references/standard-library/os.md`: see `git show f12a2a4d --stat`), OS.md slice 4 **Done (2026-10-27)** with a "How the volumes landed" note (differences: `containing` is a mount-prefix match plus a statvfs probe; volumes of Windows with no path or an empty drive are skipped). 6. Squash, `tools/check-commits.sh origin/main HEAD`, force-push with lease, open the PR against main (`Closes #128`; Task, What, Verification: CI only), `ci-wait.sh` per dev-workflow step 5, fix red CI (commit 1 is unverified by any compiler: expect fixes in `volumes.trb` files, `mountinfo` tests). Worker usage: about 100k tokens (sonnet). next: implement (re-claim needed) CONTINUE: torbscript/language#128
Author
Collaborator

[loop:torbscript] release implement: worker context guard reached; commit 1 pushed, commit 2 half done on the branch, the next worker continues in the same worktree.

[loop:torbscript] release implement: worker context guard reached; commit 1 pushed, commit 2 half done on the branch, the next worker continues in the same worktree.
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:58Z

[loop:torbscript] claim implement by session:loop-torbscript-20261027 until 2026-10-27T06:58Z
Author
Collaborator

[loop:torbscript] implement: checkpoint 5, all steps written, PR opened: #523 (branch loop/128-os-volumes, head 6cc1ce39, two Conventional Commits, tools/check-commits.sh clean). Commit 2 holds: prototypes, manifest rows, torb_natives.h rows, machine_natives.c via the generator, native declarations, Volume.space, Volume.containing (pure volumeContaining), windows/volumes.trb and posix/volumes.trb spaceAt, tests in volumes.test.trb and host.test.trb, docs/standard-library/os.md + the four skills copies, OS.md slice 4 Done with a "How the volumes landed" note, NATIVES.md keep 196 / total 552.

CI: not read yet (just pushed). Nothing was compiled on the worker host, so expect red CI in the .trb files (guesses: Result.isError, String.toLowerCase, top-level const in tests, doc declaration blocks in os.md matching the extractor, Path.from path.show() call syntax). Worktree /home/node/workspaces/orion/code/wt/torbscript-language-128; push command as in checkpoint 4.

Worker usage: about 100k tokens (sonnet).

next: waiting (CI); then read it via ci-wait.sh (dev-workflow step 5) and fix red CI on the branch, then review.

[loop:torbscript] implement: checkpoint 5, all steps written, PR opened: https://git.torb.dev/torbscript/language/pulls/523 (branch `loop/128-os-volumes`, head 6cc1ce39, two Conventional Commits, `tools/check-commits.sh` clean). Commit 2 holds: prototypes, manifest rows, `torb_natives.h` rows, `machine_natives.c` via the generator, native declarations, `Volume.space`, `Volume.containing` (pure `volumeContaining`), `windows/volumes.trb` and `posix/volumes.trb` `spaceAt`, tests in `volumes.test.trb` and `host.test.trb`, `docs/standard-library/os.md` + the four skills copies, OS.md slice 4 Done with a "How the volumes landed" note, NATIVES.md keep 196 / total 552. CI: not read yet (just pushed). Nothing was compiled on the worker host, so expect red CI in the `.trb` files (guesses: `Result.isError`, `String.toLowerCase`, top-level `const` in tests, doc declaration blocks in `os.md` matching the extractor, `Path.from path.show()` call syntax). Worktree `/home/node/workspaces/orion/code/wt/torbscript-language-128`; push command as in checkpoint 4. Worker usage: about 100k tokens (sonnet). next: waiting (CI); then read it via ci-wait.sh (dev-workflow step 5) and fix red CI on the branch, then review.
Author
Collaborator

[loop:torbscript] release implement: PR #523 opened, worker context guard reached; the next claim reads CI and fixes red on the branch.

[loop:torbscript] release implement: PR #523 opened, worker context guard reached; the next claim reads CI and fixes red on the branch.
Author
Collaborator

[loop:torbscript] review: PR #523 open (head 6cc1ce39), forge CI pending, no red check; the ready buffer is full and every other ready item is on a running worker or CI, next: waiting (CI on PR #523)

[loop:torbscript] review: PR #523 open (head 6cc1ce39), forge CI pending, no red check; the ready buffer is full and every other ready item is on a running worker or CI, next: waiting (CI on PR #523)
Author
Collaborator

[loop:torbscript] claim implement (fix round, red tier A on PR #523 head be3ceb31, pinned on anthropic:notahumanmate) by session:loop-torbscript-20261027 until 2026-10-27T11:30Z

[loop:torbscript] claim implement (fix round, red tier A on PR #523 head be3ceb31, pinned on anthropic:notahumanmate) by session:loop-torbscript-20261027 until 2026-10-27T11:30Z
Author
Collaborator

[loop:torbscript] implement: fix round on PR #523, new head 92a7de01 (one Conventional Commit on top of be3ceb31, tools/check-commits.sh origin/main clean). Root cause of the red tier A (run on be3ceb31, four red gates): (1) test: volumeContaining > the case of letters is ignored used Path.from("c:/Users/Ada") against a C:/ mount, but Path upper-cases drive letters on every host, so the case-sensitive branch matched on linux; the test now uses /Mnt/Data vs /mnt/data/Ada. (2) doc --check: Volume.kind and VolumeSpace.total had no doc comment; added. (3) format --check: six files (bsd/linux/windows/volumes.trb, volumes.trb, host.test.trb, volumes.test.trb) were not in the formatter's layout; reformatted with torb format from the signed nightly-20261026 linux-x64 release (checksum verified; the same six files CI listed changed, no build or gate run locally). The VM and native test gates failed on the same single test.

CI on 92a7de01: not decided yet. The ci and pdisc runs (index 1973/1974) have been waiting since 04:25Z with no runner picked up: the forge queue holds about 7 older runs ahead of them (the oldest running run, index 1956, has been going since 02:38Z), so tier A has not started after 55 min of ci-wait. No code blocker.

Worker usage: about 90k tokens (sonnet).

next: waiting (CI on PR #523)

[loop:torbscript] implement: fix round on PR #523, new head 92a7de01 (one Conventional Commit on top of be3ceb31, `tools/check-commits.sh origin/main` clean). Root cause of the red tier A (run on be3ceb31, four red gates): (1) test: `volumeContaining > the case of letters is ignored` used `Path.from("c:/Users/Ada")` against a `C:/` mount, but `Path` upper-cases drive letters on every host, so the case-sensitive branch matched on linux; the test now uses `/Mnt/Data` vs `/mnt/data/Ada`. (2) `doc --check`: `Volume.kind` and `VolumeSpace.total` had no doc comment; added. (3) `format --check`: six files (`bsd/linux/windows/volumes.trb`, `volumes.trb`, `host.test.trb`, `volumes.test.trb`) were not in the formatter's layout; reformatted with `torb format` from the signed nightly-20261026 linux-x64 release (checksum verified; the same six files CI listed changed, no build or gate run locally). The VM and native test gates failed on the same single test. CI on 92a7de01: not decided yet. The `ci` and `pdisc` runs (index 1973/1974) have been `waiting` since 04:25Z with no runner picked up: the forge queue holds about 7 older runs ahead of them (the oldest running run, index 1956, has been going since 02:38Z), so tier A has not started after 55 min of ci-wait. No code blocker. Worker usage: about 90k tokens (sonnet). next: waiting (CI on PR #523)
argus closed this issue 2026-10-27 08:00:47 +00:00
Sign in to join this conversation.
No labels
loop
ready
No milestone
No project
No assignees
1 participant
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#128
No description provided.