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:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* GSD Tools Tests - Health Validation
|
||||
* MSD Tools Tests - Health Validation
|
||||
*
|
||||
* Tests for fix/health-validation-1473c:
|
||||
* - W011: STATE/ROADMAP cross-validation (phase divergence detection)
|
||||
@@ -15,7 +15,7 @@ const { test, describe, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { runGsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
|
||||
// ─── Helpers ────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -80,7 +80,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '03-database-layer'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -103,7 +103,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '02-api-layer'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -113,7 +113,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// ─── #3280 — the STATE.md format `gsd-tools state update` /
|
||||
// ─── #3280 — the STATE.md format `msd-tools state update` /
|
||||
// `state begin-phase` actually persist: YAML frontmatter `current_phase` +
|
||||
// `status` (syncStateFrontmatter), not the legacy bold-prose fields. New
|
||||
// fixtures added alongside the legacy cases above (which stay, since real
|
||||
@@ -129,7 +129,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
path.join(tmpDir, '.planning', 'STATE.md'),
|
||||
[
|
||||
'---',
|
||||
"gsd_state_version: '1.0'",
|
||||
"msd_state_version: '1.0'",
|
||||
'milestone: v1.0',
|
||||
'current_phase: 3',
|
||||
'current_phase_name: Database Layer',
|
||||
@@ -147,7 +147,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '03-database-layer'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -167,7 +167,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
path.join(tmpDir, '.planning', 'STATE.md'),
|
||||
[
|
||||
'---',
|
||||
"gsd_state_version: '1.0'",
|
||||
"msd_state_version: '1.0'",
|
||||
'current_phase: 3',
|
||||
'current_phase_name: Database Layer',
|
||||
'status: completed',
|
||||
@@ -184,7 +184,7 @@ describe('W011: STATE/ROADMAP cross-validation', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '03-database-layer'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -217,7 +217,7 @@ describe('config field validation', () => {
|
||||
writeValidConfigJson(tmpDir, { branching_strategy: 'banana' });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -234,7 +234,7 @@ describe('config field validation', () => {
|
||||
writeValidConfigJson(tmpDir, { context_window: -500 });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -248,10 +248,10 @@ describe('config field validation', () => {
|
||||
writeMinimalProjectMd(tmpDir);
|
||||
writeMinimalRoadmap(tmpDir, ['1']);
|
||||
writeMinimalStateMd(tmpDir, '# Session State\n\nPhase 1 in progress.\n');
|
||||
writeValidConfigJson(tmpDir, { phase_branch_template: 'gsd/no-placeholder-{slug}' });
|
||||
writeValidConfigJson(tmpDir, { phase_branch_template: 'msd/no-placeholder-{slug}' });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -268,7 +268,7 @@ describe('config field validation', () => {
|
||||
writeValidConfigJson(tmpDir, { milestone_branch_template: 'release/no-placeholder' });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -301,7 +301,7 @@ describe('boundary conditions', () => {
|
||||
writeValidConfigJson(tmpDir, { context_window: 500000 });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -318,7 +318,7 @@ describe('boundary conditions', () => {
|
||||
writeValidConfigJson(tmpDir, { context_window: 200000 });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -335,7 +335,7 @@ describe('boundary conditions', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -352,7 +352,7 @@ describe('boundary conditions', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command should not crash: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -368,7 +368,7 @@ describe('boundary conditions', () => {
|
||||
writeValidConfigJson(tmpDir);
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-a'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command should not crash on empty ROADMAP.md: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -390,7 +390,7 @@ describe('boundary conditions', () => {
|
||||
'# Roadmap\n\n### Phase 1: Test Phase\n'
|
||||
);
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `validate health should not crash on invalid JSON: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -420,7 +420,7 @@ describe('stateReplaceFieldWithFallback field-miss warning', () => {
|
||||
`# Project State\n\n**Current Phase:** 01\n**Current Plan:** 1\n**Total Plans in Phase:** 3\n`
|
||||
);
|
||||
|
||||
const result = runGsdTools('state advance-plan', tmpDir);
|
||||
const result = runMsdTools('state advance-plan', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -454,7 +454,7 @@ describe('stateReplaceFieldWithFallback field-miss warning', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
|
||||
assert.ok(result.success, `validate health should succeed: ${result.error}`);
|
||||
|
||||
@@ -473,7 +473,7 @@ describe('stateReplaceFieldWithFallback field-miss warning', () => {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Regression tests for issue #6 (open-gsd/gsd-core):
|
||||
* Regression tests for issue #6 (golem15com/msd-core):
|
||||
* Three validation behaviors present in validate.ts are missing from verify.cjs,
|
||||
* producing silent false negatives on the CJS production path.
|
||||
*
|
||||
@@ -494,7 +494,7 @@ describe('stateReplaceFieldWithFallback field-miss warning', () => {
|
||||
*
|
||||
* References:
|
||||
* - ADR-3524 (docs/adr/3524-cjs-sdk-hard-seam.md)
|
||||
* - Issue #6 (open-gsd/gsd-core)
|
||||
* - Issue #6 (golem15com/msd-core)
|
||||
* - PR #154 (issue #4) — precedent for the generator pattern
|
||||
*/
|
||||
|
||||
@@ -504,7 +504,7 @@ const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const os = require('node:os');
|
||||
|
||||
const { runGsdTools, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, cleanup } = require('./helpers.cjs');
|
||||
|
||||
// ── Fixture helpers ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -554,7 +554,7 @@ describe('Drift item 1 — W007 activeDiskPhases: no false W007 for archived pha
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-6-d1-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-6-d1-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir);
|
||||
@@ -606,7 +606,7 @@ describe('Drift item 1 — W007 activeDiskPhases: no false W007 for archived pha
|
||||
// verify.cjs pre-fix: diskPhases = collectDiskPhases + forEachArchivedPhaseToken.
|
||||
// diskPhases includes "1" (from v1.0 archive). W007 iterates diskPhases → "1" not
|
||||
// in roadmapPhases → W007 fires for "1". False positive.
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w007 = (data.warnings ?? []).filter((w) => w.code === 'W007');
|
||||
@@ -642,7 +642,7 @@ describe('Drift item 2 — phaseVariants() normalization: letter-suffix zero-pad
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-6-d2-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-6-d2-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir);
|
||||
@@ -674,7 +674,7 @@ describe('Drift item 2 — phaseVariants() normalization: letter-suffix zero-pad
|
||||
});
|
||||
|
||||
test('no false W006 when ROADMAP says 01A and disk has 1A-... (phaseVariants normalizes)', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w006 = (data.warnings ?? []).filter((w) => w.code === 'W006');
|
||||
@@ -686,7 +686,7 @@ describe('Drift item 2 — phaseVariants() normalization: letter-suffix zero-pad
|
||||
});
|
||||
|
||||
test('no false W007 when disk has 1A and ROADMAP says 01A (phaseVariants normalizes)', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w007 = (data.warnings ?? []).filter((w) => w.code === 'W007');
|
||||
@@ -719,7 +719,7 @@ describe('Drift item 3 — W006 false positive when disk has zero-padded letter
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-6-d3-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-6-d3-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir, '3B');
|
||||
@@ -751,7 +751,7 @@ describe('Drift item 3 — W006 false positive when disk has zero-padded letter
|
||||
});
|
||||
|
||||
test('no false W006 when ROADMAP says 3B and disk has 03B-... (phaseVariants covers zero-padded)', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w006 = (data.warnings ?? []).filter((w) => w.code === 'W006');
|
||||
@@ -763,7 +763,7 @@ describe('Drift item 3 — W006 false positive when disk has zero-padded letter
|
||||
});
|
||||
|
||||
test('no false W007 when disk has 03B and ROADMAP says 3B (phaseVariants covers both forms)', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w007 = (data.warnings ?? []).filter((w) => w.code === 'W007');
|
||||
@@ -787,7 +787,7 @@ describe('Drift item 3 — W006 false positive when disk has zero-padded letter
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Regression tests for issue #416 (open-gsd/gsd-core).
|
||||
* Regression tests for issue #416 (golem15com/msd-core).
|
||||
*
|
||||
* Bug: getActiveMilestoneArchiveDir falls back to the newest archive directory
|
||||
* when STATE.md names a milestone that has no matching archive yet, producing
|
||||
@@ -809,15 +809,15 @@ const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const os = require('node:os');
|
||||
|
||||
const { runGsdTools, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, cleanup } = require('./helpers.cjs');
|
||||
|
||||
// Consolidation #1969: scope GSD_TEST_MODE to this folded block so it does not
|
||||
// leak (via the runGsdTools env copy) into host tests registered before the fold.
|
||||
const __savedTestMode = process.env.GSD_TEST_MODE;
|
||||
before(() => { process.env.GSD_TEST_MODE = '1'; });
|
||||
// Consolidation #1969: scope MSD_TEST_MODE to this folded block so it does not
|
||||
// leak (via the runMsdTools env copy) into host tests registered before the fold.
|
||||
const __savedTestMode = process.env.MSD_TEST_MODE;
|
||||
before(() => { process.env.MSD_TEST_MODE = '1'; });
|
||||
after(() => {
|
||||
if (__savedTestMode === undefined) delete process.env.GSD_TEST_MODE;
|
||||
else process.env.GSD_TEST_MODE = __savedTestMode;
|
||||
if (__savedTestMode === undefined) delete process.env.MSD_TEST_MODE;
|
||||
else process.env.MSD_TEST_MODE = __savedTestMode;
|
||||
});
|
||||
|
||||
// ── helpers ──────────────────────────────────────────────────────────────────
|
||||
@@ -883,7 +883,7 @@ describe('bug #416 case 1: STATE.md v6.0 with only v5.0-phases/ on disk → null
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-416-c1-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-416-c1-'));
|
||||
const planningDir = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeConfigJson(planningDir);
|
||||
@@ -904,7 +904,7 @@ describe('bug #416 case 1: STATE.md v6.0 with only v5.0-phases/ on disk → null
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('validate health emits zero W007 warnings (no prior-milestone phases surfaced)', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `validate health failed: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w007 = (data.warnings ?? []).filter((w) => w.code === 'W007');
|
||||
@@ -925,7 +925,7 @@ describe('bug #416 case 2: no STATE.md + multiple archives → version-sort fall
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-416-c2-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-416-c2-'));
|
||||
const planningDir = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeConfigJson(planningDir);
|
||||
@@ -946,7 +946,7 @@ describe('bug #416 case 2: no STATE.md + multiple archives → version-sort fall
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('validate health succeeds and does not emit W007 for v5.0 archive phases', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `validate health failed: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w007 = (data.warnings ?? []).filter((w) => w.code === 'W007');
|
||||
@@ -969,7 +969,7 @@ describe('bug #416 case 3: STATE.md v5.0 with matching v5.0-phases/ → returns
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-416-c3-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-416-c3-'));
|
||||
const planningDir = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeConfigJson(planningDir);
|
||||
@@ -992,7 +992,7 @@ describe('bug #416 case 3: STATE.md v5.0 with matching v5.0-phases/ → returns
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('validate health emits zero W007 — archive phases are in ROADMAP and active', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `validate health failed: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w007 = (data.warnings ?? []).filter((w) => w.code === 'W007');
|
||||
@@ -1015,7 +1015,7 @@ describe('bug #416 case 3: STATE.md v5.0 with matching v5.0-phases/ → returns
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Regression tests for issue #26 (open-gsd/gsd-core).
|
||||
* Regression tests for issue #26 (golem15com/msd-core).
|
||||
* Three generator-pattern drift items: W005 phaseDirNameRe,
|
||||
* W006-archived regex constants (PHASE_TOKEN_FROM_DIR_RE, MILESTONE_ARCHIVE_DIR_RE),
|
||||
* I001 canonicalPlanStem.
|
||||
@@ -1025,7 +1025,7 @@ describe('bug #416 case 3: STATE.md v5.0 with matching v5.0-phases/ → returns
|
||||
* tests go RED.
|
||||
*
|
||||
* References:
|
||||
* - Issue #26 (open-gsd/gsd-core) — three drift items + reproducer
|
||||
* - Issue #26 (golem15com/msd-core) — three drift items + reproducer
|
||||
* - ADR-3524 (docs/adr/3524-cjs-sdk-hard-seam.md)
|
||||
* - PR #154 (issue #4) — generator pattern precedent
|
||||
* - PR #156 (issue #6) — validate.ts generator scaffolding (#26 extends this)
|
||||
@@ -1038,7 +1038,7 @@ const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const os = require('node:os');
|
||||
|
||||
const { runGsdTools, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, cleanup } = require('./helpers.cjs');
|
||||
|
||||
function mkplanning(base) {
|
||||
const planningDir = path.join(base, '.planning');
|
||||
@@ -1073,7 +1073,7 @@ function writeConfigJson(planningDir) {
|
||||
// Issue #26 reproducer (verbatim):
|
||||
// mkdir -p .planning/phases/999.1-foo
|
||||
// echo "# Roadmap" > .planning/ROADMAP.md
|
||||
// node .claude/gsd-core/bin/gsd-tools.cjs validate health
|
||||
// node .claude/msd-core/bin/msd-tools.cjs validate health
|
||||
// # Bug: emits W005 about 999.1-foo not following NN-name format
|
||||
//
|
||||
// verify.cjs must consume phaseDirNameRe from validate.cjs so
|
||||
@@ -1083,7 +1083,7 @@ describe('Drift item W005 — phaseDirNameRe: 999.X-name dirs must not trigger W
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-26-d1-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-26-d1-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir, '999.1');
|
||||
@@ -1101,7 +1101,7 @@ describe('Drift item W005 — phaseDirNameRe: 999.X-name dirs must not trigger W
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('no W005 for 999.1-foo (multi-digit sub-phase prefix)', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w005 = (data.warnings ?? []).filter((w) => w.code === 'W005');
|
||||
@@ -1110,7 +1110,7 @@ describe('Drift item W005 — phaseDirNameRe: 999.X-name dirs must not trigger W
|
||||
});
|
||||
|
||||
test('phaseDirNameRe is exported from validate.cjs', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
assert.ok(gen.phaseDirNameRe instanceof RegExp,
|
||||
'validate.cjs must export phaseDirNameRe as a RegExp');
|
||||
const re = gen.phaseDirNameRe;
|
||||
@@ -1133,7 +1133,7 @@ describe('W023 — colliding phase directories (issue #2408)', () => {
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-2408-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-2408-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir, '1.0');
|
||||
@@ -1156,10 +1156,10 @@ describe('W023 — colliding phase directories (issue #2408)', () => {
|
||||
fs.mkdirSync(realDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(realDir, '01-01-PLAN.md'), '# Plan');
|
||||
fs.writeFileSync(path.join(realDir, '01-01-SUMMARY.md'), '# Summary');
|
||||
// Real convention is `*-VERIFICATION.md` (gsd-core/workflows/verify-work.md:573's
|
||||
// Real convention is `*-VERIFICATION.md` (msd-core/workflows/verify-work.md:573's
|
||||
// `ls "${PHASE_DIR}"/*-VERIFICATION.md` glob; verification.cts:425's
|
||||
// `readVerificationStatus` matches the same `-VERIFICATION.md` suffix) — a bare
|
||||
// `VERIFICATION.md` with no prefix is never produced by /gsd-verify-work and is
|
||||
// `VERIFICATION.md` with no prefix is never produced by /msd-verify-work and is
|
||||
// invisible to the canonical reader `isPhaseComplete` now sources this rule from.
|
||||
fs.writeFileSync(path.join(realDir, '05-real-VERIFICATION.md'), '---\nstatus: passed\n---\n# Verified');
|
||||
|
||||
@@ -1170,7 +1170,7 @@ describe('W023 — colliding phase directories (issue #2408)', () => {
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('emits W023 naming both colliding directories and their statuses', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w023 = (data.warnings ?? []).filter((w) => w.code === 'W023');
|
||||
@@ -1198,8 +1198,8 @@ describe('W023 — colliding phase directories (issue #2408)', () => {
|
||||
// what keeps the comma-separated order stable. fs.readdirSync order is
|
||||
// non-deterministic across platforms; without the tie-break, this test
|
||||
// could flake on some hosts. Run twice and assert identical output.
|
||||
const r1 = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const r2 = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const r1 = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const r2 = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(r1.success && r2.success, true);
|
||||
const m1 = JSON.parse(r1.output).warnings.find((w) => w.code === 'W023').message;
|
||||
const m2 = JSON.parse(r2.output).warnings.find((w) => w.code === 'W023').message;
|
||||
@@ -1211,7 +1211,7 @@ describe('W023 — colliding phase directories (issue #2408)', () => {
|
||||
|
||||
test('does NOT emit W023 when no collision exists (single dir per key)', () => {
|
||||
// Fresh tree with a single non-colliding dir.
|
||||
const clean = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-2408-clean-'));
|
||||
const clean = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-2408-clean-'));
|
||||
const { planningDir, phasesDir } = mkplanning(clean);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir, '1.0');
|
||||
@@ -1226,7 +1226,7 @@ describe('W023 — colliding phase directories (issue #2408)', () => {
|
||||
fs.writeFileSync(path.join(realDir, '01-01-SUMMARY.md'), '# Summary');
|
||||
|
||||
try {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], clean);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], clean);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w023 = (data.warnings ?? []).filter((w) => w.code === 'W023');
|
||||
@@ -1252,7 +1252,7 @@ describe('Drift item W006-archived — MILESTONE_ARCHIVE_DIR_RE and PHASE_TOKEN_
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-26-d2-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-26-d2-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir, '65');
|
||||
@@ -1292,7 +1292,7 @@ describe('Drift item W006-archived — MILESTONE_ARCHIVE_DIR_RE and PHASE_TOKEN_
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('no W006 for Phase 64 archived under milestones/v1.0-phases/', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const w006 = (data.warnings ?? []).filter(
|
||||
@@ -1303,7 +1303,7 @@ describe('Drift item W006-archived — MILESTONE_ARCHIVE_DIR_RE and PHASE_TOKEN_
|
||||
});
|
||||
|
||||
test('MILESTONE_ARCHIVE_DIR_RE is exported and matches vN.N-phases dirs', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
assert.ok(gen.MILESTONE_ARCHIVE_DIR_RE instanceof RegExp,
|
||||
'validate.cjs must export MILESTONE_ARCHIVE_DIR_RE');
|
||||
const re = gen.MILESTONE_ARCHIVE_DIR_RE;
|
||||
@@ -1314,7 +1314,7 @@ describe('Drift item W006-archived — MILESTONE_ARCHIVE_DIR_RE and PHASE_TOKEN_
|
||||
});
|
||||
|
||||
test('PHASE_TOKEN_FROM_DIR_RE is exported and extracts phase tokens correctly', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
assert.ok(gen.PHASE_TOKEN_FROM_DIR_RE instanceof RegExp,
|
||||
'validate.cjs must export PHASE_TOKEN_FROM_DIR_RE');
|
||||
const re = gen.PHASE_TOKEN_FROM_DIR_RE;
|
||||
@@ -1328,7 +1328,7 @@ describe('Drift item W006-archived — MILESTONE_ARCHIVE_DIR_RE and PHASE_TOKEN_
|
||||
});
|
||||
|
||||
test('PHASE_TOKEN_FROM_DIR_RE rejects a single-digit slug word after a phase number (#2043)', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
const re = gen.PHASE_TOKEN_FROM_DIR_RE;
|
||||
// Roadmap phase name "6 Rs Pipeline Orchestrator" slugifies to
|
||||
// "6-rs-pipeline-orchestrator"; the resulting dir "46-6-rs-pipeline-orchestrator"
|
||||
@@ -1358,7 +1358,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
let tmpDir;
|
||||
|
||||
before(() => {
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-26-d3-'));
|
||||
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'msd-26-d3-'));
|
||||
const { planningDir, phasesDir } = mkplanning(tmpDir);
|
||||
writeProjectMd(planningDir);
|
||||
writeStateMd(planningDir, '68');
|
||||
@@ -1380,7 +1380,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
after(() => { cleanup(tmpDir); });
|
||||
|
||||
test('no I001 when 68-01-scaffolding-PLAN.md matches 68-01-SUMMARY.md via canonicalPlanStem', () => {
|
||||
const result = runGsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
const result = runMsdTools(['validate', 'health', '--json'], tmpDir);
|
||||
assert.strictEqual(result.success, true, `unexpected failure: ${result.error}`);
|
||||
const data = JSON.parse(result.output);
|
||||
const i001 = (data.info ?? []).filter((i) => i.code === 'I001');
|
||||
@@ -1389,7 +1389,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
});
|
||||
|
||||
test('canonicalPlanStem is exported from validate.cjs', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
assert.strictEqual(typeof gen.canonicalPlanStem, 'function',
|
||||
'validate.cjs must export canonicalPlanStem as a function');
|
||||
assert.strictEqual(gen.canonicalPlanStem('68-01-scaffolding'), '68-01');
|
||||
@@ -1399,7 +1399,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
});
|
||||
|
||||
test('canonicalPlanStem rejects a single-digit slug word after a phase number (#2043)', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
// "46-6-rs-pipeline-orchestrator" is not a valid PLAN stem shape (the "6"
|
||||
// is a slug word, not a sub-phase segment), so it must return the input
|
||||
// unchanged rather than the pre-fix, buggy "46-6".
|
||||
@@ -1411,7 +1411,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
});
|
||||
|
||||
test('PHASE_TOKEN_FROM_DIR_RE rejects a ≥3-digit slug word after a phase number (#2232)', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
const re = gen.PHASE_TOKEN_FROM_DIR_RE;
|
||||
// Dir "14-2026-photos-performance" (roadmap phase name "2026 Photos &
|
||||
// Performance") must extract token "14", not "14-2026" — the year is the
|
||||
@@ -1423,7 +1423,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
});
|
||||
|
||||
test('PHASE_TOKEN_FROM_DIR_RE reads a 2-digit segment literally, whatever follows (#2528)', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
const re = gen.PHASE_TOKEN_FROM_DIR_RE;
|
||||
// A 1-digit word after the continuation is not evidence about the
|
||||
// continuation: "10-24-7-autonomy" (phase 10, slug "24/7 Autonomy") and
|
||||
@@ -1435,7 +1435,7 @@ describe('Drift item I001 — canonicalPlanStem: long PLAN stem matches short SU
|
||||
});
|
||||
|
||||
test('canonicalPlanStem does not pair a ≥3-digit slug word (#2232)', () => {
|
||||
const gen = require('../gsd-core/bin/lib/validate.cjs');
|
||||
const gen = require('../msd-core/bin/lib/validate.cjs');
|
||||
// A year-leading slug is not a plan component: the stem is returned
|
||||
// unchanged rather than the bogus "14-2026".
|
||||
assert.strictEqual(
|
||||
@@ -1490,7 +1490,7 @@ const assert = require('node:assert/strict');
|
||||
const {
|
||||
buildRoadmapPhaseVariants,
|
||||
buildNotStartedPhaseVariants,
|
||||
} = require('../gsd-core/bin/lib/validate.cjs');
|
||||
} = require('../msd-core/bin/lib/validate.cjs');
|
||||
|
||||
/**
|
||||
* NOT a subprocess spawn timeout. This is `node:test`'s own per-test
|
||||
@@ -1528,10 +1528,10 @@ describe('buildRoadmapPhaseVariants — behavior preservation (#663)', () => {
|
||||
assert.ok(roadmapPhases.has('2-01'), 'roadmapPhases should contain "2-01"');
|
||||
});
|
||||
|
||||
test('matches bracket-prefixed heading ([GSD] Phase 3.2:)', () => {
|
||||
test('matches bracket-prefixed heading ([MSD] Phase 3.2:)', () => {
|
||||
const content = [
|
||||
'# Roadmap',
|
||||
'### [GSD] Phase 3.2: Baz',
|
||||
'### [MSD] Phase 3.2: Baz',
|
||||
].join('\n');
|
||||
|
||||
const { roadmapPhases } = buildRoadmapPhaseVariants(content);
|
||||
@@ -1543,7 +1543,7 @@ describe('buildRoadmapPhaseVariants — behavior preservation (#663)', () => {
|
||||
'# Roadmap',
|
||||
'## Phase 1: Alpha',
|
||||
'### Phase 2-01: Beta',
|
||||
'### [GSD] Phase 3.2: Gamma',
|
||||
'### [MSD] Phase 3.2: Gamma',
|
||||
].join('\n');
|
||||
|
||||
const { roadmapPhases } = buildRoadmapPhaseVariants(content);
|
||||
@@ -1656,10 +1656,10 @@ const { describe, test, beforeEach, afterEach } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { runGsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, createTempProject, cleanup } = require('./helpers.cjs');
|
||||
const {
|
||||
buildRoadmapPhaseVariants,
|
||||
} = require('../gsd-core/bin/lib/validate.cjs');
|
||||
} = require('../msd-core/bin/lib/validate.cjs');
|
||||
|
||||
// ─── A: Unit-level ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -1803,7 +1803,7 @@ describe('validate health — checklist-style roadmap phases must not emit W007
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-infrastructure-hardening'), { recursive: true });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '02-feature-work'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -1844,7 +1844,7 @@ describe('validate health — checklist-style roadmap phases must not emit W007
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-known-phase'), { recursive: true });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '99-orphan'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate health', tmpDir);
|
||||
const result = runMsdTools('validate health', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -1908,7 +1908,7 @@ describe('validate consistency — checklist-style roadmap phases must not emit
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '01-infrastructure-hardening'), { recursive: true });
|
||||
fs.mkdirSync(path.join(tmpDir, '.planning', 'phases', '02-feature-work'), { recursive: true });
|
||||
|
||||
const result = runGsdTools('validate consistency', tmpDir);
|
||||
const result = runMsdTools('validate consistency', tmpDir);
|
||||
assert.ok(result.success, `Command failed: ${result.error}`);
|
||||
|
||||
const output = JSON.parse(result.output);
|
||||
@@ -1942,11 +1942,11 @@ describe('W024 — STATE.md commit-age freshness advisory (#2573)', () => {
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const { runGsdTools, cleanup } = require('./helpers.cjs');
|
||||
const { runMsdTools, cleanup } = require('./helpers.cjs');
|
||||
const { runGit, OUTCOME } = require('./helpers/process-seam.cjs');
|
||||
const {
|
||||
STATE_HEAD_ADVISORY_COMMITS,
|
||||
} = require('../gsd-core/bin/lib/verify.cjs');
|
||||
} = require('../msd-core/bin/lib/verify.cjs');
|
||||
|
||||
const dirs = [];
|
||||
const track = (d) => { dirs.push(d); return d; };
|
||||
@@ -1972,7 +1972,7 @@ describe('W024 — STATE.md commit-age freshness advisory (#2573)', () => {
|
||||
}
|
||||
|
||||
function project({ commitsAhead, stateHead = 'BASE' }) {
|
||||
const base = track(fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-2573-h-')));
|
||||
const base = track(fs.mkdtempSync(path.join(os.tmpdir(), 'msd-2573-h-')));
|
||||
const planningDir = path.join(base, '.planning');
|
||||
fs.mkdirSync(path.join(planningDir, 'phases'), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
@@ -2037,7 +2037,7 @@ describe('W024 — STATE.md commit-age freshness advisory (#2573)', () => {
|
||||
}
|
||||
|
||||
function health(dir) {
|
||||
const r = runGsdTools(['validate', 'health', '--json'], dir);
|
||||
const r = runMsdTools(['validate', 'health', '--json'], dir);
|
||||
assert.strictEqual(r.success, true, `unexpected failure: ${r.error}`);
|
||||
return JSON.parse(r.output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user