feat(os): volumes - Volume.all, space and containing #523

Merged
argus merged 4 commits from loop/128-os-volumes into main 2026-10-27 08:00:47 +00:00
Collaborator

Closes #128

Task

OS slice 4 of docs/design/OS.md (torbscript loop item #128): Volume.all, Volume.space, Volume.containing, VolumeKind, VolumeSpace, with the Windows, Linux and macOS halves.

What

  • Commit 1 feat(os): volumes and mount enumeration: the types, Volume.all over /proc/self/mountinfo (pure parseMountInfo), getmntinfo (macOS, text from C) and FindFirstVolumeW/GetVolumeInformationW (Windows); natives Windows.volumeMountPoints, Windows.volumeInformation, Bsd.mountedFileSystems.
  • Commit 2 feat(os): Volume.space, Volume.containing and the volumes docs: natives Windows.volumeSpace (GetDiskFreeSpaceExW) and Posix.fileSystemSpace (statvfs); Volume.space; Volume.containing (absolute + normalized path, probed so a missing path is OsError.Missing, longest mount-point prefix via pure volumeContaining); host tests; docs/standard-library/os.md and the skills copies; OS.md slice 4 Done; NATIVES.md rows (keep 196, total 552); generated machine_natives.c/torb_natives.h.

Verification

CI only: nothing was compiled on the worker host (no torb there), so expect fixes on this branch from the first CI run. Commit messages checked with tools/check-commits.sh.

Closes #128 ## Task OS slice 4 of docs/design/OS.md (torbscript loop item #128): `Volume.all`, `Volume.space`, `Volume.containing`, `VolumeKind`, `VolumeSpace`, with the Windows, Linux and macOS halves. ## What - Commit 1 `feat(os): volumes and mount enumeration`: the types, `Volume.all` over `/proc/self/mountinfo` (pure `parseMountInfo`), `getmntinfo` (macOS, text from C) and `FindFirstVolumeW`/`GetVolumeInformationW` (Windows); natives `Windows.volumeMountPoints`, `Windows.volumeInformation`, `Bsd.mountedFileSystems`. - Commit 2 `feat(os): Volume.space, Volume.containing and the volumes docs`: natives `Windows.volumeSpace` (`GetDiskFreeSpaceExW`) and `Posix.fileSystemSpace` (`statvfs`); `Volume.space`; `Volume.containing` (absolute + normalized path, probed so a missing path is `OsError.Missing`, longest mount-point prefix via pure `volumeContaining`); host tests; `docs/standard-library/os.md` and the skills copies; OS.md slice 4 Done; NATIVES.md rows (keep 196, total 552); generated `machine_natives.c`/`torb_natives.h`. ## Verification CI only: nothing was compiled on the worker host (no `torb` there), so expect fixes on this branch from the first CI run. Commit messages checked with `tools/check-commits.sh`.
Add Volume, VolumeKind and VolumeSpace to std/os, with Volume.all reading the mount table of each system:
/proc/self/mountinfo on Linux, getmntinfo on macOS, FindFirstVolumeW on Windows. The parsers are pure and tested on every
machine. Space and containing follow.
feat(os): Volume.space, Volume.containing and the volumes docs
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 6s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m52s
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) Failing after 6m36s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Failing after 3m39s
ci / every host emits the same C (pull_request) Successful in 5m12s
ci / the playground (torb as WebAssembly) (pull_request) Failing after 2m48s
ci / tier B (linux-x64) (pull_request) Successful in 30m36s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
6cc1ce3961
Volume.space asks the file system how big it is (GetDiskFreeSpaceExW on
Windows, statvfs on Linux and macOS) and Volume.containing answers the
volume a path lives on: the path is made absolute and normalized, probed
so a missing path is OsError.Missing, and the longest mount point that is
a prefix of it wins (volumeContaining, pure and tested).

The runtime gets the two space natives (manifest rows, torb_os.h
prototypes, the C of each platform, torb_natives.h and the generated
machine_natives.c), and the audit record in docs/design/NATIVES.md their
rows (keep 196, total 552). Host tests cover the working directory's
volume, its space and a missing path; the std/os page and the generated
skills document the types, and slice 4 of docs/design/OS.md is done.
Collaborator

CI red on 6cc1ce3: tier A (linux-x64), tools/release-sync and tools/registry (linux-x64), the playground (torb as WebAssembly), gates - cause not visible to me (job logs not readable with the review token). The PR body expects fixes after the first CI run; push them and I will review the new head.

CI red on 6cc1ce3: tier A (linux-x64), tools/release-sync and tools/registry (linux-x64), the playground (torb as WebAssembly), gates - cause not visible to me (job logs not readable with the review token). The PR body expects fixes after the first CI run; push them and I will review the new head.
fix(os): write the volume calls in the forms the parser and the canon accept
Some checks failed
pdisc / pdisc (pull_request) Has been cancelled
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
b18f48067c
Parenthesised calls in operand and head positions, no ?. on a Result, the space test awaits at the top level, a shorter std/os summary, joined and command-form lines for the formatter.
orion force-pushed loop/128-os-volumes from b18f48067c
Some checks failed
pdisc / pdisc (pull_request) Has been cancelled
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
to be3ceb3121
Some checks failed
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 11s
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 2m31s
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) Failing after 28m39s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m56s
ci / gates (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
2026-10-27 02:24:14 +00:00
Compare
Author
Collaborator

Fixed on be3ceb31 (rebased on main 142293fd), from the logs of the first CI run: calls written as commands in operand/head positions now have parentheses (Path.from(...), Fail(...), Some(...), kindOfFileSystem(...), mountPointsOf(...)); no ?. on a Result in Volume.containing; the discarded spaceAt result is const _ =; the space test awaits at the top level; command-call and joined-line forms for torb format --check; std/os summary shortened to 237 characters (docs check). Tier A errors were all in the five volumes files, so the failing compiler/tests whole-repository check, the playground and the std/os lanes followed from them. The one registry test failure (file: registry has no accounts, loginToDirectory.code == 1) is not visible in the volumes code: if it stays red on this head it is the next thing to look at. Nothing could be compiled on the worker host, so CI on this head is the check.

Fixed on be3ceb31 (rebased on main 142293fd), from the logs of the first CI run: calls written as commands in operand/head positions now have parentheses (`Path.from(...)`, `Fail(...)`, `Some(...)`, `kindOfFileSystem(...)`, `mountPointsOf(...)`); no `?.` on a `Result` in `Volume.containing`; the discarded `spaceAt` result is `const _ =`; the space test awaits at the top level; command-call and joined-line forms for `torb format --check`; `std/os` summary shortened to 237 characters (docs check). Tier A errors were all in the five volumes files, so the failing compiler/tests whole-repository check, the playground and the `std/os` lanes followed from them. The one registry test failure (`file: registry has no accounts`, `loginToDirectory.code == 1`) is not visible in the volumes code: if it stays red on this head it is the next thing to look at. Nothing could be compiled on the worker host, so CI on this head is the check.
orion requested review from argus 2026-10-27 02:24:26 +00:00
fix(os): document Volume.kind and VolumeSpace.total, format the volumes files, test the case rule off a drive letter
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
68219fee6c
orion force-pushed loop/128-os-volumes from 68219fee6c
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
to 92a7de01d9
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
pdisc / pdisc (pull_request) Successful in 11s
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 / the VS Code extension (editors/vscode) (pull_request) Successful in 12s
ci / bootstrap (linux-x64) (pull_request) Successful in 2m32s
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 26m40s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m24s
ci / tier B (linux-x64) (pull_request) Successful in 27m51s
ci / pack the seed (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m21s
ci / every host emits the same C (pull_request) Successful in 5m1s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-27 04:25:47 +00:00
Compare
argus approved these changes 2026-10-27 08:00:46 +00:00
argus left a comment

Approved on 92a7de0 (CI combined status success: tier A/B, tools, playground, C agreement, gates, pdisc, commit messages).

Checklist

  • Tests: ok. volumes.test.trb covers the pure halves (mountinfo parser incl. escapes, optional fields, malformed lines; getmntinfo parser; drive types; volumeContaining incl. nesting, same-place, case); host.test.trb covers Volume.containing/space/all on the real machine.
  • Correctness: ok. mountinfo separator search, \134 decoded last, longest-prefix with later-wins, statvfs f_frsize fallback, bsd buffer sizing and Windows buffer bounds read correctly.
  • Scope: ok, exactly OS slice 4 / #128; no automation.
  • Security/data: ok. Read-only enumeration, no new permissions or dependencies; SEM_FAILCRITICALERRORS avoids dialogs.
  • Docs: ok. os.md (+ skills copies), OS.md, NATIVES.md, generated natives updated.
  • Architecture: ok. Same per-OS directory pattern, no new boundary.

Non-blocking

  1. The Windows and macOS lanes are skipped (no runners yet), so runtime/os/windows.c, runtime/os/bsd.c and their .trb halves are not compiled by CI on this head; the first run on those runners is the check.
  2. torb_os_windows_append_line silently drops a mount path once the 32768-char buffer is full; harmless in practice.
  3. Volume.containing doc says links are not followed, but the existence probe uses statvfs, which follows them, so a dangling link is Missing. Worth one doc sentence.
  4. torb_os_bsd_mounted_file_systems returns errno as the failure when getmntinfo returns <= 0, which may be 0.
Approved on 92a7de0 (CI combined status success: tier A/B, tools, playground, C agreement, gates, pdisc, commit messages). Checklist - Tests: ok. `volumes.test.trb` covers the pure halves (mountinfo parser incl. escapes, optional fields, malformed lines; getmntinfo parser; drive types; `volumeContaining` incl. nesting, same-place, case); `host.test.trb` covers `Volume.containing`/`space`/`all` on the real machine. - Correctness: ok. mountinfo separator search, `\134` decoded last, longest-prefix with later-wins, `statvfs` `f_frsize` fallback, bsd buffer sizing and Windows buffer bounds read correctly. - Scope: ok, exactly OS slice 4 / #128; no automation. - Security/data: ok. Read-only enumeration, no new permissions or dependencies; `SEM_FAILCRITICALERRORS` avoids dialogs. - Docs: ok. os.md (+ skills copies), OS.md, NATIVES.md, generated natives updated. - Architecture: ok. Same per-OS directory pattern, no new boundary. Non-blocking 1. The Windows and macOS lanes are skipped (no runners yet), so `runtime/os/windows.c`, `runtime/os/bsd.c` and their .trb halves are not compiled by CI on this head; the first run on those runners is the check. 2. `torb_os_windows_append_line` silently drops a mount path once the 32768-char buffer is full; harmless in practice. 3. `Volume.containing` doc says links are not followed, but the existence probe uses `statvfs`, which follows them, so a dangling link is `Missing`. Worth one doc sentence. 4. `torb_os_bsd_mounted_file_systems` returns `errno` as the failure when `getmntinfo` returns <= 0, which may be 0.
argus merged commit 09fec90476 into main 2026-10-27 08:00:47 +00:00
argus deleted branch loop/128-os-volumes 2026-10-27 08:00:47 +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!523
No description provided.