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

@@ -1,6 +1,6 @@
/**
* Tests for the milestone-window single-owner contract (#3184, epic #3180
* Phase 2, ADR-3180). Matrix: .gsd/phase/refactor-3184-milestone-window-single-owner/50-test-matrix.md
* Phase 2, ADR-3180). Matrix: .msd/phase/refactor-3184-milestone-window-single-owner/50-test-matrix.md
*
* Covers:
* - src/roadmap-parser.cts `classifyMilestoneWindow` / `extractCurrentMilestoneScoped`
@@ -33,10 +33,10 @@ const fs = require('node:fs');
const path = require('node:path');
const fc = require('fast-check');
const roadmapParser = require('../gsd-core/bin/lib/roadmap-parser.cjs');
const { SCOPE } = require('../gsd-core/bin/lib/planning-scope.cjs');
const shellProj = require('../gsd-core/bin/lib/shell-command-projection.cjs');
const { createTempDir, cleanup, runGsdTools } = require('./helpers.cjs');
const roadmapParser = require('../msd-core/bin/lib/roadmap-parser.cjs');
const { SCOPE } = require('../msd-core/bin/lib/planning-scope.cjs');
const shellProj = require('../msd-core/bin/lib/shell-command-projection.cjs');
const { createTempDir, cleanup, runMsdTools } = require('./helpers.cjs');
const driftGuard = require('../scripts/lint-milestone-window-drift.cjs');
const { sanitizeForReport } = require('../scripts/lib/drift-scan.cjs');
@@ -88,7 +88,7 @@ test('unscoped read by design reports COMPLETE', () => {
});
test('scoped window with phases reports COMPLETE', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -106,7 +106,7 @@ test('scoped window with phases reports COMPLETE', (t) => {
});
test('genuinely empty milestone is COMPLETE not TRUNCATED', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = ['# Roadmap', '', '## v1.0 Current 🚧', '', 'Nothing planned yet.'].join('\n');
@@ -116,7 +116,7 @@ test('genuinely empty milestone is COMPLETE not TRUNCATED', (t) => {
});
test('window closed before the phase region reports TRUNCATED', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.0' });
const content = [
@@ -138,7 +138,7 @@ test('window closed before the phase region reports TRUNCATED', (t) => {
});
test('free-form roadmap is COMPLETE not UNSCOPED', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// No STATE.md milestone field at all -- no version resolvable, and the
// roadmap carries no versioned milestone headings anywhere.
@@ -149,7 +149,7 @@ test('free-form roadmap is COMPLETE not UNSCOPED', (t) => {
});
test('versioned roadmap with no resolvable milestone is UNSCOPED', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// No STATE.md milestone field -- no version resolvable -- but the roadmap
// DOES carry versioned milestone headings elsewhere.
@@ -160,7 +160,7 @@ test('versioned roadmap with no resolvable milestone is UNSCOPED', (t) => {
});
test('absent milestone section is UNSCOPED', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v9.9' });
const content = ['# Roadmap', '', '## v1.0 Old ✅ SHIPPED', '', '### Phase 1: Foo'].join('\n');
@@ -178,7 +178,7 @@ test('absent milestone section is UNSCOPED', (t) => {
});
test('unreadable roadmap reports UNREADABLE', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
writeRoadmap(cwd, ['# Roadmap', '', '## v1.0 Current 🚧', '', '### Phase 1: Foo'].join('\n'));
writeState(cwd, { milestone: 'v1.0' });
@@ -198,7 +198,7 @@ test('unreadable roadmap reports UNREADABLE', (t) => {
});
test('empty roadmap is COMPLETE', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// No STATE.md -- no version resolvable on empty content either.
const result = extractCurrentMilestoneScoped('', cwd);
@@ -206,7 +206,7 @@ test('empty roadmap is COMPLETE', (t) => {
});
test('bullet-style phase entries count as phases', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -223,7 +223,7 @@ test('bullet-style phase entries count as phases', (t) => {
});
test('bullet-only doc still detects truncation', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -250,7 +250,7 @@ test('bullet-only doc still detects truncation', (t) => {
// active milestone TRUNCATED instead of COMPLETE, which then made
// `cmdMilestoneComplete` refuse a legitimate archive without --force.
test('fenced bullet-phase example is not a phase entry', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -283,7 +283,7 @@ test('fenced bullet-phase example is not a phase entry', (t) => {
// the same fixture as 'bullet-only doc still detects truncation' above,
// asserted again here to pin both directions of the fix in one place.
test('unfenced bullet-phase entry outside the window still truncates', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -303,7 +303,7 @@ test('unfenced bullet-phase entry outside the window still truncates', (t) => {
});
test('shipped-details phases do not fake a truncation', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
const content = [
@@ -326,7 +326,7 @@ test('shipped-details phases do not fake a truncation', (t) => {
});
test('sentinel-only window is COMPLETE', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = ['# Roadmap', '', '## v1.0 Current 🚧', '', '### Phase 999.1: Backlog item'].join('\n');
@@ -336,7 +336,7 @@ test('sentinel-only window is COMPLETE', (t) => {
});
test('phase prose and horizontal rules are not phase entries', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -358,7 +358,7 @@ test('phase prose and horizontal rules are not phase entries', (t) => {
});
test('fenced milestone heading is not a boundary', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -380,7 +380,7 @@ test('fenced milestone heading is not a boundary', (t) => {
});
test('partial truncation is not detected (documented limit)', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -479,8 +479,8 @@ test('CRLF variants classify identically', (t) => {
const lfContent = row.lines.join('\n');
const crlfContent = row.lines.join('\n').replace(/\n/g, '\r\n');
const lfCwd = createTempDir('gsd-milestone-window-crlf-lf-');
const crlfCwd = createTempDir('gsd-milestone-window-crlf-crlf-');
const lfCwd = createTempDir('msd-milestone-window-crlf-lf-');
const crlfCwd = createTempDir('msd-milestone-window-crlf-crlf-');
tmpDirs.push(lfCwd, crlfCwd);
if (row.version) {
@@ -595,7 +595,7 @@ test('offset inside the heading line is not a boundary', () => {
});
test('three former copies agree via one owner', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
// No preamble before the milestone heading and no "(Phase Details)"
@@ -631,7 +631,7 @@ test('three former copies agree via one owner', (t) => {
// ═════════════════════════════════════════════════════════════════════════
test('roadmap.analyze phase set matches the owner window', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
writeRoadmap(cwd, [
@@ -651,7 +651,7 @@ test('roadmap.analyze phase set matches the owner window', (t) => {
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '02-bar'), { recursive: true });
const analyzeResult = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const analyzeResult = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(analyzeResult.success, true, analyzeResult.error);
const analyzed = JSON.parse(analyzeResult.output);
const analyzedNumbers = analyzed.phases.map((p) => p.number).sort();
@@ -665,7 +665,7 @@ test('roadmap.analyze phase set matches the owner window', (t) => {
});
test('roadmap analyze reports scope truncated on a truncated window', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// #3165 layout: an ACTIVE milestone heading for STATE.md's version,
// immediately followed by a CLOSED milestone heading at the SAME heading
@@ -684,7 +684,7 @@ test('roadmap analyze reports scope truncated on a truncated window', (t) => {
'### Phase 2: Bar',
].join('\n'));
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const analyzed = JSON.parse(result.output);
assert.strictEqual(analyzed.scope, SCOPE.TRUNCATED);
@@ -695,7 +695,7 @@ test('roadmap analyze reports scope truncated on a truncated window', (t) => {
});
test('roadmap analyze recovers phase_count when phase dirs exist on disk (#3165)', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// #3165 layout: the ACTIVE milestone's own `### Phase N:` detail sections
// sit AFTER an intervening CLOSED milestone heading, so the scoped window
@@ -726,7 +726,7 @@ test('roadmap analyze recovers phase_count when phase dirs exist on disk (#3165)
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '02-bar'), { recursive: true });
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const analyzed = JSON.parse(result.output);
// Acceptance criterion 1: correct phase count + resolved current/next, not
@@ -740,7 +740,7 @@ test('roadmap analyze recovers phase_count when phase dirs exist on disk (#3165)
});
test('roadmap analyze fallback does not over-fire on a well-formed sectioned roadmap (#3165)', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// Well-formed: the ACTIVE milestone's phases come right after its heading,
// BEFORE the CLOSED milestone. The scoped window is correct (COMPLETE), so
@@ -762,7 +762,7 @@ test('roadmap analyze fallback does not over-fire on a well-formed sectioned roa
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '02-bar'), { recursive: true });
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const analyzed = JSON.parse(result.output);
assert.strictEqual(analyzed.phase_count, 2);
@@ -771,7 +771,7 @@ test('roadmap analyze fallback does not over-fire on a well-formed sectioned roa
});
test('roadmap analyze fallback respects shipped <details> milestone stripping (#3165)', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// #3165 layout + a <details> shipped block holding OTHER phases. The
// fallback scans stripShippedMilestones(rawContent), so phases inside a
@@ -799,7 +799,7 @@ test('roadmap analyze fallback respects shipped <details> milestone stripping (#
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '02-bar'), { recursive: true });
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const analyzed = JSON.parse(result.output);
assert.strictEqual(analyzed.phase_count, 2);
@@ -808,7 +808,7 @@ test('roadmap analyze fallback respects shipped <details> milestone stripping (#
});
test('roadmap analyze reports scope complete on a genuinely empty milestone', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
// Same shape as the truncated fixture above, but the document carries no
// phase entries anywhere -- the negative proof that the truncated
@@ -824,7 +824,7 @@ test('roadmap analyze reports scope complete on a genuinely empty milestone', (t
'Nothing here either.',
].join('\n'));
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const analyzed = JSON.parse(result.output);
assert.strictEqual(analyzed.scope, SCOPE.COMPLETE);
@@ -832,14 +832,14 @@ test('roadmap analyze reports scope complete on a genuinely empty milestone', (t
});
test('roadmap analyze emits a scope field on every result', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
writeRoadmap(cwd, ['## v2.0 Current 🚧', '', '### Phase 1: Foo', '', '### Phase 2: Bar'].join('\n'));
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '02-bar'), { recursive: true });
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const analyzed = JSON.parse(result.output);
assert.strictEqual(Object.hasOwn(analyzed, 'scope'), true);
@@ -847,7 +847,7 @@ test('roadmap analyze emits a scope field on every result', (t) => {
});
test('milestone.complete scoping matches the owner window', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
// #3184 review finding: the shipped v1.0 phase MUST use a phase NUMBER
@@ -875,7 +875,7 @@ test('milestone.complete scoping matches the owner window', (t) => {
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '05-old-shipped'), { recursive: true });
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
const dryRun = runGsdTools(['milestone', 'complete', 'v2.0', '--dry-run', '--cwd', cwd, '--raw'], cwd);
const dryRun = runMsdTools(['milestone', 'complete', 'v2.0', '--dry-run', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(dryRun.success, true, dryRun.error);
const parsed = JSON.parse(dryRun.output);
@@ -887,7 +887,7 @@ test('milestone.complete scoping matches the owner window', (t) => {
});
test('filter membership matches the owner window', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = ['## v1.0 Current 🚧', '', '### Phase 1: Foo', '', '### Phase 2: Bar'].join('\n');
@@ -906,7 +906,7 @@ test('filter membership matches the owner window', (t) => {
// inflated `milestonePhaseNums` / `phaseCount` the same way it inflated
// `hasPhaseEntries` above.
test('fenced bullet-phase example does not inflate phaseCount', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
const content = [
@@ -931,7 +931,7 @@ test('fenced bullet-phase example does not inflate phaseCount', (t) => {
});
test('state bounding matches the owner predicate', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
writeFile(cwd, '.planning/phases/01-foo/01-PLAN.md', '# Plan\n');
@@ -944,12 +944,12 @@ test('state bounding matches the owner predicate', (t) => {
const roadmapUnbound = fs.readFileSync(path.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8');
assert.strictEqual(isMilestoneBoundedInRoadmap(roadmapUnbound, 'v2.0.1'), false);
const jsonUnbound = runGsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
const jsonUnbound = runMsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(jsonUnbound.success, true, jsonUnbound.error);
const parsedUnbound = JSON.parse(jsonUnbound.output);
assert.strictEqual('percent' in (parsedUnbound.progress || {}), false);
const syncUnbound = runGsdTools(['state', 'sync', '--verify', '--cwd', cwd, '--raw'], cwd);
const syncUnbound = runMsdTools(['state', 'sync', '--verify', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(syncUnbound.success, true, syncUnbound.error);
const syncParsedUnbound = JSON.parse(syncUnbound.output);
assert.strictEqual(syncParsedUnbound.changes.length, 1);
@@ -959,12 +959,12 @@ test('state bounding matches the owner predicate', (t) => {
const roadmapBound = fs.readFileSync(path.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8');
assert.strictEqual(isMilestoneBoundedInRoadmap(roadmapBound, 'v2.0.1'), true);
const jsonBound = runGsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
const jsonBound = runMsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(jsonBound.success, true, jsonBound.error);
const parsedBound = JSON.parse(jsonBound.output);
assert.strictEqual('percent' in (parsedBound.progress || {}), true);
const syncBound = runGsdTools(['state', 'sync', '--verify', '--cwd', cwd, '--raw'], cwd);
const syncBound = runMsdTools(['state', 'sync', '--verify', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(syncBound.success, true, syncBound.error);
const syncParsedBound = JSON.parse(syncBound.output);
assert.strictEqual(syncParsedBound.changes.length, 0);
@@ -977,7 +977,7 @@ test('raw ranges match the owner window', (t) => {
// cmdPhaseComplete instead -- a real discrepancy between the design doc
// and the code, reported back per the dispatch brief rather than silently
// adjusted around.
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
writeRoadmap(cwd, [
@@ -1005,7 +1005,7 @@ test('raw ranges match the owner window', (t) => {
assert.ok(ranges, 'expected a resolvable milestone window');
assert.ok(ranges.primary.start > 0, 'fixture must have a non-empty preamble to protect');
const result = runGsdTools(['phase', 'complete', '1', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['phase', 'complete', '1', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const after = fs.readFileSync(path.join(cwd, '.planning', 'ROADMAP.md'), 'utf-8');
@@ -1042,40 +1042,40 @@ function buildTruncatedFixture(cwd) {
}
test('milestone complete refuses to archive a truncated window', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
buildTruncatedFixture(cwd);
const result = runGsdTools(['milestone', 'complete', 'v3.0', '--cwd', cwd, '--raw', '--confirm'], cwd);
const result = runMsdTools(['milestone', 'complete', 'v3.0', '--cwd', cwd, '--raw', '--confirm'], cwd);
assert.strictEqual(result.success, false);
assert.notStrictEqual(result.exitCode, 0);
});
test('refusal leaves the phases directory untouched', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
buildTruncatedFixture(cwd);
const before = fs.readdirSync(path.join(cwd, '.planning', 'phases')).sort();
const result = runGsdTools(['milestone', 'complete', 'v3.0', '--cwd', cwd, '--raw', '--confirm'], cwd);
const result = runMsdTools(['milestone', 'complete', 'v3.0', '--cwd', cwd, '--raw', '--confirm'], cwd);
assert.strictEqual(result.success, false);
const after = fs.readdirSync(path.join(cwd, '.planning', 'phases')).sort();
assert.deepStrictEqual(after, before);
});
test('--force overrides the truncation refusal', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
buildTruncatedFixture(cwd);
const result = runGsdTools(['milestone', 'complete', 'v3.0', '--force', '--cwd', cwd, '--raw', '--confirm'], cwd);
const result = runMsdTools(['milestone', 'complete', 'v3.0', '--force', '--cwd', cwd, '--raw', '--confirm'], cwd);
assert.strictEqual(result.success, true, result.error);
const parsed = JSON.parse(result.output);
assert.strictEqual(parsed.archived.phases, true);
});
test('genuinely empty milestone still completes', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['# Roadmap', '', '## v1.0 Current 🚧', '', 'Nothing planned yet.'].join('\n'));
@@ -1083,7 +1083,7 @@ test('genuinely empty milestone still completes', (t) => {
const filter = getMilestonePhaseFilter(cwd, 'v1.0');
assert.strictEqual(filter.scope, SCOPE.COMPLETE);
const result = runGsdTools(['milestone', 'complete', 'v1.0', '--cwd', cwd, '--raw', '--confirm'], cwd);
const result = runMsdTools(['milestone', 'complete', 'v1.0', '--cwd', cwd, '--raw', '--confirm'], cwd);
assert.strictEqual(result.success, true, result.error);
});
@@ -1102,7 +1102,7 @@ test('exact version matches', () => {
});
test('both state bounding sites agree', (t) => {
const cwd = createTempDir('gsd-milestone-window-');
const cwd = createTempDir('msd-milestone-window-');
t.after(() => cleanup(cwd));
fs.mkdirSync(path.join(cwd, '.planning', 'phases', '01-foo'), { recursive: true });
writeFile(cwd, '.planning/phases/01-foo/01-PLAN.md', '# Plan\n');
@@ -1117,7 +1117,7 @@ test('both state bounding sites agree', (t) => {
// Site 1: buildStateFrontmatter, reached via `state json` -- typed via
// progress.percent presence/absence.
const jsonResult = runGsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
const jsonResult = runMsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(jsonResult.success, true, jsonResult.error);
const parsedJson = JSON.parse(jsonResult.output);
assert.strictEqual('percent' in (parsedJson.progress || {}), expectBound, `state json site for ${heading}`);
@@ -1126,7 +1126,7 @@ test('both state bounding sites agree', (t) => {
// typed via the structural (numeric) changes[] length: an unbound
// milestone unconditionally pushes exactly one "Progress: skipped"
// change; a bound, already-in-sync fixture pushes none.
const syncResult = runGsdTools(['state', 'sync', '--verify', '--cwd', cwd, '--raw'], cwd);
const syncResult = runMsdTools(['state', 'sync', '--verify', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(syncResult.success, true, syncResult.error);
const parsedSync = JSON.parse(syncResult.output);
assert.strictEqual(parsedSync.changes.length, expectBound ? 0 : 1, `state sync site for ${heading}`);
@@ -1152,7 +1152,7 @@ test('zero independent re-derivations remain', () => {
});
test('a new re-derivation is reported', (t) => {
const root = createTempDir('gsd-milestone-window-drift-root-');
const root = createTempDir('msd-milestone-window-drift-root-');
t.after(() => cleanup(root));
fs.mkdirSync(path.join(root, 'src'), { recursive: true });
fs.writeFileSync(path.join(root, 'src', 'fake.cts'), violatingLine());
@@ -1164,7 +1164,7 @@ test('a new re-derivation is reported', (t) => {
});
test('function-scoped exemption suppresses only its own function', (t) => {
const root = createTempDir('gsd-milestone-window-drift-root-');
const root = createTempDir('msd-milestone-window-drift-root-');
t.after(() => cleanup(root));
fs.mkdirSync(path.join(root, 'src'), { recursive: true });
const content = [
@@ -1180,7 +1180,7 @@ test('function-scoped exemption suppresses only its own function', (t) => {
});
test('exemption is function-scoped, not file-scoped', (t) => {
const root = createTempDir('gsd-milestone-window-drift-root-');
const root = createTempDir('msd-milestone-window-drift-root-');
t.after(() => cleanup(root));
fs.mkdirSync(path.join(root, 'src'), { recursive: true });
const content = [
@@ -1203,7 +1203,7 @@ test('exemption is function-scoped, not file-scoped', (t) => {
});
test('symlinked source is not an evasion', { skip: process.platform === 'win32' ? 'symlink creation needs privilege on Windows' : false }, (t) => {
const root = createTempDir('gsd-milestone-window-drift-root-');
const root = createTempDir('msd-milestone-window-drift-root-');
t.after(() => cleanup(root));
fs.mkdirSync(path.join(root, 'src'), { recursive: true });
fs.mkdirSync(path.join(root, 'vendor'), { recursive: true });
@@ -1217,8 +1217,8 @@ test('symlinked source is not an evasion', { skip: process.platform === 'win32'
});
test('root confinement holds', { skip: process.platform === 'win32' ? 'symlink creation needs privilege on Windows' : false }, (t) => {
const root = createTempDir('gsd-milestone-window-drift-root-');
const outside = createTempDir('gsd-milestone-window-drift-outside-');
const root = createTempDir('msd-milestone-window-drift-root-');
const outside = createTempDir('msd-milestone-window-drift-outside-');
t.after(() => {
cleanup(root);
cleanup(outside);
@@ -1414,8 +1414,8 @@ test('classification is newline-invariant', (t) => {
const lfContent = lines.join('\n');
const crlfContent = lines.join('\n').replace(/\n/g, '\r\n');
const lfCwd = createTempDir('gsd-milestone-window-g3-lf-');
const crlfCwd = createTempDir('gsd-milestone-window-g3-crlf-');
const lfCwd = createTempDir('msd-milestone-window-g3-lf-');
const crlfCwd = createTempDir('msd-milestone-window-g3-crlf-');
if (versioned) {
writeState(lfCwd, { milestone: 'v1.0' });
writeState(crlfCwd, { milestone: 'v1.0' });
@@ -1436,7 +1436,7 @@ test('classification is newline-invariant', (t) => {
// ═════════════════════════════════════════════════════════════════════════
// Section H — Milestone identity has one owner (#3216, epic #3180 Phase 6)
// Matrix: .gsd/phase/refactor-3216-milestone-identity-single-owner/50-test-matrix.md
// Matrix: .msd/phase/refactor-3216-milestone-identity-single-owner/50-test-matrix.md
// ═════════════════════════════════════════════════════════════════════════
//
// `getMilestoneInfo(cwd)` moves from a bare `{version, name}` return (with a
@@ -1456,7 +1456,7 @@ const {
getMilestoneInfo,
listMilestoneHeadings,
} = roadmapParser;
const unusableInputMod = require('../gsd-core/bin/lib/unusable-input.cjs');
const unusableInputMod = require('../msd-core/bin/lib/unusable-input.cjs');
const {
_resetUnusableInputWarningsForTests,
_unusableInputEmissionCountForTests,
@@ -1505,7 +1505,7 @@ const H_CRLF_TABLE = [
];
function buildHFixture(t, entry, crlf = false) {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
if (entry.version) writeState(cwd, { milestone: entry.version });
const content = entry.lines.join('\n');
@@ -1521,7 +1521,7 @@ test('stateVersionWithNamedHeadingReportsBothAndCompleteScope', (t) => {
});
test('progressMarkerBulletIsConsultedBeforeHeading', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
const content = [
@@ -1567,7 +1567,7 @@ test('phaseHeadingIsNeverAcceptedAsTheMilestoneHeadingOnFallbackPath', (t) => {
});
test('shippedHeadingIsNotReportedAsCurrentMilestone', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['# Roadmap', '', '## v3.3 — Old ✅ SHIPPED', '', 'body'].join('\n'));
@@ -1580,7 +1580,7 @@ test('shippedHeadingIsNotReportedAsCurrentMilestone', (t) => {
});
test('knownVersionWithNoHeadingReportsVersionAndNullName', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['# Roadmap', '', '## Overview', '', 'No milestone headings here.'].join('\n'));
@@ -1597,7 +1597,7 @@ test('knownVersionWithNoHeadingReportsVersionAndNullName', (t) => {
// TRUNCATED. Sibling negative case (no version token anywhere) is
// `freeFormRoadmapWithNoVersionYieldsUnscopedNotV1Default` immediately below.
test('bareVersionInProseYieldsTruncatedWithNoName', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['# Roadmap', '', '## Overview', '', 'Targeting v3.3 for the next release.'].join('\n'));
@@ -1609,7 +1609,7 @@ test('bareVersionInProseYieldsTruncatedWithNoName', (t) => {
// (RED) #3197: free-form legacy ROADMAP with zero version tokens anywhere --
// the version is genuinely unresolvable and must not be invented.
test('freeFormRoadmapWithNoVersionYieldsUnscopedNotV1Default', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['# Roadmap', '', '## Overview', '', '### Phase 1: Foo'].join('\n'));
@@ -1624,7 +1624,7 @@ test('freeFormRoadmapWithNoVersionYieldsUnscopedNotV1Default', (t) => {
// old `{version:'v1.0', name:'milestone'}` failure default is actually GONE,
// rather than renamed to a scope label nobody checks.
test('genuineV1ProjectIsDistinguishableFromTheOldFailureDefault', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v1.0' });
writeRoadmap(cwd, ['# Roadmap', '', '## v1.0 — Foundation Release', '', '### Phase 1: Bootstrap'].join('\n'));
@@ -1639,7 +1639,7 @@ test('genuineV1ProjectIsDistinguishableFromTheOldFailureDefault', (t) => {
});
test('absentRoadmapIsUnreadableScopeAndStaysSilent', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
// No ROADMAP.md written at all -- ENOENT.
@@ -1654,7 +1654,7 @@ test('absentRoadmapIsUnreadableScopeAndStaysSilent', (t) => {
});
test('unreadableRoadmapReportsDiagnosticAndUnreadableScope', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
writeRoadmap(cwd, ['# Roadmap', '', '## v3.3 — Name'].join('\n'));
writeState(cwd, { milestone: 'v3.3' });
_resetUnusableInputWarningsForTests();
@@ -1677,7 +1677,7 @@ test('unreadableRoadmapReportsDiagnosticAndUnreadableScope', (t) => {
});
test('unreadableStateFallsBackWithoutFabricatingAVersion', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
// No versioned milestones anywhere in the ROADMAP, so the fallback path
// (once STATE.md is unreachable) has no version evidence to find either.
writeRoadmap(cwd, ['# Roadmap', '', '## Overview', '', '### Phase 1: Foo'].join('\n'));
@@ -1705,7 +1705,7 @@ test('unreadableStateFallsBackWithoutFabricatingAVersion', (t) => {
});
test('emptyRoadmapYieldsUnscoped', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, '');
@@ -1715,7 +1715,7 @@ test('emptyRoadmapYieldsUnscoped', (t) => {
});
test('whitespaceOnlyRoadmapYieldsUnscoped', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ' \n\n\t \n');
@@ -1729,7 +1729,7 @@ test('headingLevelsOneThroughThreeAreAllAccepted', (t) => {
t.after(() => { for (const d of tmpDirs) cleanup(d); });
for (const level of [1, 2, 3]) {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
tmpDirs.push(cwd);
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, [`${'#'.repeat(level)} v3.3 — Name`, '', 'body'].join('\n'));
@@ -1741,7 +1741,7 @@ test('headingLevelsOneThroughThreeAreAllAccepted', (t) => {
});
test('headingLevelFourIsRejected', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['#### v3.3 — Name', '', 'body'].join('\n'));
@@ -1758,7 +1758,7 @@ test('versionSegmentCountsAtAndAroundTwoAreHandled', (t) => {
t.after(() => { for (const d of tmpDirs) cleanup(d); });
for (const version of ['v3', 'v3.3', 'v3.3.3']) {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
tmpDirs.push(cwd);
writeState(cwd, { milestone: version });
writeRoadmap(cwd, [`## ${version} — Name`, '', 'body'].join('\n'));
@@ -1787,7 +1787,7 @@ test('prefersTheNonClosedHeadingWhenAVersionAppearsTwice', (t) => {
// sub-milestone heading over the CLOSED `v8.0-A` one -- the `\b` boundary
// that makes this possible is deliberate, load-bearing behavior (§7.1).
test('subMilestoneSelectionIsPreservedForBoundaryWordChars', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v8.0' });
writeRoadmap(cwd, [
@@ -1805,7 +1805,7 @@ test('subMilestoneSelectionIsPreservedForBoundaryWordChars', (t) => {
// version token (v8.0-B), not the requested v8.0 -- an .includes() check
// would also pass on a leaked prefix from the closed v8.0-A heading, which
// is the specific misselection this row guards against (pinned rule,
// .gsd/phase/refactor-3216-milestone-identity-single-owner/40-design.md).
// .msd/phase/refactor-3216-milestone-identity-single-owner/40-design.md).
assert.equal(result.value.name, 'LiveMarker', `expected exact name LiveMarker, got ${JSON.stringify(result.value.name)}`);
});
@@ -1814,7 +1814,7 @@ test('subMilestoneSelectionIsPreservedForBoundaryWordChars', (t) => {
// `(?![\w.-])` boundary specifically to stop this and REVERTED it because it
// breaks #730 sub-milestone selection (the row above). Do not "fix" this.
test('versionPrefixMatchInsideLongerVersionIsRetainedDeliberately', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v2.0' });
writeRoadmap(cwd, ['## v2.0.1 — Name', '', 'body'].join('\n'));
@@ -1827,12 +1827,12 @@ test('versionPrefixMatchInsideLongerVersionIsRetainedDeliberately', (t) => {
// would also pass on the '.1 — Name' leftover that stripping the
// *requested* token (instead of the heading's own) would produce, which is
// precisely the defect the pinned name-extraction rule excludes
// (.gsd/phase/refactor-3216-milestone-identity-single-owner/40-design.md).
// (.msd/phase/refactor-3216-milestone-identity-single-owner/40-design.md).
assert.equal(result.value.name, 'Name', `expected exact name Name, got ${JSON.stringify(result.value.name)}`);
});
test('leadingDelimiterIsStrippedFromName', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['## v3.3 — Delimited Name', '', 'body'].join('\n'));
@@ -1846,7 +1846,7 @@ test('leadingDelimiterIsStrippedFromName', (t) => {
// loud (unstripped) rather than being silently cleaned, unlike a whitespace/
// dash/colon/em-dash leading delimiter.
test('hashLedNameIsLeftLoudRatherThanCleaned', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['## v3.3 #HashName', '', 'body'].join('\n'));
@@ -1861,8 +1861,8 @@ test('crlfRoadmapsProduceIdenticalIdentityToLf', (t) => {
t.after(() => { for (const d of tmpDirs) cleanup(d); });
for (const entry of H_CRLF_TABLE) {
const lfCwd = createTempDir('gsd-milestone-identity-crlf-lf-');
const crlfCwd = createTempDir('gsd-milestone-identity-crlf-crlf-');
const lfCwd = createTempDir('msd-milestone-identity-crlf-lf-');
const crlfCwd = createTempDir('msd-milestone-identity-crlf-crlf-');
tmpDirs.push(lfCwd, crlfCwd);
if (entry.version) {
writeState(lfCwd, { milestone: entry.version });
@@ -1883,7 +1883,7 @@ test('crlfRoadmapsProduceIdenticalIdentityToLf', (t) => {
});
test('unicodeNameIsPreserved', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['## v3.3 — Ünïcode ▲', '', 'body'].join('\n'));
@@ -1894,7 +1894,7 @@ test('unicodeNameIsPreserved', (t) => {
});
test('veryLongNameIsNotTruncated', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
const longName = 'X'.repeat(4096);
@@ -1910,7 +1910,7 @@ test('veryLongNameIsNotTruncated', (t) => {
// 6) -- a milestone-shaped heading at line-start INSIDE a fenced code block
// still matches. Documented known limit, not a regression to fix here.
test('fencedHeadingStillMatchesAsADocumentedKnownLimit', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['# Roadmap', '', '```markdown', '## v3.3 — Fenced Name', '```', '', 'body'].join('\n'));
@@ -1927,7 +1927,7 @@ test('fencedHeadingStillMatchesAsADocumentedKnownLimit', (t) => {
// characters on both sides of its own boundary and structurally cannot
// match there -- that is the LOCKED `\b` semantics, not a defect).
test('versionWithRegexMetacharactersIsEscaped', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
const hostileVersion = 'v1.0+(x)';
writeState(cwd, { milestone: hostileVersion });
@@ -1961,7 +1961,7 @@ test('versionWithRegexMetacharactersIsEscaped', (t) => {
});
test('versionWithReplacementPatternIsTreatedLiterally', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
const hostileVersion = 'v1.0$&$1';
writeState(cwd, { milestone: hostileVersion });
@@ -1984,7 +1984,7 @@ test('traversalVersionNeverEscapesTheMilestonesDirectory', (t) => {
// own uncommitted-changes guard a deterministic clean repo, so the test
// proves the real destructive-command guard rather than bypassing it with
// `--force` -- `--force` is exactly the safety this row exercises.
const cwd = createTempGitProject('gsd-milestone-identity-');
const cwd = createTempGitProject('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['# Roadmap', '', 'No milestone headings here.'].join('\n'));
const hostileVersion = '../../etc/passwd';
@@ -1996,7 +1996,7 @@ test('traversalVersionNeverEscapesTheMilestonesDirectory', (t) => {
const escapeTarget = path.resolve(cwd, '.planning', 'milestones', '..', '..', 'etc', 'passwd-phases');
assert.strictEqual(fs.existsSync(escapeTarget), false, 'precondition: escape target must not pre-exist');
const result = runGsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
// Negative proof: the traversal string never left `.planning/milestones/`.
@@ -2015,7 +2015,7 @@ test('traversalVersionNeverEscapesTheMilestonesDirectory', (t) => {
test('controlCharacterVersionIsRefusedAsAPathComponent', (t) => {
// `createTempGitProject`, not a bare temp dir + `--force`: see rationale on
// `traversalVersionNeverEscapesTheMilestonesDirectory` above.
const cwd = createTempGitProject('gsd-milestone-identity-');
const cwd = createTempGitProject('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeRoadmap(cwd, ['# Roadmap', '', 'No milestone headings here.'].join('\n'));
const ESC = String.fromCharCode(0x1b);
@@ -2025,7 +2025,7 @@ test('controlCharacterVersionIsRefusedAsAPathComponent', (t) => {
gitOrThrow(['add', '-A'], { cwd });
gitOrThrow(['commit', '-m', 'seed fixture'], { cwd });
const result = runGsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
// Nothing replayed to the terminal: the hostile version never reaches the
// command's own output.
@@ -2055,7 +2055,7 @@ test('getMilestoneInfoNeverThrowsAcrossEveryInputClass', (t) => {
t.after(() => { for (const d of tmpDirs) cleanup(d); });
function freshDir() {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
tmpDirs.push(cwd);
return cwd;
}
@@ -2130,7 +2130,7 @@ test('getMilestoneInfoNeverThrowsAcrossEveryInputClass', (t) => {
test('consumerOutputsMatchTheOwnersScopedResultForTheSameFixture', (t) => {
// `createTempGitProject`, not a bare temp dir + `--force`: see rationale on
// `traversalVersionNeverEscapesTheMilestonesDirectory` above.
const cwd = createTempGitProject('gsd-milestone-identity-');
const cwd = createTempGitProject('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
writeRoadmap(cwd, ['# Roadmap', '', '## v3.3 — Consolidated Name', '', 'body'].join('\n'));
@@ -2142,16 +2142,16 @@ test('consumerOutputsMatchTheOwnersScopedResultForTheSameFixture', (t) => {
assert.equal(owner.scope, SCOPE.COMPLETE);
// Consumer 1: buildStateFrontmatter, via `state sync` -> `state json`.
const syncResult = runGsdTools(['state', 'sync', '--cwd', cwd, '--raw'], cwd);
const syncResult = runMsdTools(['state', 'sync', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(syncResult.success, true, syncResult.error);
const jsonResult = runGsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
const jsonResult = runMsdTools(['state', 'json', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(jsonResult.success, true, jsonResult.error);
const parsedJson = JSON.parse(jsonResult.output);
assert.strictEqual(parsedJson.milestone, owner.value.version);
assert.strictEqual(parsedJson.milestone_name, owner.value.name);
// Consumer 2: archivePhaseDirectories, via `phases clear --confirm`.
const clearResult = runGsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
const clearResult = runMsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(clearResult.success, true, clearResult.error);
const milestonesDir = path.join(cwd, '.planning', 'milestones');
const entries = fs.readdirSync(milestonesDir);
@@ -2166,25 +2166,25 @@ test('stateSyncPersistsTheOwnersIdentityNotAFabricatedOne', (t) => {
t.after(() => { for (const d of tmpDirs) cleanup(d); });
// Row-3 fixture: parenthetical name must persist UNTRUNCATED.
const cwd3 = createTempDir('gsd-milestone-identity-');
const cwd3 = createTempDir('msd-milestone-identity-');
tmpDirs.push(cwd3);
writeState(cwd3, { milestone: 'v3.3' });
writeRoadmap(cwd3, ['# Roadmap', '', '## v3.3 — Portability (Windows)', '', 'body'].join('\n'));
const sync3 = runGsdTools(['state', 'sync', '--cwd', cwd3, '--raw'], cwd3);
const sync3 = runMsdTools(['state', 'sync', '--cwd', cwd3, '--raw'], cwd3);
assert.strictEqual(sync3.success, true, sync3.error);
const json3result = runGsdTools(['state', 'json', '--cwd', cwd3, '--raw'], cwd3);
const json3result = runMsdTools(['state', 'json', '--cwd', cwd3, '--raw'], cwd3);
assert.strictEqual(json3result.success, true, json3result.error);
const json3 = JSON.parse(json3result.output);
assert.strictEqual(json3.milestone_name, 'Portability (Windows)');
// Row-4 fixture: only a Phase heading -- must persist NO fabricated name.
const cwd4 = createTempDir('gsd-milestone-identity-');
const cwd4 = createTempDir('msd-milestone-identity-');
tmpDirs.push(cwd4);
writeState(cwd4, { milestone: 'v3.3' });
writeRoadmap(cwd4, ['# Roadmap', '', '### Phase 7: Close v3.3 gaps', '', 'body'].join('\n'));
const sync4 = runGsdTools(['state', 'sync', '--cwd', cwd4, '--raw'], cwd4);
const sync4 = runMsdTools(['state', 'sync', '--cwd', cwd4, '--raw'], cwd4);
assert.strictEqual(sync4.success, true, sync4.error);
const json4result = runGsdTools(['state', 'json', '--cwd', cwd4, '--raw'], cwd4);
const json4result = runMsdTools(['state', 'json', '--cwd', cwd4, '--raw'], cwd4);
assert.strictEqual(json4result.success, true, json4result.error);
const json4 = JSON.parse(json4result.output);
assert.strictEqual(json4.milestone, 'v3.3');
@@ -2198,7 +2198,7 @@ test('stateSyncPersistsTheOwnersIdentityNotAFabricatedOne', (t) => {
test('phasesClearFallsBackToDatedLabelWhenIdentityIsNotComplete', (t) => {
// `createTempGitProject`, not a bare temp dir + `--force`: see rationale on
// `traversalVersionNeverEscapesTheMilestonesDirectory` above.
const cwd = createTempGitProject('gsd-milestone-identity-');
const cwd = createTempGitProject('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
// Row-4 fixture: only a Phase heading -- scope is TRUNCATED, not COMPLETE,
@@ -2211,7 +2211,7 @@ test('phasesClearFallsBackToDatedLabelWhenIdentityIsNotComplete', (t) => {
const owner = getMilestoneInfo(cwd);
assert.notEqual(owner.scope, SCOPE.COMPLETE);
const result = runGsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['phases', 'clear', '--confirm', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const entries = fs.readdirSync(path.join(cwd, '.planning', 'milestones'));
assert.strictEqual(entries.length, 1);
@@ -2226,7 +2226,7 @@ test('phasesClearFallsBackToDatedLabelWhenIdentityIsNotComplete', (t) => {
// truncation -- document-shaped (#2371): built from a local grammar here,
// never via any renderer in roadmap-parser.cjs.
test('propertyHeadingNameRoundTripsWithoutTruncation', (t) => {
const cwd = createTempDir('gsd-milestone-identity-property-');
const cwd = createTempDir('msd-milestone-identity-property-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
@@ -2253,7 +2253,7 @@ test('propertyHeadingNameRoundTripsWithoutTruncation', (t) => {
// embedded version token -- ever yields COMPLETE from getMilestoneInfo when
// it is the only heading in the document.
test('propertyPhaseHeadingsNeverYieldCompleteScope', (t) => {
const cwd = createTempDir('gsd-milestone-identity-property-');
const cwd = createTempDir('msd-milestone-identity-property-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
@@ -2343,7 +2343,7 @@ test('listMilestoneHeadingsHeadingFieldIsCrlfFreeAndTrimmed', () => {
// unchanged; only the garbage "name" is refused.
test('listMilestoneHeadingsRefusesPunctuationOnlyNames', () => {
const content = [
'# Roadmap: GSD Core — Native OMP Runtime Support (v1.13)',
'# Roadmap: MSD Core — Native OMP Runtime Support (v1.13)',
'',
'### Phase 1: Runtime Adapter Interface',
].join('\n');
@@ -2393,7 +2393,7 @@ test('listMilestoneHeadingsFlagsClosedMilestones', () => {
// actually used (extractCurrentMilestoneScoped's `.value`), not a
// re-derivation of it.
test('roadmapAnalyzeMilestonesMatchTheOwnersEnumeration', (t) => {
const cwd = createTempDir('gsd-milestone-identity-');
const cwd = createTempDir('msd-milestone-identity-');
t.after(() => cleanup(cwd));
writeState(cwd, { milestone: 'v3.3' });
const rawContent = [
@@ -2407,7 +2407,7 @@ test('roadmapAnalyzeMilestonesMatchTheOwnersEnumeration', (t) => {
].join('\n');
writeRoadmap(cwd, rawContent);
const result = runGsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
const result = runMsdTools(['roadmap', 'analyze', '--cwd', cwd, '--raw'], cwd);
assert.strictEqual(result.success, true, result.error);
const parsed = JSON.parse(result.output);