T9 library-credential test: guarantee the verb sync runs alone on the second start (Vikunja 622) #1826

Closed
opened 2026-10-24 18:05:04 +00:00 by jarvis · 4 comments
Contributor

Vikunja 622, mos-1594. Fix the timing race in packages/bus/tests/library-credential.test.mjs T9 ("library.sync with a chief credential ...", :265).

Its second broker start (:313) keeps librarySync intervalMs 50. The startup sync logs library-sync-held and releases the mirror (packages/library/src/sync.mjs:140-141 and :203), but the 50 ms timer (packages/bus/src/runtime.mjs:615) keeps ticking. A later tick can hold running for the mirror when the verb at :317 arrives, and then assert.rejects sees library-sync-busy instead of library-fetch-no-grant. Fethry's row 266 gate hit it once (bus 999/1, fethry-0032).

The fix is test-only. The second start passes intervalMs 2147483647 (Node's TIMEOUT_MAX), so only the startup tick runs while the test is open. No assertion changes and no product code changes. A mutant that puts the short interval back must fail at least once in a 50-run stress loop, and the fix must pass the same loop.

Brief: docs/plans/2026-10-24_t9-library-sync-race.md.

Vikunja 622, mos-1594. Fix the timing race in packages/bus/tests/library-credential.test.mjs T9 ("library.sync with a chief credential ...", :265). Its second broker start (:313) keeps librarySync intervalMs 50. The startup sync logs library-sync-held and releases the mirror (packages/library/src/sync.mjs:140-141 and :203), but the 50 ms timer (packages/bus/src/runtime.mjs:615) keeps ticking. A later tick can hold `running` for the mirror when the verb at :317 arrives, and then assert.rejects sees library-sync-busy instead of library-fetch-no-grant. Fethry's row 266 gate hit it once (bus 999/1, fethry-0032). The fix is test-only. The second start passes intervalMs 2147483647 (Node's TIMEOUT_MAX), so only the startup tick runs while the test is open. No assertion changes and no product code changes. A mutant that puts the short interval back must fail at least once in a 50-run stress loop, and the fix must pass the same loop. Brief: docs/plans/2026-10-24_t9-library-sync-race.md.
Author
Contributor

Review request for queue row 328, round 1: T9 library-credential test: the second broker start passes Node's TIMEOUT_MAX interval so no timer tick overlaps the verb sync; mutant fails a 50-run stress loop (#1826, Vikunja 622, mos-1594)

  • Owner: fethry
  • Reviewers: boyd, dewey
  • Gate: Boyd gives the first Codex review, Dewey reviews the landing candidate; touched tests run whole, the 50-run stress loop passes with the fix and M1 fails it; bus and every scripts/test-*.sh green on Sage's gate (sage)
  • Brief: docs/plans/2026-10-24_t9-library-sync-race.md § Brief: the T9 verb sync on the second start runs with no timer tick able to overlap it @7561d2123215
  • Candidate: manifest 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733

The manifest:

ba485ecf337b4845a1c3e8ba2f4e2f0ee221d981b8d74080a3b0bcbef55d6605  packages/bus/tests/library-credential.test.mjs

Check a tree against it with scripts/mosaic queue review verify-commit 328 REF.

Post your verdict as a comment here, then record it:

scripts/mosaic queue review record 328 --verdict approve|changes --comment COMMENT_ID --candidate 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733 --op OP --by SEAT
<!-- mosaic-queue-op: sage-4217 --> <!-- mosaic-queue-round: row=328 round=1 candidate=1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733 --> Review request for queue row 328, round 1: T9 library-credential test: the second broker start passes Node's TIMEOUT_MAX interval so no timer tick overlaps the verb sync; mutant fails a 50-run stress loop (#1826, Vikunja 622, mos-1594) - Owner: fethry - Reviewers: boyd, dewey - Gate: Boyd gives the first Codex review, Dewey reviews the landing candidate; touched tests run whole, the 50-run stress loop passes with the fix and M1 fails it; bus and every scripts/test-*.sh green on Sage's gate (sage) - Brief: `docs/plans/2026-10-24_t9-library-sync-race.md` § Brief: the T9 verb sync on the second start runs with no timer tick able to overlap it @7561d2123215 - Candidate: manifest `1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733` The manifest: ```text ba485ecf337b4845a1c3e8ba2f4e2f0ee221d981b8d74080a3b0bcbef55d6605 packages/bus/tests/library-credential.test.mjs ``` Check a tree against it with `scripts/mosaic queue review verify-commit 328 REF`. Post your verdict as a comment here, then record it: ``` scripts/mosaic queue review record 328 --verdict approve|changes --comment COMMENT_ID --candidate 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733 --op OP --by SEAT ```
Owner

Row 328 / #1826 — Boyd first independent review

APPROVE. No findings.

Tip: e43b40afc. Base: 2ce476d54.
Manifest: agents/fethry/work/queue-328/manifest.r1.sha256.
Candidate digest: 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733.
Frozen test SHA-256: ba485ecf337b4845a1c3e8ba2f4e2f0ee221d981b8d74080a3b0bcbef55d6605.

Static review only; no independent tests, stress runs, mutations, installs or
live host/provider actions. Read the pinned T9 race brief, Mos1594 and amended
Mos1599/Sage4214 acceptance as recorded in BUILD, both support runners, runtime
timer and sync ordering, and concurrent run receipts.

The manifest digest and sole entry verify. The entire package delta is exactly
packages/bus/tests/library-credential.test.mjs +4/-3: parameterize start with a
50 ms default, forward that parameter, and use 2147483647 for the revoked second
start with the Mos1594 comment. First start, assertions, all other tests and
production bytes are unchanged. Package diff --check is clean.

The startup tick remains unconditional. Its held log is written after sync
returns, whose finally has already removed running(mirror). TIMEOUT_MAX avoids
another periodic caller during the 60-second test; it does not overflow into
Node's 1 ms fallback. Existing close still clears the interval. The first
start retains its timer/verb coverage.

Independently checked all 801 retained TAPs against run-records.jsonl, as data:

  • Eight workers each performed 50 M1-50 attempts: 374 pass and 26 assertion
    failures with actual library-sync-busy versus expected library-fetch-no-grant.
    No other failure shape, skip or cancellation appears.
  • Eight workers each performed 50 fixed attempts: 400/400 pass with no failure,
    skip or cancellation. The whole touched file then passes 6/6.
  • All 801 TMPDIRs are distinct, have the recorded 29-byte gXXX form, and existing
    repo(t) fixture construction isolates data roots beneath each TMPDIR. Commands,
    load/nice observations and outcomes are retained without hidden reruns.
  • Summary source is 06c57a7db2. Mutant/final
    restoration hashes equal the manifest file hash, with both full git diff/stat
    and porcelain recorded empty. Initial nice 19 and later observed drift are
    disclosed under Sage's ruling, not treated as missing or controlled priority.

The earlier serial non-reproduction and aborted 17 attempts remain explicitly
separate from the accepted concurrent result. This is Mos1599 option A; no
alternative construction-only acceptance is claimed. The narrow fixture change
preserves the refusal assertion rather than accepting library-sync-busy.

Dewey's landing review and Sage's whole bus plus twelve shell-suite landing gate
remain required. This approval does not claim those pending checks have run.

Boyd (48a3ae38-83aa-4d3f-9064-64e911ec4547), 2026-10-24.

# Row 328 / #1826 — Boyd first independent review APPROVE. No findings. Tip: e43b40afc. Base: 2ce476d54. Manifest: agents/fethry/work/queue-328/manifest.r1.sha256. Candidate digest: 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733. Frozen test SHA-256: ba485ecf337b4845a1c3e8ba2f4e2f0ee221d981b8d74080a3b0bcbef55d6605. Static review only; no independent tests, stress runs, mutations, installs or live host/provider actions. Read the pinned T9 race brief, Mos1594 and amended Mos1599/Sage4214 acceptance as recorded in BUILD, both support runners, runtime timer and sync ordering, and concurrent run receipts. The manifest digest and sole entry verify. The entire package delta is exactly packages/bus/tests/library-credential.test.mjs +4/-3: parameterize start with a 50 ms default, forward that parameter, and use 2147483647 for the revoked second start with the Mos1594 comment. First start, assertions, all other tests and production bytes are unchanged. Package diff --check is clean. The startup tick remains unconditional. Its held log is written after sync returns, whose finally has already removed running(mirror). TIMEOUT_MAX avoids another periodic caller during the 60-second test; it does not overflow into Node's 1 ms fallback. Existing close still clears the interval. The first start retains its timer/verb coverage. Independently checked all 801 retained TAPs against run-records.jsonl, as data: - Eight workers each performed 50 M1-50 attempts: 374 pass and 26 assertion failures with actual library-sync-busy versus expected library-fetch-no-grant. No other failure shape, skip or cancellation appears. - Eight workers each performed 50 fixed attempts: 400/400 pass with no failure, skip or cancellation. The whole touched file then passes 6/6. - All 801 TMPDIRs are distinct, have the recorded 29-byte gXXX form, and existing repo(t) fixture construction isolates data roots beneath each TMPDIR. Commands, load/nice observations and outcomes are retained without hidden reruns. - Summary source is 06c57a7db2d0716c7c61e27671f790263c8a6153. Mutant/final restoration hashes equal the manifest file hash, with both full git diff/stat and porcelain recorded empty. Initial nice 19 and later observed drift are disclosed under Sage's ruling, not treated as missing or controlled priority. The earlier serial non-reproduction and aborted 17 attempts remain explicitly separate from the accepted concurrent result. This is Mos1599 option A; no alternative construction-only acceptance is claimed. The narrow fixture change preserves the refusal assertion rather than accepting library-sync-busy. Dewey's landing review and Sage's whole bus plus twelve shell-suite landing gate remain required. This approval does not claim those pending checks have run. Boyd (48a3ae38-83aa-4d3f-9064-64e911ec4547), 2026-10-24.
Member

Dewey verdict: APPROVE. Row 328 (T9 library-credential race, Vikunja 622), review round 1 on the queue, answering request 31620. Candidate manifest digest 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733 (agents/fethry/work/queue-328/manifest.r1.sha256, 1 path) at tip 8f7f602a7 on fethry/row328, base 2ce476d54. This is a static review of the candidate plus a read of the committed evidence: I ran no node and no tests.

Manifest and base

  • The single entry, packages/bus/tests/library-credential.test.mjs sha256 ba485ecf…6605, matches the blob at 8f7f602a7. The queue round carries the same digest and text.
  • Outside the queue-328 packet, the diff touches only that test file, BUILD-LOG.md and docs/SESSIONS.md (additions only). e43b40afc..8f7f602a7 changes only the packet's BUILD.md.
  • 2ce476d54 is on origin/refactor. 2ce476d54..origin/refactor adds two docs, 2026-10-24_stack-model-proxy.md and a BRIEF-TEMPLATE.md edit (06f507dbc). No test or script reads either. Only two queue test fixtures mention BRIEF-TEMPLATE in prose.
  • git diff --check over the whole range is clean.
  • The old test changes +4/-3, and the 3 removed lines are the two lines of the start closure and the second start() call. No assertion line changes, no other test changes, and no product path changes.
  • No test or script pins a sha256 of the file at either the base or the tip.
  • The push-check secrets pattern (scripts/push-check.sh:120) finds no added line, and a positive control matches. No commit message carries an attribution line.

The change against the brief

  • start takes intervalMs = 50 and passes it as librarySync.intervalMs. The first start still calls start(), so the calls.length >= 2 ("the timer and the verb") check keeps its 50 ms ticks.
  • The revoked second start calls start(2147483647), which is Node's TIMEOUT_MAX exactly. Node clamps a larger delay to 1 ms, so the value can't be rounded up. runtime.mjs:122 accepts any positive safe integer, and the runtime still runs its startup tick() before setInterval (runtime.mjs ~614), so the held-line wait and the library-fetch-no-grant, calls.length === 0 and held-line assertions test the same pass as before. The interval is unref'd and cleared by close().
  • The comment names mos-1594 and the reason. This is the one change brief item 1 allows. Items 2 and 3 hold: no assertion or product change, and BUILD.md records commands, counts and load averages.

Evidence read (evidence/sage4214-concurrent at 8f7f602a7)

  • I counted all 801 committed TAPs myself:
    • M1-50, 8 workers x 50: 374 pass, 26 fail, 0 skip and 0 cancelled. All 26 failures are ERR_ASSERTION with actual library-sync-busy against expected library-fetch-no-grant, raised from :318, the verb assertion.
    • Fixed, the same 8 workers x 50: 400 pass, 0 fail, 0 skip and 0 cancelled.
    • Whole file: 6/6 pass.
    • Each M1 and fixed TAP holds exactly one test, T9.
  • run-records.jsonl has 801 records and 801 distinct TMPDIRs, all 29 bytes with no underscore.
  • BUILD.md records that the restore returned the exact fixed SHA, and that git diff --stat HEAD and git status --porcelain were empty before the fixed phase and at the end.

Notes (non-blocking)

  • N1: the gate still needs Sage's run of the whole bus suite and every scripts/test-*.sh. The builder ran the T9 loops and the whole touched file only.
  • N2: the brief's serial M1 loop did not reproduce the race (50 at 50 ms and 50 at 1 ms, all green), and Fethry stopped as the brief says. The accepted M1 is the 8x50 concurrent run under mos-1599 (option A), recorded in BUILD.md with sage-4211/4214. I took that amendment from BUILD.md and Sage's messages, not from the Mos ruling itself. The serial non-reproduction and the 17 aborted sage-4194 runs stay in the record and are not counted.
**Dewey verdict: APPROVE.** Row 328 (T9 library-credential race, Vikunja 622), review round 1 on the queue, answering request 31620. Candidate manifest digest `1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733` (agents/fethry/work/queue-328/manifest.r1.sha256, 1 path) at tip `8f7f602a7` on `fethry/row328`, base 2ce476d54. This is a static review of the candidate plus a read of the committed evidence: I ran no node and no tests. **Manifest and base** - The single entry, `packages/bus/tests/library-credential.test.mjs` sha256 `ba485ecf…6605`, matches the blob at 8f7f602a7. The queue round carries the same digest and text. - Outside the queue-328 packet, the diff touches only that test file, BUILD-LOG.md and docs/SESSIONS.md (additions only). e43b40afc..8f7f602a7 changes only the packet's BUILD.md. - 2ce476d54 is on origin/refactor. 2ce476d54..origin/refactor adds two docs, 2026-10-24_stack-model-proxy.md and a BRIEF-TEMPLATE.md edit (06f507dbc). No test or script reads either. Only two queue test fixtures mention BRIEF-TEMPLATE in prose. - `git diff --check` over the whole range is clean. - The old test changes +4/-3, and the 3 removed lines are the two lines of the `start` closure and the second `start()` call. No assertion line changes, no other test changes, and no product path changes. - No test or script pins a sha256 of the file at either the base or the tip. - The push-check secrets pattern (`scripts/push-check.sh:120`) finds no added line, and a positive control matches. No commit message carries an attribution line. **The change against the brief** - `start` takes `intervalMs = 50` and passes it as `librarySync.intervalMs`. The first start still calls `start()`, so the `calls.length >= 2` ("the timer and the verb") check keeps its 50 ms ticks. - The revoked second start calls `start(2147483647)`, which is Node's TIMEOUT_MAX exactly. Node clamps a larger delay to 1 ms, so the value can't be rounded up. `runtime.mjs:122` accepts any positive safe integer, and the runtime still runs its startup `tick()` before `setInterval` (`runtime.mjs` ~614), so the held-line wait and the `library-fetch-no-grant`, `calls.length === 0` and held-line assertions test the same pass as before. The interval is `unref`'d and cleared by `close()`. - The comment names mos-1594 and the reason. This is the one change brief item 1 allows. Items 2 and 3 hold: no assertion or product change, and BUILD.md records commands, counts and load averages. **Evidence read (evidence/sage4214-concurrent at 8f7f602a7)** - I counted all 801 committed TAPs myself: - M1-50, 8 workers x 50: 374 pass, 26 fail, 0 skip and 0 cancelled. All 26 failures are ERR_ASSERTION with actual `library-sync-busy` against expected `library-fetch-no-grant`, raised from :318, the verb assertion. - Fixed, the same 8 workers x 50: 400 pass, 0 fail, 0 skip and 0 cancelled. - Whole file: 6/6 pass. - Each M1 and fixed TAP holds exactly one test, T9. - run-records.jsonl has 801 records and 801 distinct TMPDIRs, all 29 bytes with no underscore. - BUILD.md records that the restore returned the exact fixed SHA, and that `git diff --stat HEAD` and `git status --porcelain` were empty before the fixed phase and at the end. **Notes (non-blocking)** - N1: the gate still needs Sage's run of the whole bus suite and every `scripts/test-*.sh`. The builder ran the T9 loops and the whole touched file only. - N2: the brief's serial M1 loop did not reproduce the race (50 at 50 ms and 50 at 1 ms, all green), and Fethry stopped as the brief says. The accepted M1 is the 8x50 concurrent run under mos-1599 (option A), recorded in BUILD.md with sage-4211/4214. I took that amendment from BUILD.md and Sage's messages, not from the Mos ruling itself. The serial non-reproduction and the 17 aborted sage-4194 runs stay in the record and are not counted.
Author
Contributor

Landed on refactor at 8bb5b3c73 (pushed 19:40Z 2026-10-24). These are Fethry's 8 row 328 commits, cherry-picked onto 5e77cdd09. Range 5e77cdd09..8bb5b3c73.

  • Gate: Sage's landing gate ran on 8bb5b3c73 itself (base 5e77cdd09) and finished GREEN at 19:38:54Z. Every package suite but queue and every scripts/test-.sh passed. bus 1011/0, business 283/0, harness 176/0, cli 990/0 with the one allowed skip (FED R7, its runner rc 0), webui 458/0. That covers Dewey's N1 (whole bus suite plus every test-.sh).
  • Drift: none. The gated tree is the landed tree.
  • Manifest: 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733.
  • Review: Boyd APPROVE, comment 31621, rev 4002. Dewey APPROVE, comment 31622, rev 4003.
  • Push check: LOG_OK, FF_OK, NO_BINARY, SECRETS_CLEAN, NO_ATTRIBUTION. No in-review row shares a path.
  • Vikunja: 622 closed with this landing.
Landed on refactor at 8bb5b3c73 (pushed 19:40Z 2026-10-24). These are Fethry's 8 row 328 commits, cherry-picked onto 5e77cdd09. Range 5e77cdd09..8bb5b3c73. - **Gate:** Sage's landing gate ran on 8bb5b3c73 itself (base 5e77cdd09) and finished GREEN at 19:38:54Z. Every package suite but queue and every scripts/test-*.sh passed. bus 1011/0, business 283/0, harness 176/0, cli 990/0 with the one allowed skip (FED R7, its runner rc 0), webui 458/0. That covers Dewey's N1 (whole bus suite plus every test-*.sh). - **Drift:** none. The gated tree is the landed tree. - **Manifest:** 1e0104683f49dcc96cb87975393665aa4ee30114055b4bbb45ad5e9ba9611733. - **Review:** Boyd APPROVE, comment 31621, rev 4002. Dewey APPROVE, comment 31622, rev 4003. - **Push check:** LOG_OK, FF_OK, NO_BINARY, SECRETS_CLEAN, NO_ATTRIBUTION. No in-review row shares a path. - **Vikunja:** 622 closed with this landing.
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#1826