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:
@@ -21,14 +21,14 @@ const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const { createTempProject, cleanup, runGsdTools, captureFdSync } = require('./helpers.cjs');
|
||||
const est = require('../gsd-core/bin/lib/phase-estimation.cjs');
|
||||
const estimateCli = require('../gsd-core/bin/lib/estimate-cli.cjs');
|
||||
const { createTempProject, cleanup, runMsdTools, captureFdSync } = require('./helpers.cjs');
|
||||
const est = require('../msd-core/bin/lib/phase-estimation.cjs');
|
||||
const estimateCli = require('../msd-core/bin/lib/estimate-cli.cjs');
|
||||
// io.cjs owns error()/ERROR_REASON/JSON-error-mode — driven directly here so
|
||||
// H1 below can assert a typed `reason`, mirroring tests/config-get-default.test.cjs's
|
||||
// established in-process CLI-error-path pattern.
|
||||
const io = require('../gsd-core/bin/lib/io.cjs');
|
||||
const { ExitError } = require('../gsd-core/bin/lib/cli-exit.cjs');
|
||||
const io = require('../msd-core/bin/lib/io.cjs');
|
||||
const { ExitError } = require('../msd-core/bin/lib/cli-exit.cjs');
|
||||
|
||||
/** Write a phase dir containing a PLAN with an estimate and a SUMMARY with actuals. */
|
||||
function writePhase(tmpDir, phaseDir, { estTokens, actTokens, tasks = 3, commits = 4 }) {
|
||||
@@ -77,7 +77,7 @@ describe('estimate-calibrate', () => {
|
||||
writePhase(tmpDir, '02-beta', { estTokens: 60000, actTokens: 121000 });
|
||||
writePhase(tmpDir, '03-gamma', { estTokens: 40000, actTokens: 82000 });
|
||||
|
||||
const r = runGsdTools('query estimate-calibrate', tmpDir);
|
||||
const r = runMsdTools('query estimate-calibrate', tmpDir);
|
||||
assert.ok(r.success, `estimate-calibrate should succeed: ${r.error}`);
|
||||
|
||||
const out = JSON.parse(r.output);
|
||||
@@ -94,12 +94,12 @@ describe('estimate-calibrate', () => {
|
||||
);
|
||||
|
||||
// And the read verb must now agree — this is the loop actually closing.
|
||||
const readBack = JSON.parse(runGsdTools('query estimate-calibration', tmpDir).output);
|
||||
const readBack = JSON.parse(runMsdTools('query estimate-calibration', tmpDir).output);
|
||||
assert.equal(readBack.factor, out.factor, 'estimate-calibration must see what estimate-calibrate wrote');
|
||||
assert.equal(readBack.applied, true);
|
||||
|
||||
// A subsequent estimate is therefore larger than the raw projection.
|
||||
const check = JSON.parse(runGsdTools('query estimate-check --tokens 50000', tmpDir).output);
|
||||
const check = JSON.parse(runMsdTools('query estimate-check --tokens 50000', tmpDir).output);
|
||||
assert.ok(check.calibrated_tokens > 50000,
|
||||
`a later estimate must be corrected upward, got ${check.calibrated_tokens}`);
|
||||
});
|
||||
@@ -111,7 +111,7 @@ describe('estimate-calibrate', () => {
|
||||
writePhase(tmpDir, '02-b', { estTokens: 80000, actTokens: 48000 });
|
||||
writePhase(tmpDir, '03-c', { estTokens: 90000, actTokens: 54000 });
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.ok(out.factor < 1, `expected a downward correction, got ${out.factor}`);
|
||||
});
|
||||
|
||||
@@ -121,13 +121,13 @@ describe('estimate-calibrate', () => {
|
||||
|
||||
writePhase(tmpDir, '01-a', { estTokens: 100, actTokens: 200 });
|
||||
writePhase(tmpDir, '02-b', { estTokens: 100, actTokens: 200 });
|
||||
let out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
let out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 2);
|
||||
assert.equal(out.applied, false, '2 samples must not apply a correction');
|
||||
assert.equal(out.factor, 1);
|
||||
|
||||
writePhase(tmpDir, '03-c', { estTokens: 100, actTokens: 200 });
|
||||
out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 3);
|
||||
assert.equal(out.applied, true, '3 samples must apply');
|
||||
assert.equal(out.factor, 2);
|
||||
@@ -141,7 +141,7 @@ describe('estimate-calibrate', () => {
|
||||
writePhase(tmpDir, '02-plan-only', { estTokens: 100, actTokens: null });
|
||||
writePhase(tmpDir, '03-summary-only', { estTokens: null, actTokens: 200 });
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 1, 'only the fully-paired phase counts');
|
||||
});
|
||||
|
||||
@@ -154,7 +154,7 @@ describe('estimate-calibrate', () => {
|
||||
fs.writeFileSync(path.join(dir, '01-PLAN.md'), '---\nphase: 01-noest\nplan: 01\n---\nbody\n');
|
||||
fs.writeFileSync(path.join(dir, '01-SUMMARY.md'), '---\nphase: 01-noest\nactuals:\n tokens: 5\n tasks: 1\n commits: 1\n---\nx\n');
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 0);
|
||||
assert.equal(out.applied, false);
|
||||
});
|
||||
@@ -163,7 +163,7 @@ describe('estimate-calibrate', () => {
|
||||
const tmpDir = createTempProject();
|
||||
t.after(() => cleanup(tmpDir));
|
||||
|
||||
const r = runGsdTools('query estimate-calibrate', tmpDir);
|
||||
const r = runMsdTools('query estimate-calibrate', tmpDir);
|
||||
assert.ok(r.success, 'must not fail on an empty project');
|
||||
const out = JSON.parse(r.output);
|
||||
assert.equal(out.sample_count, 0);
|
||||
@@ -177,8 +177,8 @@ describe('estimate-calibrate', () => {
|
||||
writePhase(tmpDir, '02-b', { estTokens: 100, actTokens: 200 });
|
||||
writePhase(tmpDir, '03-c', { estTokens: 100, actTokens: 200 });
|
||||
|
||||
const first = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const second = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const first = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const second = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.deepEqual(second, first, 'a second run must produce an identical result');
|
||||
|
||||
const doc = est.parseCalibrationDocument(
|
||||
@@ -193,7 +193,7 @@ describe('estimate-calibrate', () => {
|
||||
fs.writeFileSync(path.join(tmpDir, '.planning', 'estimation-calibration.json'), '{ not json');
|
||||
writePhase(tmpDir, '01-a', { estTokens: 100, actTokens: 200 });
|
||||
|
||||
const r = runGsdTools('query estimate-calibrate', tmpDir);
|
||||
const r = runMsdTools('query estimate-calibrate', tmpDir);
|
||||
assert.ok(r.success, 'a corrupt prior document must not fail the rebuild');
|
||||
const doc = est.parseCalibrationDocument(
|
||||
fs.readFileSync(path.join(tmpDir, '.planning', 'estimation-calibration.json'), 'utf8'),
|
||||
@@ -206,7 +206,7 @@ describe('estimate-calibrate', () => {
|
||||
t.after(() => cleanup(tmpDir));
|
||||
writePhase(tmpDir, '01-a', { estTokens: 12345, actTokens: 23456 });
|
||||
|
||||
runGsdTools('query estimate-calibrate', tmpDir);
|
||||
runMsdTools('query estimate-calibrate', tmpDir);
|
||||
const raw = fs.readFileSync(path.join(tmpDir, '.planning', 'estimation-calibration.json'), 'utf8');
|
||||
const parsed = est.parseCalibrationDocument(raw);
|
||||
assert.deepEqual(parsed, [{ estimateTokens: 12345, actualTokens: 23456 }]);
|
||||
@@ -273,7 +273,7 @@ describe('calibration converges instead of oscillating', () => {
|
||||
`---\nphase: ${phase}\nactuals:\n tokens: 100000\n tasks: 3\n commits: 5\n---\nx\n`);
|
||||
}
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 3);
|
||||
assert.equal(out.factor, 2,
|
||||
'ratio must be actual/raw (2.0), not actual/calibrated (1.0)');
|
||||
@@ -314,7 +314,7 @@ describe('multi-plan phases pair per plan, not per phase', () => {
|
||||
writePlan(tmpDir, '04-multi', '01', { estTokens: null, actTokens: 30000 });
|
||||
writePlan(tmpDir, '04-multi', '02', { estTokens: 80000, actTokens: 200000 });
|
||||
|
||||
runGsdTools('query estimate-calibrate', tmpDir);
|
||||
runMsdTools('query estimate-calibrate', tmpDir);
|
||||
const doc = est.parseCalibrationDocument(
|
||||
fs.readFileSync(path.join(tmpDir, '.planning', 'estimation-calibration.json'), 'utf8'),
|
||||
);
|
||||
@@ -333,7 +333,7 @@ describe('multi-plan phases pair per plan, not per phase', () => {
|
||||
writePlan(tmpDir, '05-wave', '02', { estTokens: 50000, actTokens: 100000 });
|
||||
writePlan(tmpDir, '05-wave', '03', { estTokens: 60000, actTokens: 120000 });
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 3, 'all three plans must contribute — not just the first');
|
||||
assert.equal(out.factor, 2);
|
||||
assert.equal(out.applied, true, 'three samples in one phase must reach the minimum');
|
||||
@@ -353,7 +353,7 @@ describe('multi-plan phases pair per plan, not per phase', () => {
|
||||
fs.writeFileSync(path.join(dir, '06-02-PLAN.md'),
|
||||
'---\nphase: 06-partial\nestimate:\n tokens: 999999\n raw_tokens: 999999\n tasks: 1\n confidence: low\nmust_haves:\n---\nx\n');
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 1, 'an in-flight plan must not contribute a half-sample');
|
||||
});
|
||||
|
||||
@@ -365,7 +365,7 @@ describe('multi-plan phases pair per plan, not per phase', () => {
|
||||
writePlan(tmpDir, '01-a', '02', { estTokens: 100, actTokens: 200 });
|
||||
writePlan(tmpDir, '02-b', '01', { estTokens: 100, actTokens: 200 });
|
||||
|
||||
const out = JSON.parse(runGsdTools('query estimate-calibrate', tmpDir).output);
|
||||
const out = JSON.parse(runMsdTools('query estimate-calibrate', tmpDir).output);
|
||||
assert.equal(out.sample_count, 3, 'two plans in phase 1 plus one in phase 2');
|
||||
assert.equal(out.applied, true);
|
||||
});
|
||||
@@ -380,7 +380,7 @@ describe('multi-plan phases pair per plan, not per phase', () => {
|
||||
// PLAN/SUMMARY pair carries an estimate/actuals block contributes a phantom
|
||||
// calibration sample.
|
||||
//
|
||||
// Governing constraint (.gsd/phase/feat-3882-enumerations/50-test-matrix.md
|
||||
// Governing constraint (.msd/phase/feat-3882-enumerations/50-test-matrix.md
|
||||
// row A1): computeCalibration is MEDIAN-based, so a single outlier sample does
|
||||
// not move a 3-sample factor at all — asserting "the factor is unchanged" against
|
||||
// exactly one sentinel would pass on the broken code for the wrong reason. The
|
||||
@@ -504,7 +504,7 @@ describe('sentinel phases must not skew calibration (#3882)', () => {
|
||||
// milestone 999 — reserved icebox sentinel range (SENTINEL_RANGES).
|
||||
writePhase(tmpDir, '999-icebox', { estTokens: 1000, actTokens: 50000 });
|
||||
|
||||
const r = runGsdTools('query estimate-calibrate', tmpDir);
|
||||
const r = runMsdTools('query estimate-calibrate', tmpDir);
|
||||
assert.ok(r.success, `estimate-calibrate should succeed: ${r.error}`);
|
||||
|
||||
const out = JSON.parse(r.output);
|
||||
@@ -535,7 +535,7 @@ describe('sentinel phases must not skew calibration (#3882)', () => {
|
||||
// silent-empty), disclosed and tested here rather than left as an
|
||||
// undocumented side effect of the routing fix.
|
||||
//
|
||||
// H1 drives the real `cmdEstimateCalibrate` IN-PROCESS: `runGsdTools` spawns
|
||||
// H1 drives the real `cmdEstimateCalibrate` IN-PROCESS: `runMsdTools` spawns
|
||||
// a real subprocess, and neither `fs.readdirSync` monkeypatching nor
|
||||
// `process.exit` interception crosses that process boundary. The pattern
|
||||
// below is the two established repo idioms composed, not invented: the
|
||||
@@ -604,7 +604,7 @@ describe('unreadable phases directory refuses calibration (#3882, ADR-3473 §8.5
|
||||
});
|
||||
|
||||
test('H2: a genuinely-empty phases directory still succeeds with empty calibration (boundary the H1 guard must not cross)', (t) => {
|
||||
// Real CLI as a subprocess (runGsdTools) — this is the boundary case:
|
||||
// Real CLI as a subprocess (runMsdTools) — this is the boundary case:
|
||||
// .planning/phases/ EXISTS and is READABLE, but has zero entries. Must
|
||||
// succeed, not be caught by the unreadable-directory refusal above.
|
||||
// Overlaps the pre-existing "no phases at all is a clean no-op" test
|
||||
@@ -613,7 +613,7 @@ describe('unreadable phases directory refuses calibration (#3882, ADR-3473 §8.5
|
||||
const tmpDir = createTempProject();
|
||||
t.after(() => cleanup(tmpDir));
|
||||
|
||||
const r = runGsdTools('query estimate-calibrate', tmpDir);
|
||||
const r = runMsdTools('query estimate-calibrate', tmpDir);
|
||||
assert.ok(r.success, `a readable, genuinely-empty phases dir must succeed: ${r.error}`);
|
||||
const out = JSON.parse(r.output);
|
||||
assert.equal(out.sample_count, 0);
|
||||
@@ -627,7 +627,7 @@ describe('unreadable phases directory refuses calibration (#3882, ADR-3473 §8.5
|
||||
writePhase(tmpDir, '02-b', { estTokens: 100, actTokens: 200 });
|
||||
writePhase(tmpDir, '03-c', { estTokens: 100, actTokens: 200 });
|
||||
|
||||
const r = runGsdTools('query estimate-calibrate', tmpDir);
|
||||
const r = runMsdTools('query estimate-calibrate', tmpDir);
|
||||
assert.ok(r.success, `a normal readable project must not be affected by the guard: ${r.error}`);
|
||||
const out = JSON.parse(r.output);
|
||||
assert.equal(out.sample_count, 3);
|
||||
|
||||
Reference in New Issue
Block a user