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 - reapply-patches backup logic
|
||||
* MSD Tools Tests - reapply-patches backup logic
|
||||
*
|
||||
* Validates that saveLocalPatches() in the installer correctly detects
|
||||
* user-modified files and saves pristine hashes for three-way merge.
|
||||
@@ -20,10 +20,10 @@ function sha256(content) {
|
||||
}
|
||||
|
||||
const { cleanup } = require('./helpers.cjs');
|
||||
const { collectSection } = require('../gsd-core/bin/lib/markdown-sectionizer.cjs');
|
||||
const { collectSection } = require('../msd-core/bin/lib/markdown-sectionizer.cjs');
|
||||
|
||||
function createTempDir() {
|
||||
return fs.mkdtempSync(path.join(require('os').tmpdir(), 'gsd-patch-test-'));
|
||||
return fs.mkdtempSync(path.join(require('os').tmpdir(), 'msd-patch-test-'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ function createTempDir() {
|
||||
* then run the saveLocalPatches detection logic.
|
||||
*/
|
||||
function simulateManifestAndPatch(configDir, files) {
|
||||
// Create the GSD files
|
||||
// Create the MSD files
|
||||
for (const [relPath, content] of Object.entries(files.original)) {
|
||||
const fullPath = path.join(configDir, relPath);
|
||||
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
||||
@@ -48,7 +48,7 @@ function simulateManifestAndPatch(configDir, files) {
|
||||
manifest.files[relPath] = sha256(content);
|
||||
}
|
||||
fs.writeFileSync(
|
||||
path.join(configDir, 'gsd-file-manifest.json'),
|
||||
path.join(configDir, 'msd-file-manifest.json'),
|
||||
JSON.stringify(manifest, null, 2)
|
||||
);
|
||||
|
||||
@@ -68,8 +68,8 @@ function fileHash(filePath) {
|
||||
}
|
||||
|
||||
function saveLocalPatches(configDir) {
|
||||
const PATCHES_DIR_NAME = 'gsd-local-patches';
|
||||
const MANIFEST_NAME = 'gsd-file-manifest.json';
|
||||
const PATCHES_DIR_NAME = 'msd-local-patches';
|
||||
const MANIFEST_NAME = 'msd-file-manifest.json';
|
||||
const manifestPath = path.join(configDir, MANIFEST_NAME);
|
||||
if (!fs.existsSync(manifestPath)) return [];
|
||||
|
||||
@@ -123,21 +123,21 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
test('detects modified files and backs them up', () => {
|
||||
simulateManifestAndPatch(tmpDir, {
|
||||
original: {
|
||||
'gsd-core/workflows/execute-phase.md': '# Execute Phase\nOriginal content\n',
|
||||
'gsd-core/workflows/plan-phase.md': '# Plan Phase\nOriginal content\n',
|
||||
'msd-core/workflows/execute-phase.md': '# Execute Phase\nOriginal content\n',
|
||||
'msd-core/workflows/plan-phase.md': '# Plan Phase\nOriginal content\n',
|
||||
},
|
||||
modified: {
|
||||
'gsd-core/workflows/execute-phase.md': '# Execute Phase\nOriginal content\n\n## My Custom Step\nDo something special\n',
|
||||
'msd-core/workflows/execute-phase.md': '# Execute Phase\nOriginal content\n\n## My Custom Step\nDo something special\n',
|
||||
},
|
||||
});
|
||||
|
||||
const result = saveLocalPatches(tmpDir);
|
||||
|
||||
assert.strictEqual(result.length, 1, 'should detect exactly one modified file');
|
||||
assert.ok(result.includes('gsd-core/workflows/execute-phase.md'));
|
||||
assert.ok(result.includes('msd-core/workflows/execute-phase.md'));
|
||||
|
||||
// Verify backup exists
|
||||
const backupPath = path.join(tmpDir, 'gsd-local-patches', 'gsd-core/workflows/execute-phase.md');
|
||||
const backupPath = path.join(tmpDir, 'msd-local-patches', 'msd-core/workflows/execute-phase.md');
|
||||
assert.ok(fs.existsSync(backupPath), 'backup file should exist');
|
||||
|
||||
const backupContent = fs.readFileSync(backupPath, 'utf8');
|
||||
@@ -148,16 +148,16 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
const originalContent = '# Execute Phase\nOriginal content\n';
|
||||
simulateManifestAndPatch(tmpDir, {
|
||||
original: {
|
||||
'gsd-core/workflows/execute-phase.md': originalContent,
|
||||
'msd-core/workflows/execute-phase.md': originalContent,
|
||||
},
|
||||
modified: {
|
||||
'gsd-core/workflows/execute-phase.md': originalContent + '\n## Custom\n',
|
||||
'msd-core/workflows/execute-phase.md': originalContent + '\n## Custom\n',
|
||||
},
|
||||
});
|
||||
|
||||
saveLocalPatches(tmpDir);
|
||||
|
||||
const metaPath = path.join(tmpDir, 'gsd-local-patches', 'backup-meta.json');
|
||||
const metaPath = path.join(tmpDir, 'msd-local-patches', 'backup-meta.json');
|
||||
assert.ok(fs.existsSync(metaPath), 'backup-meta.json should exist');
|
||||
|
||||
const meta = JSON.parse(fs.readFileSync(metaPath, 'utf8'));
|
||||
@@ -166,7 +166,7 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
assert.ok(meta.pristine_hashes, 'meta should have pristine_hashes field');
|
||||
const expectedHash = sha256(originalContent);
|
||||
assert.strictEqual(
|
||||
meta.pristine_hashes['gsd-core/workflows/execute-phase.md'],
|
||||
meta.pristine_hashes['msd-core/workflows/execute-phase.md'],
|
||||
expectedHash,
|
||||
'pristine hash should match SHA-256 of original file content'
|
||||
);
|
||||
@@ -174,14 +174,14 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
|
||||
test('backup-meta.json includes from_version and from_manifest_timestamp', () => {
|
||||
simulateManifestAndPatch(tmpDir, {
|
||||
original: { 'gsd-core/workflows/test.md': 'original' },
|
||||
modified: { 'gsd-core/workflows/test.md': 'modified' },
|
||||
original: { 'msd-core/workflows/test.md': 'original' },
|
||||
modified: { 'msd-core/workflows/test.md': 'modified' },
|
||||
});
|
||||
|
||||
saveLocalPatches(tmpDir);
|
||||
|
||||
const meta = JSON.parse(fs.readFileSync(
|
||||
path.join(tmpDir, 'gsd-local-patches', 'backup-meta.json'), 'utf8'
|
||||
path.join(tmpDir, 'msd-local-patches', 'backup-meta.json'), 'utf8'
|
||||
));
|
||||
|
||||
assert.strictEqual(meta.from_version, '1.0.0');
|
||||
@@ -192,27 +192,27 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
test('unmodified files are not backed up', () => {
|
||||
simulateManifestAndPatch(tmpDir, {
|
||||
original: {
|
||||
'gsd-core/workflows/a.md': 'content A',
|
||||
'gsd-core/workflows/b.md': 'content B',
|
||||
'msd-core/workflows/a.md': 'content A',
|
||||
'msd-core/workflows/b.md': 'content B',
|
||||
},
|
||||
// No modifications
|
||||
});
|
||||
|
||||
const result = saveLocalPatches(tmpDir);
|
||||
assert.strictEqual(result.length, 0, 'no files should be detected as modified');
|
||||
assert.ok(!fs.existsSync(path.join(tmpDir, 'gsd-local-patches')), 'patches dir should not be created');
|
||||
assert.ok(!fs.existsSync(path.join(tmpDir, 'msd-local-patches')), 'patches dir should not be created');
|
||||
});
|
||||
|
||||
test('multiple modified files all get pristine hashes', () => {
|
||||
simulateManifestAndPatch(tmpDir, {
|
||||
original: {
|
||||
'gsd-core/workflows/a.md': 'original A',
|
||||
'gsd-core/workflows/b.md': 'original B',
|
||||
'gsd-core/workflows/c.md': 'original C',
|
||||
'msd-core/workflows/a.md': 'original A',
|
||||
'msd-core/workflows/b.md': 'original B',
|
||||
'msd-core/workflows/c.md': 'original C',
|
||||
},
|
||||
modified: {
|
||||
'gsd-core/workflows/a.md': 'modified A',
|
||||
'gsd-core/workflows/b.md': 'modified B',
|
||||
'msd-core/workflows/a.md': 'modified A',
|
||||
'msd-core/workflows/b.md': 'modified B',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -220,14 +220,14 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
assert.strictEqual(result.length, 2);
|
||||
|
||||
const meta = JSON.parse(fs.readFileSync(
|
||||
path.join(tmpDir, 'gsd-local-patches', 'backup-meta.json'), 'utf8'
|
||||
path.join(tmpDir, 'msd-local-patches', 'backup-meta.json'), 'utf8'
|
||||
));
|
||||
|
||||
assert.strictEqual(Object.keys(meta.pristine_hashes).length, 2);
|
||||
assert.strictEqual(meta.pristine_hashes['gsd-core/workflows/a.md'], sha256('original A'));
|
||||
assert.strictEqual(meta.pristine_hashes['gsd-core/workflows/b.md'], sha256('original B'));
|
||||
assert.strictEqual(meta.pristine_hashes['msd-core/workflows/a.md'], sha256('original A'));
|
||||
assert.strictEqual(meta.pristine_hashes['msd-core/workflows/b.md'], sha256('original B'));
|
||||
// c.md should NOT have a pristine hash (it wasn't modified)
|
||||
assert.strictEqual(meta.pristine_hashes['gsd-core/workflows/c.md'], undefined);
|
||||
assert.strictEqual(meta.pristine_hashes['msd-core/workflows/c.md'], undefined);
|
||||
});
|
||||
|
||||
test('returns empty array when no manifest exists', () => {
|
||||
@@ -236,7 +236,7 @@ describe('saveLocalPatches — patch backup and pristine hash tracking (#1469)',
|
||||
});
|
||||
|
||||
test('returns empty array when manifest is malformed', () => {
|
||||
fs.writeFileSync(path.join(tmpDir, 'gsd-file-manifest.json'), 'not json');
|
||||
fs.writeFileSync(path.join(tmpDir, 'msd-file-manifest.json'), 'not json');
|
||||
const result = saveLocalPatches(tmpDir);
|
||||
assert.strictEqual(result.length, 0);
|
||||
});
|
||||
@@ -296,7 +296,7 @@ function parsePipeTable(content, expectedHeaderTokens) {
|
||||
|
||||
describe('reapply-patches workflow contract (#1469)', () => {
|
||||
test('reapply-patches.md command file is deleted (absorbed into update.md --reapply, #2790)', () => {
|
||||
const oldPath = path.join(__dirname, '..', 'commands', 'gsd', 'reapply-patches.md');
|
||||
const oldPath = path.join(__dirname, '..', 'commands', 'msd', 'reapply-patches.md');
|
||||
assert.ok(!fs.existsSync(oldPath), 'reapply-patches.md should be deleted (absorbed into update.md)');
|
||||
});
|
||||
|
||||
@@ -304,7 +304,7 @@ describe('reapply-patches workflow contract (#1469)', () => {
|
||||
// Structural: parse frontmatter, then tokenize the argument-hint pipes
|
||||
// and assert --reapply is one of the documented flags (no raw substring
|
||||
// matching on prose, per the no-source-grep contract).
|
||||
const updatePath = path.join(__dirname, '..', 'commands', 'gsd', 'update.md');
|
||||
const updatePath = path.join(__dirname, '..', 'commands', 'msd', 'update.md');
|
||||
const content = fs.readFileSync(updatePath, 'utf8');
|
||||
const argHint = parseFrontmatterField(content, 'argument-hint');
|
||||
assert.ok(argHint, 'update.md frontmatter must declare argument-hint');
|
||||
@@ -326,7 +326,7 @@ describe('reapply-patches workflow contract (#1469)', () => {
|
||||
// blocks for an `@~/.../workflows/reapply-patches.md` include. The earlier
|
||||
// substring check tolerated incidental mentions in prose; matching only the
|
||||
// first context block missed the _extended block where the delegate lives.
|
||||
const updatePath = path.join(__dirname, '..', 'commands', 'gsd', 'update.md');
|
||||
const updatePath = path.join(__dirname, '..', 'commands', 'msd', 'update.md');
|
||||
const content = fs.readFileSync(updatePath, 'utf8');
|
||||
const blocks = [
|
||||
// eslint-disable-next-line local/no-unbounded-quantifier -- parses this repo's own command .md content, fixed-size author-controlled content
|
||||
@@ -348,17 +348,17 @@ describe('reapply-patches workflow contract (#1469)', () => {
|
||||
|
||||
// #2790: reapply-patches.md (the command file which contained the inline workflow)
|
||||
// was deleted. The hunk verification contract now lives in the workflow file
|
||||
// gsd-core/workflows/reapply-patches.md, referenced via execution_context_extended.
|
||||
// msd-core/workflows/reapply-patches.md, referenced via execution_context_extended.
|
||||
describe('reapply-patches gated hunk verification (#1999)', () => {
|
||||
const workflowPath = path.join(__dirname, '..', 'gsd-core', 'workflows', 'reapply-patches.md');
|
||||
const workflowPath = path.join(__dirname, '..', 'msd-core', 'workflows', 'reapply-patches.md');
|
||||
|
||||
test('reapply-patches.md command is deleted and absorbed into update.md (#2790)', () => {
|
||||
const oldPath = path.join(__dirname, '..', 'commands', 'gsd', 'reapply-patches.md');
|
||||
const oldPath = path.join(__dirname, '..', 'commands', 'msd', 'reapply-patches.md');
|
||||
assert.ok(!fs.existsSync(oldPath), 'reapply-patches.md should be absent (absorbed into update.md --reapply)');
|
||||
});
|
||||
|
||||
test('reapply-patches workflow file exists (behavioral contract for --reapply)', () => {
|
||||
assert.ok(fs.existsSync(workflowPath), 'gsd-core/workflows/reapply-patches.md must exist');
|
||||
assert.ok(fs.existsSync(workflowPath), 'msd-core/workflows/reapply-patches.md must exist');
|
||||
});
|
||||
|
||||
test('Step 4 declares a Hunk Verification Table with all required columns', () => {
|
||||
@@ -430,7 +430,7 @@ describe('reapply-patches gated hunk verification (#1999)', () => {
|
||||
*
|
||||
* The three-way merge baseline detection previously used `git log --diff-filter=A`
|
||||
* which returns the commit that FIRST added the file. On repos that have been
|
||||
* through multiple GSD update cycles, this returns a stale, many-versions-old
|
||||
* through multiple MSD update cycles, this returns a stale, many-versions-old
|
||||
* baseline — not the version immediately prior to the current update.
|
||||
*
|
||||
* Fix: Option A must prefer `pristine_hashes` from backup-meta.json to locate
|
||||
@@ -444,7 +444,7 @@ describe('reapply-patches gated hunk verification (#1999)', () => {
|
||||
*/
|
||||
|
||||
// allow-test-rule: source-text-is-the-product (see #2424)
|
||||
// gsd-core/workflows/update.md is the installed runtime workflow —
|
||||
// msd-core/workflows/update.md is the installed runtime workflow —
|
||||
// its text IS the deployed behavioral contract.
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
@@ -454,7 +454,7 @@ const path = require('path');
|
||||
|
||||
// #2790: reapply-patches.md (command with inline workflow) was deleted.
|
||||
// The --reapply functionality is now in update.md.
|
||||
const UPDATE_MD = path.join(__dirname, '..', 'commands', 'gsd', 'update.md');
|
||||
const UPDATE_MD = path.join(__dirname, '..', 'commands', 'msd', 'update.md');
|
||||
|
||||
/**
|
||||
* Parse a field from YAML frontmatter between --- markers.
|
||||
@@ -473,7 +473,7 @@ function parseFrontmatterField(content, field) {
|
||||
|
||||
describe('reapply-patches pristine baseline detection (#2424)', () => {
|
||||
test('reapply-patches.md command is deleted (absorbed into update.md --reapply, #2790)', () => {
|
||||
const oldPath = path.join(__dirname, '..', 'commands', 'gsd', 'reapply-patches.md');
|
||||
const oldPath = path.join(__dirname, '..', 'commands', 'msd', 'reapply-patches.md');
|
||||
assert.ok(!fs.existsSync(oldPath), 'reapply-patches.md should be absent (absorbed into update.md --reapply)');
|
||||
});
|
||||
|
||||
@@ -488,14 +488,14 @@ describe('reapply-patches pristine baseline detection (#2424)', () => {
|
||||
|
||||
test('update.md workflow references backup-meta.json for pristine-hash baseline', () => {
|
||||
// #2790: The behavioral contract (pristine_hashes from backup-meta.json as primary
|
||||
// baseline source) is implemented in the update.md workflow (gsd-core/workflows/update.md),
|
||||
// baseline source) is implemented in the update.md workflow (msd-core/workflows/update.md),
|
||||
// not the command file. The command delegates via --reapply flag.
|
||||
// Verify the underlying workflow has this content.
|
||||
const workflowPath = path.join(__dirname, '..', 'gsd-core', 'workflows', 'update.md');
|
||||
const workflowPath = path.join(__dirname, '..', 'msd-core', 'workflows', 'update.md');
|
||||
const workflowContent = fs.readFileSync(workflowPath, 'utf-8');
|
||||
assert.ok(
|
||||
workflowContent.includes('backup-meta.json'),
|
||||
'gsd-core/workflows/update.md must reference backup-meta.json (pristine_hashes baseline source)'
|
||||
'msd-core/workflows/update.md must reference backup-meta.json (pristine_hashes baseline source)'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -518,28 +518,28 @@ describe('reapply-patches pristine baseline detection (#2424)', () => {
|
||||
}
|
||||
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
// Folded from tests/bug-3516-reapply-patches-gsd-update-filter.test.cjs — consolidation epic #1969 (B4 #1973)
|
||||
// Folded from tests/bug-3516-reapply-patches-msd-update-filter.test.cjs — consolidation epic #1969 (B4 #1973)
|
||||
// ────────────────────────────────────────────────────────────────────────
|
||||
{
|
||||
const { describe: __foldDescribe } = require('node:test');
|
||||
__foldDescribe("folded:bug-3516-reapply-patches-gsd-update-filter (consolidation epic #1969 B4 #1973)", () => {
|
||||
__foldDescribe("folded:bug-3516-reapply-patches-msd-update-filter (consolidation epic #1969 B4 #1973)", () => {
|
||||
// allow-test-rule: source-text-is-the-product (see #3516)
|
||||
// gsd-core/workflows/reapply-patches.md is the installed runtime workflow —
|
||||
// msd-core/workflows/reapply-patches.md is the installed runtime workflow —
|
||||
// its text IS the deployed behavioral contract for the --reapply flag.
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Bug #3516: reapply-patches.md git-enhanced two-way merge filter misses
|
||||
* commits authored by the renamed `/gsd-update` flow.
|
||||
* commits authored by the renamed `/msd-update` flow.
|
||||
*
|
||||
* The `grep -v` alternation on line 231 only included the legacy `gsd:update`
|
||||
* marker. After the slash-command rename `/gsd:update` → `/gsd-update`, commits
|
||||
* The `grep -v` alternation on line 231 only included the legacy `msd:update`
|
||||
* marker. After the slash-command rename `/msd:update` → `/msd-update`, commits
|
||||
* authored by the current flow fall through the filter and are misclassified as
|
||||
* user customizations, prompting spurious merge conflicts during `--reapply`.
|
||||
*
|
||||
* Fix: add `gsd-update` arm to the alternation so both the legacy and current
|
||||
* commit-message prefixes are excluded. `GSD update` and `gsd-install`
|
||||
* Fix: add `msd-update` arm to the alternation so both the legacy and current
|
||||
* commit-message prefixes are excluded. `MSD update` and `msd-install`
|
||||
* exclusions are preserved.
|
||||
*
|
||||
* Per the repo's source-text-is-the-product exception: the workflow file's text
|
||||
@@ -555,7 +555,7 @@ const path = require('node:path');
|
||||
const WORKFLOW_PATH = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'gsd-core',
|
||||
'msd-core',
|
||||
'workflows',
|
||||
'reapply-patches.md',
|
||||
);
|
||||
@@ -583,7 +583,7 @@ function parseAlternationArms(alternation) {
|
||||
return alternation.split(/\\\|/).map((arm) => arm.trim());
|
||||
}
|
||||
|
||||
describe('Bug #3516: git-enhanced two-way merge filter includes gsd-update arm', () => {
|
||||
describe('Bug #3516: git-enhanced two-way merge filter includes msd-update arm', () => {
|
||||
let content;
|
||||
let alternation;
|
||||
let arms;
|
||||
@@ -597,7 +597,7 @@ describe('Bug #3516: git-enhanced two-way merge filter includes gsd-update arm',
|
||||
test('workflow file exists', () => {
|
||||
assert.ok(
|
||||
fs.existsSync(WORKFLOW_PATH),
|
||||
'gsd-core/workflows/reapply-patches.md must exist',
|
||||
'msd-core/workflows/reapply-patches.md must exist',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -608,36 +608,36 @@ describe('Bug #3516: git-enhanced two-way merge filter includes gsd-update arm',
|
||||
);
|
||||
});
|
||||
|
||||
test('filter excludes legacy gsd:update commits (back-compat)', () => {
|
||||
test('filter excludes legacy msd:update commits (back-compat)', () => {
|
||||
assert.ok(
|
||||
arms.some((arm) => arm === 'gsd:update'),
|
||||
`filter must include 'gsd:update' arm for back-compat; got arms: ${JSON.stringify(arms)}`,
|
||||
arms.some((arm) => arm === 'msd:update'),
|
||||
`filter must include 'msd:update' arm for back-compat; got arms: ${JSON.stringify(arms)}`,
|
||||
);
|
||||
});
|
||||
|
||||
test('filter excludes renamed gsd-update commits (primary fix)', () => {
|
||||
test('filter excludes renamed msd-update commits (primary fix)', () => {
|
||||
assert.ok(
|
||||
arms.some((arm) => arm === 'gsd-update'),
|
||||
`filter must include 'gsd-update' arm (renamed flow); got arms: ${JSON.stringify(arms)}`,
|
||||
arms.some((arm) => arm === 'msd-update'),
|
||||
`filter must include 'msd-update' arm (renamed flow); got arms: ${JSON.stringify(arms)}`,
|
||||
);
|
||||
});
|
||||
|
||||
test('filter excludes GSD update commits (no regression)', () => {
|
||||
test('filter excludes MSD update commits (no regression)', () => {
|
||||
assert.ok(
|
||||
arms.some((arm) => arm === 'GSD update'),
|
||||
`filter must include 'GSD update' arm; got arms: ${JSON.stringify(arms)}`,
|
||||
arms.some((arm) => arm === 'MSD update'),
|
||||
`filter must include 'MSD update' arm; got arms: ${JSON.stringify(arms)}`,
|
||||
);
|
||||
});
|
||||
|
||||
test('filter excludes gsd-install commits (no regression)', () => {
|
||||
test('filter excludes msd-install commits (no regression)', () => {
|
||||
assert.ok(
|
||||
arms.some((arm) => arm === 'gsd-install'),
|
||||
`filter must include 'gsd-install' arm; got arms: ${JSON.stringify(arms)}`,
|
||||
arms.some((arm) => arm === 'msd-install'),
|
||||
`filter must include 'msd-install' arm; got arms: ${JSON.stringify(arms)}`,
|
||||
);
|
||||
});
|
||||
|
||||
test('all four expected exclusion patterns are present in the filter', () => {
|
||||
const required = ['gsd:update', 'gsd-update', 'GSD update', 'gsd-install'];
|
||||
const required = ['msd:update', 'msd-update', 'MSD update', 'msd-install'];
|
||||
const missing = required.filter((p) => !arms.some((arm) => arm === p));
|
||||
assert.deepEqual(
|
||||
missing,
|
||||
@@ -657,18 +657,18 @@ describe('Bug #3516: git-enhanced two-way merge filter includes gsd-update arm',
|
||||
__foldDescribe("folded:bug-2994-verify-reapply-patches-installed-path (consolidation epic #1969 B5 #1974)", () => {
|
||||
'use strict';
|
||||
|
||||
process.env.GSD_TEST_MODE = '1';
|
||||
process.env.MSD_TEST_MODE = '1';
|
||||
|
||||
/**
|
||||
* Bug #2994: scripts/verify-reapply-patches.cjs ships in tarball but is
|
||||
* not installed at ${GSD_HOME}/scripts/.
|
||||
* not installed at ${MSD_HOME}/scripts/.
|
||||
*
|
||||
* Root cause: bin/install.js copies the gsd-core/ source tree to
|
||||
* ${configDir}/gsd-core/ but does NOT copy the top-level scripts/
|
||||
* directory. The verifier script lived under scripts/ so /gsd-reapply-patches
|
||||
* Root cause: bin/install.js copies the msd-core/ source tree to
|
||||
* ${configDir}/msd-core/ but does NOT copy the top-level scripts/
|
||||
* directory. The verifier script lived under scripts/ so /msd-reapply-patches
|
||||
* Step 5 hit `Cannot find module …/scripts/verify-reapply-patches.cjs`.
|
||||
*
|
||||
* Fix: move the script to gsd-core/bin/verify-reapply-patches.cjs
|
||||
* Fix: move the script to msd-core/bin/verify-reapply-patches.cjs
|
||||
* (which IS installed) and update reapply-patches.md to point there.
|
||||
*
|
||||
* This test enforces the structural invariant that prevents regression.
|
||||
@@ -680,19 +680,19 @@ const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const RUNTIME_SCRIPT_PATH = path.join(ROOT, 'gsd-core', 'bin', 'verify-reapply-patches.cjs');
|
||||
const RUNTIME_SCRIPT_PATH = path.join(ROOT, 'msd-core', 'bin', 'verify-reapply-patches.cjs');
|
||||
const STALE_SCRIPT_PATH = path.join(ROOT, 'scripts', 'verify-reapply-patches.cjs');
|
||||
const REAPPLY_WORKFLOW = path.join(ROOT, 'gsd-core', 'workflows', 'reapply-patches.md');
|
||||
const REAPPLY_WORKFLOW = path.join(ROOT, 'msd-core', 'workflows', 'reapply-patches.md');
|
||||
|
||||
describe('Bug #2994: verify-reapply-patches.cjs lives at the runtime-installed path', () => {
|
||||
test('the script exists under gsd-core/bin/ (installed by copyWithPathReplacement)', () => {
|
||||
test('the script exists under msd-core/bin/ (installed by copyWithPathReplacement)', () => {
|
||||
assert.equal(fs.existsSync(RUNTIME_SCRIPT_PATH), true,
|
||||
`Expected verifier script at ${RUNTIME_SCRIPT_PATH} -- installer copies gsd-core/ recursively`);
|
||||
`Expected verifier script at ${RUNTIME_SCRIPT_PATH} -- installer copies msd-core/ recursively`);
|
||||
});
|
||||
|
||||
test('the script does NOT live at the legacy scripts/ path (not installed)', () => {
|
||||
assert.equal(fs.existsSync(STALE_SCRIPT_PATH), false,
|
||||
`scripts/ is not copied by installer; verifier must be under gsd-core/bin/ instead`);
|
||||
`scripts/ is not copied by installer; verifier must be under msd-core/bin/ instead`);
|
||||
});
|
||||
|
||||
test('the script is requireable (loads without throwing)', () => {
|
||||
@@ -702,12 +702,12 @@ describe('Bug #2994: verify-reapply-patches.cjs lives at the runtime-installed p
|
||||
});
|
||||
});
|
||||
|
||||
// Parse reapply-patches.md to extract every `node "${GSD_HOME}/...cjs"`
|
||||
// Parse reapply-patches.md to extract every `node "${MSD_HOME}/...cjs"`
|
||||
// invocation as structured records. Assertions go against the parsed
|
||||
// records, not against the markdown text.
|
||||
function extractScriptInvocations(markdown) {
|
||||
const invocations = [];
|
||||
const re = /node\s+"\$\{GSD_HOME\}\/([^"]+\.cjs)"/g;
|
||||
const re = /node\s+"\$\{MSD_HOME\}\/([^"]+\.cjs)"/g;
|
||||
let match;
|
||||
while ((match = re.exec(markdown)) !== null) {
|
||||
invocations.push({ relPath: match[1] });
|
||||
@@ -716,16 +716,16 @@ function extractScriptInvocations(markdown) {
|
||||
}
|
||||
|
||||
describe('Bug #2994: reapply-patches workflow references the runtime-installed path', () => {
|
||||
test('every node ${GSD_HOME}/... invocation in reapply-patches.md uses an installed runtime path', () => {
|
||||
test('every node ${MSD_HOME}/... invocation in reapply-patches.md uses an installed runtime path', () => {
|
||||
const md = fs.readFileSync(REAPPLY_WORKFLOW, 'utf-8');
|
||||
const invocations = extractScriptInvocations(md);
|
||||
assert.ok(invocations.length > 0, 'sanity: expected at least one node ${GSD_HOME}/... invocation in reapply-patches.md');
|
||||
assert.ok(invocations.length > 0, 'sanity: expected at least one node ${MSD_HOME}/... invocation in reapply-patches.md');
|
||||
|
||||
const violations = invocations.filter(inv => !inv.relPath.startsWith('gsd-core/'));
|
||||
const violations = invocations.filter(inv => !inv.relPath.startsWith('msd-core/'));
|
||||
assert.deepEqual(violations, [], `invocations under non-installed paths: ${JSON.stringify(violations)}`);
|
||||
});
|
||||
|
||||
test('reapply-patches.md references the verifier at gsd-core/bin/verify-reapply-patches.cjs', () => {
|
||||
test('reapply-patches.md references the verifier at msd-core/bin/verify-reapply-patches.cjs', () => {
|
||||
const md = fs.readFileSync(REAPPLY_WORKFLOW, 'utf8');
|
||||
const invocations = extractScriptInvocations(md);
|
||||
const verifierInvocations = invocations.filter(inv => inv.relPath.endsWith('verify-reapply-patches.cjs'));
|
||||
@@ -735,7 +735,7 @@ describe('Bug #2994: reapply-patches workflow references the runtime-installed p
|
||||
// (the sibling test above enforces the path for every invocation).
|
||||
assert.deepEqual(
|
||||
verifierInvocations.map(i => i.relPath),
|
||||
['gsd-core/bin/verify-reapply-patches.cjs', 'gsd-core/bin/verify-reapply-patches.cjs'],
|
||||
['msd-core/bin/verify-reapply-patches.cjs', 'msd-core/bin/verify-reapply-patches.cjs'],
|
||||
'workflow must call the runtime-installed verifier exactly twice (classify + gate, #4136)',
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user