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

@@ -19,6 +19,11 @@ const os = require('node:os');
const { execFileSync } = require('node:child_process');
const { runNode } = require('./helpers/process-seam.cjs');
const { toLegacyResult } = require('./helpers/git-fixture.cjs');
const {
GIT_TIMEOUT_MS,
LOOP_HOOK_POINT_CLI_TIMEOUT_MS,
PROBE_TIMEOUT_MS,
} = require('./helpers/timeouts.cjs');
// `phase complete` against a real STATE.md rewrite; matches the 60000ms bound
// already used for the same CLI call elsewhere in this file (runPhaseComplete
@@ -2528,7 +2533,7 @@ describe('phase add allocation vs sibling git worktrees (#3849)', () => {
const activeDirs = [];
function git(args, cwd) {
return execFileSync('git', args, { cwd, encoding: 'utf-8', timeout: 15_000 });
return execFileSync('git', args, { cwd, encoding: 'utf-8', timeout: GIT_TIMEOUT_MS });
}
function initRepo(repoDir) {
@@ -2700,7 +2705,7 @@ describe('phase add --ws workstream-scoped allocation vs sibling git worktrees (
const activeDirs = [];
function git(args, cwd) {
return execFileSync('git', args, { cwd, encoding: 'utf-8', timeout: 15_000 });
return execFileSync('git', args, { cwd, encoding: 'utf-8', timeout: GIT_TIMEOUT_MS });
}
/**
@@ -6577,7 +6582,7 @@ function runPhaseComplete(tmpDir, { phase = '1', tolerateExit = false } = {}) {
try {
return execFileSync('node', [GSD_TOOLS_BIN, 'phase', 'complete', phase], {
cwd: tmpDir,
timeout: 60000,
timeout: LOOP_HOOK_POINT_CLI_TIMEOUT_MS,
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'pipe'],
});
@@ -9379,7 +9384,7 @@ function run(args, cwd) {
return {
stdout: execFileSync('node', [gsdTools, ...args], {
cwd,
timeout: 15000,
timeout: PROBE_TIMEOUT_MS,
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'pipe'],
}),
@@ -9749,7 +9754,7 @@ function run2853(args, cwd) {
try {
return {
stdout: execFileSync('node', [gsdTools2853, ...args], {
cwd, timeout: 15000, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'],
cwd, timeout: PROBE_TIMEOUT_MS, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'],
}),
ok: true,
};