test(#3339): fix orthogonal-review findings — Wave 7 fold
Standards/Spec-axis review + Memtrace graph pass found real issues in the just-folded suites, all fixed here: - tests/phase.test.cjs: the issue explicitly asked to dedupe overlapping fixtures between issue-2945/issue-2949 — the fold preserved both test sets correctly (genuinely distinct code paths, 0 tests dropped, already verified correct) but left each fold block with its own near-identical copy of a runVerifiedPhaseComplete(args, tmpDir) helper, the fixture- level dedup the issue actually asked for. Consolidated into one shared definition without disturbing the file's other, unrelated same-named helper at module scope (would have collided if hoisted directly). Removed two now-unused local runGsdTools destructurings left behind by the consolidation (both blocks already close over the module-scope import at line 26). - tests/review-lane-descriptor.test.cjs: two .find() results dereferenced without a presence guard (same defect class Wave 3/#3335 already found and fixed once in this epic) — added assert.ok() guards matching the repo's established style. - tests/model-resolver.test.cjs: documented the 1-of-80 dropped duplicate test with an inline comment, matching this same wave's host-integration fold's convention of citing drops by exact reference instead of leaving a reviewer to reconstruct the justification via git archaeology. No test() count changed in any file. No production code touched.
This commit is contained in:
@@ -4781,7 +4781,12 @@ describe('#2297: install-marker precedence rung (GSD_RUNTIME and config.runtime
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/issue-2517-runtime-aware-profiles.test.cjs
|
||||
// Folded from tests/issue-2517-runtime-aware-profiles.test.cjs (H3 Wave 7,
|
||||
// issue #3339). 1 of 80 source test blocks ('resolveTierEntry helper: unknown
|
||||
// runtime + no overrides -> null', runtime:'mystery') was dropped as a verified
|
||||
// duplicate of the pre-existing test at line 525 ('unknown runtime + unknown
|
||||
// tier, no overrides -> null') — same resolveTierEntry null-return assertion
|
||||
// for an unknown runtime with no overrides.
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
|
||||
@@ -10492,6 +10492,39 @@ describe('#2572: phase complete warns when a SUMMARY claims files that never lan
|
||||
});
|
||||
});
|
||||
|
||||
// Outer scope shared by the two fold blocks below (deliberately NOT module-scope:
|
||||
// this file already declares a distinct, 3-arg `runVerifiedPhaseComplete(args, tmpDir, env)`
|
||||
// at line 54 used throughout the rest of the file; nesting here avoids shadowing it).
|
||||
{
|
||||
/**
|
||||
* Write a passed-VERIFICATION marker for the phase, then run `phase complete N`.
|
||||
* Mirrors phase.test.cjs's writePassedVerificationForPhase: a `<phase>-VERIFICATION.md`
|
||||
* with `status: passed` frontmatter. Requires the phase directory to exist.
|
||||
*
|
||||
* Shared by the folded:issue-2945-phase-complete-checkbox-rollback and
|
||||
* folded:issue-2949-phase-complete-stage3-sentinel blocks below — both fold sources
|
||||
* defined this same helper independently; consolidated to one definition (PR #3339
|
||||
* review, Fowler-baseline duplication finding) since both bodies were functionally
|
||||
* identical modulo variable naming.
|
||||
*/
|
||||
function runVerifiedPhaseComplete(args, tmpDir) {
|
||||
const argv = Array.isArray(args) ? args : args.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
|
||||
const completeIdx = argv.findIndex((t, i) => t === 'complete' && argv[i - 1] === 'phase');
|
||||
const phase = argv[completeIdx + 1];
|
||||
const phasesDir = path.join(tmpDir, '.planning', 'phases');
|
||||
const wanted = parseInt(String(phase).replace(/^0+/, ''), 10);
|
||||
const phaseDirName = fs.readdirSync(phasesDir).find((name) => {
|
||||
const m = name.match(/^(\d+)/);
|
||||
return m && parseInt(m[1], 10) === wanted;
|
||||
});
|
||||
if (!phaseDirName) throw new Error(`no phase directory for phase ${phase}`);
|
||||
fs.writeFileSync(
|
||||
path.join(phasesDir, phaseDirName, `${phase}-VERIFICATION.md`),
|
||||
['---', 'status: passed', '---', '', '# Verification', ''].join('\n'),
|
||||
);
|
||||
return runGsdTools(args, tmpDir);
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/issue-2945-phase-complete-checkbox-rollback.test.cjs — H3 Wave 7 test-hygiene sweep (#3339)
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
@@ -10519,30 +10552,11 @@ const { test, describe, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { runGsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const { createTempProject, cleanup } = require('./helpers.cjs');
|
||||
|
||||
/**
|
||||
* Write a passed-VERIFICATION marker for the phase, then run `phase complete N`.
|
||||
* Mirrors phase.test.cjs's writePassedVerificationForPhase: a `<phase>-VERIFICATION.md`
|
||||
* with `status: passed` frontmatter. Requires the phase directory to exist.
|
||||
*/
|
||||
function runVerifiedPhaseComplete(args, tmpDir) {
|
||||
const argv = Array.isArray(args) ? args : args.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
|
||||
const completeIdx = argv.findIndex((t, i) => t === 'complete' && argv[i - 1] === 'phase');
|
||||
const phase = argv[completeIdx + 1];
|
||||
const phasesDir = path.join(tmpDir, '.planning', 'phases');
|
||||
const wanted = parseInt(String(phase).replace(/^0+/, ''), 10);
|
||||
const phaseDirName = fs.readdirSync(phasesDir).find((name) => {
|
||||
const m = name.match(/^(\d+)/);
|
||||
return m && parseInt(m[1], 10) === wanted;
|
||||
});
|
||||
if (!phaseDirName) throw new Error(`no phase directory for phase ${phase}`);
|
||||
fs.writeFileSync(
|
||||
path.join(phasesDir, phaseDirName, `${phase}-VERIFICATION.md`),
|
||||
['---', 'status: passed', '---', '', '# Verification', ''].join('\n'),
|
||||
);
|
||||
return runGsdTools(args, tmpDir);
|
||||
}
|
||||
// runVerifiedPhaseComplete is defined once, hoisted above both fold blocks (see
|
||||
// the shared helper preceding the "Folded from tests/issue-2945-..." banner);
|
||||
// this block closes over that module-scope definition.
|
||||
|
||||
describe('phase complete checkbox rollback (#2945)', () => {
|
||||
let tmpDir;
|
||||
@@ -10668,33 +10682,11 @@ const { test, describe, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { runGsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const { createTempProject, cleanup } = require('./helpers.cjs');
|
||||
|
||||
/**
|
||||
* Write a passed-verification marker for a phase, then run `phase complete N`.
|
||||
* Mirrors phase.test.cjs's writePassedVerificationForPhase: a `<phase>-VERIFICATION.md`
|
||||
* with `status: passed` frontmatter, plus a SUMMARY for each plan (the completion gate
|
||||
* requires executed plans). Requires the phase directory to already exist.
|
||||
*/
|
||||
function runVerifiedPhaseComplete(args, tmpDir) {
|
||||
const argv = Array.isArray(args) ? args : args.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
|
||||
const completeIdx = argv.findIndex((t, i) => t === 'complete' && argv[i - 1] === 'phase');
|
||||
const phase = argv[completeIdx + 1];
|
||||
const phasesDir = path.join(tmpDir, '.planning', 'phases');
|
||||
// Find the phase directory whose leading token matches the requested phase number.
|
||||
const wantedPadded = String(phase).replace(/^0+/, '');
|
||||
const phaseDirName = fs.readdirSync(phasesDir).find((name) => {
|
||||
const m = name.match(/^(\d+)/);
|
||||
return m && parseInt(m[1], 10) === parseInt(wantedPadded, 10);
|
||||
});
|
||||
if (!phaseDirName) throw new Error(`no phase directory for phase ${phase}`);
|
||||
const phaseDir = path.join(phasesDir, phaseDirName);
|
||||
fs.writeFileSync(
|
||||
path.join(phaseDir, `${phase}-VERIFICATION.md`),
|
||||
['---', 'status: passed', '---', '', '# Verification', ''].join('\n'),
|
||||
);
|
||||
return runGsdTools(args, tmpDir);
|
||||
}
|
||||
// runVerifiedPhaseComplete is defined once, in the outer scope shared by this block
|
||||
// and the folded:issue-2945-phase-complete-checkbox-rollback block above (see the
|
||||
// shared helper preceding that block's banner comment); this block closes over it.
|
||||
|
||||
describe('phase complete stage-3 sentinel filter (#2949)', () => {
|
||||
let tmpDir;
|
||||
@@ -10854,3 +10846,4 @@ describe('phase complete stage-3 sentinel filter (#2949)', () => {
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,6 +815,7 @@ describe('mergeReviewerLanes (#2927)', () => {
|
||||
assert.ok(slugs.includes('gemini'), 'first-party lanes preserved');
|
||||
// the overlay body itself is the merged entry (no translation layer)
|
||||
const overlay = merged.find((l) => l.slug === 'agy-revisor');
|
||||
assert.ok(overlay, 'agy-revisor overlay lane should be present in merged set');
|
||||
assert.equal(overlay.reviewsSection, 'Antigravity revisor-gsd');
|
||||
assert.deepEqual(overlay.flags, ['--agy-revisor']);
|
||||
});
|
||||
@@ -824,6 +825,7 @@ describe('mergeReviewerLanes (#2927)', () => {
|
||||
const colliding = overlayLane({ slug: 'claude', reviewsSection: 'EVIL CLAUDE' });
|
||||
const merged = mergeReviewerLanes(FP, registry(reviewerCap(colliding)));
|
||||
const claude = merged.find((l) => l.slug === 'claude');
|
||||
assert.ok(claude, 'claude first-party lane should be present in merged set');
|
||||
assert.equal(claude, FP.find((l) => l.slug === 'claude'), 'first-party identity wins');
|
||||
assert.notEqual(claude.reviewsSection, 'EVIL CLAUDE', 'overlay did not leak through');
|
||||
assert.equal(merged.length, FP.length, 'collision added no extra entry');
|
||||
|
||||
Reference in New Issue
Block a user