Skip to content

Commit 0079e25

Browse files
Elon Muskclaude
andauthored
ci(devx): run measure-stall-guard-headroom's --self-test in the lint farm (#13358)
The stall-guard family has three members and only two were wired. Its measurement tool ships a `--self-test` that drives the real `main()` over fixture payloads and fixture workflow trees, and no `check:*` family ran it, so its 32 assertions never executed in CI. The header's stated reason for keeping the tool out of the farm -- "it needs the network and a token" -- is true of the TOOL and false of the FLAG. The flag takes no `--run`, which makes `fetchRunJobs` unreachable from it. Measured with net.Socket.connect, net.connect, dns.lookup and globalThis.fetch all armed to throw and with GITHUB_TOKEN/GH_TOKEN unset: 32 assertions passed, ~1.5s, no build, no socket. Wires ONLY the self-test leg. The two siblings run `--self-test && the gate`; appending a bare invocation here would red the farm on a token-less runner, and the header now records that asymmetry so the next reader does not tidy it away. Claude-Session: https://claude.ai/code/session_01CPrUz21stTFhJRUirdc4yw Co-authored-by: Claude <noreply@anthropic.com>
1 parent d029c31 commit 0079e25

3 files changed

Lines changed: 57 additions & 5 deletions

File tree

.github/workflows/lint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,6 +3470,46 @@ jobs:
34703470
- name: Stall-guard budget invariant
34713471
run: pnpm check:stall-guard-budget
34723472

3473+
# The third member of the stall-guard family, and the only one that was
3474+
# never wired (#13246). `measure-stall-guard-headroom.mjs` re-derives the
3475+
# one term the budget gate above cannot read statically -- `p + s`, the
3476+
# job's prep plus the healthy run length -- by joining that gate's own
3477+
# sweep against GitHub's runner timestamps.
3478+
#
3479+
# ONLY THE `--self-test` LEG, and the asymmetry with the two steps above is
3480+
# deliberate: they run `--self-test && the gate`, this one must never
3481+
# append a bare invocation. The measurement path fetches
3482+
# `GET /actions/runs/{id}/jobs` and reads GITHUB_TOKEN/GH_TOKEN, so a bare
3483+
# run reds the farm on a token-less runner. "Consistency with the sibling"
3484+
# is the tidy-up that breaks this step.
3485+
#
3486+
# The `--self-test` half is a different animal, and conflating the two is
3487+
# exactly why this sat unrun: it takes no `--run`, so `fetchRunJobs` is
3488+
# unreachable from it. Measured with `net.Socket.connect`, `net.connect`,
3489+
# `dns.lookup` and `globalThis.fetch` all armed to throw, and with
3490+
# GITHUB_TOKEN/GH_TOKEN unset: 32 assertions passed, ~1.5s, no build. It
3491+
# drives the real `main()` over fixture payloads and fixture workflow trees
3492+
# in a temp dir, and asserts all three exit codes -- 0 covered, 1 a step
3493+
# that cannot deliver a verdict, 2 REFUSED -- so a tool that can only print
3494+
# "covered" cannot pass.
3495+
#
3496+
# Why it is worth a step rather than a note: #13121 gave the tool refusal
3497+
# branches (an unattributable observation refuses; an observation matching
3498+
# no guarded site is EXCLUDED and reported, never dropped), and every proof
3499+
# that those branches fire lives here. A refusal branch nobody exercises
3500+
# decays into decoration -- the same silence #13121 was filed about, one
3501+
# level up. The collision refusal in particular is unreachable from this
3502+
# tree, where all seven guarded steps carry distinct names, so only the
3503+
# synthetic `--root` fixtures can exercise it at all.
3504+
#
3505+
# WHAT REDDENS IT: its own script's code, and the guarded-site population
3506+
# this repo's workflows declare. Measured adversarially -- inverting the
3507+
# `attribute` NONE branch to attribute rather than exclude reds this step
3508+
# alone, naming the assertion. It reads `.github/workflows/**` plus temp
3509+
# fixtures; no network, no token, no build.
3510+
- name: Stall-guard headroom self-test (self-test half only, never the measurement)
3511+
run: pnpm check:stall-guard-headroom
3512+
34733513
# The dev-preflight gate's self-test — and deliberately only HALF of that
34743514
# gate (#8170, the second and only other member of #8110's split-gate
34753515
# family). Same neighbour as the step above for the same reason: both are

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@
143143
"check:spec-parsed-alias": "node scripts/check-spec-parsed-alias.mjs --self-test && node scripts/check-spec-parsed-alias.mjs",
144144
"check:tenant-chokepoint": "node scripts/check-tenant-chokepoint.mjs --self-test && node scripts/check-tenant-chokepoint.mjs",
145145
"check:stall-guard": "node scripts/run-with-stall-guard.mjs --self-test",
146-
"check:stall-guard-budget": "node scripts/check-stall-guard-budget.mjs --self-test && node scripts/check-stall-guard-budget.mjs"
146+
"check:stall-guard-budget": "node scripts/check-stall-guard-budget.mjs --self-test && node scripts/check-stall-guard-budget.mjs",
147+
"check:stall-guard-headroom": "node scripts/measure-stall-guard-headroom.mjs --self-test"
147148
},
148149
"keywords": [
149150
"objectstack",

scripts/measure-stall-guard-headroom.mjs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,21 @@
105105
* folded silently into the answer. Choosing the margin -- and deciding whether to
106106
* spend it at all -- is a fleet-budget decision this tool has no standing to make.
107107
*
108-
* It is also NOT a CI gate and is deliberately not wired into any workflow: it
109-
* needs the network and a token, and a check that cannot run offline has no
110-
* business in the lint farm. `check-stall-guard-budget.mjs` is the gate; this is
111-
* the instrument you reach for when that gate's headroom needs re-deriving.
108+
* The MEASUREMENT path is NOT a CI gate and is deliberately not wired into any
109+
* workflow: it needs the network and a token, and a check that cannot run
110+
* offline has no business in the lint farm. `check-stall-guard-budget.mjs` is
111+
* the gate; this is the instrument you reach for when that gate's headroom needs
112+
* re-deriving.
113+
*
114+
* `--self-test` is the exception, and that distinction is load-bearing (#13246).
115+
* The paragraph above was written of the TOOL and was read as covering the FLAG
116+
* too, which left every assertion below unrun -- the #13121 refusal branches
117+
* included, so the only proof they fire was itself never executed. The flag
118+
* takes no `--run`, which makes `fetchRunJobs` unreachable from it: no socket,
119+
* no token, only this repo's workflow directory and temp fixtures. It is wired
120+
* as `check:stall-guard-headroom` and runs ONLY the flag -- never append a bare
121+
* invocation to that script, however tidy the symmetry with its two siblings in
122+
* the lint farm looks.
112123
*
113124
* ## Reading the exit code
114125
*

0 commit comments

Comments
 (0)