refactor: hard-fork GSD -> MSD (Make Software Done)

Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
This commit is contained in:
Jakub Zych
2026-10-06 01:47:40 +02:00
parent fe069b2a56
commit a9a7a328e6
2763 changed files with 78465 additions and 78434 deletions

View File

@@ -3,11 +3,11 @@
/**
* Tests for `src/planning-snapshot.cts` (Phase 10, #3308, ADR-3180 §8.1).
*
* Design: .gsd/phase/refactor-3308-planning-snapshot-parsed-projection/40-design.md
* Test matrix: .gsd/phase/refactor-3308-planning-snapshot-parsed-projection/50-test-matrix.md
* Design: .msd/phase/refactor-3308-planning-snapshot-parsed-projection/40-design.md
* Test matrix: .msd/phase/refactor-3308-planning-snapshot-parsed-projection/50-test-matrix.md
*
* TDD RED: `src/planning-snapshot.cts` does not exist yet — this file's
* `require('../gsd-core/bin/lib/planning-snapshot.cjs')` throws
* `require('../msd-core/bin/lib/planning-snapshot.cjs')` throws
* MODULE_NOT_FOUND until a companion implementation phase adds it. That is
* the intended starting state.
*
@@ -38,18 +38,18 @@ const { gitOrThrow } = require('./helpers/git-fixture.cjs');
// callable-with-properties export (mirrors plan-scan.cjs) or a plain object
// export (mirrors verification.cjs) so this file does not lock in a shape the
// design doc leaves to the implementer.
const planningSnapshotLib = require('../gsd-core/bin/lib/planning-snapshot.cjs');
const planningSnapshotLib = require('../msd-core/bin/lib/planning-snapshot.cjs');
const buildPlanningSnapshot = planningSnapshotLib.buildPlanningSnapshot ?? planningSnapshotLib;
const { worstScope } = planningSnapshotLib;
const { SCOPE } = require('../gsd-core/bin/lib/planning-scope.cjs');
const { _unusableInputEmissionCountForTests } = require('../gsd-core/bin/lib/unusable-input.cjs');
const { normalizePhaseName } = require('../gsd-core/bin/lib/phase-id.cjs');
const { SCOPE } = require('../msd-core/bin/lib/planning-scope.cjs');
const { _unusableInputEmissionCountForTests } = require('../msd-core/bin/lib/unusable-input.cjs');
const { normalizePhaseName } = require('../msd-core/bin/lib/phase-id.cjs');
// Phase 11 (#3309) additions — agent-install fixture helper mirrors
// tests/agent-install-check.test.cjs's own EXPECTED_AGENTS/createCompleteAgents
// (design doc's "subject-surface gap" §, reused per its provenance rule).
const { MODEL_PROFILES } = require('../gsd-core/bin/lib/model-profiles.cjs');
const { MODEL_PROFILES } = require('../msd-core/bin/lib/model-profiles.cjs');
const EXPECTED_AGENTS = Object.keys(MODEL_PROFILES);
// ─── Fixture helpers (mirrors tests/completion-ratio-scope-withholding.test.cjs) ─
@@ -172,7 +172,7 @@ function emissionsDuring(fn) {
describe('happy path', () => {
test('builds a fully-COMPLETE snapshot for a healthy two-phase milestone', (t) => {
const cwd = createTempDir('gsd-3308-h1-');
const cwd = createTempDir('msd-3308-h1-');
t.after(() => cleanup(cwd));
buildHealthyTwoPhaseFixture(cwd);
@@ -192,7 +192,7 @@ describe('happy path', () => {
});
test('zero phase directories is a COMPLETE empty array, not a non-answer', (t) => {
const cwd = createTempDir('gsd-3308-h2-');
const cwd = createTempDir('msd-3308-h2-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', ''].join('\n'));
@@ -204,7 +204,7 @@ describe('happy path', () => {
});
test('single phase directory produces a one-element phases array', (t) => {
const cwd = createTempDir('gsd-3308-h3-');
const cwd = createTempDir('msd-3308-h3-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -217,7 +217,7 @@ describe('happy path', () => {
});
test('three phase directories each carry independent completion', (t) => {
const cwd = createTempDir('gsd-3308-h4-');
const cwd = createTempDir('msd-3308-h4-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, [
@@ -246,7 +246,7 @@ describe('happy path', () => {
});
test('Phase field under Current Position is extracted verbatim as currentPhaseLabel', (t) => {
const cwd = createTempDir('gsd-3308-h12-');
const cwd = createTempDir('msd-3308-h12-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, ['', '## Current Position', '', 'Phase: 3 of 8 (User Auth)', ''].join('\n'));
@@ -262,7 +262,7 @@ describe('happy path', () => {
describe('negative space', () => {
test('absent ROADMAP.md yields a non-COMPLETE milestone but does not crash phase enumeration', (t) => {
const cwd = createTempDir('gsd-3308-n5-');
const cwd = createTempDir('msd-3308-n5-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
writeFile(cwd, '.planning/phases/01-foo/01-01-PLAN.md', '# Plan\n');
@@ -276,7 +276,7 @@ describe('negative space', () => {
});
test('absent STATE.md is a non-answer but not an unusable-input diagnostic', (t) => {
const cwd = createTempDir('gsd-3308-n9-');
const cwd = createTempDir('msd-3308-n9-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
// No STATE.md at all.
@@ -287,7 +287,7 @@ describe('negative space', () => {
});
test('missing Current Position section yields TRUNCATED scope with a whole-body fallback value', (t) => {
const cwd = createTempDir('gsd-3308-n11-');
const cwd = createTempDir('msd-3308-n11-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, ['', '## Notes', '', 'Phase: 3 of 8 (User Auth)', ''].join('\n'));
@@ -298,7 +298,7 @@ describe('negative space', () => {
});
test('a truncated milestone window still forwards its over-inclusive phase set, not an empty one', (t) => {
const cwd = createTempDir('gsd-3308-n14-');
const cwd = createTempDir('msd-3308-n14-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
writeRoadmap(cwd, [
@@ -315,7 +315,7 @@ describe('negative space', () => {
});
test('a legitimately-missing verification file is not conflated with an unreadable phase directory', (t) => {
const cwd = createTempDir('gsd-3308-ns18-');
const cwd = createTempDir('msd-3308-ns18-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo', '', '### Phase 2: Bar'].join('\n'));
@@ -349,7 +349,7 @@ describe('negative space', () => {
describe('hostile input', () => {
test('unreadable ROADMAP.md reports milestone scope UNREADABLE', (t) => {
const cwd = createTempDir('gsd-3308-h6-');
const cwd = createTempDir('msd-3308-h6-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
makeFileUnreadableAsDir(path.join(planningDirOf(cwd), 'ROADMAP.md'));
@@ -359,7 +359,7 @@ describe('hostile input', () => {
});
test('an unreadable nested plans dir taints the phase record to TRUNCATED via worstScope, not COMPLETE', (t) => {
const cwd = createTempDir('gsd-3308-h7-');
const cwd = createTempDir('msd-3308-h7-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -377,7 +377,7 @@ describe('hostile input', () => {
});
test('an unreadable phase directory reports scope UNREADABLE from both owners combined', (t) => {
const cwd = createTempDir('gsd-3308-h8-');
const cwd = createTempDir('msd-3308-h8-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -392,7 +392,7 @@ describe('hostile input', () => {
});
test('unreadable-but-present STATE.md emits exactly one STATE_UNREADABLE diagnostic', (t) => {
const cwd = createTempDir('gsd-3308-h10-');
const cwd = createTempDir('msd-3308-h10-');
t.after(() => cleanup(cwd));
makeFileUnreadableAsDir(path.join(planningDirOf(cwd), 'STATE.md'));
@@ -402,7 +402,7 @@ describe('hostile input', () => {
});
test('unterminated frontmatter does not double-emit and still yields a body-only phase label', (t) => {
const cwd = createTempDir('gsd-3308-h13-');
const cwd = createTempDir('msd-3308-h13-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
// Opens `---` and never closes it. Every non-empty line in the tail is
@@ -413,7 +413,7 @@ describe('hostile input', () => {
// stateExtractField's plain line-start pattern.
fs.writeFileSync(
path.join(planningDirOf(cwd), 'STATE.md'),
['---', 'gsd_state_version: 1', 'Phase: 3 of 8 (User Auth)', ''].join('\n'),
['---', 'msd_state_version: 1', 'Phase: 3 of 8 (User Auth)', ''].join('\n'),
);
const [snap, emitted] = emissionsDuring(() => buildPlanningSnapshot(cwd));
@@ -428,7 +428,7 @@ describe('hostile input', () => {
describe('independence', () => {
test('phases-level scope is the worst of every individual PhaseSnapshot scope, not the first or last', (t) => {
const cwd = createTempDir('gsd-3308-i15-');
const cwd = createTempDir('msd-3308-i15-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo', '', '### Phase 2: Bar'].join('\n'));
@@ -445,7 +445,7 @@ describe('independence', () => {
});
test('a truncated phase-enumeration window taints phases.scope even when every phase itself reads COMPLETE', (t) => {
const cwd = createTempDir('gsd-3308-i16-');
const cwd = createTempDir('msd-3308-i16-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
writeRoadmap(cwd, [
@@ -463,7 +463,7 @@ describe('independence', () => {
});
test('two calls against unchanged disk state produce identical snapshots', (t) => {
const cwd = createTempDir('gsd-3308-i19-');
const cwd = createTempDir('msd-3308-i19-');
t.after(() => cleanup(cwd));
buildHealthyTwoPhaseFixture(cwd);
@@ -513,9 +513,9 @@ describe('worstScope — pure unit coverage', () => {
// ═════════════════════════════════════════════════════════════════════════
// Phase 11 (#3309) additions — config / agentInstall / worktreeHealth
//
// Design: .gsd/phase/refactor-3309-health-diagnostic-rule-table/40-design.md
// Design: .msd/phase/refactor-3309-health-diagnostic-rule-table/40-design.md
// ("The subject-surface gap: config.json, agent-install, git-worktree-list")
// Test matrix: .gsd/phase/refactor-3309-health-diagnostic-rule-table/50-test-matrix.md
// Test matrix: .msd/phase/refactor-3309-health-diagnostic-rule-table/50-test-matrix.md
// section 1, rows 1-8
//
// These three new fields wrap the SAME owner calls `cmdValidateHealth`
@@ -534,15 +534,15 @@ function writeRawConfig(cwd, rawText) {
fs.writeFileSync(path.join(planningDirOf(cwd), 'config.json'), rawText);
}
// Env isolation for GSD_AGENTS_DIR — mirrors tests/agent-install-check.test.cjs's
// Env isolation for MSD_AGENTS_DIR — mirrors tests/agent-install-check.test.cjs's
// beforeEach/afterEach save-restore idiom, inlined per-test via t.after since this
// describe block does not otherwise need beforeEach/afterEach hooks.
function withAgentsDirOverride(t, agentsDir) {
const saved = process.env['GSD_AGENTS_DIR'];
process.env['GSD_AGENTS_DIR'] = agentsDir;
const saved = process.env['MSD_AGENTS_DIR'];
process.env['MSD_AGENTS_DIR'] = agentsDir;
t.after(() => {
if (saved === undefined) delete process.env['GSD_AGENTS_DIR'];
else process.env['GSD_AGENTS_DIR'] = saved;
if (saved === undefined) delete process.env['MSD_AGENTS_DIR'];
else process.env['MSD_AGENTS_DIR'] = saved;
});
}
@@ -581,7 +581,7 @@ function mockGitWorktreeListTimeout(t) {
describe('config field (Phase 11, #3309, matrix rows 1-3)', () => {
test('row 1: well-formed config.json parses to {value, scope: COMPLETE}', (t) => {
const cwd = createTempDir('gsd-3309-cfg1-');
const cwd = createTempDir('msd-3309-cfg1-');
t.after(() => cleanup(cwd));
writeConfig(cwd, { model_profile: 'balanced' });
@@ -590,7 +590,7 @@ describe('config field (Phase 11, #3309, matrix rows 1-3)', () => {
});
test('row 2: absent config.json is a real non-answer — {value: null, scope: UNREADABLE, exists: false}', (t) => {
const cwd = createTempDir('gsd-3309-cfg2-');
const cwd = createTempDir('msd-3309-cfg2-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
// No config.json written at all.
@@ -601,7 +601,7 @@ describe('config field (Phase 11, #3309, matrix rows 1-3)', () => {
});
test('row 3: present-but-unparseable config.json degrades without throwing — {value: null, scope: UNREADABLE, exists: true}, emits CONFIG_UNREADABLE exactly once', (t) => {
const cwd = createTempDir('gsd-3309-cfg3-');
const cwd = createTempDir('msd-3309-cfg3-');
t.after(() => cleanup(cwd));
writeRawConfig(cwd, '{ not valid json');
@@ -617,7 +617,7 @@ describe('config field (Phase 11, #3309, matrix rows 1-3)', () => {
describe('agentInstall field (Phase 11, #3309, matrix rows 4-5)', () => {
test('row 4: all agents present reports zero missing/incomplete, scope COMPLETE', (t) => {
const cwd = createTempDir('gsd-3309-agt4-');
const cwd = createTempDir('msd-3309-agt4-');
t.after(() => cleanup(cwd));
const agentsDir = path.join(cwd, 'agents-complete');
createCompleteAgentsDir(agentsDir);
@@ -631,7 +631,7 @@ describe('agentInstall field (Phase 11, #3309, matrix rows 4-5)', () => {
});
test('row 5: missing agents dir reports the full missing set, scope COMPLETE (the scan itself succeeded)', (t) => {
const cwd = createTempDir('gsd-3309-agt5-');
const cwd = createTempDir('msd-3309-agt5-');
t.after(() => cleanup(cwd));
const agentsDir = path.join(cwd, 'agents-absent');
withAgentsDirOverride(t, agentsDir);
@@ -646,7 +646,7 @@ describe('agentInstall field (Phase 11, #3309, matrix rows 4-5)', () => {
describe('worktreeHealth field (Phase 11, #3309, matrix rows 6-7)', () => {
test('row 6: git worktree list succeeds — value is the parsed findings array, scope COMPLETE', (t) => {
const cwd = createTempDir('gsd-3309-wt6-');
const cwd = createTempDir('msd-3309-wt6-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
mockGitWorktreeListOk(t, 'worktree /repo\nHEAD 0000000000000000000000000000000000000000\nbranch refs/heads/main\n\n');
@@ -657,7 +657,7 @@ describe('worktreeHealth field (Phase 11, #3309, matrix rows 6-7)', () => {
});
test('row 7: git worktree list times out — scope reflects degradation (mirrors W020)', (t) => {
const cwd = createTempDir('gsd-3309-wt7-');
const cwd = createTempDir('msd-3309-wt7-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
mockGitWorktreeListTimeout(t);
@@ -671,7 +671,7 @@ describe('worktreeHealth field (Phase 11, #3309, matrix rows 6-7)', () => {
describe('Phase-10 fields unchanged by the Phase-11 extension (matrix row 8)', () => {
test('the four original fields keep their exact pre-extension values on the same fixture', (t) => {
const cwd = createTempDir('gsd-3309-reg8-');
const cwd = createTempDir('msd-3309-reg8-');
t.after(() => cleanup(cwd));
buildHealthyTwoPhaseFixture(cwd);
@@ -699,7 +699,7 @@ describe('Phase-10 fields unchanged by the Phase-11 extension (matrix row 8)', (
// ═════════════════════════════════════════════════════════════════════════
// Phase 11 (#3309) — "Rule table organization" batch, 7 more fields
//
// Design: .gsd/phase/refactor-3309-health-diagnostic-rule-table/40-design.md
// Design: .msd/phase/refactor-3309-health-diagnostic-rule-table/40-design.md
// ("Rule table organization" table)
//
// Each field relocates (not reinvents) an existing verify.cts derivation —
@@ -726,7 +726,7 @@ function writeMilestonesRegistry(cwd, content) {
describe('projectSections field (Phase 11, #3309)', () => {
test('happy: returns every ## heading actually present, unfiltered against any required list', (t) => {
const cwd = createTempDir('gsd-3309-ps1-');
const cwd = createTempDir('msd-3309-ps1-');
t.after(() => cleanup(cwd));
writeProject(cwd, [
'# My Project',
@@ -749,7 +749,7 @@ describe('projectSections field (Phase 11, #3309)', () => {
});
test('absence: no PROJECT.md is a real non-answer, not corruption', (t) => {
const cwd = createTempDir('gsd-3309-ps2-');
const cwd = createTempDir('msd-3309-ps2-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
@@ -759,7 +759,7 @@ describe('projectSections field (Phase 11, #3309)', () => {
});
test('hostile: present-but-unreadable PROJECT.md degrades without throwing, emits PROJECT_UNREADABLE exactly once', (t) => {
const cwd = createTempDir('gsd-3309-ps3-');
const cwd = createTempDir('msd-3309-ps3-');
t.after(() => cleanup(cwd));
makeFileUnreadableAsDir(path.join(planningDirOf(cwd), 'PROJECT.md'));
@@ -771,7 +771,7 @@ describe('projectSections field (Phase 11, #3309)', () => {
describe('statePhaseTokens field (Phase 11, #3309)', () => {
test('happy: every phase-number-shaped token anywhere in STATE.md text, in appearance order', (t) => {
const cwd = createTempDir('gsd-3309-spt1-');
const cwd = createTempDir('msd-3309-spt1-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
// The `Phase:`-field syntax ("Phase: 3 of 8") does NOT match this regex —
@@ -794,7 +794,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('absence: no STATE.md yields an empty token list, non-answer scope, no diagnostic', (t) => {
const cwd = createTempDir('gsd-3309-spt2-');
const cwd = createTempDir('msd-3309-spt2-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
@@ -804,7 +804,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('hostile: unreadable-but-present STATE.md degrades statePhaseTokens together with currentPhaseLabel from ONE diagnostic', (t) => {
const cwd = createTempDir('gsd-3309-spt3-');
const cwd = createTempDir('msd-3309-spt3-');
t.after(() => cleanup(cwd));
makeFileUnreadableAsDir(path.join(planningDirOf(cwd), 'STATE.md'));
@@ -817,16 +817,16 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
// ─── #4257: harvest precision — a command MENTION is not a phase REFERENCE ──
//
// The pre-#4257 scan (`[Pp]hase\s+(TOKEN)`, unanchored, over the raw file)
// harvested the `-phase 5` tail of GSD's own command names and any token
// harvested the `-phase 5` tail of MSD's own command names and any token
// inside an inline code span / fenced block, so a ledger row quoting
// `/gsd-execute-phase 5` fired W002 as an undeclared-phase reference. The
// `/msd-execute-phase 5` fired W002 as an undeclared-phase reference. The
// #4257 grammar: strip fenced blocks, then inline spans (the canonical
// markdown-sectionizer seam + composition order, #2365), THEN match with a
// left word boundary `(?<![-\w])` so a hyphen- or word-suffixed carrier
// (`execute-phase`, `myphase`) is not a reference while `Phase 5`,
// `**Phase 5:**`, `(Phase 5)` still are.
test('#4257 row 1 (regression): `/gsd-execute-phase 5` in a Queue ledger row inside an inline code span is NOT harvested', (t) => {
const cwd = createTempDir('gsd-4257-spt1-');
test('#4257 row 1 (regression): `/msd-execute-phase 5` in a Queue ledger row inside an inline code span is NOT harvested', (t) => {
const cwd = createTempDir('msd-4257-spt1-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -837,7 +837,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
'',
'## Queue',
'',
'- `/gsd-execute-phase 5`',
'- `/msd-execute-phase 5`',
'',
].join('\n'));
@@ -845,15 +845,15 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
assert.deepStrictEqual(snap.statePhaseTokens, { value: [], scope: SCOPE.COMPLETE });
});
test('#4257: a bare `/gsd-execute-phase 5` command mention (no backticks) is NOT harvested — left word boundary', (t) => {
const cwd = createTempDir('gsd-4257-spt2-');
test('#4257: a bare `/msd-execute-phase 5` command mention (no backticks) is NOT harvested — left word boundary', (t) => {
const cwd = createTempDir('msd-4257-spt2-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
'',
'## Queue',
'',
'- Run /gsd-execute-phase 5 when the ledger clears',
'- Run /msd-execute-phase 5 when the ledger clears',
'',
].join('\n'));
@@ -862,7 +862,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('#4257: a quoted roadmap line `- [ ] **Phase 40:**` inside an inline code span is NOT harvested', (t) => {
const cwd = createTempDir('gsd-4257-spt3-');
const cwd = createTempDir('msd-4257-spt3-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -878,7 +878,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('#4257: a `Phase 9` mention inside a fenced code block is NOT harvested', (t) => {
const cwd = createTempDir('gsd-4257-spt4-');
const cwd = createTempDir('msd-4257-spt4-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -896,7 +896,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('#4257 tradeoff (pinned by the issue): a GENUINE reference written in backticks stops counting', (t) => {
const cwd = createTempDir('gsd-4257-spt5-');
const cwd = createTempDir('msd-4257-spt5-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -912,7 +912,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('#4257: word-suffixed carriers (myphase 5, alphaphase 3) are NOT harvested — boundary covers non-command suffixes too', (t) => {
const cwd = createTempDir('gsd-4257-spt6-');
const cwd = createTempDir('msd-4257-spt6-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -928,7 +928,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('#4257 mixed form: prose reference survives while command mention and quoted literal are dropped from the same file', (t) => {
const cwd = createTempDir('gsd-4257-spt7-');
const cwd = createTempDir('msd-4257-spt7-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -939,7 +939,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
'',
'## Queue',
'',
'- `/gsd-execute-phase 9` once Phase 5 wraps (see `Phase 12` notes)',
'- `/msd-execute-phase 9` once Phase 5 wraps (see `Phase 12` notes)',
'',
].join('\n'));
@@ -949,7 +949,7 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
// KEEP rows — the #4257 boundary must NOT narrow legitimate references.
test('#4257 keep: bold `**Phase 5:**` and parenthesised `(Phase 5)` and heading `### Phase 5:` forms still harvest', (t) => {
const cwd = createTempDir('gsd-4257-spt8-');
const cwd = createTempDir('msd-4257-spt8-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -966,14 +966,14 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
});
test('#4257 keep: silent forms stay silent (Phase5, flag form, non-English word)', (t) => {
const cwd = createTempDir('gsd-4257-spt9-');
const cwd = createTempDir('msd-4257-spt9-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
'',
'## Queue',
'',
'- `gsd-tools phase --insert 5`',
'- `msd-tools phase --insert 5`',
'- `Phase5` shorthand does not count',
'- фаза 5 is not the token either',
'',
@@ -988,23 +988,23 @@ describe('statePhaseTokens field (Phase 11, #3309)', () => {
describe('workstream field (#4257)', () => {
// The env save/restore pattern mirrors tests/health-diagnostic.test.cjs:598-602
// and tests/config-loader.test.cjs:499-509 — GSD_WORKSTREAM is the SAME
// and tests/config-loader.test.cjs:499-509 — MSD_WORKSTREAM is the SAME
// discriminator planningDir applies (planning-workspace.cts:130), and the
// CLI bootstrap folds the stored active-workstream pointer into it
// (active-workstream-store.cts:488-494), so setting it directly is the
// faithful rule-level simulation of "workstream alpha is active".
function withWorkstreamEnv(t, name) {
const prev = process.env['GSD_WORKSTREAM'];
if (name === null) delete process.env['GSD_WORKSTREAM'];
else process.env['GSD_WORKSTREAM'] = name;
const prev = process.env['MSD_WORKSTREAM'];
if (name === null) delete process.env['MSD_WORKSTREAM'];
else process.env['MSD_WORKSTREAM'] = name;
t.after(() => {
if (prev === undefined) delete process.env['GSD_WORKSTREAM'];
else process.env['GSD_WORKSTREAM'] = prev;
if (prev === undefined) delete process.env['MSD_WORKSTREAM'];
else process.env['MSD_WORKSTREAM'] = prev;
});
}
test('flat project (no GSD_WORKSTREAM): workstream is null', (t) => {
const cwd = createTempDir('gsd-4257-ws1-');
test('flat project (no MSD_WORKSTREAM): workstream is null', (t) => {
const cwd = createTempDir('msd-4257-ws1-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
withWorkstreamEnv(t, null);
@@ -1013,8 +1013,8 @@ describe('workstream field (#4257)', () => {
assert.strictEqual(snap.workstream, null);
});
test('GSD_WORKSTREAM=alpha: workstream names the scope every workstream-aware read used', (t) => {
const cwd = createTempDir('gsd-4257-ws2-');
test('MSD_WORKSTREAM=alpha: workstream names the scope every workstream-aware read used', (t) => {
const cwd = createTempDir('msd-4257-ws2-');
t.after(() => cleanup(cwd));
writeFile(cwd, '.planning/workstreams/alpha/STATE.md', [
'---',
@@ -1033,7 +1033,7 @@ describe('workstream field (#4257)', () => {
});
test('non-divergence: the field names the base statePhaseTokens was actually read from', (t) => {
const cwd = createTempDir('gsd-4257-ws3-');
const cwd = createTempDir('msd-4257-ws3-');
t.after(() => cleanup(cwd));
// Root STATE.md carries Phase 7; workstream STATE.md carries Phase 5. The
// tokens must come from the WORKSTREAM file (planningPaths scoped it) and
@@ -1059,7 +1059,7 @@ describe('workstream field (#4257)', () => {
describe('stateStatus field (Phase 11, #3309)', () => {
test('happy: Status field under Current Position is extracted verbatim, mirroring currentPhaseLabel', (t) => {
const cwd = createTempDir('gsd-3309-ss1-');
const cwd = createTempDir('msd-3309-ss1-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
appendToState(cwd, [
@@ -1076,7 +1076,7 @@ describe('stateStatus field (Phase 11, #3309)', () => {
});
test('boundary: missing Current Position section still resolves status from frontmatter, scope TRUNCATED', (t) => {
const cwd = createTempDir('gsd-3309-ss2-');
const cwd = createTempDir('msd-3309-ss2-');
t.after(() => cleanup(cwd));
writeState(cwd, { status: 'planning' });
@@ -1086,7 +1086,7 @@ describe('stateStatus field (Phase 11, #3309)', () => {
});
test('absence: no STATE.md yields a non-answer, no diagnostic', (t) => {
const cwd = createTempDir('gsd-3309-ss3-');
const cwd = createTempDir('msd-3309-ss3-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
@@ -1098,7 +1098,7 @@ describe('stateStatus field (Phase 11, #3309)', () => {
describe('roadmapDeclaredPhases field (Phase 11, #3309)', () => {
test('happy: every declared phase id paired with the milestone section it was found under', (t) => {
const cwd = createTempDir('gsd-3309-rdp1-');
const cwd = createTempDir('msd-3309-rdp1-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo', '', '### Phase 2: Bar'].join('\n'));
@@ -1113,7 +1113,7 @@ describe('roadmapDeclaredPhases field (Phase 11, #3309)', () => {
});
test('boundary: a phase declared before any version heading gets milestone: null', (t) => {
const cwd = createTempDir('gsd-3309-rdp2-');
const cwd = createTempDir('msd-3309-rdp2-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['### Phase 9: Prelude', '', '## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -1125,7 +1125,7 @@ describe('roadmapDeclaredPhases field (Phase 11, #3309)', () => {
});
test('absence: no ROADMAP.md is a non-answer', (t) => {
const cwd = createTempDir('gsd-3309-rdp3-');
const cwd = createTempDir('msd-3309-rdp3-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
@@ -1134,7 +1134,7 @@ describe('roadmapDeclaredPhases field (Phase 11, #3309)', () => {
});
test('hostile: unreadable ROADMAP.md degrades to an empty list, scope UNREADABLE', (t) => {
const cwd = createTempDir('gsd-3309-rdp4-');
const cwd = createTempDir('msd-3309-rdp4-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
makeFileUnreadableAsDir(path.join(planningDirOf(cwd), 'ROADMAP.md'));
@@ -1146,7 +1146,7 @@ describe('roadmapDeclaredPhases field (Phase 11, #3309)', () => {
describe('roadmapPhaseCheckboxes field (Phase 11, #3309)', () => {
test('happy: [x]/[ ] checkbox state parsed per phase id', (t) => {
const cwd = createTempDir('gsd-3309-rpc1-');
const cwd = createTempDir('msd-3309-rpc1-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['## Progress', '', '- [x] Phase 1: Foo', '- [ ] Phase 2: Bar'].join('\n'));
@@ -1155,7 +1155,7 @@ describe('roadmapPhaseCheckboxes field (Phase 11, #3309)', () => {
});
test('boundary: no checklist lines present is a real empty answer, not a non-answer', (t) => {
const cwd = createTempDir('gsd-3309-rpc2-');
const cwd = createTempDir('msd-3309-rpc2-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -1164,7 +1164,7 @@ describe('roadmapPhaseCheckboxes field (Phase 11, #3309)', () => {
});
test('hostile: unreadable ROADMAP.md degrades to an empty map, scope UNREADABLE', (t) => {
const cwd = createTempDir('gsd-3309-rpc3-');
const cwd = createTempDir('msd-3309-rpc3-');
t.after(() => cleanup(cwd));
makeFileUnreadableAsDir(path.join(planningDirOf(cwd), 'ROADMAP.md'));
@@ -1175,7 +1175,7 @@ describe('roadmapPhaseCheckboxes field (Phase 11, #3309)', () => {
describe('researchValidationStatus field (Phase 11, #3309)', () => {
test('happy: RESEARCH.md carries the Validation Architecture heading and a VALIDATION.md exists', (t) => {
const cwd = createTempDir('gsd-3309-rvs1-');
const cwd = createTempDir('msd-3309-rvs1-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -1189,7 +1189,7 @@ describe('researchValidationStatus field (Phase 11, #3309)', () => {
});
test('negative: RESEARCH.md without the heading and no VALIDATION.md reports both false', (t) => {
const cwd = createTempDir('gsd-3309-rvs2-');
const cwd = createTempDir('msd-3309-rvs2-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -1201,7 +1201,7 @@ describe('researchValidationStatus field (Phase 11, #3309)', () => {
});
test('#3511-class: a phase dir holding only ANOTHER phase\'s -RESEARCH.md/-VALIDATION.md does not set this phase\'s flags', (t) => {
const cwd = createTempDir('gsd-3511-rvs4-');
const cwd = createTempDir('msd-3511-rvs4-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo', '', '### Phase 2: Bar'].join('\n'));
@@ -1219,7 +1219,7 @@ describe('researchValidationStatus field (Phase 11, #3309)', () => {
});
test('hostile: an unreadable phase directory degrades that entry to false/false without throwing', (t) => {
const cwd = createTempDir('gsd-3309-rvs3-');
const cwd = createTempDir('msd-3309-rvs3-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
@@ -1235,7 +1235,7 @@ describe('researchValidationStatus field (Phase 11, #3309)', () => {
describe('milestoneArchiveStatus field (Phase 11, #3309)', () => {
test('happy: archived ROADMAP snapshot present and its version documented in MILESTONES.md', (t) => {
const cwd = createTempDir('gsd-3309-mas1-');
const cwd = createTempDir('msd-3309-mas1-');
t.after(() => cleanup(cwd));
writeMilestoneArchiveRoadmap(cwd, 'v1.0', '# v1.0 archive\n');
writeMilestonesRegistry(cwd, '## v1.0\n\nShipped.\n');
@@ -1248,7 +1248,7 @@ describe('milestoneArchiveStatus field (Phase 11, #3309)', () => {
});
test('negative: no milestones/ dir and no MILESTONES.md is a real empty answer, not a non-answer', (t) => {
const cwd = createTempDir('gsd-3309-mas2-');
const cwd = createTempDir('msd-3309-mas2-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
@@ -1260,7 +1260,7 @@ describe('milestoneArchiveStatus field (Phase 11, #3309)', () => {
});
test('boundary: an archived version missing from the registry is reported, not silently dropped', (t) => {
const cwd = createTempDir('gsd-3309-mas3-');
const cwd = createTempDir('msd-3309-mas3-');
t.after(() => cleanup(cwd));
writeMilestoneArchiveRoadmap(cwd, 'v1.0', '# v1.0 archive\n');
// No MILESTONES.md at all.
@@ -1271,7 +1271,7 @@ describe('milestoneArchiveStatus field (Phase 11, #3309)', () => {
});
test('hostile: an unreadable milestones/ dir degrades to scope UNREADABLE without throwing', (t) => {
const cwd = createTempDir('gsd-3309-mas4-');
const cwd = createTempDir('msd-3309-mas4-');
t.after(() => cleanup(cwd));
// Directory-vs-file swap: milestones/ is a regular FILE, so
// fs.existsSync is true but readdirSync throws ENOTDIR.
@@ -1284,7 +1284,7 @@ describe('milestoneArchiveStatus field (Phase 11, #3309)', () => {
describe('planningRootFiles field (Phase 11, #3309)', () => {
test('happy: lists files (not directories) directly under .planning/ root', (t) => {
const cwd = createTempDir('gsd-3309-prf1-');
const cwd = createTempDir('msd-3309-prf1-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['## v1.0 Current 🚧', ''].join('\n'));
@@ -1297,7 +1297,7 @@ describe('planningRootFiles field (Phase 11, #3309)', () => {
});
test('absence: no .planning/ directory at all degrades to an empty list, scope UNREADABLE', (t) => {
const cwd = createTempDir('gsd-3309-prf2-');
const cwd = createTempDir('msd-3309-prf2-');
t.after(() => cleanup(cwd));
// .planning/ deliberately never created.
@@ -1306,7 +1306,7 @@ describe('planningRootFiles field (Phase 11, #3309)', () => {
});
test('hostile: an unreadable .planning/ root degrades without throwing', (t) => {
const cwd = createTempDir('gsd-3309-prf3-');
const cwd = createTempDir('msd-3309-prf3-');
t.after(() => cleanup(cwd));
fs.mkdirSync(planningDirOf(cwd), { recursive: true });
injectPhaseDirFault(t, planningDirOf(cwd));
@@ -1323,7 +1323,7 @@ describe('allPhaseDirNames field (Phase 11, #3309 — health-diagnostic-rules/ro
// directory. `allPhaseDirNames` is the unwindowed twin.
test('happy: lists every directory under phases/, including one NOT declared anywhere in ROADMAP.md', (t) => {
const cwd = createTempDir('gsd-3309-apdn1-');
const cwd = createTempDir('msd-3309-apdn1-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
fs.mkdirSync(path.join(planningDirOf(cwd), 'phases', '01-foo'), { recursive: true });
@@ -1338,7 +1338,7 @@ describe('allPhaseDirNames field (Phase 11, #3309 — health-diagnostic-rules/ro
});
test('absence: no phases/ directory at all is a real empty, not a failure', (t) => {
const cwd = createTempDir('gsd-3309-apdn2-');
const cwd = createTempDir('msd-3309-apdn2-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['## v1.0 Current 🚧', ''].join('\n'));
@@ -1347,7 +1347,7 @@ describe('allPhaseDirNames field (Phase 11, #3309 — health-diagnostic-rules/ro
});
test('hostile: an unreadable phases/ directory degrades to an empty list, scope UNREADABLE, without throwing', (t) => {
const cwd = createTempDir('gsd-3309-apdn3-');
const cwd = createTempDir('msd-3309-apdn3-');
t.after(() => cleanup(cwd));
const phasesDir = path.join(planningDirOf(cwd), 'phases');
fs.mkdirSync(phasesDir, { recursive: true });
@@ -1369,7 +1369,7 @@ describe('allPhaseDirNames field (Phase 11, #3309 — health-diagnostic-rules/ro
// a genuinely COLLIDING phase-number pair (01-real / 01-duplicate, both
// phase "01" — the shape where a raw-fs -> comparePhaseNum reorder could
// silently change output order).
const cwd = createTempDir('gsd-3882-apdn-order-');
const cwd = createTempDir('msd-3882-apdn-order-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
const names = ['01-real', '01-duplicate', '999-icebox', '0-backlog', '04.1-decimal', '03A-suffix'];
@@ -1392,9 +1392,9 @@ describe('allPhaseDirNames field (Phase 11, #3309 — health-diagnostic-rules/ro
// Phase 12 (#3310, ADR-3180 §8.4) additions — perPhasePlanNumbering /
// perPhaseOrphanSummaries / perPhaseWaveMissingPlans
//
// Design: .gsd/phase/feat-3310-enhance-3180-the-sibling-validators-shar/40-design.md
// Design: .msd/phase/feat-3310-enhance-3180-the-sibling-validators-shar/40-design.md
// ("New PlanningSnapshot fields")
// Test matrix: .gsd/phase/feat-3310-enhance-3180-the-sibling-validators-shar/50-test-matrix.md
// Test matrix: .msd/phase/feat-3310-enhance-3180-the-sibling-validators-shar/50-test-matrix.md
// section 1, rows 1-8
//
// Each relocates (not reinvents) `verify.cts:1556-1603`'s per-phase-directory
@@ -1410,7 +1410,7 @@ function writePlan(cwd, relPhasePath, planName, frontmatterLines) {
describe('perPhasePlanNumbering field (Phase 12, #3310, matrix rows 1-2)', () => {
test('row 1: sequential plans (01, 02, 03) report the full sorted sequence, no gap', (t) => {
const cwd = createTempDir('gsd-3310-ppn1-');
const cwd = createTempDir('msd-3310-ppn1-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md');
writePlan(cwd, '.planning/phases/01-foo', '01-02-PLAN.md');
@@ -1423,7 +1423,7 @@ describe('perPhasePlanNumbering field (Phase 12, #3310, matrix rows 1-2)', () =>
});
test('row 2: a real gap (01, 03) is surfaced in the raw per-phase number list', (t) => {
const cwd = createTempDir('gsd-3310-ppn2-');
const cwd = createTempDir('msd-3310-ppn2-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md');
writePlan(cwd, '.planning/phases/01-foo', '01-03-PLAN.md');
@@ -1434,7 +1434,7 @@ describe('perPhasePlanNumbering field (Phase 12, #3310, matrix rows 1-2)', () =>
});
test('boundary: zero phase directories yields an empty array, not a non-answer', (t) => {
const cwd = createTempDir('gsd-3310-ppn3-');
const cwd = createTempDir('msd-3310-ppn3-');
t.after(() => cleanup(cwd));
fs.mkdirSync(path.join(planningDirOf(cwd), 'phases'), { recursive: true });
@@ -1443,7 +1443,7 @@ describe('perPhasePlanNumbering field (Phase 12, #3310, matrix rows 1-2)', () =>
});
test('boundary: a phase with zero plans reports an empty planNums list for that phase, not an absent entry', (t) => {
const cwd = createTempDir('gsd-3310-ppn4-');
const cwd = createTempDir('msd-3310-ppn4-');
t.after(() => cleanup(cwd));
fs.mkdirSync(path.join(planningDirOf(cwd), 'phases', '01-foo'), { recursive: true });
@@ -1455,7 +1455,7 @@ describe('perPhasePlanNumbering field (Phase 12, #3310, matrix rows 1-2)', () =>
describe('perPhaseOrphanSummaries field (Phase 12, #3310, matrix rows 3-5)', () => {
test('row 3: a paired plan+summary produces no orphan entries', (t) => {
const cwd = createTempDir('gsd-3310-pos1-');
const cwd = createTempDir('msd-3310-pos1-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md');
writeFile(cwd, '.planning/phases/01-foo/01-01-SUMMARY.md', '# Summary\n');
@@ -1468,7 +1468,7 @@ describe('perPhaseOrphanSummaries field (Phase 12, #3310, matrix rows 3-5)', ()
});
test('row 4: a summary with no live plan at all is named as an orphan', (t) => {
const cwd = createTempDir('gsd-3310-pos2-');
const cwd = createTempDir('msd-3310-pos2-');
t.after(() => cleanup(cwd));
writeFile(cwd, '.planning/phases/01-foo/01-01-SUMMARY.md', '# Summary\n');
@@ -1478,7 +1478,7 @@ describe('perPhaseOrphanSummaries field (Phase 12, #3310, matrix rows 3-5)', ()
});
test('row 5: a summary paired only to a superseded plan is still orphan — superseded plans are not live', (t) => {
const cwd = createTempDir('gsd-3310-pos3-');
const cwd = createTempDir('msd-3310-pos3-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md', ['status: superseded']);
writeFile(cwd, '.planning/phases/01-foo/01-01-SUMMARY.md', '# Summary\n');
@@ -1491,7 +1491,7 @@ describe('perPhaseOrphanSummaries field (Phase 12, #3310, matrix rows 3-5)', ()
describe('perPhaseWaveMissingPlans field (Phase 12, #3310, matrix rows 6-7)', () => {
test('row 6: a plan with wave: in frontmatter is not flagged', (t) => {
const cwd = createTempDir('gsd-3310-pwm1-');
const cwd = createTempDir('msd-3310-pwm1-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md', ['wave: 1']);
@@ -1503,7 +1503,7 @@ describe('perPhaseWaveMissingPlans field (Phase 12, #3310, matrix rows 6-7)', ()
});
test('row 7: a plan without wave: in frontmatter is flagged', (t) => {
const cwd = createTempDir('gsd-3310-pwm2-');
const cwd = createTempDir('msd-3310-pwm2-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md');
@@ -1513,7 +1513,7 @@ describe('perPhaseWaveMissingPlans field (Phase 12, #3310, matrix rows 6-7)', ()
});
test('boundary: a phase where every plan lacks wave: reports every one, none silently dropped', (t) => {
const cwd = createTempDir('gsd-3310-pwm3-');
const cwd = createTempDir('msd-3310-pwm3-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md');
writePlan(cwd, '.planning/phases/01-foo', '01-02-PLAN.md');
@@ -1527,7 +1527,7 @@ describe('perPhaseWaveMissingPlans field (Phase 12, #3310, matrix rows 6-7)', ()
});
test('boundary: a phase where every plan carries wave: reports none', (t) => {
const cwd = createTempDir('gsd-3310-pwm4-');
const cwd = createTempDir('msd-3310-pwm4-');
t.after(() => cleanup(cwd));
writePlan(cwd, '.planning/phases/01-foo', '01-01-PLAN.md', ['wave: 1']);
writePlan(cwd, '.planning/phases/01-foo', '01-02-PLAN.md', ['wave: 2']);
@@ -1540,7 +1540,7 @@ describe('perPhaseWaveMissingPlans field (Phase 12, #3310, matrix rows 6-7)', ()
describe('Phase-10/11 fields unchanged by the Phase-12 extension (matrix row 8)', () => {
test('the new fields are additive alongside every prior field on the same fixture', (t) => {
const cwd = createTempDir('gsd-3310-reg8-');
const cwd = createTempDir('msd-3310-reg8-');
t.after(() => cleanup(cwd));
buildHealthyTwoPhaseFixture(cwd);
@@ -1568,8 +1568,8 @@ describe('Phase-10/11 fields unchanged by the Phase-12 extension (matrix row 8)'
// ═════════════════════════════════════════════════════════════════════════
// #3586 (Phase 2, epic #2292) — `planningTracked` field
//
// Design: .gsd/phase/fix-3586-tracked-gitignored-planning/40-design.md
// Test matrix: .gsd/phase/fix-3586-tracked-gitignored-planning/50-test-matrix.md
// Design: .msd/phase/fix-3586-tracked-gitignored-planning/40-design.md
// Test matrix: .msd/phase/fix-3586-tracked-gitignored-planning/50-test-matrix.md
// section A (rows A1-A12)
//
// `.gitignore` has no effect on files git already tracks — this field detects
@@ -1660,7 +1660,7 @@ function mockGitSpawnNotARepoNoStderr(t) {
describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
test('A1: ignored + tracked is detected', (t) => {
const cwd = createTempGitProject('gsd-3586-a1-');
const cwd = createTempGitProject('msd-3586-a1-');
t.after(() => cleanup(cwd));
writeGitignore(cwd, '.planning/\n');
commitAll(cwd, 'add gitignore');
@@ -1674,7 +1674,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A2: ignored + untracked is clean', (t) => {
const cwd = createTempDir('gsd-3586-a2-');
const cwd = createTempDir('msd-3586-a2-');
t.after(() => cleanup(cwd));
initBareGitRepo(cwd);
writeGitignore(cwd, '.planning/\n');
@@ -1691,7 +1691,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A3: tracked + NOT ignored is the normal (default) project — must NOT read as detected', (t) => {
const cwd = createTempGitProject('gsd-3586-a3-');
const cwd = createTempGitProject('msd-3586-a3-');
t.after(() => cleanup(cwd));
// No .gitignore at all — the default state of essentially every project.
@@ -1704,7 +1704,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A4: fresh project (untracked, not ignored) is clean', (t) => {
const cwd = createTempDir('gsd-3586-a4-');
const cwd = createTempDir('msd-3586-a4-');
t.after(() => cleanup(cwd));
initBareGitRepo(cwd);
gitOrThrow(['commit', '--allow-empty', '-m', 'initial'], { cwd });
@@ -1721,7 +1721,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A5: not a git repo degrades to UNREADABLE/not_a_git_repo, silently', (t) => {
const cwd = createTempDir('gsd-3586-a5-');
const cwd = createTempDir('msd-3586-a5-');
t.after(() => cleanup(cwd));
fs.mkdirSync(path.join(cwd, '.planning'), { recursive: true });
fs.writeFileSync(path.join(cwd, '.planning', 'PROJECT.md'), '# Project\n');
@@ -1733,7 +1733,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A6: git ls-files timeout degrades quietly (no throw)', (t) => {
const cwd = createTempGitProject('gsd-3586-a6-');
const cwd = createTempGitProject('msd-3586-a6-');
t.after(() => cleanup(cwd));
mockGitSpawnTimeout(t);
@@ -1746,7 +1746,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A7: git ls-files non-zero exit degrades quietly (no throw)', (t) => {
const cwd = createTempGitProject('gsd-3586-a7-');
const cwd = createTempGitProject('msd-3586-a7-');
t.after(() => cleanup(cwd));
mockGitSpawnFailure(t);
@@ -1759,7 +1759,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A8: .planning/ absent from disk is silent (untracked, not ignored)', (t) => {
const cwd = createTempDir('gsd-3586-a8-');
const cwd = createTempDir('msd-3586-a8-');
t.after(() => cleanup(cwd));
initBareGitRepo(cwd);
gitOrThrow(['commit', '--allow-empty', '-m', 'initial'], { cwd });
@@ -1774,7 +1774,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A9: exactly ONE tracked file under an ignored .planning/ is enough to detect', (t) => {
const cwd = createTempGitProject('gsd-3586-a9-');
const cwd = createTempGitProject('msd-3586-a9-');
t.after(() => cleanup(cwd));
// createTempGitProject seeds exactly .planning/PROJECT.md — one file.
writeGitignore(cwd, '.planning/\n');
@@ -1786,7 +1786,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A10: tracked in the index but deleted from the worktree is still detected', (t) => {
const cwd = createTempGitProject('gsd-3586-a10-');
const cwd = createTempGitProject('msd-3586-a10-');
t.after(() => cleanup(cwd));
writeGitignore(cwd, '.planning/\n');
commitAll(cwd, 'add gitignore');
@@ -1800,7 +1800,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A11: ignored via .git/info/exclude counts the same as .gitignore', (t) => {
const cwd = createTempGitProject('gsd-3586-a11-');
const cwd = createTempGitProject('msd-3586-a11-');
t.after(() => cleanup(cwd));
// Local-only, never committed — check-ignore honors it all the same.
fs.appendFileSync(path.join(cwd, '.git', 'info', 'exclude'), '.planning/\n');
@@ -1810,7 +1810,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A12: a .gitignore covering only .planning/cache/ does NOT count as the root ignored (sub-path ignore is not the contradictory state)', (t) => {
const cwd = createTempGitProject('gsd-3586-a12-');
const cwd = createTempGitProject('msd-3586-a12-');
t.after(() => cleanup(cwd));
writeGitignore(cwd, '.planning/cache/\n');
commitAll(cwd, 'add sub-path gitignore');
@@ -1828,7 +1828,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
// (`rev-parse --is-inside-work-tree`) instead of parsing stderr.
test('A5-locale: not-a-git-repo classification holds with a non-English LANG/LC_ALL set', (t) => {
const cwd = createTempDir('gsd-3586-a5-locale-');
const cwd = createTempDir('msd-3586-a5-locale-');
t.after(() => cleanup(cwd));
fs.mkdirSync(path.join(cwd, '.planning'), { recursive: true });
fs.writeFileSync(path.join(cwd, '.planning', 'PROJECT.md'), '# Project\n');
@@ -1858,7 +1858,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('A5-structural: not_a_git_repo classification does not depend on stderr content (regression for #3586)', (t) => {
const cwd = createTempDir('gsd-3586-a5-structural-');
const cwd = createTempDir('msd-3586-a5-structural-');
t.after(() => cleanup(cwd));
mockGitSpawnNotARepoNoStderr(t);
@@ -1873,7 +1873,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
});
test('happy path issues exactly ONE git subprocess for planningTracked (no rev-parse probe when ls-files succeeds)', (t) => {
const cwd = createTempGitProject('gsd-3586-one-call-');
const cwd = createTempGitProject('msd-3586-one-call-');
t.after(() => cleanup(cwd));
const originalSpawnSync = childProcess.spawnSync;
@@ -1907,7 +1907,7 @@ describe('planningTracked field (#3586, matrix rows A1-A12)', () => {
// must read `true`, not degrade.
test('A13: git ls-files ENOBUFS overflow is treated as proof of tracking, not a failure', (t) => {
const cwd = createTempGitProject('gsd-3586-a13-enobufs-');
const cwd = createTempGitProject('msd-3586-a13-enobufs-');
t.after(() => cleanup(cwd));
writeGitignore(cwd, '.planning/\n');
commitAll(cwd, 'add gitignore');