test(#4522): migrate core CLI/domain state batch to named timeout constants (#4662)

Batch 11 of the ad hoc timeout literal migration (epic #4445). Replaces
every bare numeric timeout/timeoutMs object-literal property in
tests/state-document.test.cjs, tests/phase.test.cjs, tests/commands.test.cjs,
tests/pattern.test.cjs, tests/adr-612-bracket-coherence.test.cjs,
tests/adr-612-bracket-read-tolerance.test.cjs, tests/milestone-lock.test.cjs,
tests/init.test.cjs, tests/state-todos-render.test.cjs,
tests/quick-batch.test.cjs, tests/graphify.test.cjs, and
tests/effort-surface-axis.test.cjs with a named constant, per
eslint-rules/no-adhoc-timeout-literal.cjs. Removes these 12 files from the
rule's allowlist.

Ground truth via eslint found 25 sites, not the issue's stated 24 (phase.test.cjs
has 5, not 4) -- disclosed in the PR body.

Reuses PROBE_TIMEOUT_MS, GIT_TIMEOUT_MS, and LOOP_HOOK_POINT_CLI_TIMEOUT_MS
across 8 files. Adds two new shared constants to tests/helpers/timeouts.cjs
(each independently arrived at by 2 files in this batch, crossing the
promotion bar): PATHOLOGICAL_INPUT_TEST_TIMEOUT_MS (node:test's own per-test
timeout option, not a subprocess bound) and GSD_TOOLS_CLI_MODERATE_TIMEOUT_MS
(a single gsd-tools.cjs CLI subcommand spawn, distinct tier from
PROBE_TIMEOUT_MS/LOOP_HOOK_POINT_CLI_TIMEOUT_MS). Adds 3 file-local constants
for values used by only 1 file in this batch. No src/bin file touched, no
numeric value changed anywhere.

Co-authored-by: sim <sim@local>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-09-12 09:12:31 -04:00
committed by GitHub
parent 241646a43a
commit c99d7bb2be
14 changed files with 103 additions and 38 deletions

View File

@@ -265,6 +265,41 @@ const GENERATOR_SCRIPT_TIMEOUT_MS = 30000;
*/
const REAL_REPO_GIT_TIMEOUT_MS = 30000;
/**
* NOT a subprocess spawn timeout. This is `node:test`'s own per-test
* `{ timeout }` option (the second positional argument to `test(name,
* options, fn)`), used as a hang BACKSTOP -- not an assertion -- for tests
* that exercise a pathological, adversarially-large input against an
* algorithmic bound (ADR-612 bracket-coherence and read-tolerance) rather
* than a wall-clock ceiling. If the bound holds, the test finishes in
* milliseconds; this only turns a genuine runaway into a deterministic
* failure instead of a suite that never returns.
*
* Shared across 2 files in batch #4522 of the ad hoc timeout literal
* migration, epic #4445 -- every site independently arrived at this exact
* value -- that is why it lives here rather than as a file-local constant.
*/
const PATHOLOGICAL_INPUT_TEST_TIMEOUT_MS = 60000;
/**
* A single `gsd-tools.cjs` CLI subcommand invocation, spawned directly
* (execFileSync/spawnSync, or the process seam's runNode wrapping the same
* shape -- never via an intermediate shell script), with no confirmed
* nested-subprocess fan-out. A distinct, heavier tier than
* `PROBE_TIMEOUT_MS` (15000ms, the lighter CLI-query/probe class) but half
* of `LOOP_HOOK_POINT_CLI_TIMEOUT_MS` (60000ms) -- not equalized to either
* without bench data. Coincides numerically with `BUILD_TIMEOUT_MS`,
* `GENERATOR_SCRIPT_TIMEOUT_MS`, and `REAL_REPO_GIT_TIMEOUT_MS`, none of
* which describe this call shape (a `build-hooks.js` bundle, a
* `scripts/*.cjs` generator, and real-repo git plumbing respectively) --
* disclosed, not merged.
*
* Shared across 2 files in batch #4522 of the ad hoc timeout literal
* migration, epic #4445 -- every site independently arrived at this exact
* value -- that is why it lives here rather than as a file-local constant.
*/
const GSD_TOOLS_CLI_MODERATE_TIMEOUT_MS = 30000;
module.exports = {
PROBE_TIMEOUT_MS,
HOOK_FANOUT_TIMEOUT_MS,
@@ -281,4 +316,6 @@ module.exports = {
MALFORMED_INPUT_HOOK_TIMEOUT_MS,
GENERATOR_SCRIPT_TIMEOUT_MS,
REAL_REPO_GIT_TIMEOUT_MS,
PATHOLOGICAL_INPUT_TEST_TIMEOUT_MS,
GSD_TOOLS_CLI_MODERATE_TIMEOUT_MS,
};