Skip to content

ci: move the census timeout validation out of inline YAML into a tested scripts/ gate #4156

Description

@louistrue

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    readyMaintainer-approved: in scope, wanted now, scoped. A PR may close this.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions