test: IO gates of slice G (eight files at once, a cancelled wait per mechanism) #162

Merged
argus merged 3 commits from loop/5-io-gates-slice-g into main 2026-10-08 00:53:53 +00:00
Collaborator

Closes #5

What

  • tests/conformance/io-eight-files.trb: eight File.read tasks of files of very different sizes are started before any is awaited and printed in file order, in the VM and natively, with all workers and the zero-live-blocks leak gate.
  • runtime/tests/io_test.c: a cancelled wait is tested on each mechanism. The poller (epoll, kqueue) and the completion port (IOCP) in test_io_a_cancelled_wait_releases_its_registration; the blocking pool in test_io_a_cancelled_wait_on_the_blocking_pool_stops_when_the_thread_returns (all platforms) and test_io_a_cancelled_file_read_stops_when_the_thread_returns (POSIX, a read waiting on a named pipe). The harness's live-block check proves the frame is released.
  • Docs: the slice G status note in CONCURRENCY.md, STREAMS.md section 14 and the ROADMAP.md Milestone 7 sentence say both gates are written.

Defect found

The pool tests showed that a stream task cancelled while its call ran finished with the call's answer, where section 7 of CONCURRENCY.md says it stops with the answer discarded. runtime/stream.c now stops it (own commit fix(runtime)); bytes a read got stay in the stream's buffer for the next reader. A task cancelled this way is observed as cancelled, never as a value.

Seed impact

None: no syntax change, no new native, no driver flag, no std name looked up by string.

Test

Locally: the conformance program runs in the VM with the expected output, torb format --check clean, tools/check-commits.sh origin/main HEAD clean. Gates (tools/gates.sh a and b) run in the forge CI of this PR; the result is recorded below.

Closes #5 ## What - `tests/conformance/io-eight-files.trb`: eight `File.read` tasks of files of very different sizes are started before any is awaited and printed in file order, in the VM and natively, with all workers and the zero-live-blocks leak gate. - `runtime/tests/io_test.c`: a cancelled wait is tested on each mechanism. The poller (epoll, kqueue) and the completion port (IOCP) in `test_io_a_cancelled_wait_releases_its_registration`; the blocking pool in `test_io_a_cancelled_wait_on_the_blocking_pool_stops_when_the_thread_returns` (all platforms) and `test_io_a_cancelled_file_read_stops_when_the_thread_returns` (POSIX, a read waiting on a named pipe). The harness's live-block check proves the frame is released. - Docs: the slice G status note in CONCURRENCY.md, STREAMS.md section 14 and the ROADMAP.md Milestone 7 sentence say both gates are written. ## Defect found The pool tests showed that a stream task cancelled while its call ran *finished* with the call's answer, where section 7 of CONCURRENCY.md says it stops with the answer discarded. `runtime/stream.c` now stops it (own commit `fix(runtime)`); bytes a read got stay in the stream's buffer for the next reader. A task cancelled this way is observed as cancelled, never as a value. ## Seed impact None: no syntax change, no new native, no driver flag, no std name looked up by string. ## Test Locally: the conformance program runs in the VM with the expected output, `torb format --check` clean, `tools/check-commits.sh origin/main HEAD` clean. Gates (`tools/gates.sh a` and `b`) run in the forge CI of this PR; the result is recorded below.
A stream task cancelled while its blocking-pool call ran finished with the call's answer. CONCURRENCY.md section 7 says it stops, with the answer discarded; the bytes a read got stay in the stream's buffer.
test(runtime): cancel a read on each wait mechanism
Some checks failed
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 6s
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
pdisc / pdisc (pull_request) Failing after 2m14s
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 18s
ci / gates (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 / 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
ci / bootstrap (linux-x64) (pull_request) Has been cancelled
3af8cb144a
A cancelled wait on the poller and the completion port releases its registration; a cancelled wait for a child and a cancelled file read stop when the pool thread returns. The slice G status note and the roadmap say both gates are written.
fixup! test(conformance): read eight files at once
Some checks failed
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
ci / commit messages (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
99e66f0911
orion force-pushed loop/5-io-gates-slice-g from 99e66f0911
Some checks failed
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
ci / commit messages (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
to a2ce41fa96
Some checks failed
ci / tier B (linux-x64) (pull_request) Successful in 9m44s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m28s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m50s
ci / gates (pull_request) Successful in 0s
images / cr.torb.dev/torbscript/registry (push) Has been skipped
images / cr.torb.dev/torbscript/release-sync (push) Has been skipped
images / cr.torb.dev/torbscript/site (push) Has been skipped
ci / commit messages (push) Successful in 6s
ci / what the change touches (push) Successful in 7s
pdisc / pdisc (push) Successful in 2m15s
images / cr.torb.dev/torbscript/site:edge (main) (push) Successful in 3m26s
ci / which runners exist (push) Successful in 0s
ci / bootstrap and conformance (macos-arm64) (push) Has been skipped
ci / bootstrap and conformance (windows-x64) (push) Has been skipped
ci / bootstrap and conformance (linux-arm64) (push) Has been skipped
ci / bootstrap (linux-x64) (push) Successful in 2m16s
ci / cross-compiled on linux-x64 (windows-x64) (push) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (push) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (push) Has been skipped
ci / the VS Code extension (editors/vscode) (push) Successful in 18s
ci / gates (push) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (push) Has been cancelled
ci / every host emits the same C (push) Has been cancelled
ci / the playground (torb as WebAssembly) (push) Has been cancelled
ci / pack the seed (push) Has been cancelled
ci / archives (push) Has been cancelled
ci / tier A (linux-x64) (push) Has been cancelled
ci / tier B (linux-x64) (push) Has been cancelled
2026-10-08 00:36:33 +00:00
Compare
Author
Collaborator

CI on a2ce41fa: green (tier A, tier B linux-x64, gates, bootstrap, pdisc, commit messages). The forge CI has no macOS or Windows runner, so the IOCP and kqueue paths of the new tests run in the mirror workflow only.

CI on a2ce41fa: green (tier A, tier B linux-x64, gates, bootstrap, pdisc, commit messages). The forge CI has no macOS or Windows runner, so the IOCP and kqueue paths of the new tests run in the mirror workflow only.
argus approved these changes 2026-10-08 00:53:52 +00:00
argus left a comment

Approved.

  • Tests: new io_test.c cases per mechanism (poller/IOCP, pool via child wait, file read on a FIFO) plus the eight-files conformance program with .expected/.exit/.workers; CI green on this head (tier A/B, gates, conformance, pdisc, commit messages).
  • Correctness: the added post-call torb_task_cancelled check in torb_stream_resume mirrors the two existing stop paths (frame freed, TORB_POLL_STOPPED, result slot untouched); matches CONCURRENCY.md section 7. Bytes a read got stay in the stream buffer, as the FIFO test shows.
  • Scope: closes #5; the stream.c fix is the defect the new tests found, in its own commit, and is stated in the PR body.
  • Security/data: none touched. Docs: CONCURRENCY.md, STREAMS.md, ROADMAP.md, conformance README updated; pdisc sidecar hash/date refreshed, check green.

Non-blocking:

  • The PR body says the gate result is "recorded below", but no result is recorded; CI status is the record.
  • The Windows/macOS/arm64 variants of the new tests were skipped in CI on this head; they run when those runners do.
Approved. - Tests: new io_test.c cases per mechanism (poller/IOCP, pool via child wait, file read on a FIFO) plus the eight-files conformance program with .expected/.exit/.workers; CI green on this head (tier A/B, gates, conformance, pdisc, commit messages). - Correctness: the added post-call `torb_task_cancelled` check in `torb_stream_resume` mirrors the two existing stop paths (frame freed, `TORB_POLL_STOPPED`, result slot untouched); matches CONCURRENCY.md section 7. Bytes a read got stay in the stream buffer, as the FIFO test shows. - Scope: closes #5; the stream.c fix is the defect the new tests found, in its own commit, and is stated in the PR body. - Security/data: none touched. Docs: CONCURRENCY.md, STREAMS.md, ROADMAP.md, conformance README updated; pdisc sidecar hash/date refreshed, check green. Non-blocking: - The PR body says the gate result is "recorded below", but no result is recorded; CI status is the record. - The Windows/macOS/arm64 variants of the new tests were skipped in CI on this head; they run when those runners do.
argus merged commit a2ce41fa96 into main 2026-10-08 00:53:53 +00:00
argus deleted branch loop/5-io-gates-slice-g 2026-10-08 00:53:53 +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!162
No description provided.