test(#2126): resolve review findings — fold dedup, harness fidelity, malformed-parity lock
Adversarial review of the Phase 3 branch surfaced three verified defects; fix all three in place (no defer): - install-runtime-artifacts.test.cjs: finish the fold-triplication dedup started earlier (only enh-1511 had been collapsed). 11 B1-batch __foldDescribe blocks were byte-identical triplicates (~5.9k lines, ~49% of the file), tripling the subprocess-spawning installer suites under --test-concurrency — the same starvation that produced the temp-dir races this branch fixes. Byte-identity verified per block before removal; 230 distinct test/it titles preserved (origin/next: 230 -> 230), interleaved B3/B5/B6 singletons untouched. - config-get-default.test.cjs: make runExpectError faithful to production. The throwing process.exit seam was caught by cmdConfigGet's "No config.json" guard and reclassified into a spurious 2nd error() with the wrong reason (CONFIG_PARSE_FAILED). Drive io.setJsonErrorMode + carry the original message on the sentinel so the guard re-throws (single fire), assert exitCount===1, and strengthen both probes to assert the typed reason (CONFIG_NO_FILE / CONFIG_KEY_NOT_FOUND). - roadmap.test.cjs: lock the #2121/#2114 malformed_roadmap parity — a project-code-prefixed query against a checklist-only roadmap now surfaces the same diagnostic a bare query always did (fails on prior silent-empty behavior). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2121,6 +2121,39 @@ describe('bug #2114: roadmap get-phase resolves drifted prefixed headings by bar
|
||||
assert.strictEqual(payload30.found, true);
|
||||
assert.strictEqual(payload30.phase_name, 'Plain');
|
||||
});
|
||||
|
||||
test('prefixed query surfaces malformed_roadmap when only a checklist entry exists (parity with bare)', () => {
|
||||
// #2121/#2114 route all three resolvers through the shared 3-source lookup, so a
|
||||
// project-code-prefixed query now surfaces the SAME `malformed_roadmap` diagnostic a
|
||||
// bare numeric query always did: a `**Phase PROJ-42:**` summary line with no matching
|
||||
// `### Phase PROJ-42:` detail heading is malformed for BOTH query forms. Before the
|
||||
// consolidation the prefixed form silently returned `{found:false}` with no diagnostic
|
||||
// (the exact-prefix pass discarded its malformed candidate) — this test fails on that
|
||||
// prior behavior and locks the unified, more-informative result.
|
||||
fs.writeFileSync(
|
||||
path.join(tmpDir, '.planning', 'ROADMAP.md'),
|
||||
[
|
||||
'# Roadmap v1.0',
|
||||
'',
|
||||
'## Phases',
|
||||
'',
|
||||
'- [ ] **Phase PROJ-42: Checklist only, no header**',
|
||||
'',
|
||||
].join('\n'),
|
||||
);
|
||||
|
||||
const prefixed = runGsdTools('roadmap get-phase PROJ-42 --json', tmpDir);
|
||||
assert.ok(prefixed.success, `command failed: ${prefixed.error || prefixed.output}`);
|
||||
const pPayload = JSON.parse(prefixed.output);
|
||||
assert.strictEqual(pPayload.found, false, 'malformed roadmap: phase must not be found');
|
||||
assert.strictEqual(pPayload.error, 'malformed_roadmap', 'prefixed query must surface malformed_roadmap');
|
||||
assert.ok(pPayload.message.includes('missing'), 'message must explain the missing detail section');
|
||||
|
||||
// Parity: the bare numeric form yields the same diagnostic against the same fixture.
|
||||
const bare = runGsdTools('roadmap get-phase 42 --json', tmpDir);
|
||||
assert.ok(bare.success, `command failed: ${bare.error || bare.output}`);
|
||||
assert.strictEqual(JSON.parse(bare.output).error, 'malformed_roadmap', 'bare query surfaces the same diagnostic');
|
||||
});
|
||||
});
|
||||
|
||||
describe('roadmap annotate-dependencies', () => {
|
||||
|
||||
Reference in New Issue
Block a user