Repository navigation
feat(cd): freshness reads D2 skip reasons, quiet slots need live evidence (CHE-9956) [squash] - #177
Draft
congvc-bot-x99[bot] wants to merge 8 commits into
Draft
congvc-bot-x99[bot] wants to merge 8 commits into
congvc-bot-x99[bot] wants to merge 8 commits into
Conversation
added 8 commits
November 27, 2026 16:10
…lict Keep the S2 skip-reason, candidate-slot and diagnosis logic; carry main's alarm field and CHE-10498 backup dispatch into freshness().
…oyed candidates (CHE-9956)
…receipt (CHE-9956) A deployed candidate was always treated as a quiet slot, so a normal slot that deployed and confirmed, and a busy slot recovered by the one dispatch, false-alarmed at +90 min. The watcher now reads the D2 evidence since the slot: a run that confirmed the target after the slot delivers it. Only a slot with no such confirmation needs the current skip and bound live proof. Adds a behavioural FP-03 test that reaches the alarm assertion on the pinned 19e83e2 head.
This branch has not been deployed
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.
Summary
CHE-9956 (S2 of the hands-off deploy train, parent CHE-9850).
freshness()reads the D2skip_reason.suspendedandunreadablealarm at once and never dispatch.busyandarmedsend nothing while a D2 run is active, and exactly one dispatch after it ends if the slot is still undelivered.confirmedSinceSlot): outcomeconfirmed,candidate_sha= the slot target (full SHA), confirmation time after the slot. That covers a normal scheduled deploy and a busy slot recovered by the one dispatch: idle, no live evidence needed, nocurrentskip needed. Only a slot with no such confirmation is a quiet slot:ok, and it names the run and attempt that observed it, which must equal the live run it was downloaded from; and the slot's own D2 run skipped withcurrent. Missing facts fail closed. Otherwise alarm at slot + 90 min (owner c00-hermes-devops if the X99 runner is down, else the CD lane).cd-live-revisionuploadslive-evidence.json(full revision, ok, observed_at, run id, run attempt).busyandarmedget their one dispatch after the blocking run ends at any age; past slot + 90 min the same tick also alarms (dispatchwithalarm: true), so the alarm no longer swallows it.slotCandidate()picks the newest successful D1 push run created at or before the slot. The fact used is the D1 run'screated_at(a push run is created by the push that put the commit oncheese/main). A candidate that only exists after the slot isidlewithcandidate <sha> merged after the slot; due at the next slot: no alarm, no dispatch. If D2 already deployed a later candidate (a dispatch), that later run is the candidate, so the older slot commit is not called undelivered; its delivery is checked like a quiet slot (fresh bound live evidence, else alarm at slot + 90 min), it does not bypass the alarm.diagnosis {step, reason, owner}: D1 red -> PR author; C00 job queued > 10 min -> c00-hermes-devops (measured byc00QueuedMinutes()from the active D2 run's jobs, labelcheese-c00-deploy); marker suspended -> Cheese.inconclusive. D2's evidence has noinconclusiveoutcome (outcomeOfindeploy-evidence.mjsyields confirmed, failed, rolled_back, ...), so nothing can measure it. I removed the dead branch instead of shipping it.Tests
Command:
bunx vitest run tests/cdWatch.test.ts tests/cdWatchWorkflows.test.ts tests/cdWatchTrigger.test.tsGreen on the exact PR head
5623086562a2c1ce628b83feaf0b03b19cfc7734(run locally on that checkout;bun run typecheck,eslint --max-warnings 0,oxlint --type-aware --deny-warningsandprettier --checkexit 0; all 11 GitHub checks on this head are SUCCESS):New in review round 2:
gh, fixed clock): scheduled deploy confirmed (run 50) isnoneat +100; busy run 50 then dispatch run 51 confirmed isnoneat +100; a run that skippedcurrentwith no live run still alarms.noneat +100; absent, stale (observed before the slot) and wrong-revision evidence each must alarm with exit 1: four tests, one CLI run each, explicit 30 s timeout since each run spawns the real watcher.New in this round (review round 1, three P1s):
deploy-evidence.mjsoutput (the realWrite the evidencestep env), and a late case: ended at slot + 120 min dispatches once with the alarm; still active alarms without dispatch; already dispatched alarms without a second one; at +89 the dispatch has no alarm.cd-watch livewritesLIVE_EVIDENCE_OUT, the file is served as thelive-evidenceartifact by a fakegh, andcd-watch freshnessreads it (fixed clock and/healthz, fakeghon PATH). Positive control delivers at +100; evidence of another run, of another attempt, a slot whose D2 run skippedbusy, and unhealthy evidence each alarm with exit 1. Unit cases cover missing run identity and every non-currentskip.Red/green receipts
The PR-head test file run against the older
scripts/, selector by selector.On the previously reviewed head
5bb8c521, assertion level (each one is a finding):a busy or armed run that ends after slot+90 min still gets its one dispatch:expected 'alarm' to be 'dispatch'.expected true to be false; slot skipexpected true to be false; later deployed candidateexpected [ 'none', false ] to deeply equal [ 'alarm', true ]; three real-CLI casesexpected +0 to be 1(the freshness CLI exited 0 on evidence of another run, another attempt and abusyslot).Review round 2, on the round-1 head
609c9154with the new tests and the oldscripts/: P1a 6 failed. The two real-CLI cases fail at the assertion, the freshness CLI answeredcd-watch freshness: alarm: candidate aaaaaaa is already deployed, but the slot has no fresh live evidence: no live evidence since the slot; owner c00-hermes-devopsfor a confirmed deployment (the false alarm). The four pure cases fail withTypeError: confirmedSinceSlot is not a function.On pinned head
19e83e20(new test file,git worktreeof the pin): FP-02 5 failed, 2 passed; FP-03 18 failed (the file as of that run; the 4-test split of the behaviour test has since raised FP-03 to 21 tests, and its 3 alarm cases were re-run on the pin: 3 failed, 1 control passed); FP-05 7 failed. The new FP-03 behaviour test reaches the watcher assertion there: its fresh-evidence control passes (none) and the first absent-evidence case fails withAssertionError: expected 'cd-watch freshness: none: candidate a…' to contain 'cd-watch freshness: alarm:'. The P1a CLI cases there fail withexpected 'cd-watch freshness: none: candidate a…' to contain 'D2 run 50 confirmed'(and 51). Assertion level: FP-02 suspended/unreadableexpected 'dispatch' to be 'alarm'; busy and armedexpected 'dispatch' to be 'none'; late busyexpected 'alarm' to be 'dispatch'; FP-05expected 'alarm' to be 'none',expected 'alarm' to be 'dispatch'andexpected 'dispatch' to be 'none'. The rest fail withTypeError: quietSlotProof / liveEvidence / diagnose / slotCandidate is not a function(those functions do not exist there) or, for the real-CLI cases,ENOENTbecause the pinned CLI writes no live evidence file.FP-03 includes the two-slot no-new-merge case (evidence after slot 2 delivers it; evidence only before slot 2 alarms at + 90 min).
Known limits
busyskip, with no confirmation of the slot's own SHA, is still a quiet-slot case: it needs bound live proof or alarms at slot + 90 min.inconclusivestays in S4.Not done here
Changelog
Changelog: none