Repository navigation
feat(queen): the round's claim is decided by the claim card, proven equal to the hand-written rule first (Closes #1767) - #1768
Conversation
…qual to the hand-written rule first (Closes gHashTag#1767) stateOfDispatch keeps its signature and its callers (the round, the board's dispatchRowState). Its body is now the claim card's claim_of as generated wasm (gHashTag/t27 specs/queen/claim.t27, t27#8765, PR t27#8768), which imports the review valve's escalation_kind and next_step instead of restating them. queen-claim.ts only maps the review_state word to the card's code and the answer back to its word. - specs/queen/claim.t27 and review_valve.t27 vendored byte-identical; claim.wasm = t27c gen-c + zig 0.16.0 cc wasm32-wasi, two builds, one hash, 0 imports; all three pinned in specs/PIN. - SEND_BACK_IDLE_FLOOR_MS, WAIT_FROZEN_FLOOR_MS, FREE_ATTEMPT_CEILING and REVIEWER_MISS_CEILING now come from the card (t27c gen-ts). - tests/api/queen-claim-card.test.ts keeps the hand-written body verbatim as the reference: the card answers it on all 2,211,840 finished rows of the grid; 22 mutants of the reference are each caught; the spec's own asserts run against the wasm; the valve's hand mirror equals the spec's escalation_kind/next_step on their whole input grid.
… constants (Refs gHashTag#1767) The agent workspace typechecks apps/server sources without allowJs, so importing OBSOLETE_STATE from the untyped queen-review-valve.gen.js added a TS7016 there. claim.t27 now imports OBSOLETE_STATE from review_valve.t27 (t27#8768 head d4cedbc5) and t27c gen-ts emits it typed. The wasm is byte-identical (08fc2b32); PIN updated for the new spec blob.
Summary by t27-beesChecked by the t27 compilert27c parse, parse-complete and typecheck on each changed .t27 file at
Read by the modelThe pull request replaces the hand-written Worth a look
Read: 8 files, +1829 -146, the whole diff up to 60000 characters (the rest was not read). Head |
…s logged, instead of failing every round (Refs gHashTag#1767) claimWord threw on a code outside CL_. The round maps every in-flight row through stateOfDispatch with no per-row try, so one such row would fail runRound before closeObsolete and dispatch on every round while it stays in the 7-day window, and the boards with it. Every other card consumer degrades to a conservative branch. Now the row is held as awaitingReview (the claim the card gives a verdict it does not know: the issue and its files stay held) and logger.error names the card and the code, once per code per process. A card that cannot load still throws from loadCardWasm; PIN hashes and the per-code test still catch drift. Raised by the t27-bees review on gHashTag#1768 (point 3).
|
Replying to the t27-bees review of 087fd88, point by point. Head is now 6aa063e.
Red checks on this PR:
Action needed outside this PR: the existing Biome and Typecheck findings on Dmitrii Fedorov (@dmitrii-f-t27) |
|
The same comparison on head 6aa063e, run 38083058828, against
The fix belongs to the existing Dmitrii Fedorov (@dmitrii-f-t27) |
|
I re-ran only that job, as attempt 2. Dmitrii Fedorov (@dmitrii-f-t27) |
…ueen-claim-card # Conflicts: # trios/agent-server/specs/PIN
|
Head 9a9e124 merged the current
Locally, on the merged tree, Dmitrii Fedorov (@dmitrii-f-t27) |
|
The two red test jobs on 9a9e124 (run 38088131937) are not caused by this PR. I re-ran the failed jobs.
Action needed outside this PR: the intermittent Bun 1.3.6 segfault in Dmitrii Fedorov (@dmitrii-f-t27) |
…ueen-claim-card # Conflicts: # trios/agent-server/specs/PIN
…ueen-claim-card # Conflicts: # trios/agent-server/specs/PIN
…ueen-claim-card # Conflicts: # trios/agent-server/apps/server/src/api/services/queen-tick.ts
|
@gHashTag, this PR waits on gHashTag/t27#8768 (the spec merges first) and on one decision. Head 6d4a440 merges Why the same conflict keeps coming back. Every card adds its lines to the end of State.
Action needed.
Dmitrii Fedorov (@dmitrii-f-t27) |
…ueen-claim-card # Conflicts: # trios/agent-server/specs/PIN
Closes #1767. Spec first: gHashTag/t27#8765, PR gHashTag/t27#8768 (
specs/queen/claim.t27).What changes
stateOfDispatchdecides every round, for every dispatch row, whether the row still claims its issue. Its body was hand-written. It now calls the claim card'sclaim_ofas generated wasm, the same wayqueen-holds.tscallsholds.wasm. The signature, the six words and the callers are unchanged: the round's board tasks and the kanban'sdispatchRowState.specs/queen/claim.t27: the card, from t27#8768 head d4cedbc5.specs/queen/review_valve.t27: the file the card imports from, at t27 master c31c059ef. Both are vendored byte-identical. The card importsescalation_kind,next_step, the kind and step codes,RETRY_FLOOR_MINUTESandOBSOLETE_STATE, so it restates nothing of the valve, and the boundary reads the wordobsoletefrom the card's typed constants.specs/queen/claim.wasm: built witht27c gen-c(0.5.2 at c31c059ef), thenzig 0.16.0 cc --target=wasm32-wasi -Oz -DNDEBUG -mexec-model=reactor. It exports the card's functions and the ones it imports. Two builds give one hash, and the module has 0 imports.specs/PINnames the sha256 of all three files.queen-claim-card.gen.ts: the verbatim output oft27c gen-ts.queen-claim.ts: the boundary. It maps thereview_stateword to aV_code, callsclaim_of, and maps theCL_code back to its word. A word with no rule isV_OTHER, which the card holds with no clock, as before. A code the card does not define (a drifted card) holds the row asawaitingReviewand is logged once per code. It does not throw, because the round maps every row with no per-row try (t27-bees point 3, 6aa063e).queen-tick.ts: the body ofstateOfDispatchis one call.SEND_BACK_IDLE_FLOOR_MS,WAIT_FROZEN_FLOOR_MS,FREE_ATTEMPT_CEILINGandREVIEWER_MISS_CEILINGnow come from the card's generated constants. The review-valve imports the old body used are removed.The clock crosses the boundary in whole minutes. Every floor is a whole number of minutes, so
idleMs >= floorMsholds exactly whenfloor(idleMs / 60000) >= floorMinutes. NaN and negative clocks read 0, which keeps the hold, as every comparison against NaN did. The counters areinteger NOT NULL DEFAULT 0columns.Proven equal before the switch
tests/api/queen-claim-card.test.tskeeps the old body verbatim, with its comments, as the reference. The reference reads the old literal floors and ceilings and the valve's hand mirror inqueen-review-valve.ts, never the card.review_statevalues (null, '', every word with a rule, case and prototype traps, a number); 27 idle clocks (a minute and a millisecond either side of the 30/60/120/360/2880-minute floors, NaN, negative, 1e12, Infinity); send-backs, ceilings, releases, criteria (unread/null/0/2), free attempts and reviewer misses either side of their ceilings. On every row, the card and the reference give the same word. The card's answers on the grid include every finished claim. A bee that has not ended isrunningfor every row.dispatchRowStatereads rows exactly as before.tri mutateon the spec found exactly that. They are pinned through the card'sescalation_kind_ofagainst the hand mirror on 1,200 rows, and a ±1 move of either ceiling is caught.assertin the 11 test blocks ofclaim.t27is read from the vendored spec and run against the wasm.escalationKind/nextStep/wantsBackfillequals the spec's own functions compiled into the card, on their whole input grid.SEND_BACK_FLOOR_MINUTES = 61and swapped it in. 4 tests failed: the PIN hash, the spec's own assert, the grid equality, and the +1-minute mutant (the card now matched it). I then restored the real wasm and checked its hash.Checks run locally (bun 1.3.6, head 087fd88; 6aa063e changes only
claimWordand its test: 50 pass)bun test tests/api/queen-claim-card.test.ts: 49 pass, 0 fail, 2.3 s.send-back-lease,queen-adversarial-review,send-back-valve-row,queen-review-valve,queen-holds: unchanged and passing (with the new file: 132 pass, 13 skip, 0 fail).bun run test:api(apps/server): 2021 tests in 156 files, 1956 pass, 65 skip, 0 fail.bun run typecheck(apps/server): clean.biome cion the changed files: no errors. The 2 warnings are the existing complexity warnings onrunRoundandreviewFinishedDispatches.CI on this PR versus
queenCode Qualityis red onqueenitself (the last four pushes, 82bcc93 included). I compared the findings of this PR's run with those of thequeenrun, file by file:apps/serversources withoutallowJs): the first head of this PR added one finding, a TS7016 for an import of the untypedqueen-review-valve.gen.js. Head 087fd88 removes it: the word now comes from the card's typed constants. One existing finding onqueen-tick.ts(theKIND_SEND_BACK_CEILINGimport) is also gone. The local run on 087fd88 shows no finding inqueen-claim.ts.t27c test-report11/11, 0 vacuous.tri mutate spec: 40/40 killed. The seal holds 11/11 at Zig 0.16.Recorded, not changed
When a spent ceiling is handed back,
queen-dispatch.tsresetssend_backsto 0 and leavesceiling_releases = 1. The first send-back of the new attempt reaches the valve with a spent release (claim_of(true, sendBack, idle < 60, 1, 2, releases 1)givescancelled).closeObsoletethen closes it inside its hour, which contradicts this file's own "then one more set". This PR keeps today's answer exactly. The spec test pins the behaviour, so a fix will be a visible change to the valve or the card, filed separately.Not in this PR
rings/T27-02/tick_core.t27state_of_dispatchis now a stale third copy. Retiring it is the next step, together with the tick's two other pure decisions (boundaryPathsOf,parseVerdictBlock).queendeploys the Queen; the live check comes after that.Dmitrii Fedorov (@dmitrii-f-t27)