Files
msd-core/tests/audit-milestone-filename-guard.test.cjs
Jakub Zych a9a7a328e6 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.
2026-10-06 01:47:40 +02:00

40 lines
2.0 KiB
JavaScript

'use strict';
// ─────────────────────────────────────────────────────────────────────────────
// #3796 — the audit-milestone report writer and its readers must agree on
// the report's filename.
//
// The single writer line created `.planning/v{version}-v{version}-MILESTONE
// -AUDIT.md` (a doubled version segment) while every downstream reference —
// the step's own heading, the Report pointers, the `cat`, and the completion
// checklist — reads `v{version}-MILESTONE-AUDIT.md`. The report landed at a
// path no reader ever looked at.
// ─────────────────────────────────────────────────────────────────────────────
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const AUDIT_MD = path.join(__dirname, '..', 'msd-core', 'workflows', 'audit-milestone.md');
// audit-milestone.md is shipped workflow text — the bytes ARE what the
// runtime loads; a structural scan over it tests the deployed contract.
test('#3796: the audit report writer and readers agree on the single-version filename', () => {
const md = fs.readFileSync(AUDIT_MD, 'utf-8');
assert.ok(
!md.includes('v{version}-v{version}'),
'#3796: no doubled version segment may appear anywhere in the workflow',
);
const writer = /^Create `\.planning\/v\{version\}-MILESTONE-AUDIT\.md` with:$/m;
assert.ok(
writer.test(md),
'#3796: the writer line must create exactly .planning/v{version}-MILESTONE-AUDIT.md',
);
const readers = md.match(/v\{version\}-MILESTONE-AUDIT\.md/g) || [];
assert.ok(
readers.length >= 5,
`the single-version readers (heading, Report pointers, cat, checklist) must remain; found ${readers.length}`,
);
});