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 @@
|
||||
/**
|
||||
* Tests for gsd:plan-review-convergence command (#2306)
|
||||
* Tests for msd:plan-review-convergence command (#2306)
|
||||
*
|
||||
* Validates that the command source and workflow contain the key structural
|
||||
* elements required for correct cross-AI plan convergence loop behavior:
|
||||
@@ -37,8 +37,8 @@ const { runHook, OUTCOME } = require('./helpers/process-seam.cjs');
|
||||
const { PROBE_TIMEOUT_MS, QUICK_SPAWN_TIMEOUT_MS } = require('./helpers/timeouts.cjs');
|
||||
const fc = require('fast-check');
|
||||
|
||||
// A nested bash → node → gsd-tools.cjs cold-start chain: `execFileSync('bash',
|
||||
// ['-c', script], ...)` where `script` itself invokes `node "$GSD_TOOLS_PATH"
|
||||
// A nested bash → node → msd-tools.cjs cold-start chain: `execFileSync('bash',
|
||||
// ['-c', script], ...)` where `script` itself invokes `node "$MSD_TOOLS_PATH"
|
||||
// ...`. Deliberately NOT `GENERATOR_SCRIPT_TIMEOUT_MS` despite the
|
||||
// coincidentally-matching value: that constant's own doc comment (see
|
||||
// tests/helpers/timeouts.cjs) scopes it to "a single scripts/*.cjs generator
|
||||
@@ -49,19 +49,19 @@ const fc = require('fast-check');
|
||||
// file's sites are a heavier, different shape (bash wrapping a further node
|
||||
// spawn), so they get their own file-local constant instead of borrowing one
|
||||
// whose doc comment describes something else.
|
||||
const NESTED_BASH_GSD_TOOLS_TIMEOUT_MS = 30000;
|
||||
const NESTED_BASH_MSD_TOOLS_TIMEOUT_MS = 30000;
|
||||
|
||||
const COMMAND_PATH = path.join(__dirname, '..', 'commands', 'gsd', 'plan-review-convergence.md');
|
||||
const WORKFLOW_PATH = path.join(__dirname, '..', 'gsd-core', 'workflows', 'plan-review-convergence.md');
|
||||
const COMMAND_PATH = path.join(__dirname, '..', 'commands', 'msd', 'plan-review-convergence.md');
|
||||
const WORKFLOW_PATH = path.join(__dirname, '..', 'msd-core', 'workflows', 'plan-review-convergence.md');
|
||||
const CONFIG_DOC_PATH = path.join(__dirname, '..', 'docs', 'CONFIGURATION.md');
|
||||
const PLAN_PHASE_PATH = path.join(__dirname, '..', 'gsd-core', 'workflows', 'plan-phase.md');
|
||||
const PLANNER_REVIEWS_PATH = path.join(__dirname, '..', 'gsd-core', 'references', 'planner-reviews.md');
|
||||
const PLAN_CHECKER_PATH = path.join(__dirname, '..', 'agents', 'gsd-plan-checker.md');
|
||||
const WORKFLOW_REVIEW_PATH = path.join(__dirname, '..', 'gsd-core', 'workflows', 'review.md');
|
||||
const PLAN_PHASE_PATH = path.join(__dirname, '..', 'msd-core', 'workflows', 'plan-phase.md');
|
||||
const PLANNER_REVIEWS_PATH = path.join(__dirname, '..', 'msd-core', 'references', 'planner-reviews.md');
|
||||
const PLAN_CHECKER_PATH = path.join(__dirname, '..', 'agents', 'msd-plan-checker.md');
|
||||
const WORKFLOW_REVIEW_PATH = path.join(__dirname, '..', 'msd-core', 'workflows', 'review.md');
|
||||
|
||||
// #2315: the workflow's reviewer-resolution block pipes through `jq`, which is
|
||||
// a documented production dependency (review.md:244 "install jq if missing")
|
||||
// but is NOT present in every test container (gsd-test's linux-node{22,24}
|
||||
// but is NOT present in every test container (msd-test's linux-node{22,24}
|
||||
// images lack it; see tests/opencode-review-reconstruction.property.test.cjs
|
||||
// for the same skip pattern). Behavioral tests that exercise the deployed jq
|
||||
// pipeline skip when jq is absent; structural tests still run.
|
||||
@@ -69,14 +69,14 @@ let jqAvailable = false;
|
||||
try { execFileSync('jq', ['--version'], { stdio: 'ignore', timeout: QUICK_SPAWN_TIMEOUT_MS, killSignal: 'SIGKILL' }); jqAvailable = true; } catch { /* no jq on PATH */ }
|
||||
|
||||
// #2800: the hand-written per-flag `grep -q '\-\-<flag>'` whitelist lines were
|
||||
// replaced by a loop deriving REVIEWER_FLAGS from `gsd_run review-lane flags`
|
||||
// replaced by a loop deriving REVIEWER_FLAGS from `msd_run review-lane flags`
|
||||
// (the declared lane roster). These helpers extract the REAL deployed parse
|
||||
// block (`REVIEWER_FLAGS=""` through the closing `done` of the for-loop) and
|
||||
// execute it under a real `gsd_run` shim backed by the actual gsd-tools.cjs
|
||||
// execute it under a real `msd_run` shim backed by the actual msd-tools.cjs
|
||||
// binary, so behavioral coverage proves pass-through against the real
|
||||
// implementation rather than a stale hand-written literal. POSIX-only —
|
||||
// callers must skip on win32.
|
||||
const GSD_TOOLS_PATH = path.join(__dirname, '..', 'gsd-core', 'bin', 'gsd-tools.cjs');
|
||||
const MSD_TOOLS_PATH = path.join(__dirname, '..', 'msd-core', 'bin', 'msd-tools.cjs');
|
||||
|
||||
function extractReviewerFlagsParseBlock(workflowText) {
|
||||
const startIdx = workflowText.indexOf('REVIEWER_FLAGS=""');
|
||||
@@ -86,19 +86,19 @@ function extractReviewerFlagsParseBlock(workflowText) {
|
||||
}
|
||||
|
||||
function runReviewerFlagsParseBlock(block, args) {
|
||||
const stub = 'gsd_run() { node "$GSD_TOOLS_PATH" "$@"; }';
|
||||
const stub = 'msd_run() { node "$MSD_TOOLS_PATH" "$@"; }';
|
||||
const script = `${stub}\n${block}\nprintf "%s" "$REVIEWER_FLAGS"`;
|
||||
return execFileSync('bash', ['-c', script], {
|
||||
env: { ...process.env, ARGUMENTS: args, GSD_TOOLS_PATH },
|
||||
env: { ...process.env, ARGUMENTS: args, MSD_TOOLS_PATH },
|
||||
encoding: 'utf8',
|
||||
// NESTED_BASH_GSD_TOOLS_TIMEOUT_MS (30s) covers the nested bash → node →
|
||||
// gsd-tools.cjs cold-start chain this helper spawns. 5s was too tight: on
|
||||
// NESTED_BASH_MSD_TOOLS_TIMEOUT_MS (30s) covers the nested bash → node →
|
||||
// msd-tools.cjs cold-start chain this helper spawns. 5s was too tight: on
|
||||
// a loaded bench (30k tests running in parallel) that budget was consumed
|
||||
// by process-spawn scheduling latency alone, producing a spurious
|
||||
// ETIMEDOUT with no genuine hang. See that constant's doc comment for why
|
||||
// this is a distinct class from GENERATOR_SCRIPT_TIMEOUT_MS despite the
|
||||
// matching value.
|
||||
timeout: NESTED_BASH_GSD_TOOLS_TIMEOUT_MS,
|
||||
timeout: NESTED_BASH_MSD_TOOLS_TIMEOUT_MS,
|
||||
}).trim();
|
||||
}
|
||||
|
||||
@@ -107,10 +107,10 @@ function runReviewerFlagsParseBlock(block, args) {
|
||||
describe('plan-review-convergence command source (#2306)', () => {
|
||||
const command = fs.readFileSync(COMMAND_PATH, 'utf8');
|
||||
|
||||
test('command name uses gsd: prefix (installer converts to gsd- on install)', () => {
|
||||
test('command name uses msd: prefix (installer converts to msd- on install)', () => {
|
||||
assert.ok(
|
||||
command.includes('name: gsd:plan-review-convergence'),
|
||||
'command name must use gsd: prefix so installer converts it to gsd-plan-review-convergence'
|
||||
command.includes('name: msd:plan-review-convergence'),
|
||||
'command name must use msd: prefix so installer converts it to msd-plan-review-convergence'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@ describe('plan-review-convergence command source (#2306)', () => {
|
||||
|
||||
test('command references the workflow file via execution_context', () => {
|
||||
assert.ok(
|
||||
command.includes('@$HOME/.claude/gsd-core/workflows/plan-review-convergence.md'),
|
||||
command.includes('@$HOME/.claude/msd-core/workflows/plan-review-convergence.md'),
|
||||
'execution_context must reference the workflow file'
|
||||
);
|
||||
});
|
||||
@@ -175,7 +175,7 @@ describe('plan-review-convergence command source (#2306)', () => {
|
||||
test('command declares Skill in allowed-tools (required for inline plan-phase invocations)', () => {
|
||||
assert.ok(
|
||||
command.includes('- Skill'),
|
||||
'Skill must be in allowed-tools — command invokes gsd-plan-phase inline via Skill() at depth 0 (#936 fix)'
|
||||
'Skill must be in allowed-tools — command invokes msd-plan-phase inline via Skill() at depth 0 (#936 fix)'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -212,7 +212,7 @@ describe('plan-review-convergence command source (#2306)', () => {
|
||||
|
||||
describe('plan-review-convergence: --agy/--antigravity reviewer whitelist (#2293)', () => {
|
||||
const workflow = fs.readFileSync(WORKFLOW_PATH, 'utf8');
|
||||
const SKILL_PATH = path.join(__dirname, '..', 'skills', 'gsd-plan-review-convergence', 'SKILL.md');
|
||||
const SKILL_PATH = path.join(__dirname, '..', 'skills', 'msd-plan-review-convergence', 'SKILL.md');
|
||||
|
||||
test('workflow REVIEWER_FLAGS extraction derives its whitelist from review-lane flags, not a hand-written list (#2800)', () => {
|
||||
// #2800: the runtime contract used to be a hand-written grep-accumulation
|
||||
@@ -220,12 +220,12 @@ describe('plan-review-convergence: --agy/--antigravity reviewer whitelist (#2293
|
||||
// the flag was silently dropped, and that whitelist drifted three separate
|
||||
// times (--coderabbit, then --qwen/--cursor/--kimi-code, then the unanchored
|
||||
// --agy pattern matching inside --antigravity). The fix derives the whitelist
|
||||
// structurally from the declared lane roster via `gsd_run review-lane flags`,
|
||||
// structurally from the declared lane roster via `msd_run review-lane flags`,
|
||||
// so --agy/--antigravity (and every other lane flag) are guaranteed reachable
|
||||
// without being named individually here.
|
||||
assert.ok(
|
||||
workflow.includes('gsd_run review-lane flags'),
|
||||
'workflow must derive REVIEWER_FLAGS by iterating `gsd_run review-lane flags` (the declared lane roster), not a hand-written list'
|
||||
workflow.includes('msd_run review-lane flags'),
|
||||
'workflow must derive REVIEWER_FLAGS by iterating `msd_run review-lane flags` (the declared lane roster), not a hand-written list'
|
||||
);
|
||||
// Anti-parity guard: re-introducing a hand-enumerated per-flag whitelist line
|
||||
// (the exact shape of the pre-#2800 bug) must fail this test, even though the
|
||||
@@ -292,12 +292,12 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
// is the single correct fix rather than a per-test patch.
|
||||
const workflow = readFileNormalized(WORKFLOW_PATH);
|
||||
const command = fs.readFileSync(COMMAND_PATH, 'utf8');
|
||||
const SKILL_PATH = path.join(__dirname, '..', 'skills', 'gsd-plan-review-convergence', 'SKILL.md');
|
||||
const SKILL_PATH = path.join(__dirname, '..', 'skills', 'msd-plan-review-convergence', 'SKILL.md');
|
||||
const skill = fs.readFileSync(SKILL_PATH, 'utf8');
|
||||
|
||||
// Pre-fix #2315: the workflow unconditionally set REVIEWER_FLAGS="--codex" in
|
||||
// step 1 (line 37) BEFORE the workflow.plan_review_convergence config gate.
|
||||
// gsd-review sees the injected --codex as an explicit flag (precedence rule 1)
|
||||
// msd-review sees the injected --codex as an explicit flag (precedence rule 1)
|
||||
// and never reaches rule 3 (review.default_reviewers), silently overriding
|
||||
// any configured default — a violation of ADR-0011 and ADR-0015.
|
||||
//
|
||||
@@ -317,8 +317,8 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
});
|
||||
|
||||
test('workflow resolves REVIEWER_FLAGS against review.default_reviewers AFTER the config gate', () => {
|
||||
const resolutionIdx = workflow.indexOf('gsd_run query config-get review.default_reviewers');
|
||||
const configGateIdx = workflow.indexOf('CONVERGENCE_ENABLED=$(gsd_run query config-get workflow.plan_review_convergence');
|
||||
const resolutionIdx = workflow.indexOf('msd_run query config-get review.default_reviewers');
|
||||
const configGateIdx = workflow.indexOf('CONVERGENCE_ENABLED=$(msd_run query config-get workflow.plan_review_convergence');
|
||||
assert.ok(resolutionIdx !== -1, 'workflow must query review.default_reviewers to resolve the no-flag default (#2315)');
|
||||
assert.ok(
|
||||
resolutionIdx > configGateIdx,
|
||||
@@ -326,14 +326,14 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
);
|
||||
});
|
||||
|
||||
test('workflow documents that empty REVIEWER_FLAGS lets gsd-review apply review.default_reviewers', () => {
|
||||
test('workflow documents that empty REVIEWER_FLAGS lets msd-review apply review.default_reviewers', () => {
|
||||
// After the fix, an empty REVIEWER_FLAGS is INTENTIONAL — it signals "let
|
||||
// gsd-review apply its own precedence (rule 3: review.default_reviewers)".
|
||||
// msd-review apply its own precedence (rule 3: review.default_reviewers)".
|
||||
// A comment must document this so a future maintainer does not re-add the
|
||||
// unconditional --codex fallback and resurrect the #2315 bug.
|
||||
assert.ok(
|
||||
/gsd-review applies.*review\.default_reviewers|review\.default_reviewers.*gsd-review applies/i.test(workflow),
|
||||
'workflow must document that empty REVIEWER_FLAGS lets gsd-review apply review.default_reviewers (prevent #2315 regression)'
|
||||
/msd-review applies.*review\.default_reviewers|review\.default_reviewers.*msd-review applies/i.test(workflow),
|
||||
'workflow must document that empty REVIEWER_FLAGS lets msd-review apply review.default_reviewers (prevent #2315 regression)'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -356,8 +356,8 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
|
||||
test('command and skill doc both document the review.default_reviewers precedence (content parity)', () => {
|
||||
// The #2315 fix updated the --codex flag description in BOTH the command
|
||||
// (commands/gsd/plan-review-convergence.md) and the generated skill mirror
|
||||
// (skills/gsd-plan-review-convergence/SKILL.md). The two are kept in sync
|
||||
// (commands/msd/plan-review-convergence.md) and the generated skill mirror
|
||||
// (skills/msd-plan-review-convergence/SKILL.md). The two are kept in sync
|
||||
// by `npm run gen:plugin-skills`; this assertion catches a manual edit to
|
||||
// one that the other doesn't mirror. Both must mention review.default_reviewers
|
||||
// alongside the --codex default claim.
|
||||
@@ -373,8 +373,8 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
});
|
||||
|
||||
// Behavioral: extract the parse block + the post-config-gate resolution block
|
||||
// and execute them with a stubbed gsd_run. Proves the matrix:
|
||||
// - bare + default_reviewers configured → empty REVIEWER_FLAGS (gsd-review applies default)
|
||||
// and execute them with a stubbed msd_run. Proves the matrix:
|
||||
// - bare + default_reviewers configured → empty REVIEWER_FLAGS (msd-review applies default)
|
||||
// - bare + default_reviewers unset → --codex fallback (pre-fix behavior preserved)
|
||||
// - bare + empty-array default → --codex fallback (defensive — schema would reject)
|
||||
// - explicit --codex + default set → --codex wins (explicit flags unaffected, #2315 AC5)
|
||||
@@ -384,8 +384,8 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
const { execFileSync } = require('node:child_process');
|
||||
|
||||
// Parse block: the REAL deployed REVIEWER_FLAGS derivation loop (#2800), from
|
||||
// `REVIEWER_FLAGS=""` through the closing `done`. It calls `gsd_run review-lane
|
||||
// flags`, so the stub below delegates that specific call to the real gsd-tools.cjs
|
||||
// `REVIEWER_FLAGS=""` through the closing `done`. It calls `msd_run review-lane
|
||||
// flags`, so the stub below delegates that specific call to the real msd-tools.cjs
|
||||
// binary rather than a hand-maintained flag list.
|
||||
const parseBlock = extractReviewerFlagsParseBlock(workflow);
|
||||
assert.ok(parseBlock, 'parse block must exist');
|
||||
@@ -395,7 +395,7 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
// Extract to the closing fence of the enclosing ```bash block — the block
|
||||
// contains a nested if/else/fi, so a naive "first \nfi\n" match would stop
|
||||
// at the inner fi and yield unbalanced bash.
|
||||
const configGateIdx = workflow.indexOf('CONVERGENCE_ENABLED=$(gsd_run query config-get workflow.plan_review_convergence');
|
||||
const configGateIdx = workflow.indexOf('CONVERGENCE_ENABLED=$(msd_run query config-get workflow.plan_review_convergence');
|
||||
const resolutionStart = workflow.indexOf('if [ -z "$REVIEWER_FLAGS" ]; then', configGateIdx);
|
||||
assert.ok(resolutionStart !== -1, 'post-config-gate REVIEWER_FLAGS resolution block must exist (#2315)');
|
||||
const closingFence = workflow.indexOf('\n```\n', resolutionStart);
|
||||
@@ -403,31 +403,31 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
const resolutionBlock = workflow.slice(resolutionStart, closingFence);
|
||||
|
||||
const run = ({ args, defaultReviewers }) => {
|
||||
// Stub gsd_run: `query config-get review.default_reviewers` returns the
|
||||
// stubbed value; `review-lane flags` delegates to the REAL gsd-tools.cjs
|
||||
// Stub msd_run: `query config-get review.default_reviewers` returns the
|
||||
// stubbed value; `review-lane flags` delegates to the REAL msd-tools.cjs
|
||||
// binary (so the parse block's loop is genuinely exercised, not stubbed
|
||||
// into a no-op); anything else is a no-op.
|
||||
//
|
||||
// The default_reviewers value is passed via env var ($GSD_TEST_DEFAULT_REVIEWERS)
|
||||
// The default_reviewers value is passed via env var ($MSD_TEST_DEFAULT_REVIEWERS)
|
||||
// rather than inline-interpolated into the bash script. This avoids a quoting
|
||||
// fragility: a future test input containing a single quote would otherwise
|
||||
// break the bash single-quoted string and execute as bash. With env-var
|
||||
// handoff, the value never crosses an interpreting shell context.
|
||||
const stub = `gsd_run() { case "$*" in *"config-get review.default_reviewers"*) printf '%s' "$GSD_TEST_DEFAULT_REVIEWERS";; *"review-lane flags"*) node "$GSD_TOOLS_PATH" review-lane flags;; *) return 0;; esac; }`;
|
||||
const stub = `msd_run() { case "$*" in *"config-get review.default_reviewers"*) printf '%s' "$MSD_TEST_DEFAULT_REVIEWERS";; *"review-lane flags"*) node "$MSD_TOOLS_PATH" review-lane flags;; *) return 0;; esac; }`;
|
||||
const script = `${stub}\n${parseBlock}\n${resolutionBlock}\nprintf 'REVIEWER_FLAGS=[%s] REVIEWER_DISPLAY=[%s]' "$REVIEWER_FLAGS" "$REVIEWER_DISPLAY"`;
|
||||
return execFileSync('bash', ['-c', script], {
|
||||
env: { ...process.env, ARGUMENTS: args, GSD_TEST_DEFAULT_REVIEWERS: defaultReviewers ?? '', GSD_TOOLS_PATH },
|
||||
env: { ...process.env, ARGUMENTS: args, MSD_TEST_DEFAULT_REVIEWERS: defaultReviewers ?? '', MSD_TOOLS_PATH },
|
||||
encoding: 'utf8',
|
||||
// NESTED_BASH_GSD_TOOLS_TIMEOUT_MS covers the same nested bash → node
|
||||
// → gsd-tools.cjs cold-start chain as runReviewerFlagsParseBlock
|
||||
// NESTED_BASH_MSD_TOOLS_TIMEOUT_MS covers the same nested bash → node
|
||||
// → msd-tools.cjs cold-start chain as runReviewerFlagsParseBlock
|
||||
// above; see that helper's comment for why 5s flaked under bench
|
||||
// load.
|
||||
timeout: NESTED_BASH_GSD_TOOLS_TIMEOUT_MS,
|
||||
timeout: NESTED_BASH_MSD_TOOLS_TIMEOUT_MS,
|
||||
});
|
||||
};
|
||||
|
||||
// AC1: bare invocation with default_reviewers configured → empty REVIEWER_FLAGS
|
||||
// (gsd-review applies configured default per its rule 3) and banner shows the resolved default.
|
||||
// (msd-review applies configured default per its rule 3) and banner shows the resolved default.
|
||||
let r = run({ args: '5', defaultReviewers: '["gemini","claude"]' });
|
||||
assert.ok(/REVIEWER_FLAGS=\[\s*\]/.test(r), `configured default → REVIEWER_FLAGS empty, got: "${r}"`);
|
||||
assert.ok(/review\.default_reviewers \(gemini, claude\)/.test(r), `banner shows configured default, got: "${r}"`);
|
||||
@@ -452,7 +452,7 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
// Property test — CLAUDE.md mandates at least one fast-check (fc) property
|
||||
// test for parsers and bijective contracts. The resolution block parses the
|
||||
// configured review.default_reviewers JSON and classifies it into one of two
|
||||
// outcomes: "non-empty array → delegate to gsd-review" (REVIEWER_FLAGS empty)
|
||||
// outcomes: "non-empty array → delegate to msd-review" (REVIEWER_FLAGS empty)
|
||||
// or "anything else → fall back to --codex" (defensive — schema rejects most
|
||||
// of these at config-set time, but corruption/edge cases must not crash or
|
||||
// misclassify). Locks the contract so a future change can't subtly narrow or
|
||||
@@ -465,22 +465,22 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
// Re-extract the blocks (the test above proved extraction works; we re-use
|
||||
// the same logic rather than promoting to a helper to keep the test scope local).
|
||||
const parseBlock = extractReviewerFlagsParseBlock(workflow);
|
||||
const configGateIdx = workflow.indexOf('CONVERGENCE_ENABLED=$(gsd_run query config-get workflow.plan_review_convergence');
|
||||
const configGateIdx = workflow.indexOf('CONVERGENCE_ENABLED=$(msd_run query config-get workflow.plan_review_convergence');
|
||||
const resolutionStart = workflow.indexOf('if [ -z "$REVIEWER_FLAGS" ]; then', configGateIdx);
|
||||
const closingFence = workflow.indexOf('\n```\n', resolutionStart);
|
||||
const resolutionBlock = workflow.slice(resolutionStart, closingFence);
|
||||
const { execFileSync } = require('node:child_process');
|
||||
const run = ({ args, defaultReviewers }) => {
|
||||
const stub = `gsd_run() { case "$*" in *"config-get review.default_reviewers"*) printf '%s' "$GSD_TEST_DEFAULT_REVIEWERS";; *"review-lane flags"*) node "$GSD_TOOLS_PATH" review-lane flags;; *) return 0;; esac; }`;
|
||||
const stub = `msd_run() { case "$*" in *"config-get review.default_reviewers"*) printf '%s' "$MSD_TEST_DEFAULT_REVIEWERS";; *"review-lane flags"*) node "$MSD_TOOLS_PATH" review-lane flags;; *) return 0;; esac; }`;
|
||||
const script = `${stub}\n${parseBlock}\n${resolutionBlock}\nprintf 'REVIEWER_FLAGS=[%s] REVIEWER_DISPLAY=[%s]' "$REVIEWER_FLAGS" "$REVIEWER_DISPLAY"`;
|
||||
return execFileSync('bash', ['-c', script], {
|
||||
env: { ...process.env, ARGUMENTS: args, GSD_TEST_DEFAULT_REVIEWERS: defaultReviewers ?? '', GSD_TOOLS_PATH },
|
||||
env: { ...process.env, ARGUMENTS: args, MSD_TEST_DEFAULT_REVIEWERS: defaultReviewers ?? '', MSD_TOOLS_PATH },
|
||||
encoding: 'utf8',
|
||||
// NESTED_BASH_GSD_TOOLS_TIMEOUT_MS covers the same nested bash → node
|
||||
// → gsd-tools.cjs cold-start chain as runReviewerFlagsParseBlock
|
||||
// NESTED_BASH_MSD_TOOLS_TIMEOUT_MS covers the same nested bash → node
|
||||
// → msd-tools.cjs cold-start chain as runReviewerFlagsParseBlock
|
||||
// above; see that helper's comment for why 5s flaked under bench
|
||||
// load.
|
||||
timeout: NESTED_BASH_GSD_TOOLS_TIMEOUT_MS,
|
||||
timeout: NESTED_BASH_MSD_TOOLS_TIMEOUT_MS,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -528,10 +528,10 @@ describe('plan-review-convergence: #2315 respects review.default_reviewers (no-f
|
||||
describe('plan-review-convergence workflow: initialization (#2306)', () => {
|
||||
const workflow = fs.readFileSync(WORKFLOW_PATH, 'utf8');
|
||||
|
||||
test('workflow calls gsd-tools.cjs init plan-phase for initialization', () => {
|
||||
test('workflow calls msd-tools.cjs init plan-phase for initialization', () => {
|
||||
assert.ok(
|
||||
workflow.includes('gsd-tools.cjs') && workflow.includes('init') && workflow.includes('plan-phase'),
|
||||
'workflow must initialize via gsd-tools.cjs init plan-phase'
|
||||
workflow.includes('msd-tools.cjs') && workflow.includes('init') && workflow.includes('plan-phase'),
|
||||
'workflow must initialize via msd-tools.cjs init plan-phase'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -565,7 +565,7 @@ describe('plan-review-convergence workflow: config gate (#2306-v2)', () => {
|
||||
test('workflow exits with enable instructions when config key is false', () => {
|
||||
// Must tell the user how to enable the feature
|
||||
assert.ok(
|
||||
workflow.includes('gsd config-set workflow.plan_review_convergence true') ||
|
||||
workflow.includes('msd config-set workflow.plan_review_convergence true') ||
|
||||
workflow.includes('config-set workflow.plan_review_convergence'),
|
||||
'workflow must show the user how to enable the feature when disabled (#2306-v2)'
|
||||
);
|
||||
@@ -598,10 +598,10 @@ describe('plan-review-convergence workflow: initial planning gate (#2306)', () =
|
||||
);
|
||||
});
|
||||
|
||||
test('workflow runs gsd-plan-phase when no plans exist', () => {
|
||||
test('workflow runs msd-plan-phase when no plans exist', () => {
|
||||
assert.ok(
|
||||
workflow.includes('gsd-plan-phase'),
|
||||
'workflow must invoke gsd-plan-phase when no plans exist'
|
||||
workflow.includes('msd-plan-phase'),
|
||||
'workflow must invoke msd-plan-phase when no plans exist'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -620,8 +620,8 @@ describe('plan-review-convergence workflow: convergence loop (#2306)', () => {
|
||||
|
||||
test('workflow spawns isolated review agent each cycle', () => {
|
||||
assert.ok(
|
||||
workflow.includes('gsd-review'),
|
||||
'workflow must spawn Agent → gsd-review each cycle'
|
||||
workflow.includes('msd-review'),
|
||||
'workflow must spawn Agent → msd-review each cycle'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -668,15 +668,15 @@ describe('plan-review-convergence workflow: convergence loop (#2306)', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('review agent spawn forwards --ws via GSD_WS (symmetric with replan agent)', () => {
|
||||
// Critical correctness bug: if GSD_WS is not forwarded to the review agent,
|
||||
test('review agent spawn forwards --ws via MSD_WS (symmetric with replan agent)', () => {
|
||||
// Critical correctness bug: if MSD_WS is not forwarded to the review agent,
|
||||
// the review reads from the wrong workspace while replanning reads from the correct one.
|
||||
const reviewAgentBlock = workflow.match(/gsd-review['"`,\s][\s\S]{0,300}?GSD_WS/);
|
||||
const reviewAgentBlock = workflow.match(/msd-review['"`,\s][\s\S]{0,300}?MSD_WS/);
|
||||
assert.ok(
|
||||
reviewAgentBlock ||
|
||||
(workflow.includes("'gsd-review'") && workflow.includes('{GSD_WS}') &&
|
||||
workflow.indexOf('{GSD_WS}') < workflow.indexOf("'gsd-plan-phase'")),
|
||||
'review agent spawn must forward {GSD_WS} — workspace flag must reach the reviewer (#2306-v2 --ws fix)'
|
||||
(workflow.includes("'msd-review'") && workflow.includes('{MSD_WS}') &&
|
||||
workflow.indexOf('{MSD_WS}') < workflow.indexOf("'msd-plan-phase'")),
|
||||
'review agent spawn must forward {MSD_WS} — workspace flag must reach the reviewer (#2306-v2 --ws fix)'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -694,14 +694,14 @@ describe('plan-review-convergence workflow: convergence loop (#2306)', () => {
|
||||
test('workflow updates STATE.md on convergence', () => {
|
||||
assert.ok(
|
||||
workflow.includes('planned-phase') || workflow.includes('state'),
|
||||
'workflow must update STATE.md via gsd-tools.cjs when converged'
|
||||
'workflow must update STATE.md via msd-tools.cjs when converged'
|
||||
);
|
||||
});
|
||||
|
||||
test('workflow invokes inline replan with --reviews flag', () => {
|
||||
assert.ok(
|
||||
workflow.includes('--reviews'),
|
||||
'inline replan must pass --reviews so gsd-plan-phase incorporates review feedback'
|
||||
'inline replan must pass --reviews so msd-plan-phase incorporates review feedback'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -939,12 +939,12 @@ describe('plan-review-convergence workflow: success criteria (#2306-v2)', () =>
|
||||
describe('plan-review-convergence config schema registration (#2306-v2)', () => {
|
||||
// After Cycle 5 (#3536), config-schema.cjs is a thin adapter sourcing from
|
||||
// the manifest. Use the runtime Set instead of text-parsing the source file.
|
||||
const { VALID_CONFIG_KEYS } = require('../gsd-core/bin/lib/config-schema.cjs');
|
||||
const { VALID_CONFIG_KEYS } = require('../msd-core/bin/lib/config-schema.cjs');
|
||||
|
||||
test('workflow.plan_review_convergence is registered in config-schema.cjs', () => {
|
||||
assert.ok(
|
||||
VALID_CONFIG_KEYS.has('workflow.plan_review_convergence'),
|
||||
"workflow.plan_review_convergence must be registered in VALID_CONFIG_KEYS in config-schema.cjs so gsd config-set accepts it (#2306-v2)"
|
||||
"workflow.plan_review_convergence must be registered in VALID_CONFIG_KEYS in config-schema.cjs so msd config-set accepts it (#2306-v2)"
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -991,7 +991,7 @@ describe('plan-review-convergence reviews-mode incorporation contract (#724)', (
|
||||
assert.ok(
|
||||
planPhase.includes('<review_incorporation_contract>') &&
|
||||
planPhase.includes('REVIEWS.md is feedback input') &&
|
||||
planPhase.includes('/gsd:execute-phase primarily consumes PLAN.md'),
|
||||
planPhase.includes('/msd:execute-phase primarily consumes PLAN.md'),
|
||||
'planner prompt must explain that actionable review feedback must land in PLAN.md for execute-phase (#724)'
|
||||
);
|
||||
});
|
||||
@@ -1007,14 +1007,14 @@ describe('plan-review-convergence reviews-mode incorporation contract (#724)', (
|
||||
|
||||
test('planner reviews reference requires actionable findings to appear in PLAN.md or be deferred there', () => {
|
||||
assert.ok(
|
||||
plannerReviews.includes('/gsd:execute-phase primarily consumes PLAN.md') &&
|
||||
plannerReviews.includes('/msd:execute-phase primarily consumes PLAN.md') &&
|
||||
plannerReviews.includes('Every current actionable review finding') &&
|
||||
plannerReviews.includes('deferral/rejection rationale in that PLAN.md'),
|
||||
'planner reviews reference must keep REVIEWS.md from becoming a hidden execution contract (#724)'
|
||||
);
|
||||
});
|
||||
|
||||
test('gsd-plan-checker has a Review Incorporation dimension for reviews mode', () => {
|
||||
test('msd-plan-checker has a Review Incorporation dimension for reviews mode', () => {
|
||||
assert.ok(
|
||||
planChecker.includes('Review Incorporation') &&
|
||||
planChecker.includes('current_actionable=<M>') &&
|
||||
@@ -1047,7 +1047,7 @@ describe('plan-review-convergence reviews-mode incorporation contract (#724)', (
|
||||
// payload tables (`### Review Feedback Addressed` / `### Review Feedback
|
||||
// Deferred`) into a canonical `## Review Dispositions Ledger` PLAN.md
|
||||
// section, stated ONCE in planner-reviews.md and referenced — not restated —
|
||||
// from plan-phase.md and gsd-plan-checker.md. These tests are the parity
|
||||
// from plan-phase.md and msd-plan-checker.md. These tests are the parity
|
||||
// assertion the maintainer's verdict required (condition 3): they fail if
|
||||
// the three seams diverge.
|
||||
|
||||
@@ -1064,7 +1064,7 @@ describe('plan-review-convergence reviews-mode ledger canonicalization (#3806)',
|
||||
// example that happens to show the same heading text as sample content
|
||||
// (planner-reviews.md's worked example does this deliberately, so a plan-
|
||||
// writing agent has a full copyable sample including its own top heading).
|
||||
const { splitLines } = require('../gsd-core/bin/lib/text-lines.cjs');
|
||||
const { splitLines } = require('../msd-core/bin/lib/text-lines.cjs');
|
||||
let inFence = false;
|
||||
let realHeadingCount = 0;
|
||||
for (const line of splitLines(plannerReviews)) {
|
||||
@@ -1103,7 +1103,7 @@ describe('plan-review-convergence reviews-mode ledger canonicalization (#3806)',
|
||||
);
|
||||
});
|
||||
|
||||
test('gsd-plan-checker.md references the canonical ledger instead of restating its shape', () => {
|
||||
test('msd-plan-checker.md references the canonical ledger instead of restating its shape', () => {
|
||||
const headingMatch = plannerReviews.match(LEDGER_HEADING_RE);
|
||||
assert.ok(headingMatch, 'precondition: canonical heading must exist in planner-reviews.md');
|
||||
const canonicalHeading = headingMatch[1].trim();
|
||||
@@ -1111,16 +1111,16 @@ describe('plan-review-convergence reviews-mode ledger canonicalization (#3806)',
|
||||
assert.match(
|
||||
planChecker,
|
||||
/references\/planner-reviews\.md/,
|
||||
'gsd-plan-checker.md Review Incorporation dimension must point at references/planner-reviews.md for the ledger shape (#3806)'
|
||||
'msd-plan-checker.md Review Incorporation dimension must point at references/planner-reviews.md for the ledger shape (#3806)'
|
||||
);
|
||||
assert.ok(
|
||||
planChecker.includes(canonicalHeading),
|
||||
`gsd-plan-checker.md must name the live canonical heading ("${canonicalHeading}") — if planner-reviews.md renames it without updating this reference, this fails (#3806 parity)`
|
||||
`msd-plan-checker.md must name the live canonical heading ("${canonicalHeading}") — if planner-reviews.md renames it without updating this reference, this fails (#3806 parity)`
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
planChecker,
|
||||
/^##\s+Review Dispositions Ledger[^\r\n]*$/m,
|
||||
'gsd-plan-checker.md must NOT define its own competing "## Review Dispositions Ledger" heading — the contract is stated once, in planner-reviews.md, never restated (#3806)'
|
||||
'msd-plan-checker.md must NOT define its own competing "## Review Dispositions Ledger" heading — the contract is stated once, in planner-reviews.md, never restated (#3806)'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1184,7 +1184,7 @@ describe('plan-review-convergence local model reviewer flags (#2306-local)', ()
|
||||
const workflow = fs.readFileSync(WORKFLOW_PATH, 'utf8');
|
||||
|
||||
// #2800: local-model flags are no longer hand-listed in the workflow — they
|
||||
// reach REVIEWER_FLAGS via the derived `gsd_run review-lane flags` loop (see
|
||||
// reach REVIEWER_FLAGS via the derived `msd_run review-lane flags` loop (see
|
||||
// the #2293 describe block above). Prove pass-through behaviorally against
|
||||
// the REAL deployed parse block instead of grepping for a literal string
|
||||
// that no longer exists in the workflow source.
|
||||
@@ -1209,19 +1209,19 @@ describe('plan-review-convergence local model config schema registration (#2306-
|
||||
// #2797 (ADR-2782 D9): these three host keys are no longer in VALID_CONFIG_KEYS
|
||||
// — they are federated to their reviewer-lane capabilities (`ollama`,
|
||||
// `lm-studio`, `llama-cpp`), and the exclusivity invariant forbids a key living
|
||||
// in both places. What #2306-local actually protects is that `gsd config-set`
|
||||
// in both places. What #2306-local actually protects is that `msd config-set`
|
||||
// ACCEPTS these keys, so that is what is asserted now, via isValidConfigKey —
|
||||
// the predicate config-set itself uses, which spans both the central schema and
|
||||
// federated capability slices. Asserting central membership would now be
|
||||
// asserting the migration did not happen.
|
||||
const { isValidConfigKey, isCapabilityConfigKey } =
|
||||
require('../gsd-core/bin/lib/config-schema.cjs');
|
||||
require('../msd-core/bin/lib/config-schema.cjs');
|
||||
|
||||
for (const key of ['review.ollama_host', 'review.lm_studio_host', 'review.llama_cpp_host']) {
|
||||
test(`${key} is accepted by config-set`, () => {
|
||||
assert.ok(
|
||||
isValidConfigKey(key),
|
||||
`${key} must be a valid config key so gsd config-set accepts it`
|
||||
`${key} must be a valid config key so msd config-set accepts it`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1381,8 +1381,8 @@ describe('plan-review-convergence local model CONFIGURATION.md documentation (#2
|
||||
// ─── Bug #936: plan-phase must run inline, not inside Agent() ─────────────
|
||||
//
|
||||
// Regression guard: inverted from the pre-#936 behavior that locked in the bug.
|
||||
// On Claude Code a depth-1 Agent has no Agent tool, so gsd-plan-phase wrapped in
|
||||
// Agent() cannot spawn gsd-planner / gsd-plan-checker → the replan loop breaks.
|
||||
// On Claude Code a depth-1 Agent has no Agent tool, so msd-plan-phase wrapped in
|
||||
// Agent() cannot spawn msd-planner / msd-plan-checker → the replan loop breaks.
|
||||
// Fix: run plan-phase inline (bare Skill()) from the depth-0 convergence orchestrator.
|
||||
//
|
||||
// These tests FAIL on pre-fix code and PASS after the fix.
|
||||
@@ -1409,38 +1409,38 @@ describe('plan-review-convergence workflow: inline plan-phase dispatch (#936)',
|
||||
return blocks;
|
||||
}
|
||||
|
||||
test('initial planning does NOT wrap gsd-plan-phase inside Agent() (#936 fix)', () => {
|
||||
// Pre-fix: Agent( ... Skill('gsd-plan-phase') ... ) in step 4
|
||||
// Post-fix: bare Skill(skill="gsd-plan-phase") at orchestrator level
|
||||
test('initial planning does NOT wrap msd-plan-phase inside Agent() (#936 fix)', () => {
|
||||
// Pre-fix: Agent( ... Skill('msd-plan-phase') ... ) in step 4
|
||||
// Post-fix: bare Skill(skill="msd-plan-phase") at orchestrator level
|
||||
const blocks = extractAgentBlocks(workflow);
|
||||
const wrapping = blocks.filter((b) =>
|
||||
/Skill\(\s*skill=['"]gsd-plan-phase['"]/.test(b.blockText)
|
||||
/Skill\(\s*skill=['"]msd-plan-phase['"]/.test(b.blockText)
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
wrapping.map((b) => b.blockText.slice(0, 80).replace(/\r?\n/g, '\\n')),
|
||||
[],
|
||||
'Initial planning must NOT wrap gsd-plan-phase inside Agent() — run it inline so ' +
|
||||
'it can spawn gsd-planner/gsd-plan-checker at depth 1. See: bug #936'
|
||||
'Initial planning must NOT wrap msd-plan-phase inside Agent() — run it inline so ' +
|
||||
'it can spawn msd-planner/msd-plan-checker at depth 1. See: bug #936'
|
||||
);
|
||||
});
|
||||
|
||||
test('replan step does NOT wrap gsd-plan-phase inside Agent() (#936 fix)', () => {
|
||||
test('replan step does NOT wrap msd-plan-phase inside Agent() (#936 fix)', () => {
|
||||
// Same check as above; explicitly named for the replan site (step 5d)
|
||||
const blocks = extractAgentBlocks(workflow);
|
||||
const wrapping = blocks.filter((b) =>
|
||||
/Skill\(\s*skill=['"]gsd-plan-phase['"]/.test(b.blockText) &&
|
||||
/Skill\(\s*skill=['"]msd-plan-phase['"]/.test(b.blockText) &&
|
||||
/--reviews/.test(b.blockText)
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
wrapping.map((b) => b.blockText.slice(0, 80).replace(/\r?\n/g, '\\n')),
|
||||
[],
|
||||
'Replan step must NOT wrap gsd-plan-phase inside Agent() — the replan loop can ' +
|
||||
'Replan step must NOT wrap msd-plan-phase inside Agent() — the replan loop can ' +
|
||||
'never produce a plan on Claude Code when plan-phase is at depth 1. See: bug #936'
|
||||
);
|
||||
});
|
||||
|
||||
test('workflow calls gsd-plan-phase inline (bare Skill outside Agent block) (#936 fix)', () => {
|
||||
// After the fix there must be at least one bare Skill(skill="gsd-plan-phase")
|
||||
test('workflow calls msd-plan-phase inline (bare Skill outside Agent block) (#936 fix)', () => {
|
||||
// After the fix there must be at least one bare Skill(skill="msd-plan-phase")
|
||||
// OUTSIDE any Agent() block.
|
||||
const blocks = extractAgentBlocks(workflow);
|
||||
let masked = workflow;
|
||||
@@ -1449,8 +1449,8 @@ describe('plan-review-convergence workflow: inline plan-phase dispatch (#936)',
|
||||
masked = masked.slice(0, b.start) + ' '.repeat(b.end - b.start) + masked.slice(b.end);
|
||||
}
|
||||
assert.ok(
|
||||
/Skill\(\s*skill=["']gsd-plan-phase["']/.test(masked),
|
||||
'plan-review-convergence must contain at least one bare Skill(skill="gsd-plan-phase") ' +
|
||||
/Skill\(\s*skill=["']msd-plan-phase["']/.test(masked),
|
||||
'plan-review-convergence must contain at least one bare Skill(skill="msd-plan-phase") ' +
|
||||
'outside any Agent() block — the inline call that preserves depth-0 Agent availability. See: bug #936'
|
||||
);
|
||||
});
|
||||
@@ -1459,7 +1459,7 @@ describe('plan-review-convergence workflow: inline plan-phase dispatch (#936)',
|
||||
const successBlock = workflow.slice(workflow.lastIndexOf('<success_criteria>'));
|
||||
// The broken criterion said "Initial planning via Agent → Skill"
|
||||
assert.ok(
|
||||
!successBlock.includes('via Agent → Skill("gsd-plan-phase")'),
|
||||
!successBlock.includes('via Agent → Skill("msd-plan-phase")'),
|
||||
'success_criteria must NOT describe plan-phase as Agent → Skill — that was the broken pattern. See: bug #936'
|
||||
);
|
||||
// The broken criterion said "isolated, not inline" for the replan
|
||||
@@ -1479,9 +1479,9 @@ describe('plan-review-convergence workflow: inline plan-phase dispatch (#936)',
|
||||
__foldDescribe("folded:bug-936-no-nested-spawner-wrap (consolidation epic #1969 B4 #1973)", () => {
|
||||
'use strict';
|
||||
/**
|
||||
* Structural guard — bug(#936): plan-review-convergence wrapped gsd-plan-phase
|
||||
* Structural guard — bug(#936): plan-review-convergence wrapped msd-plan-phase
|
||||
* in Agent() at TWO sites (initial planning + replan). On Claude Code, a depth-1
|
||||
* Agent has no Agent tool, so plan-phase cannot spawn gsd-planner / gsd-plan-checker
|
||||
* Agent has no Agent tool, so plan-phase cannot spawn msd-planner / msd-plan-checker
|
||||
* → the replan loop never works when HIGHs are found.
|
||||
*
|
||||
* Fix: run plan-phase INLINE (bare Skill()) from the convergence orchestrator,
|
||||
@@ -1504,7 +1504,7 @@ const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const WORKFLOWS_DIR = path.join(__dirname, '..', 'gsd-core', 'workflows');
|
||||
const WORKFLOWS_DIR = path.join(__dirname, '..', 'msd-core', 'workflows');
|
||||
|
||||
// ── 1. Derive spawner skill names dynamically ──────────────────────────────
|
||||
// A "spawner" workflow is one that contains `subagent_type=` — it NEEDS the
|
||||
@@ -1534,21 +1534,21 @@ function collectWorkflowFiles(dir) {
|
||||
const allWorkflowFiles = collectWorkflowFiles(WORKFLOWS_DIR);
|
||||
|
||||
// Map: base-slug → workflow filename (e.g. "plan-phase" → "plan-phase.md")
|
||||
// Skill() calls use the "gsd-<slug>" convention in all workflow files.
|
||||
// We build BOTH the bare slug set and the gsd-prefixed skill-name set.
|
||||
// Skill() calls use the "msd-<slug>" convention in all workflow files.
|
||||
// We build BOTH the bare slug set and the msd-prefixed skill-name set.
|
||||
const SPAWNER_BASE_SLUGS = new Set(
|
||||
allWorkflowFiles
|
||||
.filter((w) => w.content.includes('subagent_type='))
|
||||
.map((w) => w.name.replace(/\.md$/, ''))
|
||||
);
|
||||
|
||||
// Skill invocations use "gsd-<slug>" (e.g. gsd-plan-phase, gsd-execute-phase).
|
||||
// Skill invocations use "msd-<slug>" (e.g. msd-plan-phase, msd-execute-phase).
|
||||
// Build the regex from the prefixed names so it actually matches what workflows write.
|
||||
const SPAWNER_GSD_NAMES = new Set([...SPAWNER_BASE_SLUGS].map((s) => `gsd-${s}`));
|
||||
const SPAWNER_MSD_NAMES = new Set([...SPAWNER_BASE_SLUGS].map((s) => `msd-${s}`));
|
||||
|
||||
// Build a regex that matches Skill(skill='gsd-<spawner>') or Skill(skill="gsd-<spawner>")
|
||||
// Build a regex that matches Skill(skill='msd-<spawner>') or Skill(skill="msd-<spawner>")
|
||||
const spawnerPattern = new RegExp(
|
||||
`Skill\\(\\s*skill=['"](?:${[...SPAWNER_GSD_NAMES].join('|')})['"]`,
|
||||
`Skill\\(\\s*skill=['"](?:${[...SPAWNER_MSD_NAMES].join('|')})['"]`,
|
||||
's'
|
||||
);
|
||||
|
||||
@@ -1606,8 +1606,8 @@ describe('bug-936 — no workflow wraps a spawner skill inside Agent() without a
|
||||
assert.ok(SPAWNER_BASE_SLUGS.size > 0, `No spawner workflows found in ${WORKFLOWS_DIR} — SPAWNER_BASE_SLUGS derivation is broken`);
|
||||
// plan-phase must be a spawner (base slug)
|
||||
assert.ok(SPAWNER_BASE_SLUGS.has('plan-phase'), 'plan-phase.md must be in the spawner set (contains subagent_type=)');
|
||||
// gsd-plan-phase must be in the prefixed set used by the regex
|
||||
assert.ok(SPAWNER_GSD_NAMES.has('gsd-plan-phase'), 'gsd-plan-phase must be in SPAWNER_GSD_NAMES — the prefixed form used in Skill() calls');
|
||||
// msd-plan-phase must be in the prefixed set used by the regex
|
||||
assert.ok(SPAWNER_MSD_NAMES.has('msd-plan-phase'), 'msd-plan-phase must be in SPAWNER_MSD_NAMES — the prefixed form used in Skill() calls');
|
||||
});
|
||||
|
||||
for (const wf of allWorkflowFiles) {
|
||||
@@ -1641,24 +1641,24 @@ describe('bug-936 — plan-review-convergence runs plan-phase inline, not inside
|
||||
'utf8'
|
||||
);
|
||||
|
||||
test('plan-review-convergence does NOT wrap gsd-plan-phase inside Agent()', () => {
|
||||
// The anti-pattern: Agent( block whose body contains Skill(skill='gsd-plan-phase')
|
||||
test('plan-review-convergence does NOT wrap msd-plan-phase inside Agent()', () => {
|
||||
// The anti-pattern: Agent( block whose body contains Skill(skill='msd-plan-phase')
|
||||
const blocks = extractAgentBlocks(CONVERGENCE);
|
||||
const wrapping = blocks.filter((b) =>
|
||||
/Skill\(\s*skill=['"]gsd-plan-phase['"]/.test(b.blockText) &&
|
||||
/Skill\(\s*skill=['"]msd-plan-phase['"]/.test(b.blockText) &&
|
||||
!hasRuntimeCarveout(b)
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
wrapping.map((v) => v.blockText.slice(0, 120).replace(/\n/g, '\\n')),
|
||||
[],
|
||||
'plan-review-convergence must NOT wrap gsd-plan-phase inside Agent(). ' +
|
||||
'Run it inline (bare Skill() at depth 0) so it can spawn gsd-planner/gsd-plan-checker. ' +
|
||||
'plan-review-convergence must NOT wrap msd-plan-phase inside Agent(). ' +
|
||||
'Run it inline (bare Skill() at depth 0) so it can spawn msd-planner/msd-plan-checker. ' +
|
||||
'See: bug #936'
|
||||
);
|
||||
});
|
||||
|
||||
test('plan-review-convergence calls gsd-plan-phase inline (bare Skill call outside Agent block)', () => {
|
||||
// After the fix: at least one bare Skill(skill="gsd-plan-phase") must appear
|
||||
test('plan-review-convergence calls msd-plan-phase inline (bare Skill call outside Agent block)', () => {
|
||||
// After the fix: at least one bare Skill(skill="msd-plan-phase") must appear
|
||||
// outside any Agent( block — that is the inline call from the depth-0 orchestrator.
|
||||
const blocks = extractAgentBlocks(CONVERGENCE);
|
||||
// Remove all Agent block ranges from the text
|
||||
@@ -1668,20 +1668,20 @@ describe('bug-936 — plan-review-convergence runs plan-phase inline, not inside
|
||||
for (const b of sorted) {
|
||||
masked = masked.slice(0, b.start) + ' '.repeat(b.end - b.start) + masked.slice(b.end);
|
||||
}
|
||||
const hasInlineCall = /Skill\(\s*skill=["']gsd-plan-phase["']/.test(masked);
|
||||
const hasInlineCall = /Skill\(\s*skill=["']msd-plan-phase["']/.test(masked);
|
||||
assert.ok(
|
||||
hasInlineCall,
|
||||
'plan-review-convergence must contain at least one bare Skill(skill="gsd-plan-phase") ' +
|
||||
'plan-review-convergence must contain at least one bare Skill(skill="msd-plan-phase") ' +
|
||||
'outside any Agent() block — this is the inline call that lets plan-phase spawn its sub-agents. ' +
|
||||
'See: bug #936'
|
||||
);
|
||||
});
|
||||
|
||||
test('plan-review-convergence still wraps gsd-review inside Agent() (leaf — isolation is correct)', () => {
|
||||
// gsd-review is a leaf (shells out via Bash, no subagent_type) so the Agent wrap is fine and intentional.
|
||||
test('plan-review-convergence still wraps msd-review inside Agent() (leaf — isolation is correct)', () => {
|
||||
// msd-review is a leaf (shells out via Bash, no subagent_type) so the Agent wrap is fine and intentional.
|
||||
const blocks = extractAgentBlocks(CONVERGENCE);
|
||||
const reviewWrap = blocks.some((b) => /Skill\(\s*skill=['"]gsd-review['"]/.test(b.blockText));
|
||||
assert.ok(reviewWrap, 'gsd-review must still be wrapped in Agent() — it is a Bash leaf and isolation is intentional');
|
||||
const reviewWrap = blocks.some((b) => /Skill\(\s*skill=['"]msd-review['"]/.test(b.blockText));
|
||||
assert.ok(reviewWrap, 'msd-review must still be wrapped in Agent() — it is a Bash leaf and isolation is intentional');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1816,13 +1816,13 @@ describe('plan-review-convergence: cross-artifact fact-drift pass (#1956)', () =
|
||||
// The issue's pre-submission checklist asserts the change adds no new
|
||||
// concept, and its breaking-change mitigation reads "gated behind the
|
||||
// EXISTING plan_review config". A third key would also force a 25th
|
||||
// setting into gsd-core/workflows/settings.md's six-section UX.
|
||||
// setting into msd-core/workflows/settings.md's six-section UX.
|
||||
//
|
||||
// Two halves, both required. The gate must still be NAMED — otherwise a
|
||||
// deleted or empty section would satisfy a bare "no novel keys" check
|
||||
// vacuously — and nothing beyond the two keys the drift guard already owns
|
||||
// may appear. (`source_grounding_authority` is resolved through
|
||||
// `gsd_run drift-guard authority` and is not spelled out in this file
|
||||
// `msd_run drift-guard authority` and is not spelled out in this file
|
||||
// today; it stays on the allowed list so naming it later is not a failure.)
|
||||
const keys = new Set([...WORKFLOW.matchAll(/plan_review\.([a-z_]+)/g)].map((m) => m[1]));
|
||||
assert.ok(
|
||||
@@ -1931,7 +1931,7 @@ describe('plan-review-convergence: cross-artifact fact-drift pass (#1956)', () =
|
||||
const span = driftSpan();
|
||||
assert.match(
|
||||
span,
|
||||
/gsd_run drift-guard phase-status/,
|
||||
/msd_run drift-guard phase-status/,
|
||||
'the phase-status axis must be decided by the drift-guard seam, not by model judgment — ' +
|
||||
'issue #1956 requires a drifted STATE/ROADMAP pair to yield a finding deterministically'
|
||||
);
|
||||
@@ -2122,9 +2122,9 @@ describe('plan-review-convergence: cross-artifact fact-drift pass (#1956)', () =
|
||||
//
|
||||
// See https://github.com/open-gsd/gsd-core/issues/2398
|
||||
|
||||
const WORKFLOW_2398 = path.join(__dirname, '..', 'gsd-core', 'workflows', 'plan-review-convergence.md');
|
||||
const REVIEWER_INSTANCES_2398 = path.join(__dirname, '..', 'gsd-core', 'references', 'reviewer-instances.md');
|
||||
const runner2398 = require('../gsd-core/bin/lib/review-lane-runner.cjs');
|
||||
const WORKFLOW_2398 = path.join(__dirname, '..', 'msd-core', 'workflows', 'plan-review-convergence.md');
|
||||
const REVIEWER_INSTANCES_2398 = path.join(__dirname, '..', 'msd-core', 'references', 'reviewer-instances.md');
|
||||
const runner2398 = require('../msd-core/bin/lib/review-lane-runner.cjs');
|
||||
|
||||
const lf2398 = (t) => String(t == null ? '' : t).replace(/\r\n/g, '\n');
|
||||
|
||||
@@ -2415,7 +2415,7 @@ function extractReviewsFileResolution3899() {
|
||||
|
||||
/** Run the extracted fragment with `phase_dir` / `padded_phase` bound, and echo what it resolved. */
|
||||
function runReviewsFileResolution3899(phaseDir, paddedPhase = '01') {
|
||||
const dir = createTempDir('gsd-3899-gate-');
|
||||
const dir = createTempDir('msd-3899-gate-');
|
||||
try {
|
||||
const script = path.join(dir, 'resolve.sh');
|
||||
fs.writeFileSync(
|
||||
@@ -2439,7 +2439,7 @@ function runReviewsFileResolution3899(phaseDir, paddedPhase = '01') {
|
||||
* "resolves by accident" into "resolves to the wrong file".
|
||||
*/
|
||||
function withPhaseDir3899(dirName, { reviews = 'real', siblings = [] }, fn) {
|
||||
const root = createTempDir('gsd-3899-phase-');
|
||||
const root = createTempDir('msd-3899-phase-');
|
||||
try {
|
||||
for (const sibling of siblings) {
|
||||
fs.mkdirSync(path.join(root, sibling), { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user