Repository navigation
fix(evaluation): record an unverified shadow attempt as missing, not none - #1219
Merged
Merged
Conversation
The bundled shadow recorder published `verificationJson: null` for every
attempt, so `--record` scored attempts that ran and opened a pull request as
`none` ("nothing was recorded") even though they observed no check runs. It now
publishes the snapshot it observed — `{"ok": false, "reasons": [...]}` — for an
attempt that opened a pull request, and nothing when nothing was opened, so the
report says `missing` and the `--attempts` replay prints the same counts.
Fixes #1128
Docs-not-needed: docs/architecture.md already says the evidence state comes from the same parseVerification a job uses.
HugoXK-bot
approved these changes
Nov 23, 2026
HugoXK-bot
left a comment
Collaborator
There was a problem hiding this comment.
Verdict: PASS at 0de9ecd
- The recorder now publishes what it observed:
observedVerification(src/jobs/shadow.ts:67) emits the{ok:false,reasons:[…]}snapshot only when a pull request opened (:89-94), andevidenceOfmaps that tomissingwhile anullstill readsnone(src/lib/evaluation.ts:332-337);parseVerificationaccepts it on the boolean alone (src/lib/verification.ts:119-127). - Driven at this tip:
--recordprinted[{"verified":0,"missing":4,"none":0}]with four string snapshots and zero nulls, and the--attemptsreplay printed the same counts with every taskmissing;test/evaluationShadow.test.tsis 13/13. - No UI surface (无 UI 面); the snapshot invents no
sha/prState/checksfield, the refusal path still publishesnull(observedVerification(null) === null), capabilities stay all false, and CI at this sha is green except the pre-verdictreview-gate.
Ran:
node --import tsx --test test/evaluationShadow.test.ts— 13 pass / 0 failnode --import tsx scripts/evolution-shadow.ts --shadow test/fixtures/shadow/holdout.json --record … --out …and the--attemptsreplay — both[{"verified":0,"missing":4,"none":0}]
Not run:npm run checkat this tip (no repo-wide dev dependencies installed here); the head's CItest (24)and coverage are green.
Written-by: HugoXK-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written-by: HugoXK
Fixes #1128
What was wrong
createMockShadowHost(src/jobs/shadow.ts:72at the pin) publishedverificationJson: nullfor every attempt.evidenceOf(src/lib/evaluation.ts:332-337) readsnullasnone, so the bundled recorder's four holdout attempts were all scored "nothing was recorded" even though each attempt ran and opened a pull request.--recordprintedversions[].evidence = {"verified":0,"missing":0,"none":4}, and its replay printed the same.What changed
src/jobs/shadow.ts: an attempt that opened a pull request now publishes the snapshot the recorder actually observed —{"ok":false,"reasons":["shadow recorder: the bundled mock opened a pull request and observed no check runs"]}— and an attempt that opened nothing publishesnull, because there was nothing to verify. The rule is one small exported function,observedVerification(pullRequest), so both halves are testable without a host that can skip the mock's pull request.test/evaluationShadow.test.ts: the red test, covering the card's six acceptance points.changelog.d/1128.fixed.md: one fragment; the artifact a human reads changes.src/lib/evaluation.tsis consumed, not edited:parseVerification(src/lib/verification.ts:119-130) accepts{"ok":false}, andevidenceOfalready maps that tomissing. No score, interval, refusal code or saturation label moves.Red first, at the pin
d16ebf60cc260a3af30223392a86379deac1fd15node --import tsx scripts/evolution-shadow.ts --shadow test/fixtures/shadow/holdout.json --record /tmp/a1128.json --out /tmp/r1128.json→ report[{"verified":0,"missing":0,"none":4}], and every recordedverificationJsonwasnull. The new tests failed at that tip.Tests, against the card's acceptance list
evidenceismissingand none isnone—test/evaluationShadow.test.ts--attemptspath (child process, the checked-in CLI) — the replayedversions[].evidenceandtasks[].evidenceequal the recording run'sverificationJsonis a string,parseVerificationreturns non-null, andokisfalsesha,prState,draft,mergeableState,combinedStatus,reviews), has no non-zerocheckscounts, andmergedstaysfalseassertShadowHostandLIVE_REPOSITORYstay green, andcreateMockShadowHost().capabilitiesis all falsenone, pinned throughobservedVerification(null) === nullplus a run over an in-memory refusal fixtureAlternatives considered
sha,prState,checks,reviews) so the record resembles a job snapshot. Rejected: the mock reads nothing, so each of those values would be invented, which is the class of mistake this card removes.evidenceOfto treatnullasmissing. Rejected: out of scope, and it would erase the "not recorded" state an operator host still needs.nonemeans "mock". Rejected:nonealready has a meaning, and the card's expected behaviour ismissing.Uncertainty and residual risk
evidenceOfstill maps an unparseable snapshot and anok: falsesnapshot to the samemissingbucket; this card takes theok: falsepath and does not change that mapping — the card names that as its residual. The bundled fixture set is fourpull-requestfixtures, so acceptance 6 pins the "publishes nothing when nothing opened" rule at its seam rather than through a full mock run.Risk and rollback
src/jobs/**);node scripts/risk-gate.mjs --base mainprintedrisk-tier: T3; basis: src/jobs/shadow.ts.nonefor every attempt; no schema, no migration, no stored data changes.Docs
Docs-not-needed:
docs/architecture.md:1416-1444already says the evidence state comes from the sameparseVerificationa job uses, and it does not describe the recorder's oldnull. The new snapshot is exactly that shape, so no doc line moves.Ran:
npm run checkat this tip — pass: lint, typecheck, 3315 tests / 3315 pass / 0 fail, buildnpx tsx --test test/evaluationShadow.test.ts— 13/13 pass{"verified":0,"missing":4,"none":0}node scripts/version.mjs check—version: 0.4.5 oknode scripts/risk-gate.mjs --base main—risk-tier: T3; basis: src/jobs/shadow.tsNot run: no live host, repository, token or database — the shadow path is offline by design and
createMockShadowHoststill declares all capabilities false; no browser render, because this changes a JSON artifact and no rendered page.One note for the reviewer: the first full
npm run checkon this tip failed one unrelated test,deployAutomation"the deploy lock wait reads the holder instead of probing it" (its injected clock reachedelapsedMs 5000and the assert wanted> 5000). It passes alone and on a second full run, and this diff touches neitherdeploy/nor that test — recording it so the green run above is not read as the first attempt.