test(#4518): migrate loop/hook-point e2e batch to named timeout constants

Batch 7 of 17 in the ad hoc timeout literal migration (epic #4445).
Replaces every bare numeric timeout/timeoutMs object-literal property in
tests/loop-render-hooks.test.cjs, tests/loop-walk.qa.test.cjs,
tests/loop-hooks-empty-points-e2e.test.cjs, tests/loop-hooks-ship-pre-e2e.test.cjs,
tests/loop-hooks-verify-post-e2e.test.cjs, tests/check-gap-analysis-plan-post-e2e.test.cjs,
tests/check-tdd-review-checkpoint-e2e.test.cjs, tests/execute-wave-post-gate-pipeline-e2e.test.cjs,
tests/plan-pre-hook-e2e.test.cjs, and tests/qa/tdd-walk.cjs with a named
constant, per eslint-rules/no-adhoc-timeout-literal.cjs. Removes the 10
files from the rule's allowlist.

Promotes a new shared class norm to tests/helpers/timeouts.cjs,
LOOP_HOOK_POINT_CLI_TIMEOUT_MS: 7 files independently arrived at the same
value for a single gsd-tools.cjs CLI subcommand invocation with no
confirmed subprocess fan-out. Reuses the existing PROBE_TIMEOUT_MS for
loop-render-hooks.test.cjs's 11 sites (same class, exact value match).
Adds 4 file-local constants for values that share a class with the new
norm or an existing one but diverge in pre-existing value, or that
numerically coincide with an unrelated existing constant without
matching its actual operation.

Isolated Standards-axis review caught that the new shared constant's doc
comment exhaustively enumerated 3 verb families while a 7th genuine site
(an `init new-project` invocation) also correctly belonged to the class;
fixed by rewording the comment to state the class definition (call
shape) first and list all 4 representative verbs, explicitly
illustrative rather than exhaustive. No value changed, no site's
classification changed.

No src/bin file touched, no numeric value changed anywhere.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sim
2026-09-10 15:50:52 -04:00
parent 138e70d734
commit 6d6e3eea73
12 changed files with 91 additions and 31 deletions

View File

@@ -963,6 +963,7 @@ describe('renderLoopHooks', () => {
// ─── 9. End-to-end cmdLoopRenderHooks (via gsd-tools subprocess) ─────────────
const { runNode } = require('./helpers/process-seam.cjs');
const { PROBE_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
const ROOT = path.resolve(__dirname, '..');
const GSD_TOOLS = path.join(ROOT, 'gsd-core', 'bin', 'gsd-tools.cjs');
@@ -970,7 +971,7 @@ describe('cmdLoopRenderHooks end-to-end (via gsd-tools)', () => {
test('loop render-hooks plan:pre returns JSON envelope with ui-phase step active', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'plan:pre', '--cwd', tmpProjectDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
const envelope = JSON.parse(result.stdout.trim());
@@ -987,7 +988,7 @@ describe('cmdLoopRenderHooks end-to-end (via gsd-tools)', () => {
test('loop render-hooks plan:pre with no config.json → ui-phase step active by schema default', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'plan:pre', '--cwd', tmpEmptyProjectDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
const envelope = JSON.parse(result.stdout.trim());
@@ -1011,7 +1012,7 @@ describe('cmdLoopRenderHooks end-to-end (via gsd-tools)', () => {
'--config-dir',
tmpUiDisabledConfigDir,
],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
const envelope = JSON.parse(result.stdout.trim());
@@ -1027,7 +1028,7 @@ describe('cmdLoopRenderHooks end-to-end (via gsd-tools)', () => {
test('loop render-hooks plan:pre with ui_phase=false in config.json → ui-phase step absent', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'plan:pre', '--cwd', tmpFalseConfigProjectDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
const envelope = JSON.parse(result.stdout.trim());
@@ -1042,7 +1043,7 @@ describe('cmdLoopRenderHooks end-to-end (via gsd-tools)', () => {
test('loop render-hooks invalid-point exits non-zero', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'plan:mid', '--cwd', tmpProjectDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.notStrictEqual(result.exitCode, 0, 'Expected non-zero exit for invalid point');
assert.match(result.stderr, /plan:mid|Invalid loop point/);
@@ -1085,7 +1086,7 @@ describe('--active-cap flag (loop render-hooks)', () => {
test('--active-cap tdd with tdd_mode=true → stdout trimmed === "true", exit 0', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'execute:post', '--active-cap', 'tdd', '--cwd', tddOnDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
assert.strictEqual(result.stdout.trim(), 'true', 'Expected stdout "true" when tdd_mode=true');
@@ -1094,7 +1095,7 @@ describe('--active-cap flag (loop render-hooks)', () => {
test('--active-cap tdd with tdd_mode=false → stdout trimmed === "false", exit 0', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'execute:post', '--active-cap', 'tdd', '--cwd', tddOffDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
assert.strictEqual(result.stdout.trim(), 'false', 'Expected stdout "false" when tdd_mode=false');
@@ -1103,7 +1104,7 @@ describe('--active-cap flag (loop render-hooks)', () => {
test('--active-cap <nonexistent-cap> → stdout trimmed === "false", exit 0', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'execute:post', '--active-cap', 'no-such-capability-xyz', '--cwd', tddOffDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0 for unknown capId. stderr: ' + (result.stderr || ''));
assert.strictEqual(result.stdout.trim(), 'false', 'Expected stdout "false" for unknown capId');
@@ -1112,7 +1113,7 @@ describe('--active-cap flag (loop render-hooks)', () => {
test('--active-cap with no value → non-zero exit and error message', () => {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'execute:post', '--active-cap', '--cwd', tddOffDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.notStrictEqual(result.exitCode, 0, 'Expected non-zero exit when --active-cap has no value');
assert.match(result.stderr, /active-cap/i, 'Expected error message referencing --active-cap');
@@ -1122,7 +1123,7 @@ describe('--active-cap flag (loop render-hooks)', () => {
// The entire stdout must be just "true" or "false" + newline — no envelope object
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', 'execute:post', '--active-cap', 'tdd', '--cwd', tddOnDir],
{ cwd: ROOT, timeoutMs: 15000 },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS },
);
assert.strictEqual(result.exitCode, 0, 'Expected exit 0. stderr: ' + (result.stderr || ''));
// Must be exactly "true" or "false" — not a JSON object/envelope
@@ -1251,7 +1252,7 @@ describe('ADR-1244 D2: load-failed capability gates fail OPEN with a loud warnin
function renderHooks(overlayHome, point, extraArgs = []) {
const result = runNode(
[GSD_TOOLS, 'loop', 'render-hooks', point, '--cwd', overlayHome, ...extraArgs],
{ cwd: ROOT, timeoutMs: 15000, env: { ...process.env, GSD_HOME: overlayHome } },
{ cwd: ROOT, timeoutMs: PROBE_TIMEOUT_MS, env: { ...process.env, GSD_HOME: overlayHome } },
);
assert.strictEqual(result.exitCode, 0, `Expected exit 0 at ${point}. stderr: ` + (result.stderr || ''));
return result;