concurrency: write the IO gates of slice G (eight files, a cancelled read per mechanism) #5

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

Goal

Write the gate of CONCURRENCY.md slice G, which is the only part of the slice still open: the machinery (blocking pool, IO thread and poller, cancellation of a wait) is built, but nothing yet proves the two "not before" rows of section 7 ("Cancelling a task that is waiting for the world") instead of assuming them.

Design point implemented

  • CONCURRENCY.md slice G ("Slice G - IO ... Gate: the conformance suite unchanged, plus a program that reads eight files at once and prints them in a fixed order, on all three platforms; and a cancelled read on each of the three mechanisms, with the live-block counter at zero afterwards"), and section 7 table of the three mechanisms (readiness poller, completion port, blocking pool).
  • Status note in the record: "the eight-file gate is not written". ROADMAP.md Milestone 7 lists the gates of slices G and H as open work.
  • Fully settled by the design record; no entry in CONCEPT "Open Questions" is involved.

Acceptance criteria

  • A conformance program under tests/conformance/ (with .expected, .exit, and a .workers file if it needs more than one worker) starts eight file reads at once (one task per file, files written by the program itself) and prints the contents in a fixed order. It passes in the VM and natively on Linux, macOS and Windows, and the suite's zero-live-blocks leak gate (TORB_REPORT_LEAKS=1) passes for it.
  • A cancelled read is tested for each mechanism, in runtime/tests/ (the test harness already fails any test whose live-block count differs before and after, so "counter at zero" is checked per test):
    • blocking pool: a file read cancelled while the pool thread runs; the task stops, the frame is released and the result discarded when the pool thread returns (new test, runtime/stream.c path);
    • readiness poller (epoll, kqueue): a cancelled wait (existing tests in io_test.c cover socket receive, accept, datagram, child read; add or point to the one that asserts the registration is removed, if none does);
    • completion port (IOCP): same, on Windows, where the request is cancelled and the task stops when the completion arrives.
      A platform runs the mechanisms it has (Linux and the BSDs/macOS: poller + pool; Windows: IOCP + pool); each of the three is exercised on at least one platform of the CI matrix.
  • The slice G status note in CONCURRENCY.md (and the ROADMAP.md Milestone 7 "open work" sentence) is updated: the eight-file gate and the cancel gate are written.
  • sh tools/gates.sh a and sh tools/gates.sh b are green; docs/ change regenerates skills/ (torb docs skill docs skills).

Seed impact

None expected: no syntax change, no new native, no driver flag, no std name looked up by string. Conformance programs and C runtime tests only. If a test exposes a defect in runtime/stream.c or runtime/io.c, fixing it is a separate commit and, if it changes behavior visible to programs, goes back to the owner.

Size and commits

One PR, two Conventional Commits: test(conformance): read eight files at once and test(runtime): cancel a read on each wait mechanism (docs status update folded into the second, or a docs: third only if the reviewer prefers; keep to two). Mostly test code.

Suggested implementer

sonnet/medium (tests and docs). Escalate to opus/high only if a runtime defect shows up.

Dependencies

None known.

## Goal Write the gate of CONCURRENCY.md slice G, which is the only part of the slice still open: the machinery (blocking pool, IO thread and poller, cancellation of a wait) is built, but nothing yet proves the two "not before" rows of section 7 ("Cancelling a task that is waiting for the world") instead of assuming them. ## Design point implemented - [CONCURRENCY.md slice G](https://git.torb.dev/torbscript/language/src/branch/main/docs/design/CONCURRENCY.md) ("Slice G - IO ... Gate: the conformance suite unchanged, plus a program that reads eight files at once and prints them in a fixed order, on all three platforms; and a cancelled read on each of the three mechanisms, with the live-block counter at zero afterwards"), and section 7 table of the three mechanisms (readiness poller, completion port, blocking pool). - Status note in the record: "the eight-file gate is not written". ROADMAP.md Milestone 7 lists the gates of slices G and H as open work. - Fully settled by the design record; no entry in CONCEPT "Open Questions" is involved. ## Acceptance criteria - [ ] A conformance program under `tests/conformance/` (with `.expected`, `.exit`, and a `.workers` file if it needs more than one worker) starts eight file reads at once (one task per file, files written by the program itself) and prints the contents in a fixed order. It passes in the VM and natively on Linux, macOS and Windows, and the suite's zero-live-blocks leak gate (`TORB_REPORT_LEAKS=1`) passes for it. - [ ] A cancelled read is tested for each mechanism, in `runtime/tests/` (the test harness already fails any test whose live-block count differs before and after, so "counter at zero" is checked per test): - blocking pool: a file read cancelled while the pool thread runs; the task stops, the frame is released and the result discarded when the pool thread returns (new test, `runtime/stream.c` path); - readiness poller (epoll, kqueue): a cancelled wait (existing tests in `io_test.c` cover socket receive, accept, datagram, child read; add or point to the one that asserts the registration is removed, if none does); - completion port (IOCP): same, on Windows, where the request is cancelled and the task stops when the completion arrives. A platform runs the mechanisms it has (Linux and the BSDs/macOS: poller + pool; Windows: IOCP + pool); each of the three is exercised on at least one platform of the CI matrix. - [ ] The slice G status note in CONCURRENCY.md (and the ROADMAP.md Milestone 7 "open work" sentence) is updated: the eight-file gate and the cancel gate are written. - [ ] `sh tools/gates.sh a` and `sh tools/gates.sh b` are green; `docs/` change regenerates `skills/` (`torb docs skill docs skills`). ## Seed impact None expected: no syntax change, no new native, no driver flag, no std name looked up by string. Conformance programs and C runtime tests only. If a test exposes a defect in `runtime/stream.c` or `runtime/io.c`, fixing it is a separate commit and, if it changes behavior visible to programs, goes back to the owner. ## Size and commits One PR, two Conventional Commits: `test(conformance): read eight files at once` and `test(runtime): cancel a read on each wait mechanism` (docs status update folded into the second, or a `docs:` third only if the reviewer prefers; keep to two). Mostly test code. ## Suggested implementer sonnet/medium (tests and docs). Escalate to opus/high only if a runtime defect shows up. ## Dependencies None known.
Author
Collaborator

[loop:torbscript] intake: in scope (author orion, label loop). Completes CONCURRENCY.md slice G (machinery built, gate missing); design record is the specification, no collision with CONCEPT "Open Questions", no seed impact expected. Needs three platforms in CI (tier B). Release freeze for 0.1.0 (2026-10-06) holds new PRs, next: refine (queued, buffer >= 2 ready)

[loop:torbscript] intake: in scope (author orion, label loop). Completes CONCURRENCY.md slice G (machinery built, gate missing); design record is the specification, no collision with CONCEPT "Open Questions", no seed impact expected. Needs three platforms in CI (tier B). Release freeze for 0.1.0 (2026-10-06) holds new PRs, next: refine (queued, buffer >= 2 ready)
Author
Collaborator

[loop:torbscript] claim refine by session:loop-torbscript-20261007 until 2026-10-07T20:53:50Z

[loop:torbscript] claim refine by session:loop-torbscript-20261007 until 2026-10-07T20:53:50Z
Author
Collaborator

[loop:torbscript] refine: body rewritten to the definition of ready (goal, testable criteria, design point CONCURRENCY.md slice G + section 7, no seed impact, one PR / two test commits, sonnet/medium). Everything is settled by the design record; no owner decision needed. Claim 600 released. Label ready set. next: implement

[loop:torbscript] refine: body rewritten to the definition of ready (goal, testable criteria, design point CONCURRENCY.md slice G + section 7, no seed impact, one PR / two test commits, sonnet/medium). Everything is settled by the design record; no owner decision needed. Claim 600 released. Label ready set. next: implement
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T04:11:50Z

[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T04:11:50Z
Author
Collaborator

[loop:torbscript] release implement: the previous implement worker was killed by a gateway recreate at about 22:32Z with uncommitted work left in its worktree (ROADMAP, CONCURRENCY and STREAMS docs, runtime/stream.c, runtime/tests/io_test.c, the eight-files conformance program). Resuming in the same worktree with a new worker, next: implement

[loop:torbscript] release implement: the previous implement worker was killed by a gateway recreate at about 22:32Z with uncommitted work left in its worktree (ROADMAP, CONCURRENCY and STREAMS docs, runtime/stream.c, runtime/tests/io_test.c, the eight-files conformance program). Resuming in the same worktree with a new worker, next: implement
Author
Collaborator

[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T06:31:58Z

[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T06:31:58Z
Author
Collaborator

[loop:torbscript] implement: resumed the killed worker's work, finished and pushed it as three commits (conformance eight-file program, a runtime fix found by the pool test so a cancelled stream task stops when its call returns, the per-mechanism cancel tests plus the slice G status docs); forge CI green on a2ce41fa (tier A, tier B, gates, pdisc). PR #162, worker usage ~300k tokens, next: review

[loop:torbscript] implement: resumed the killed worker's work, finished and pushed it as three commits (conformance eight-file program, a runtime fix found by the pool test so a cancelled stream task stops when its call returns, the per-mechanism cancel tests plus the slice G status docs); forge CI green on a2ce41fa (tier A, tier B, gates, pdisc). PR https://git.torb.dev/torbscript/language/pulls/162, worker usage ~300k tokens, next: review
argus closed this issue 2026-10-08 00:53:53 +00:00
Author
Collaborator

[loop:torbscript] PR #162 merged by argus (merge commit a2ce41fa); CI on the merge commit was green (tier A, tier B linux-x64, gates, bootstrap, pdisc, commit messages). The eight-file gate and the per-mechanism cancel tests are on main, the slice G status note is updated. macOS (kqueue) and Windows (IOCP) paths run in the mirror workflow only. No after-merge steps. Issue closed by the PR; nothing further.

[loop:torbscript] PR #162 merged by argus (merge commit a2ce41fa); CI on the merge commit was green (tier A, tier B linux-x64, gates, bootstrap, pdisc, commit messages). The eight-file gate and the per-mechanism cancel tests are on main, the slice G status note is updated. macOS (kqueue) and Windows (IOCP) paths run in the mirror workflow only. No after-merge steps. Issue closed by the PR; nothing further.
Sign in to join this conversation.
No labels
loop
ready
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#5
No description provided.