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

@@ -149,10 +149,10 @@ const SHA_B = 'b'.repeat(40);
const REPO_ROOT = path.join(__dirname, '..');
/** A real emitted key + its real source, so rows assert the shape production uses. */
const WORKFLOW_KEY = 'gsd-core/workflows/plan-phase.md';
const WORKFLOW_SRC = 'gsd-core/workflows/plan-phase.md';
const SKILL_KEY = 'skills/gsd-add-tests/SKILL.md';
const SKILL_SRC = 'commands/gsd/add-tests.md';
const WORKFLOW_KEY = 'msd-core/workflows/plan-phase.md';
const WORKFLOW_SRC = 'msd-core/workflows/plan-phase.md';
const SKILL_KEY = 'skills/msd-add-tests/SKILL.md';
const SKILL_SRC = 'commands/msd/add-tests.md';
const mf = (obj) => ({ claude: obj });
@@ -195,7 +195,7 @@ test('a moved hash whose source changed is attributed', () => {
test('a trailing-slash source entry matches by prefix, segment-aware', () => {
// Kimi's root agent aggregates all of agents/ — a Phase 2 prefix source.
assert.equal(sourceSatisfiedBy('agents/', new Set(['agents/gsd-planner.md'])), 'agents/gsd-planner.md');
assert.equal(sourceSatisfiedBy('agents/', new Set(['agents/msd-planner.md'])), 'agents/msd-planner.md');
// Hostile: a bare startsWith would over-attribute here. It must NOT match.
assert.equal(sourceSatisfiedBy('agents/', new Set(['agentsfoo/x.md'])), null);
// Exact entries compare exactly.
@@ -203,12 +203,12 @@ test('a trailing-slash source entry matches by prefix, segment-aware', () => {
assert.equal(sourceSatisfiedBy('a/b.md', new Set(['a/b.md.bak'])), null);
const r = diffEmitted({
baseline: { kimi: { 'agents/gsd.yaml': 'aaa' } },
current: { kimi: { 'agents/gsd.yaml': 'bbb' } },
changedPaths: ['agents/gsd-planner.md'],
baseline: { kimi: { 'agents/msd.yaml': 'aaa' } },
current: { kimi: { 'agents/msd.yaml': 'bbb' } },
changedPaths: ['agents/msd-planner.md'],
});
assert.equal(r.unattributable.length, 0, 'prefix source should attribute');
assert.equal(r.attributed[0].via, 'agents/gsd-planner.md');
assert.equal(r.attributed[0].via, 'agents/msd-planner.md');
});
test('a moved hash nothing explains is unattributable and named', () => {
@@ -221,7 +221,7 @@ test('a moved hash nothing explains is unattributable and named', () => {
const u = r.unattributable[0];
assert.equal(u.rel, WORKFLOW_KEY);
assert.equal(u.runtime, 'claude');
assert.equal(u.ruleId, 'gsd-core-verbatim');
assert.equal(u.ruleId, 'msd-core-verbatim');
assert.deepEqual(u.expectedSources, [WORKFLOW_SRC]);
assert.ok(!r.ok);
@@ -234,8 +234,8 @@ test('a moved hash nothing explains is unattributable and named', () => {
test('synthesized paths are exempt from attribution', () => {
const r = diffEmitted({
baseline: mf({ 'gsd-core/VERSION': 'aaa' }),
current: mf({ 'gsd-core/VERSION': 'bbb' }),
baseline: mf({ 'msd-core/VERSION': 'aaa' }),
current: mf({ 'msd-core/VERSION': 'bbb' }),
changedPaths: [],
});
assert.equal(r.unattributable.length, 0, 'install-time state can never be unexplained');
@@ -246,16 +246,16 @@ test('synthesized paths are exempt from attribution', () => {
test('code-derived paths attribute to their emitting source file', () => {
// Phase 2 deliberately refused to mark these exempt; this is why.
const r = diffEmitted({
baseline: { cline: { '.clinerules/gsd.md': 'aaa' } },
current: { cline: { '.clinerules/gsd.md': 'bbb' } },
baseline: { cline: { '.clinerules/msd.md': 'aaa' } },
current: { cline: { '.clinerules/msd.md': 'bbb' } },
changedPaths: ['src/runtime-hooks-surface.cts'],
});
assert.equal(r.unattributable.length, 0);
assert.equal(r.attributed[0].via, 'src/runtime-hooks-surface.cts');
const blind = diffEmitted({
baseline: { cline: { '.clinerules/gsd.md': 'aaa' } },
current: { cline: { '.clinerules/gsd.md': 'bbb' } },
baseline: { cline: { '.clinerules/msd.md': 'aaa' } },
current: { cline: { '.clinerules/msd.md': 'bbb' } },
changedPaths: ['README.md'],
});
assert.equal(blind.unattributable.length, 1, 'had these been exempt, this ripple would be invisible forever');
@@ -313,10 +313,10 @@ test('a derived path explained only by a transform change is attributed (#2566 s
const moved = {};
const base = {};
const agentNames = [
'gsd-planner', 'gsd-executor', 'gsd-verifier', 'gsd-code-reviewer',
'gsd-security-auditor', 'gsd-nyquist-auditor', 'gsd-doc-writer', 'gsd-roadmapper',
'gsd-phase-researcher', 'gsd-pattern-mapper', 'gsd-plan-checker', 'gsd-debugger',
'gsd-ui-checker', 'gsd-eval-planner', 'gsd-framework-selector', 'gsd-code-fixer',
'msd-planner', 'msd-executor', 'msd-verifier', 'msd-code-reviewer',
'msd-security-auditor', 'msd-nyquist-auditor', 'msd-doc-writer', 'msd-roadmapper',
'msd-phase-researcher', 'msd-pattern-mapper', 'msd-plan-checker', 'msd-debugger',
'msd-ui-checker', 'msd-eval-planner', 'msd-framework-selector', 'msd-code-fixer',
];
assert.equal(agentNames.length, 16, 'the #2566 reproduction is 16 emitted .toml files');
for (const name of agentNames) {
@@ -362,8 +362,8 @@ test('an identity-classified agent .md moved by a transform-only change is unatt
// changed, only `kind`/`transforms`, so this same test proves both "was broken" and
// "is fixed" depending on which commit runs it).
const r = diffEmitted({
baseline: { codex: { 'agents/gsd-nyquist-auditor.md': 'before' } },
current: { codex: { 'agents/gsd-nyquist-auditor.md': 'after' } },
baseline: { codex: { 'agents/msd-nyquist-auditor.md': 'before' } },
current: { codex: { 'agents/msd-nyquist-auditor.md': 'after' } },
changedPaths: ['src/runtime-artifact-conversion.cts'],
});
assert.equal(r.unattributable.length, 0, 'a declared transform must explain the moved identity-family path');
@@ -374,19 +374,19 @@ test('an identity-classified agent .md moved by a transform-only change is unatt
test('a moved derived path with neither source nor transform in the diff still fails, named', () => {
const r = diffEmitted({
baseline: mf({ 'agents/gsd-planner.toml': 'before' }),
current: mf({ 'agents/gsd-planner.toml': 'after' }),
baseline: mf({ 'agents/msd-planner.toml': 'before' }),
current: mf({ 'agents/msd-planner.toml': 'after' }),
changedPaths: ['docs/README.md'],
});
assert.equal(r.unattributable.length, 1);
assert.equal(r.unattributable[0].rel, 'agents/gsd-planner.toml');
assert.deepEqual(r.unattributable[0].expectedSources, ['agents/gsd-planner.md']);
assert.equal(r.unattributable[0].rel, 'agents/msd-planner.toml');
assert.deepEqual(r.unattributable[0].expectedSources, ['agents/msd-planner.md']);
assert.ok(
r.unattributable[0].expectedTransforms.includes('src/runtime-artifact-conversion.cts'),
'the message must be able to say what transform WOULD have explained it too',
);
const msg = formatReport(r);
assert.ok(msg.includes('agents/gsd-planner.toml'));
assert.ok(msg.includes('agents/msd-planner.toml'));
assert.ok(msg.includes('src/runtime-artifact-conversion.cts'), 'the transform hint must appear in the report');
});
@@ -394,8 +394,8 @@ test('an unrelated src file does not attribute a moved derived path (transforms
// The review's own risk: a transform list that is too broad silently excuses real
// ripples. src/state-document.cts has nothing to do with agent conversion.
const r = diffEmitted({
baseline: mf({ 'agents/gsd-planner.toml': 'before' }),
current: mf({ 'agents/gsd-planner.toml': 'after' }),
baseline: mf({ 'agents/msd-planner.toml': 'before' }),
current: mf({ 'agents/msd-planner.toml': 'after' }),
changedPaths: ['src/state-document.cts'],
});
assert.equal(r.unattributable.length, 1, 'an unrelated src/*.cts file must NOT excuse the ripple');
@@ -409,8 +409,8 @@ test('bin/install.js alone does not attribute a moved agent artifact (deliberate
// escape hatch ADR-2719 warns against. This proves the exclusion holds in the
// shipped table, not just in the design doc.
const r = diffEmitted({
baseline: mf({ 'agents/gsd-planner.toml': 'before' }),
current: mf({ 'agents/gsd-planner.toml': 'after' }),
baseline: mf({ 'agents/msd-planner.toml': 'before' }),
current: mf({ 'agents/msd-planner.toml': 'after' }),
changedPaths: ['bin/install.js'],
});
assert.equal(r.unattributable.length, 1, 'bin/install.js alone must not attribute — it is not a declared transform');
@@ -419,12 +419,12 @@ test('bin/install.js alone does not attribute a moved agent artifact (deliberate
test('a moved path with a source match wins over an also-present transform match (deterministic via)', () => {
const r = diffEmitted({
baseline: mf({ 'agents/gsd-planner.toml': 'before' }),
current: mf({ 'agents/gsd-planner.toml': 'after' }),
changedPaths: ['agents/gsd-planner.md', 'src/runtime-artifact-conversion.cts'],
baseline: mf({ 'agents/msd-planner.toml': 'before' }),
current: mf({ 'agents/msd-planner.toml': 'after' }),
changedPaths: ['agents/msd-planner.md', 'src/runtime-artifact-conversion.cts'],
});
assert.equal(r.unattributable.length, 0);
assert.equal(r.attributed[0].via, 'agents/gsd-planner.md', 'sources are checked before transforms');
assert.equal(r.attributed[0].via, 'agents/msd-planner.md', 'sources are checked before transforms');
});
test('a transform-explained converter ripple still needs no ack (transforms are a first-class attribution, not a workaround)', () => {
@@ -435,8 +435,8 @@ test('a transform-explained converter ripple still needs no ack (transforms are
const moved = {};
const base = {};
for (let i = 0; i < 5; i++) {
base[`agents/gsd-fixture-${i}.toml`] = `h${i}`;
moved[`agents/gsd-fixture-${i}.toml`] = `x${i}`;
base[`agents/msd-fixture-${i}.toml`] = `h${i}`;
moved[`agents/msd-fixture-${i}.toml`] = `x${i}`;
}
const r = diffEmitted({
baseline: mf(base),
@@ -676,8 +676,8 @@ test('an unregistered converter change fails without an ack and passes with one'
const moved = {};
const base = {};
for (let i = 0; i < 25; i++) {
base[`skills/gsd-cmd-${i}/SKILL.md`] = `h${i}`;
moved[`skills/gsd-cmd-${i}/SKILL.md`] = `x${i}`;
base[`skills/msd-cmd-${i}/SKILL.md`] = `h${i}`;
moved[`skills/msd-cmd-${i}/SKILL.md`] = `x${i}`;
}
const changedPaths = ['src/unregistered-runtime-converter.cts'];
@@ -841,7 +841,7 @@ test('REMEDIATION.ackTrailerExample itself round-trips through parseAckTrailers'
const rawValue = REMEDIATION.ackTrailerExample.slice(ACK_TRAILER_HASH.length + 2);
const { hash, errors } = parseAckTrailers({ hash: [rawValue] });
assert.deepEqual(errors, []);
assert.equal(hash.get('skills/gsd-add-tests/SKILL.md').reason, 'converter rewrite, ADR-2719');
assert.equal(hash.get('skills/msd-add-tests/SKILL.md').reason, 'converter rewrite, ADR-2719');
});
test('the remediation surface is frozen and teaches the trailer, not the legacy fragment file', () => {
@@ -1266,11 +1266,11 @@ test('baseline resolution precedence is explicit and reported', () => {
// restores the baseline keyed on the PR's RECORDED base sha (`test.yml:198`) while the
// gate resolves the base ref LIVE (`resolveBase()`), so the two drift whenever `next`
// advances between a PR's last sync and its run. The restore was published straight to
// GSD_EMITTED_BASELINE, where a mismatch is fatal — turning a recoverable cache into a
// MSD_EMITTED_BASELINE, where a mismatch is fatal — turning a recoverable cache into a
// hard failure on diffs that touched nothing related. The export step is the boundary
// that must be conservative in what it sends.
const CI_CACHE_PATH = '.gsd-cache/emitted-baseline.json';
const CI_CACHE_PATH = '.msd-cache/emitted-baseline.json';
/** Resolve exactly as CI does: cache restored to the DEFAULT path, nothing announced. */
const resolveAsCI = (doc, expectedSha = SHA_A) => resolveBaseline({
@@ -1379,11 +1379,11 @@ test('#2854: the gate is pinned to the SAME base the tree was merged with', () =
for (const [name, job] of jobsUnderTest) {
const rebaseStep = job.steps.find((s) => typeof s.run === 'string' && s.run.includes('ci-rebase-check.cjs'));
const mergedBase = (rebaseStep.env || {}).CI_REBASE_BASE_SHA;
const gateBase = (job.env || {}).GSD_EMITTED_BASE;
const gateBase = (job.env || {}).MSD_EMITTED_BASE;
assert.ok(mergedBase, `job ${name}: rebase step must pin CI_REBASE_BASE_SHA`);
assert.equal(gateBase, mergedBase,
`job ${name}: the emitted gate's base (GSD_EMITTED_BASE=${JSON.stringify(gateBase)}) must equal ` +
`job ${name}: the emitted gate's base (MSD_EMITTED_BASE=${JSON.stringify(gateBase)}) must equal ` +
`the commit the tree was merged with (CI_REBASE_BASE_SHA=${JSON.stringify(mergedBase)}). ` +
'Diverging them makes the differential compare a tree against a baseline from a ' +
'different commit, which mis-attributes unrelated merges to this PR.');
@@ -1391,10 +1391,10 @@ test('#2854: the gate is pinned to the SAME base the tree was merged with', () =
});
test('#2854: an explicit base pin outranks the live branch tip', () => {
// The mechanism the workflow pin relies on: GSD_EMITTED_BASE must win over
// The mechanism the workflow pin relies on: MSD_EMITTED_BASE must win over
// origin/<base>, or setting it in CI would change nothing.
const pinned = 'c'.repeat(40);
assert.equal(baseRefCandidates({ GSD_EMITTED_BASE: pinned, GITHUB_BASE_REF: 'next' })[0], pinned,
assert.equal(baseRefCandidates({ MSD_EMITTED_BASE: pinned, GITHUB_BASE_REF: 'next' })[0], pinned,
'an explicit pin must be tried before origin/next');
});
@@ -1406,11 +1406,11 @@ test('#2854: an EMPTY base pin is ignored, not treated as a candidate', () => {
// silently push '' as the first candidate and have `git rev-parse ''` decide the
// baseline. Pinned here because the workflow now guarantees this input shape.
assert.deepEqual(
baseRefCandidates({ GSD_EMITTED_BASE: '', GITHUB_BASE_REF: 'next' }),
baseRefCandidates({ MSD_EMITTED_BASE: '', GITHUB_BASE_REF: 'next' }),
baseRefCandidates({ GITHUB_BASE_REF: 'next' }),
'an empty pin must behave exactly as an absent one',
);
assert.ok(!baseRefCandidates({ GSD_EMITTED_BASE: '', GITHUB_BASE_REF: 'next' }).includes(''),
assert.ok(!baseRefCandidates({ MSD_EMITTED_BASE: '', GITHUB_BASE_REF: 'next' }).includes(''),
'the empty string must never become a base-ref candidate');
});
@@ -1438,11 +1438,11 @@ test('#2854: the resolution summary names only sources actually attempted', () =
test('base-ref candidates are ordered most-specific first and de-duplicated', () => {
// The gate went red on its first matrix run because it hard-depended on
// `origin/next`, which cannot exist in the gsd-test container (shallow clone +
// `origin/next`, which cannot exist in the msd-test container (shallow clone +
// base/head merge, no remote-tracking refs). Candidate order is the fix, so it is
// pinned rather than left implicit.
assert.deepEqual(
baseRefCandidates({ GSD_EMITTED_BASE: 'abc123', GITHUB_BASE_REF: 'next' }),
baseRefCandidates({ MSD_EMITTED_BASE: 'abc123', GITHUB_BASE_REF: 'next' }),
['abc123', 'origin/next', 'next'],
'an explicit override wins, then the Actions base ref, then the defaults',
);
@@ -1491,7 +1491,7 @@ test(
// PR adds. That was true only until this PR merged: after merge every resolvable
// base ref carries the file, the precondition is permanently false, and the test
// would skip forever, losing all regression value silently (a skip reads as green).
// It also depended on `origin/next` being resolvable at all, which the gsd-test
// It also depended on `origin/next` being resolvable at all, which the msd-test
// runner's shallow clone + base/head merge does not guarantee (no remote-tracking
// refs) — the same non-hermetic-history failure mode "baseline families are
// enumerated from the ref, not from the current registry" (above) was rewritten to
@@ -1499,7 +1499,7 @@ test(
// repo's history.
//
// That precedent doesn't directly transplant here: `buildBaselineAtRef` needs a
// REAL, buildable gsd-core tree (`npm run build:lib`, the compiled `bin/lib/*.cjs`,
// REAL, buildable msd-core tree (`npm run build:lib`, the compiled `bin/lib/*.cjs`,
// `node_modules`) to produce a real manifest — a minimal from-scratch repo has none
// of that. So instead of a from-scratch repo, this synthesizes the missing-generator
// condition IN-PLACE with git plumbing: read this checkout's own HEAD tree into a
@@ -1516,8 +1516,8 @@ test(
const gitEnv = {
...process.env,
GIT_INDEX_FILE: tmpIndexFile,
GIT_AUTHOR_NAME: 'GSD Test', GIT_AUTHOR_EMAIL: 'test@example.invalid',
GIT_COMMITTER_NAME: 'GSD Test', GIT_COMMITTER_EMAIL: 'test@example.invalid',
GIT_AUTHOR_NAME: 'MSD Test', GIT_AUTHOR_EMAIL: 'test@example.invalid',
GIT_COMMITTER_NAME: 'MSD Test', GIT_COMMITTER_EMAIL: 'test@example.invalid',
};
// `-c safe.directory=<REPO_ROOT>` via the shared `safeDirArgs` (emitted-runtime.cjs):
// the remote runner mounts this repo at a path owned by a different uid, and git's
@@ -1579,7 +1579,7 @@ test('formatReport truncation is exact at limit-1 / limit / limit+1', () => {
const build = (n) => {
const baseline = {}; const current = {};
for (let i = 0; i < n; i++) {
const k = `gsd-core/workflows/w${String(i).padStart(3, '0')}.md`;
const k = `msd-core/workflows/w${String(i).padStart(3, '0')}.md`;
baseline[k] = 'a'; current[k] = 'b';
}
return diffEmitted({ baseline: mf(baseline), current: mf(current), changedPaths: [] });
@@ -1629,9 +1629,9 @@ test('property: every moved key lands in exactly one bucket', () => {
// The conservation law itself. A key silently dropped from all three buckets is a
// hole in the very invariant ADR-2719 asserts — and it is the failure a hand-written
// example set is least likely to find.
const keys = [WORKFLOW_KEY, SKILL_KEY, 'agents/gsd-planner.md', 'scripts/lib/cli-exit.cjs'];
const keys = [WORKFLOW_KEY, SKILL_KEY, 'agents/msd-planner.md', 'scripts/lib/cli-exit.cjs'];
const sources = { [WORKFLOW_KEY]: WORKFLOW_SRC, [SKILL_KEY]: SKILL_SRC,
'agents/gsd-planner.md': 'agents/gsd-planner.md', 'scripts/lib/cli-exit.cjs': 'scripts/lib/cli-exit.cjs' };
'agents/msd-planner.md': 'agents/msd-planner.md', 'scripts/lib/cli-exit.cjs': 'scripts/lib/cli-exit.cjs' };
fc.assert(
fc.property(
@@ -1676,14 +1676,14 @@ test('property: every moved key lands in exactly one bucket', () => {
// PR was hard-blocked — found by tracing #2005 (Qoder) through the gate.
//
// Driven at PURE-FUNCTION altitude on purpose. The real-tree test below skips wherever no
// base ref exists (the gsd-test runner shallow-clones, so `origin/*` is absent), so a
// base ref exists (the msd-test runner shallow-clones, so `origin/*` is absent), so a
// regression written at that altitude would silently skip on the very runner that has to
// prove RED.
const ALL_FAMILIES = MANIFEST_FAMILIES.map((f) => f.name);
const REGISTRY_CHANGE = ['tests/helpers/install-shared.cjs'];
// The shape a shipping caller passes: repo-relative POSIX paths from `git diff --name-only`.
const CONTENT_ONLY_CHANGE = ['gsd-core/workflows/plan-phase.md'];
const CONTENT_ONLY_CHANGE = ['msd-core/workflows/plan-phase.md'];
const derivedOf = (names) => names.map((name) => ({ name, runtime: name, scope: 'global' }));
const manifestsOf = (names) => Object.fromEntries(names.map((n) => [n, { 'some/emitted/path': 'hash' }]));
@@ -1943,7 +1943,7 @@ test('each registry-signal path independently attributes a family change', () =>
}
// Narrow on purpose: surfaces that merely accompany a runtime addition must NOT
// excuse an unattributed family delta.
for (const p of ['src/runtime-name-policy.cts', 'gsd-core/bin/lib/capability-registry.cjs']) {
for (const p of ['src/runtime-name-policy.cts', 'msd-core/bin/lib/capability-registry.cjs']) {
assert.equal(touchesRuntimeRegistry([p]), false, `${p} must NOT attribute on its own`);
}
});
@@ -1960,7 +1960,7 @@ test('near-miss paths do not attribute a family change', () => {
'capabilities/capability.json',
'tests/helpers/install-shared.cjs.bak',
'docs/tests/helpers/install-shared.cjs',
'gsd-core/workflows/plan-phase.md',
'msd-core/workflows/plan-phase.md',
]) {
assert.equal(touchesRuntimeRegistry([p]), false, `${p} should NOT attribute`);
}
@@ -1975,7 +1975,7 @@ test('baseline families are enumerated from the ref, not from the current regist
// from the current registry, so the base ref is never asked for it, and the dropped-
// family check can never fire in production even though its unit tests pass.
//
// Built as its own git repo rather than reaching for this repo's history. The gsd-test
// Built as its own git repo rather than reaching for this repo's history. The msd-test
// runner shallow-clones base+head, so `rev-list --max-parents=0` there returns the
// GRAFTED boundary commit — a recent one carrying every fixture — not a true root. (This
// repo also has two root commits locally.) A history-dependent assertion passes on a full
@@ -2092,9 +2092,9 @@ test('property: reported added/dropped are exactly the set differences', () => {
//
// Baseline source note (#2724, post-cutover): the committed golden fixtures this test
// used to read via `git show origin/next:<fixture>` are deleted. `resolveBaseline()`'s
// documented precedence takes over: `GSD_EMITTED_BASELINE` env (CI's PR-lane cache
// documented precedence takes over: `MSD_EMITTED_BASELINE` env (CI's PR-lane cache
// restore, keyed on the PR's base sha) -> the on-disk cache at
// `.gsd-cache/emitted-baseline.json` (populated by CI's push-to-next publish step,
// `.msd-cache/emitted-baseline.json` (populated by CI's push-to-next publish step,
// scripts/gen-emitted-baseline.cjs) -> an in-job build (a throwaway `git worktree`
// checked out at `base`, running the same script there — slow but never absent). Never
// the working-tree fixtures, which would be whatever this PR's author regenerated;
@@ -2114,7 +2114,7 @@ test('differential attribution over the real tree', { timeout: HEAVY_REAL_TREE_T
// Build idempotently, exactly as the golden harness does.
execFileSync(process.execPath, [BUILD_SCRIPT], { encoding: 'utf-8', stdio: 'pipe', timeout: BUILD_HOOKS_UNDER_LOAD_TIMEOUT_MS });
// The base ref is not universally available. The gsd-test runner shallow-clones and
// The base ref is not universally available. The msd-test runner shallow-clones and
// merges base+head, so no `origin/*` remote-tracking ref exists in the container —
// this test went red on its first matrix run for exactly that reason, which is the
// resolver doing its job and the dependency being wrong.
@@ -2129,7 +2129,7 @@ test('differential attribution over the real tree', { timeout: HEAVY_REAL_TREE_T
t.skip(
'no base ref resolvable — tried ' + baseRefCandidates().join(', ') +
'. The differential gate did NOT run here. It binds in the CI test lanes, which ' +
'fetch the base ref explicitly; set GSD_EMITTED_BASE=<ref|sha> to run it elsewhere.',
'fetch the base ref explicitly; set MSD_EMITTED_BASE=<ref|sha> to run it elsewhere.',
);
return;
}
@@ -2138,7 +2138,7 @@ test('differential attribution over the real tree', { timeout: HEAVY_REAL_TREE_T
// Phase 4 (#2724): the golden fixtures this used to read via `baselineManifestsAtRef`
// (git show <base>:<fixture>) are deleted, so the baseline now comes through
// `resolveBaseline()`'s documented precedence: GSD_EMITTED_BASELINE env (CI's PR-lane
// `resolveBaseline()`'s documented precedence: MSD_EMITTED_BASELINE env (CI's PR-lane
// cache restore) -> the on-disk cache (CI's push-to-next publish step) -> an in-job
// build at `base` (a throwaway git worktree + scripts/gen-emitted-baseline.cjs) ->
// explicit failure. The build fallback is deliberately the slow path — it exists so a
@@ -2224,7 +2224,7 @@ test('differential attribution over the real tree', { timeout: HEAVY_REAL_TREE_T
// #2767's `currentManifests({ repoRoot })` spawns a DIFFERENT checkout's installer
// but, before this fix, still normalized the emitted content against THIS checkout's
// PKG_VERSION — so a version-bumped current tree compared against an older-version
// baseline worktree never collapsed the baseline's `// gsd-hook-version: <old>` stamp
// baseline worktree never collapsed the baseline's `// msd-hook-version: <old>` stamp
// to '<VERSION>', every one of that baseline's emitted files spuriously "differed",
// and the differential attribution gate above (the real-tree test) failed with all
// 364 emitted hook paths unattributed. These tests pin the mechanism directly against
@@ -2233,12 +2233,12 @@ test('differential attribution over the real tree', { timeout: HEAVY_REAL_TREE_T
// expensive real-tree gate.
function makeVersionStampedTree(hookVersion) {
const root = createTempDir('gsd-test-ppm-version-');
const root = createTempDir('msd-test-ppm-version-');
const configDir = path.join(root, 'cfg');
fs.mkdirSync(configDir, { recursive: true });
fs.writeFileSync(
path.join(configDir, 'hook.js'),
`// gsd-hook-version: ${hookVersion}\nconsole.log('hook body unchanged across versions');\n`,
`// msd-hook-version: ${hookVersion}\nconsole.log('hook body unchanged across versions');\n`,
);
return { root, configDir };
}
@@ -2278,7 +2278,7 @@ test('buildParityManifest: hash of a measured tree does not depend on the MEASUR
// measuring repo's own PKG_VERSION had been used instead), the raw '7.7.7' would
// still be present pre-hash and this hash would differ from a control manifest
// built directly against the sentinel-substituted content.
const controlContent = `// gsd-hook-version: <VERSION>\nconsole.log('hook body unchanged across versions');\n`;
const controlContent = `// msd-hook-version: <VERSION>\nconsole.log('hook body unchanged across versions');\n`;
const controlHash = crypto.createHash('sha256').update(controlContent).digest('hex').slice(0, 16);
assert.equal(
manifest['hook.js'],
@@ -2317,7 +2317,7 @@ test('buildParityManifest: pkgVersion guard rejects empty/undefined/null/non-str
// replacement, would corrupt content that merely contains matching characters.
// Confirm the guard fires BEFORE that — a file whose entire content is 'abc' must
// never make it into a manifest via a '' pkgVersion.
const corruptibleRoot = createTempDir('gsd-test-ppm-corrupt-');
const corruptibleRoot = createTempDir('msd-test-ppm-corrupt-');
const corruptibleDir = path.join(corruptibleRoot, 'cfg');
fs.mkdirSync(corruptibleDir, { recursive: true });
fs.writeFileSync(path.join(corruptibleDir, 'f.txt'), 'abc');
@@ -2372,7 +2372,7 @@ test('buildParityManifest: pkgVersion is honored when reachable via the PROTOTYP
// prevent), reached via a different vector than an explicit own-key bad value.
const opts = Object.create({ pkgVersion: '7.7.7' });
const manifest = buildParityManifest(tree.configDir, tree.root, opts);
const controlContent = `// gsd-hook-version: <VERSION>\nconsole.log('hook body unchanged across versions');\n`;
const controlContent = `// msd-hook-version: <VERSION>\nconsole.log('hook body unchanged across versions');\n`;
const controlHash = crypto.createHash('sha256').update(controlContent).digest('hex').slice(0, 16);
assert.equal(
manifest['hook.js'],
@@ -2438,7 +2438,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
}
// A different tree's package.json: its OWN version, not this checkout's.
const measuredRoot = createTempDir('gsd-test-mpv-ok-');
const measuredRoot = createTempDir('msd-test-mpv-ok-');
try {
fs.writeFileSync(
path.join(measuredRoot, 'package.json'),
@@ -2450,7 +2450,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
}
// Missing package.json: fails closed, never falls back to this checkout's version.
const missingRoot = createTempDir('gsd-test-mpv-missing-');
const missingRoot = createTempDir('msd-test-mpv-missing-');
try {
assert.throws(() => measuredPackageVersion(missingRoot), /cannot read/);
} finally {
@@ -2458,7 +2458,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
}
// Unparseable package.json.
const badJsonRoot = createTempDir('gsd-test-mpv-badjson-');
const badJsonRoot = createTempDir('msd-test-mpv-badjson-');
try {
fs.writeFileSync(path.join(badJsonRoot, 'package.json'), '{not json');
assert.throws(() => measuredPackageVersion(badJsonRoot), /not valid JSON/);
@@ -2468,7 +2468,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
// Version-less package.json (key ABSENT entirely) — the only branch the pre-review
// test suite drove.
const noVersionRoot = createTempDir('gsd-test-mpv-noversion-');
const noVersionRoot = createTempDir('msd-test-mpv-noversion-');
try {
fs.writeFileSync(path.join(noVersionRoot, 'package.json'), JSON.stringify({ name: 'no-version' }));
assert.throws(() => measuredPackageVersion(noVersionRoot), /no non-empty string "version" field/);
@@ -2480,7 +2480,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
// (`typeof '' === 'string'` but `''.length === 0`); the pre-review suite never drove
// it and both surviving mutants collapse this into the absent-key case (#2891 review
// FINDING 3).
const emptyVersionRoot = createTempDir('gsd-test-mpv-emptyversion-');
const emptyVersionRoot = createTempDir('msd-test-mpv-emptyversion-');
try {
fs.writeFileSync(path.join(emptyVersionRoot, 'package.json'), JSON.stringify({ version: '' }));
assert.throws(() => measuredPackageVersion(emptyVersionRoot), /no non-empty string "version" field/);
@@ -2491,7 +2491,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
// "version" key PRESENT but non-string (e.g. a bare JSON number) — the other branch
// `typeof version !== 'string'` guards, distinct from both "absent" and "empty
// string" (#2891 review FINDING 3).
const numericVersionRoot = createTempDir('gsd-test-mpv-numericversion-');
const numericVersionRoot = createTempDir('msd-test-mpv-numericversion-');
try {
fs.writeFileSync(path.join(numericVersionRoot, 'package.json'), JSON.stringify({ version: 123 }));
assert.throws(() => measuredPackageVersion(numericVersionRoot), /no non-empty string "version" field/);
@@ -2502,7 +2502,7 @@ test('measuredPackageVersion: resolves this checkout\'s version with no repoRoot
// Unreadable package.json: monkeypatch fs.readFileSync (NEVER chmod 0o000 — root
// bypasses mode bits and the test would silently pass with zero coverage in root
// Docker/CI). Save original, override to throw, assert.throws, restore in `finally`.
const unreadableRoot = createTempDir('gsd-test-mpv-unreadable-');
const unreadableRoot = createTempDir('msd-test-mpv-unreadable-');
try {
fs.writeFileSync(path.join(unreadableRoot, 'package.json'), JSON.stringify({ version: '1.0.0' }));
const orig = fs.readFileSync;