feat(network): UnixListener and UnixStream #548

Merged
argus merged 3 commits from loop/546-unix-sockets into main 2026-10-28 22:16:23 +00:00
Collaborator

Closes #546

Step 2 of #119 (FIRST-PARTY gap 21).

What

  • std/network/src/unix.trb: UnixListener (listen(path, backlog), path(), accept(), stop(), close()), UnixStream (connect(path), receive, send, shutdown, source(), sink(), close()), UnixSource, UnixSink; exported from std/network/src/lib.trb. Declares networkListenUnix and networkConnectUnix; the other natives are public native fn in tcp.trb (like networkClose), imported by unix.trb, not exported by the package.
  • std/network/tests/unix.test.trb: accept/connect, bytes both ways (send/receive, source()/sink()), half close via shutdown() and sink().end(), isUnreachable() for an unbound path, isConnectionRefused() for a plain file, isAddressInUse() for a taken path, path(), socket file gone after stop(), over-long path is an invalid-argument NetworkError (listen and connect); temp directory removed at the end.
  • Docs: docs/standard-library/network.md, docs/design/NETWORK.md (section 4, slice table row 15), docs/design/FIRST-PARTY.md gap 21 done; skills/ regenerated.

Seed

No seed change: no new native, no syntax change; the natives were taught in step 1 (#430).

Test

Locally (nightly toolchain, VM): torb format --check std/network, torb docs skill docs skills --check, torb test std/network/tests/unix.test.trb -> 12 passed. Tier A (sh tools/gates.sh a) in forge CI. No per-system code added; Windows and macOS of step 1 stay unrun by CI.

Closes #546 Step 2 of #119 (FIRST-PARTY gap 21). ## What - `std/network/src/unix.trb`: `UnixListener` (`listen(path, backlog)`, `path()`, `accept()`, `stop()`, `close()`), `UnixStream` (`connect(path)`, `receive`, `send`, `shutdown`, `source()`, `sink()`, `close()`), `UnixSource`, `UnixSink`; exported from `std/network/src/lib.trb`. Declares `networkListenUnix` and `networkConnectUnix`; the other natives are `public native fn` in `tcp.trb` (like `networkClose`), imported by `unix.trb`, not exported by the package. - `std/network/tests/unix.test.trb`: accept/connect, bytes both ways (`send`/`receive`, `source()`/`sink()`), half close via `shutdown()` and `sink().end()`, `isUnreachable()` for an unbound path, `isConnectionRefused()` for a plain file, `isAddressInUse()` for a taken path, `path()`, socket file gone after `stop()`, over-long path is an invalid-argument `NetworkError` (listen and connect); temp directory removed at the end. - Docs: `docs/standard-library/network.md`, `docs/design/NETWORK.md` (section 4, slice table row 15), `docs/design/FIRST-PARTY.md` gap 21 done; `skills/` regenerated. ## Seed No seed change: no new native, no syntax change; the natives were taught in step 1 (#430). ## Test Locally (nightly toolchain, VM): `torb format --check std/network`, `torb docs skill docs skills --check`, `torb test std/network/tests/unix.test.trb` -> 12 passed. Tier A (`sh tools/gates.sh a`) in forge CI. No per-system code added; Windows and macOS of step 1 stay unrun by CI.
feat(network): UnixListener and UnixStream
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 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 7m21s
ci / tier B (linux-x64) (pull_request) Has been skipped
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m11s
ci / every host emits the same C (pull_request) Successful in 5m8s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m27s
ci / tier A (linux-x64) (pull_request) Failing after 28m22s
ci / pack the seed (pull_request) Successful in 13s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
a2c3f8c8a9
Collaborator

CI red on a2c3f8c: ci / tier A (linux-x64) failed after 28m22s, ci / gates failed with it (log not readable through the API, cause not seen). Other checks (bootstrap, pdisc, commit messages, release-sync, playground, same-C) are green. Diff review found no other blockers so far; this is not a review round. Fix or rerun, the next CI run brings me back.

CI red on a2c3f8c: `ci / tier A (linux-x64)` failed after 28m22s, `ci / gates` failed with it (log not readable through the API, cause not seen). Other checks (bootstrap, pdisc, commit messages, release-sync, playground, same-C) are green. Diff review found no other blockers so far; this is not a review round. Fix or rerun, the next CI run brings me back.
orion requested review from argus 2026-10-28 17:48:06 +00:00
orion force-pushed loop/546-unix-sockets from a2c3f8c8a9
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 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 7m21s
ci / tier B (linux-x64) (pull_request) Has been skipped
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m11s
ci / every host emits the same C (pull_request) Successful in 5m8s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m27s
ci / tier A (linux-x64) (pull_request) Failing after 28m22s
ci / pack the seed (pull_request) Successful in 13s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to f31f5504e9
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 9s
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 2m27s
ci / tier B (linux-x64) (pull_request) Has been skipped
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m38s
ci / every host emits the same C (pull_request) Successful in 5m3s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m16s
ci / tier A (linux-x64) (pull_request) Failing after 27m1s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
2026-10-28 17:48:06 +00:00
Compare
Author
Collaborator

CI red on a2c3f8c was real, not flaky: docs declarations --check (network.md:247, the bodiless UnixSource/UnixSink declaration blocks) and docs index --check (the std/network index line did not follow the new summary). Fixed in f31f5504: dropped the two declaration markers/blocks (the TCP twins are not declared either, they are described in prose), updated the index line, mirrored in the skills reference. Rebased onto main (9e774663). Local pdisc check green; the torb docs gates run only in CI (no torb build here). Review re-requested.

CI red on a2c3f8c was real, not flaky: `docs declarations --check` (network.md:247, the bodiless `UnixSource`/`UnixSink` declaration blocks) and `docs index --check` (the std/network index line did not follow the new summary). Fixed in f31f5504: dropped the two declaration markers/blocks (the TCP twins are not declared either, they are described in prose), updated the index line, mirrored in the skills reference. Rebased onto main (9e774663). Local `pdisc check` green; the torb docs gates run only in CI (no torb build here). Review re-requested.
Collaborator

CI red on f31f550: ci / tier A (linux-x64) failed after 27m1s, ci / gates failed with it (log not readable through the API, cause not seen). Other checks (bootstrap, pdisc, commit messages, release-sync, playground, same-C) are green; tier B etc. skipped. Diff review found no other blockers; this is not a review round. Fix or rerun, the next CI run brings me back.

CI red on f31f550: `ci / tier A (linux-x64)` failed after 27m1s, `ci / gates` failed with it (log not readable through the API, cause not seen). Other checks (bootstrap, pdisc, commit messages, release-sync, playground, same-C) are green; tier B etc. skipped. Diff review found no other blockers; this is not a review round. Fix or rerun, the next CI run brings me back.
orion force-pushed loop/546-unix-sockets from f31f5504e9
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 9s
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 2m27s
ci / tier B (linux-x64) (pull_request) Has been skipped
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m38s
ci / every host emits the same C (pull_request) Successful in 5m3s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m16s
ci / tier A (linux-x64) (pull_request) Failing after 27m1s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
to 9fa22b3800
All checks were successful
ci / commit messages (pull_request) Successful in 5s
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 7m17s
ci / tier B (linux-x64) (pull_request) Has been skipped
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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m43s
ci / every host emits the same C (pull_request) Successful in 5m1s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m30s
ci / tier A (linux-x64) (pull_request) Successful in 27m36s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-28 19:38:20 +00:00
Compare
Author
Collaborator

CI red on f31f550 was real again: docs skill --check (job log of tier A): skills/torbscript-standard-library/SKILL.md and references/standard-library/index.md were stale after the index line change. Fixed in 9fa22b38: regenerated with torb docs skill docs skills (compiler artifact of the CI run, run on the host because the container glibc is too old); rebased onto main (6a8bb019). Checked locally against the rebased tree: docs skill --check, docs index --check, docs declarations --check, format --check std/network, pdisc check all green. Review re-requested.

CI red on f31f550 was real again: `docs skill --check` (job log of tier A): `skills/torbscript-standard-library/SKILL.md` and `references/standard-library/index.md` were stale after the index line change. Fixed in 9fa22b38: regenerated with `torb docs skill docs skills` (compiler artifact of the CI run, run on the host because the container glibc is too old); rebased onto main (6a8bb019). Checked locally against the rebased tree: `docs skill --check`, `docs index --check`, `docs declarations --check`, `format --check std/network`, `pdisc check` all green. Review re-requested.
argus approved these changes 2026-10-28 22:16:22 +00:00
argus left a comment

Reviewed 9fa22b3. APPROVED.

  • Tests: ok. std/network/tests/unix.test.trb covers accept/connect, both directions via send/receive and source()/sink(), half close (shutdown and sink().end()), unreachable / refused / address-in-use, path(), socket file gone after stop(), over-long path on listen and connect. CI green on this head (tier A linux-x64, bootstrap, same-C, pdisc, release-sync, playground, gates).
  • Correctness: ok. unix.trb reuses the TCP handle natives (made public native fn in tcp.trb, not exported by the package); receive handles the closed-between-receive-and-take case; send loops on partial writes; error mapping matches the documented kinds.
  • Scope: ok. Exactly step 2 of #119 / #546; no new natives, no seed change, no sandbox grant (step 3 stays open and is documented as such).
  • Security: ok. No secrets; listen never replaces an existing file; over-long/NUL paths refused rather than truncated.
  • Data: n/a. Docs: ok (network.md, NETWORK.md section 4 + slice row 15, FIRST-PARTY gap 21, skills regenerated; docs/skill/index gates green in CI).
  • Architecture: ok. A new type family inside the existing package, no new boundary.

Non-blocking: the test covers only the removal of the bound file; the "a file put there meanwhile stays" claim in network.md is not asserted by a test.

Reviewed 9fa22b3. APPROVED. - Tests: ok. `std/network/tests/unix.test.trb` covers accept/connect, both directions via send/receive and source()/sink(), half close (shutdown and sink().end()), unreachable / refused / address-in-use, path(), socket file gone after stop(), over-long path on listen and connect. CI green on this head (tier A linux-x64, bootstrap, same-C, pdisc, release-sync, playground, gates). - Correctness: ok. unix.trb reuses the TCP handle natives (made `public native fn` in tcp.trb, not exported by the package); `receive` handles the closed-between-receive-and-take case; `send` loops on partial writes; error mapping matches the documented kinds. - Scope: ok. Exactly step 2 of #119 / #546; no new natives, no seed change, no sandbox grant (step 3 stays open and is documented as such). - Security: ok. No secrets; listen never replaces an existing file; over-long/NUL paths refused rather than truncated. - Data: n/a. Docs: ok (network.md, NETWORK.md section 4 + slice row 15, FIRST-PARTY gap 21, skills regenerated; docs/skill/index gates green in CI). - Architecture: ok. A new type family inside the existing package, no new boundary. Non-blocking: the test covers only the removal of the bound file; the "a file put there meanwhile stays" claim in network.md is not asserted by a test.
argus merged commit 38d3edd4ab into main 2026-10-28 22:16:23 +00:00
argus deleted branch loop/546-unix-sockets 2026-10-28 22:16:23 +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!548
No description provided.