The census lane's run: block now carries roughly 60 lines of shell whose only job is
to turn two strings and a file path into a verdict: parse a coreutils DURATION to
seconds, reject zero (coreutils treats timeout 0 as no limit), reject non-positive and
malformed values, read the job's real timeout-minutes out of the checked-out workflow
file, and compare the two with headroom.
It is the most branch-heavy thing in the workflow and it has no test. Reviewing it meant
reconstructing a 20-case accept/reject table by hand, twice, in two different review
rounds.
Why it belongs in scripts/
This repo already has roughly 50 scripts/check-*.mjs paired with check-*.test.mjs,
and scripts/check-test-wiring.mjs enforces the pairing and the invocation. A
scripts/check-census-timeout.mjs would:
- turn that hand-reconstructed table into a checked-in assertion,
- run on every PR through the node-tests lane instead of every Monday,
- be mutation-testable, which eight lines of inline YAML can never be.
The inputs it must keep rejecting, all measured on the current shell version:
accept 50m -> 3000s, 10s -> 10s, 3000 -> 3000s, and exactly the budget
reject 0, 0s, 0m, 0.5s, 0.9 (coreutils no-limit hole, and truncation to 0)
reject -5m, -1 (negative)
reject 1h, 90m, 1.5h, 1d, 3301 (over budget)
reject " 50m", "50 m", "", 50M, 50min, +50m, 1e3
reject 99999999999999999999d (clamps to LLONG_MAX, fails closed)
Plus the cross-check: it must fail when the file's timeout-minutes disagrees with the
declared copy, when the file cannot be read, and when more than one timeout-minutes:
line matches.
What should stay in YAML
Per the review that raised this: the timeout wrapper and its exit-code message have to
wrap the invocation; the rows assertion is eight lines and a glob; and both gh blocks
are genuinely workflow-shaped and match deploy-nightly.yml and review-lane-canary.yml
line for line, so extracting them would create a third dialect for two existing copies.
Related, separate
Those two gh blocks are now the THIRD near-identical copy of file-an-ops-issue logic in
this repo (deploy-nightly.yml, review-lane-canary.yml, and this lane). That is a
scripts/lib/ candidate in its own right, and it is the piece #4144's sweep would
otherwise install a fourth and fifth copy of.
Raised by code review on the #4127 workflow PR, deferred there because it is a
restructure rather than a fix and that PR had already been through three rework rounds.
The census lane's
run:block now carries roughly 60 lines of shell whose only job isto turn two strings and a file path into a verdict: parse a coreutils DURATION to
seconds, reject zero (coreutils treats
timeout 0as no limit), reject non-positive andmalformed values, read the job's real
timeout-minutesout of the checked-out workflowfile, and compare the two with headroom.
It is the most branch-heavy thing in the workflow and it has no test. Reviewing it meant
reconstructing a 20-case accept/reject table by hand, twice, in two different review
rounds.
Why it belongs in
scripts/This repo already has roughly 50
scripts/check-*.mjspaired withcheck-*.test.mjs,and
scripts/check-test-wiring.mjsenforces the pairing and the invocation. Ascripts/check-census-timeout.mjswould:The inputs it must keep rejecting, all measured on the current shell version:
Plus the cross-check: it must fail when the file's
timeout-minutesdisagrees with thedeclared copy, when the file cannot be read, and when more than one
timeout-minutes:line matches.
What should stay in YAML
Per the review that raised this: the
timeoutwrapper and its exit-code message have towrap the invocation; the rows assertion is eight lines and a glob; and both
ghblocksare genuinely workflow-shaped and match
deploy-nightly.ymlandreview-lane-canary.ymlline for line, so extracting them would create a third dialect for two existing copies.
Related, separate
Those two
ghblocks are now the THIRD near-identical copy of file-an-ops-issue logic inthis repo (
deploy-nightly.yml,review-lane-canary.yml, and this lane). That is ascripts/lib/candidate in its own right, and it is the piece #4144's sweep wouldotherwise install a fourth and fifth copy of.
Raised by code review on the #4127 workflow PR, deferred there because it is a
restructure rather than a fix and that PR had already been through three rework rounds.