test(#4521): migrate capability subsystem batch to named timeout constants (#4627)

Batch 10 of the ad hoc timeout literal migration (epic #4445). Replaces
every bare numeric timeout/timeoutMs object-literal property in
tests/adr857-core-without-capabilities.test.cjs, tests/capability-cli.test.cjs,
tests/capability-probe-fallback.test.cjs, tests/capability-state.test.cjs,
tests/capability-trust.test.cjs,
tests/capability-validator-task-content-resolver.test.cjs, and
tests/capability-writer.test.cjs with a named constant, per
eslint-rules/no-adhoc-timeout-literal.cjs. Removes these 7 files from the
rule's allowlist.

Reuses the existing PROBE_TIMEOUT_MS constant at 8 sites across 3 files.
Adds 7 new file-local constants (no promotion to the shared helper needed
this batch -- every new class is confined to exactly one file, below the
two-file promotion bar): GSD_TOOLS_CLI_TIMEOUT_MS,
FRAGMENT_PROBE_SNIPPET_TIMEOUT_MS, INSTALLED_RUNTIME_CLI_TIMEOUT_MS,
FIXTURE_MCP_SERVER_TIMEOUT_VALUE, TASK_RESOLVER_FIXTURE_TIMEOUT_MS,
TASK_RESOLVER_TIMEOUT_CEILING_MS, and TASK_RESOLVER_TIMEOUT_CEILING_PLUS_ONE_MS
(the last two forming a boundary-coverage limit/limit+1 pair). 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-11 09:55:55 -04:00
committed by GitHub
parent 7249bdddac
commit aad96e0b5f
8 changed files with 97 additions and 25 deletions

View File

@@ -38,6 +38,19 @@ const DELTA_FRAGMENT = path.join(
REPO_ROOT, 'capabilities', 'assumption-delta', 'fragments', 'plan-pre.md');
const TOOLS_PATH = path.join(REPO_ROOT, 'gsd-core', 'bin', 'gsd-tools.cjs');
/**
* The OUTER runNode() timeoutMs bound for a node -e wrapper that itself
* spawns ONE bash subprocess to execute an extracted capability-fragment
* probe snippet (a two-level nested spawn). Distinct from
* HOOK_FANOUT_TIMEOUT_MS (a git-hook-shaped multi-spawn fan-out, ~4 spawns)
* and LOOP_HOOK_POINT_CLI_TIMEOUT_MS (specifically gsd-tools.cjs, not a
* generic node -e wrapper) despite the coincidentally-matching value. Does
* NOT touch the inner `timeout: 60000` inside the node-e script's own
* string literal a few lines above -- that is JS text content passed to a
* spawned child, not a real object-literal property in this file's AST.
*/
const FRAGMENT_PROBE_SNIPPET_TIMEOUT_MS = 60000;
/**
* Pull the fragment's probe snippet out of its markdown: the first fenced
* ```bash block that assigns `varName`. The block is returned verbatim so the
@@ -84,7 +97,7 @@ function runSnippet({ block, varName, prelude, cwd }) {
const { spawnSync } = require('node:child_process');
const r = spawnSync('bash', [process.argv[1]], { cwd: process.argv[2], encoding: 'utf8', timeout: 60000 });
process.stdout.write(r.stdout || '');
`, scriptFile, cwd], { cwd, timeoutMs: 60000 });
`, scriptFile, cwd], { cwd, timeoutMs: FRAGMENT_PROBE_SNIPPET_TIMEOUT_MS });
assert.strictEqual(r.outcome, OUTCOME.EXITED, `snippet runner outcome: ${r.outcome}`);
return r.stdout;
} finally {