diff --git a/tests/model-resolver.test.cjs b/tests/model-resolver.test.cjs index 9c56419cf..d56ef896a 100644 --- a/tests/model-resolver.test.cjs +++ b/tests/model-resolver.test.cjs @@ -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'); diff --git a/tests/phase.test.cjs b/tests/phase.test.cjs index ca4175277..b596966a1 100644 --- a/tests/phase.test.cjs +++ b/tests/phase.test.cjs @@ -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 `-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 `-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 `-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)', () => { }); }); } +} diff --git a/tests/review-lane-descriptor.test.cjs b/tests/review-lane-descriptor.test.cjs index 3f393b211..594555b31 100644 --- a/tests/review-lane-descriptor.test.cjs +++ b/tests/review-lane-descriptor.test.cjs @@ -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');