You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci(devx): floor and handshake the watchdog pin's self-test; drop a comment its own trigger falsified
Review found two things and both are correct.
1. The workflow carried a comment claiming NO pull_request and NO merge_group
trigger, four lines under the pull_request trigger this branch added, and
false about the pin besides. Replaced with the true statement.
2. The new gate's self-test decided success by `failures.length === 0` and
printed an UNCOMPARED case count, and the dispatch discarded its completion —
so an early return would have printed `0 assertions` and exited 0. Landing a
new scripts/** gate in that shape re-opens two closed sets by one. Brought to
the landed shape: a frozen SELF_TEST_BATTERIES roster of eight battery names
with per-battery floors, the roster's own size pinned, registerCase()
attribution to the most recently opened battery, the floor evaluated at the
verdict site before the green line, and the reached-verdict handshake read at
the --self-test dispatch.
Measured, not asserted: `measure-self-test-floor.mjs --json` now reads ROSTER
for this file (was COUNT), and `--probe --only` reads HELD (0 DEFEATED, 1 HELD,
0 ACCIDENT). Every floor equals its measured count; 42 assertions across 8
batteries.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PU9zBGbH2s2ZtxSyu963M3
// ── The self-test's own battery roster and floor ───────────────────────────
125
+
//
126
+
// `failures.length === 0` alone cannot tell "every case held" from "the cases
127
+
// never ran": both print the same green line, and a printed `checked` count
128
+
// that nothing COMPARES is evidence, not proof. So each battery declares a
129
+
// FLOOR and the roster is compared as a SET — a set difference names WHICH
130
+
// battery stopped, where a count says only that something did.
131
+
//
132
+
// The counts are a floor, not an equality: adding cases is ordinary work and
133
+
// must not red. A battery BELOW its floor means cases stopped running, and the
134
+
// remedy is to find what stopped registering — ⛔ never to lower the number.
135
+
//
136
+
// ⛔ A pinned TOTAL is not the repair either: one battery dropping from 12
137
+
// cases to 2 keeps a total "right" the moment a sibling grows.
138
+
constSELF_TEST_BATTERIES=Object.freeze({
139
+
'the positive control — a compliant workflow yields no finding': 2,
140
+
'clause 1 — the file exists, is non-empty, and parses as a workflow': 5,
141
+
'clause 2 — schedule (with a real cron) and workflow_dispatch': 5,
142
+
'clause 3 — merge_group and pull_request_target refused outright': 6,
143
+
'clause 4 — a pull_request trigger paths-filtered to this file ALONE': 10,
144
+
'clause 4b — no board write reachable from a pull_request run': 6,
145
+
'clauses 5 and 6 — the package script, and no inlined copy of it': 5,
146
+
'the manifest clause — the package script exists to be invoked': 3,
147
+
});
148
+
149
+
// DELETING an entry silences that battery's floor exactly as effectively as
150
+
// zeroing it, so the roster's own size is pinned beside the floors.
151
+
constSELF_TEST_BATTERY_FLOOR=8;
152
+
153
+
// The key an assertion is filed under when no battery is open. It is not a
154
+
// declared battery, so it reds by the same set difference rather than silently
155
+
// inflating whichever battery happened to run last.
156
+
constUNATTRIBUTED_BATTERY='(no battery open)';
157
+
158
+
// Set by `selfTest()` only after a verdict is printed — EITHER verdict — and
159
+
// read at the dispatch: a `return` that leaves the function above those lines
160
+
// prints nothing and still exits 0, so a self-test that never finished would
161
+
// report as one that passed. The failure path sets it too, so the refusal fires
162
+
// only when NEITHER verdict was printed, never on a genuine red.
163
+
letselfTestReachedVerdict=false;
164
+
124
165
/** The tail every trigger refusal carries, so one reason is stated once. */
125
166
constDECISION_TAIL='A standing maintainer decision keeps `check:platform-checklist` off the per-PR path, in its own words so that "an unrelated PR is never blocked by checklist drift"; this workflow changes the reporting channel and must never undo that.';
failures.push(`SELF_TEST_BATTERIES declares ${declaredBatteries.length} batteries, below the pinned ${SELF_TEST_BATTERY_FLOOR} — a battery deleted from the roster takes its own floor with it.`);
559
+
}
560
+
for(const[name,count]ofseen){
561
+
if(declaredBatteries.includes(name))continue;
562
+
failures.push(`self-test battery "${name}" registered ${count} case(s) but is not declared in SELF_TEST_BATTERIES — an assertion attributed to no declared battery is one nothing floors.`);
563
+
}
564
+
for(constnameofdeclaredBatteries){
565
+
constcount=seen.get(name)??0;
566
+
if(count>=SELF_TEST_BATTERIES[name])continue;
567
+
failures.push(count===0
568
+
? `self-test battery "${name}" DID NOT RUN — 0 cases registered, ${SELF_TEST_BATTERIES[name]} pinned. The verdict would otherwise have claimed those cases hold.`
569
+
: `self-test battery "${name}" registered ${count} case(s), below its pinned floor of ${SELF_TEST_BATTERIES[name]} — cases that used to run no longer do (⛔ MAINTAINER-ONLY: lowering a floor is not the repair).`);
570
+
}
571
+
572
+
if(failures.length>0){
573
+
console.error(`\nx check-platform-checklist-watchdog self-test: ${failures.length} of ${checked} assertions failed\n`);
574
+
for(constfoffailures)console.error(` - ${f}`);
575
+
console.error('');
576
+
selfTestReachedVerdict=true;
577
+
return1;
578
+
}
579
+
console.log(`OK check-platform-checklist-watchdog self-test: ${checked} assertions across ${declaredBatteries.length} floored batteries, every clause driven by a fixture that makes it fire.`);
0 commit comments