Files
msd-core/tests/review-timeout-guidance.test.cjs
Tom Boucher 9341d8b8d3 test(#3334): fold the workflow-dispatch & review-lane fix-* cluster — Wave 2 (#3342)
Folds 15 tests/fix-*.test.cjs regression files (191 test() blocks) into
their module's main suite, per the wave decomposition of #3315 (H3 of
epic #3053). 187 blocks land in 8 existing suites (4 exact-duplicate
cases dropped, documented inline); 4 blocks move via git mv into 2 new
suite files with no prior coverage to merge into. Zero production
behavior change.

Also tightens two H1 (#3313) ratchets that the fold's own file-count
reduction moved past their grace window, per the ratchets' documented
dual failure mode (a stale/too-loose baseline fails exactly like a
novel violation):
- lint-test-file-count.allowlist.json: removes the stale "audit" entry
  (folding fix-2766 into tests/uat.test.cjs drops that module back to
  its 2-file cap).
- lint-allow-test-rule-refs.ceiling.json: lowers maxFiles 314 -> 309,
  the real post-fold high-water mark (gsd-test's own repo-baseline
  test caught this — CI, not a human, found it).

Two orthogonal review passes (Standards+Spec code-review, isolated
security-review) found and this commit fixes two issues before push:
a genuinely-distinct #2287 test case (file-absent vs. file-present-
resolved) that a prior fold pass had wrongly dropped as a duplicate —
restored verbatim into tests/uat.test.cjs; and a missing same-line
allow-test-rule citation on the #2196 block in
tests/debug-session-management.test.cjs, added for consistency with
its sibling #2257 block.

lint-removed-but-needed also caught two stale doc references to the
now-folded-away fix-2285-claude-orchestration-wiring.test.cjs filename
(docs/adr/1143-claude-orchestration-capability.md,
gsd-core/references/execute-phase-response-language.md) — updated both
to point at tests/claude-orchestration.test.cjs, its new home.

Co-authored-by: sim <sim@local>
2026-08-10 20:51:40 -04:00

56 lines
2.6 KiB
JavaScript

'use strict';
/**
* #2194 — review.md prompt-fed reviewers (Gemini/Claude/Codex) need explicit
* Bash timeout guidance.
*
* Without it each lane inherits the host default (~2 min on Claude Code), so a
* source-grounded review (~570s Codex xhigh, ~525s headless Claude) is killed
* mid-review, its output is empty, and the cross-AI review silently proceeds
* with fewer lanes. CodeRabbit and OpenCode already documented a timeout; the
* four main lanes did not. review.md IS the product the runtime loads, so this asserts the
* deployed text carries the guidance.
*
* Phase 5b (#2799) replaced the per-lane blocks with a loop, so the anchor moved from the old
* "invoke in sequence" prose to the step itself — but the guidance is MORE load-bearing now, not
* less: one Bash call wraps the whole loop, so a host timeout kills every remaining lane rather
* than one.
*/
const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const REVIEW_MD = path.join(__dirname, '..', 'gsd-core', 'workflows', 'review.md');
describe('#2194 review.md prompt-fed reviewer timeout guidance', () => {
const content = fs.readFileSync(REVIEW_MD, 'utf-8');
const sectionStart = content.indexOf('<step name="invoke_reviewers">');
const sectionEnd = content.indexOf('</step>', sectionStart);
const section = sectionStart !== -1 ? content.slice(sectionStart, sectionEnd) : '';
test('review.md has the reviewer-invocation step', () => {
assert.notEqual(sectionStart, -1, 'review.md must contain the invoke_reviewers step');
});
test('lanes are invoked sequentially, not in parallel', () => {
// Concurrent invocation trips provider rate limits; the original prose said so and the loop
// must keep saying so, since a future reader could otherwise "optimize" it into a fan-out.
assert.ok(/sequential|in sequence|not in parallel/i.test(section),
'the step must state that lanes run sequentially');
});
test('the section carries Bash timeout guidance for the prompt-fed lanes', () => {
assert.ok(/timeout/i.test(section),
'the Gemini/Claude/Codex reviewer blocks must carry Bash timeout guidance');
assert.ok(/900000|1200000/.test(section),
'timeout guidance must recommend a high ms value (>= 900000) so a slow lane is not killed');
});
test('a slow-lane empty output is framed as a timeout, not a crash', () => {
assert.ok(/timeout.+not.+crash|not a crash/i.test(section),
'the guidance must distinguish a timeout kill from a crash so operators do not misdiagnose (e.g. the Codex 0xc0000142 misattribution)');
});
});