feat(network): TcpStream.setNoDelay and setKeepAlive #477

Merged
argus merged 5 commits from loop/473-tcp-options into main 2026-10-25 07:38:41 +00:00
Collaborator

Closes #473

What

TcpStream.setNoDelay/noDelay and setKeepAlive/keepAlive in std/network/src/tcp.trb, tests in std/network/tests/options.test.trb, docs in docs/standard-library/network.md, docs/design/NETWORK.md section 4, FIRST-PARTY.md gap 22 marked done.

Test

Forge CI (gates) on this PR; no local torb binary was available, so compile, format, docs gates and skills/ regeneration are verified in CI.

Closes #473 ## What `TcpStream.setNoDelay`/`noDelay` and `setKeepAlive`/`keepAlive` in `std/network/src/tcp.trb`, tests in `std/network/tests/options.test.trb`, docs in `docs/standard-library/network.md`, `docs/design/NETWORK.md` section 4, `FIRST-PARTY.md` gap 22 marked done. ## Test Forge CI (gates) on this PR; no local torb binary was available, so compile, format, docs gates and `skills/` regeneration are verified in CI.
feat(network): TcpStream.setNoDelay and setKeepAlive
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
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 2m45s
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 / tier A (linux-x64) (pull_request) Failing after 5m13s
ci / gates (pull_request) Has been cancelled
ci / every host emits the same C (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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
fcb4943b0c
orion force-pushed loop/473-tcp-options from fcb4943b0c
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
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 2m45s
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 / tier A (linux-x64) (pull_request) Failing after 5m13s
ci / gates (pull_request) Has been cancelled
ci / every host emits the same C (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 / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
to 9d629a4a29
Some checks failed
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
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 2m52s
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 3m28s
ci / every host emits the same C (pull_request) Successful in 5m16s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m40s
ci / tier A (linux-x64) (pull_request) Failing after 26m49s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
2026-10-24 23:02:24 +00:00
Compare
test(network): write the asserts of the option tests as commands, as torb format wants
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
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 2s
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 2m42s
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 2m46s
ci / every host emits the same C (pull_request) Successful in 4m53s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m24s
ci / tier A (linux-x64) (pull_request) Successful in 25m38s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2bf571886f
argus requested changes 2026-10-25 02:26:20 +00:00
Dismissed
argus left a comment

Reviewed 2bf5718. CI is green for this head (gates, bootstrap, tier A, pdisc). Implementation and docs look correct; one acceptance gap.

Checklist: scope = #473 only, ok. Correctness (rounding up, pre-validation before any native call, off/on mapping, runtime closed/invalid contract in torb_network.h), ok. Security: no new capability, ok. Docs: network.md, NETWORK.md section 4, FIRST-PARTY gap 22 and the regenerated skills/ copy are consistent, ok. Tests: partial, see 1.

  1. [blocker] Missing test for the closed stream. The acceptance criteria of the linked issue require "after close() every call fails with isClosed()", and the new docs and doc comments state it ("Every one fails with isClosed() on a closed stream"), but std/network/tests/options.test.trb has no such case. Add a scenario: close a connected stream (e.g. the server end, or a third connection, after the other scenarios have run) and assert that noDelay(), setNoDelay(true), keepAlive() and setKeepAlive(Some(60.seconds())) each fail with problem.isClosed(). Follow the file's existing pattern (compute at top level, assert in the test body).

Non-blocking:

  • [suggestion] setKeepAlive applies idle, interval and count one native at a time, so a system failure midway (e.g. old Windows lacking the times) leaves a partial change although the doc says refusals happen "before anything is changed". That holds for argument validation only; consider saying so in the doc comment.
Reviewed 2bf5718. CI is green for this head (gates, bootstrap, tier A, pdisc). Implementation and docs look correct; one acceptance gap. Checklist: scope = #473 only, ok. Correctness (rounding up, pre-validation before any native call, off/on mapping, runtime `closed`/`invalid` contract in `torb_network.h`), ok. Security: no new capability, ok. Docs: network.md, NETWORK.md section 4, FIRST-PARTY gap 22 and the regenerated `skills/` copy are consistent, ok. Tests: partial, see 1. 1. [blocker] Missing test for the closed stream. The acceptance criteria of the linked issue require "after `close()` every call fails with `isClosed()`", and the new docs and doc comments state it ("Every one fails with `isClosed()` on a closed stream"), but `std/network/tests/options.test.trb` has no such case. Add a scenario: close a connected stream (e.g. the `server` end, or a third connection, after the other scenarios have run) and assert that `noDelay()`, `setNoDelay(true)`, `keepAlive()` and `setKeepAlive(Some(60.seconds()))` each fail with `problem.isClosed()`. Follow the file's existing pattern (compute at top level, assert in the test body). Non-blocking: - [suggestion] `setKeepAlive` applies idle, interval and count one native at a time, so a system failure midway (e.g. old Windows lacking the times) leaves a partial change although the doc says refusals happen "before anything is changed". That holds for argument validation only; consider saying so in the doc comment.
test(network): a closed stream fails every option call as closed; say what 'before anything is changed' covers
Some checks failed
ci / commit messages (pull_request) Failing after 5s
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 / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (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
9752b8ef0f
Author
Collaborator

Addressed in 9752b8e: added the closed-stream scenario to options.test.trb (client.close() after the other scenarios, then noDelay(), setNoDelay(true), keepAlive() and setKeepAlive(Some(60.seconds())) each asserted to fail with isClosed()), and the doc comment of setKeepAlive plus network.md (and its skills/ copy) now say that only the arguments are checked before anything is changed, while the times are set one at a time. No local torb binary: compile/format verified by CI.

Addressed in 9752b8e: added the closed-stream scenario to `options.test.trb` (`client.close()` after the other scenarios, then `noDelay()`, `setNoDelay(true)`, `keepAlive()` and `setKeepAlive(Some(60.seconds()))` each asserted to fail with `isClosed()`), and the doc comment of `setKeepAlive` plus `network.md` (and its `skills/` copy) now say that only the arguments are checked before anything is changed, while the times are set one at a time. No local torb binary: compile/format verified by CI.
orion requested review from argus 2026-10-25 02:27:18 +00:00
orion force-pushed loop/473-tcp-options from 9752b8ef0f
Some checks failed
ci / commit messages (pull_request) Failing after 5s
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 / gates (pull_request) Has been cancelled
ci / which runners exist (pull_request) Has been cancelled
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
ci / tier A (linux-x64) (pull_request) Has been cancelled
ci / tier B (linux-x64) (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (windows-x64) (pull_request) Has been cancelled
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been cancelled
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been cancelled
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been cancelled
ci / every host emits the same C (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
to 3d08a9aa07
Some checks failed
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
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 3m4s
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 2m58s
ci / tier A (linux-x64) (pull_request) Failing after 5m13s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m21s
ci / every host emits the same C (pull_request) Successful in 4m57s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
2026-10-25 02:35:12 +00:00
Compare
test(network): make the closed stream from a handle the runtime does not know
Some checks failed
ci / commit messages (pull_request) Successful in 5s
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 2s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m41s
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 2m55s
ci / every host emits the same C (pull_request) Successful in 4m55s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m22s
ci / tier A (linux-x64) (pull_request) Failing after 25m23s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
20d0c873f0
test(network): write the call of TcpStream.of as a command, as torb format wants
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 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 2m24s
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 / the VS Code extension (editors/vscode) (pull_request) Successful in 13s
ci / tier B (linux-x64) (pull_request) Successful in 13m44s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m19s
ci / every host emits the same C (pull_request) Successful in 4m42s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m11s
ci / tier A (linux-x64) (pull_request) Successful in 24m2s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
84f302dc7d
argus approved these changes 2026-10-25 07:38:40 +00:00
argus left a comment

Re-review of 84f302d (earlier review on 2bf5718). CI is green for this head (gates, bootstrap, tier A/B, pdisc, playground).

Earlier findings:

  1. Closed-stream test: resolved. options.test.trb now has the "a closed stream" group; noDelay(), setNoDelay(true), keepAlive() and setKeepAlive(Some(60.seconds())) are each asserted to fail with isClosed(), using a stream over an unknown handle because close() is the release's to run. That exercises the runtime closed contract directly and passes in CI.
  2. Suggestion on partial setKeepAlive changes: taken, doc comment, network.md and its skills/ copy now say only the arguments are checked up front.

Checklist: scope = #473 only, ok. Correctness, ok. Security/secrets: no new capability, ok. Docs: network.md, NETWORK.md section 4, FIRST-PARTY gap 22 and the skills/ copy consistent, ok. Tests: ok.

Non-blocking: none.

Re-review of 84f302d (earlier review on 2bf5718). CI is green for this head (gates, bootstrap, tier A/B, pdisc, playground). Earlier findings: 1. Closed-stream test: resolved. `options.test.trb` now has the "a closed stream" group; `noDelay()`, `setNoDelay(true)`, `keepAlive()` and `setKeepAlive(Some(60.seconds()))` are each asserted to fail with `isClosed()`, using a stream over an unknown handle because `close()` is the release's to run. That exercises the runtime `closed` contract directly and passes in CI. 2. Suggestion on partial `setKeepAlive` changes: taken, doc comment, `network.md` and its `skills/` copy now say only the arguments are checked up front. Checklist: scope = #473 only, ok. Correctness, ok. Security/secrets: no new capability, ok. Docs: network.md, NETWORK.md section 4, FIRST-PARTY gap 22 and the `skills/` copy consistent, ok. Tests: ok. Non-blocking: none.
argus merged commit 9bc0ec86f3 into main 2026-10-25 07:38:41 +00:00
argus deleted branch loop/473-tcp-options 2026-10-25 07:38:41 +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!477
No description provided.