Batch 16 of 17 in the ad hoc timeout literal migration (epic #4445). Replaces every bare numeric timeout/timeoutMs object-literal property in 9 test files with a named constant, per eslint-rules/no-adhoc-timeout-literal.cjs. No src/bin file touched, no numeric value changed anywhere. Ground truth via eslint found 48 sites, not the issue's stated 38 — tests/code-review.test.cjs alone has 11, not 1 (a 10-site undercount, the largest single-file drift in this epic). All 11 are migrated. Reuses PROBE_TIMEOUT_MS (17 sites across assumption-delta.test.cjs and code-review.test.cjs), LOOP_HOOK_POINT_CLI_TIMEOUT_MS (1 site), QUICK_SPAWN_TIMEOUT_MS (1 site). Adds a new shared constant, HTTP_REACHABLE_PROBE_TIMEOUT_FIXTURE_MS, promoted because two files (reviewer-manifest-body.test.cjs, reviewer-trust-disclosure.test.cjs) independently arrived at the same probe-fixture value across 3 sites. File-local constants elsewhere for values not shared across files: FALLOW_AUDIT_TIMEOUT_MS (code-review-pipeline-regression.test.cjs); a 5-constant set covering runBashScript's own override/forced-timeout/ boundary-triple tests (plan-phase-stall-detection.test.cjs); 9 lane-specific NATIVE_TIMEOUT_MS constants, one per shipped reviewer CLI tool, even where 4 lanes coincidentally share a value (review-lane-invocation.test.cjs); and a 6-constant set covering reviewer-manifest-body.test.cjs's own probe-kind fixtures and its separate, unrelated boundary/invalid set that coincidentally overlaps in shape (not value) with plan-phase-stall-detection.test.cjs's triple. Fixes applied inline from review: GENERATOR_SCRIPT_TIMEOUT_MS was misapplied to 3 sites in plan-review-convergence.test.cjs whose actual shape (nested bash -> node -> gsd-tools.cjs chain) doesn't match that constant's documented direct-spawn class, confirmed against its own cited precedent files — replaced with a new file-local constant naming the correct class, same value. Two stray un-renamed literals in review-lane-invocation.test.cjs (missed by eslint's object-literal-only detection) were investigated and left as disclosed literals with an explanatory comment rather than force-fit onto an unrelated lane's constant, since they belong to a distinct config-override code path. Co-authored-by: sim <sim@local> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,7 @@ const os = require('os');
|
||||
const { runGsdTools, createTempProject, createTempGitProject, cleanup } = require('./helpers.cjs');
|
||||
const { runNode } = require('./helpers/process-seam.cjs');
|
||||
const { escapeRegex } = require('../gsd-core/bin/lib/pattern.cjs');
|
||||
const { PROBE_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '..');
|
||||
const GSD_TOOLS_BIN = path.join(REPO_ROOT, 'gsd-core', 'bin', 'gsd-tools.cjs');
|
||||
@@ -610,7 +611,7 @@ describe('CR-CONFIG: config key registration', () => {
|
||||
function renderHooksEnvelope(tmpDir, point) {
|
||||
const result = runNode(
|
||||
[GSD_TOOLS_BIN, 'loop', 'render-hooks', point, '--cwd', tmpDir],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000 },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `Expected exit 0 for render-hooks ${point}. stderr: ` + (result.stderr || ''));
|
||||
return JSON.parse(result.stdout.trim());
|
||||
@@ -737,7 +738,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
'echo "CODE_REVIEW_POINT=[$CODE_REVIEW_POINT]"',
|
||||
'echo "EXPLICIT_JOINED=[$EXPLICIT_JOINED]"',
|
||||
].join('\n');
|
||||
const result = require('node:child_process').spawnSync('bash', ['-c', driver], { cwd: tmpDir, encoding: 'utf8', timeout: 15000 });
|
||||
const result = require('node:child_process').spawnSync('bash', ['-c', driver], { cwd: tmpDir, encoding: 'utf8', timeout: PROBE_TIMEOUT_MS });
|
||||
assert.equal(result.status, 0, `driver failed: stdout=${result.stdout} stderr=${result.stderr}`);
|
||||
assert.match(result.stdout, /CODE_REVIEW_POINT=\[execute:post\]/,
|
||||
`CODE_REVIEW_POINT must be computed and survive within the SAME fence that later uses it for --point, got: ${result.stdout}`);
|
||||
@@ -788,7 +789,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
'--repo-root', tmpDir, '--depth', 'standard', '--base-sha', 'deadbeef',
|
||||
'--run-dir', tmpDir, '--cwd', tmpDir, '--explicit', 'not-a-real-reviewer-xyz',
|
||||
'--cap-id', 'code-review', '--point', 'execute:post', '--raw'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000, input: 'src/foo.ts\n' },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS, input: 'src/foo.ts\n' },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
@@ -811,7 +812,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
'--repo-root', tmpDir, '--depth', 'standard', '--base-sha', 'deadbeef',
|
||||
'--run-dir', tmpDir, '--cwd', tmpDir, '--explicit', 'codex',
|
||||
'--cap-id', 'no-such-capability-xyz', '--point', 'execute:post', '--raw'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000, input: 'src/foo.ts\n' },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS, input: 'src/foo.ts\n' },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
@@ -830,7 +831,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
[GSD_TOOLS_BIN, 'review-lane', 'dispatch-step',
|
||||
'--repo-root', tmpDir, '--depth', 'standard', '--base-sha', 'deadbeef',
|
||||
'--run-dir', tmpDir, '--cwd', tmpDir, '--explicit', 'codex', '--raw'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000, input: 'src/foo.ts\n' },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS, input: 'src/foo.ts\n' },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
@@ -849,7 +850,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
'--repo-root', tmpDir, '--depth', 'standard', '--base-sha', 'deadbeef',
|
||||
'--run-dir', tmpDir, '--cwd', tmpDir, '--explicit', 'codex',
|
||||
'--cap-id', 'code-review', '--raw'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000, input: 'src/foo.ts\n' },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS, input: 'src/foo.ts\n' },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
assert.match(result.stderr, /--cap-id and --point must both be given/,
|
||||
@@ -864,7 +865,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
test('review-lane explicit-from-argv matches CLI flags against the merged roster (#4209 RQ-02)', () => {
|
||||
const result = runNode(
|
||||
[GSD_TOOLS_BIN, 'review-lane', 'explicit-from-argv', '--', '--codex', '--agy'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000 },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
assert.strictEqual(result.stdout.trim(), 'antigravity,codex');
|
||||
@@ -873,7 +874,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
test('review-lane explicit-from-argv resolves to empty when no known flag is present', () => {
|
||||
const result = runNode(
|
||||
[GSD_TOOLS_BIN, 'review-lane', 'explicit-from-argv', '--'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000 },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
assert.strictEqual(result.stdout.trim(), '');
|
||||
@@ -957,7 +958,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
'--repo-root', tmpDir, '--depth', 'standard', '--base-sha', 'deadbeef',
|
||||
'--run-dir', tmpDir, '--cwd', tmpDir,
|
||||
'--cap-id', 'code-review', '--point', 'execute:post', '--raw'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000, input: 'src/foo.ts\n' },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS, input: 'src/foo.ts\n' },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
@@ -976,7 +977,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
'--repo-root', tmpDir, '--depth', 'standard', '--base-sha', 'deadbeef',
|
||||
'--run-dir', tmpDir, '--cwd', tmpDir, '--explicit', 'not-a-real-reviewer-xyz',
|
||||
'--cap-id', 'code-review', '--point', 'execute:post', '--raw'],
|
||||
{ cwd: REPO_ROOT, timeoutMs: 15000, input: 'src/foo.ts\n' },
|
||||
{ cwd: REPO_ROOT, timeoutMs: PROBE_TIMEOUT_MS, input: 'src/foo.ts\n' },
|
||||
);
|
||||
assert.strictEqual(result.exitCode, 0, `expected exit 0, stderr: ${result.stderr || ''}`);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
@@ -1010,7 +1011,7 @@ describe('CR-REVIEWER-LANES: optional external source-reviewer dispatch (#4209)'
|
||||
|
||||
function runReducer(dispatchJson) {
|
||||
const script = `DISPATCH_JSON=${JSON.stringify(dispatchJson)}\n${extractEvidenceReducer()}\necho "$EVIDENCE_LIST"`;
|
||||
const result = require('node:child_process').spawnSync('bash', ['-c', script], { encoding: 'utf8', timeout: 15000 });
|
||||
const result = require('node:child_process').spawnSync('bash', ['-c', script], { encoding: 'utf8', timeout: PROBE_TIMEOUT_MS });
|
||||
return { stdout: result.stdout, stderr: result.stderr, status: result.status };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user