chore(#1671): fragmentize plan-phase.md and repair flag forwarding to the init bundle — Phase 6.2 (#3019)
* chore(#2993): fragmentize plan-phase.md onto the fragment model Epic #1671 Phase 6.2. plan-phase.md is the largest workflow in the repo and carried zero markers; it was deferred out of the Phase 3 pilot for two reasons, both now dead. The 36-byte PRE_PHASE6 headroom was never the blocker it looked like — fragmentizing is net-negative on host source, so the trim is what creates the room. The --mvp interleaving was resolved by measurement in #2992 and no sub-line mechanism is built. - widen WHEN_VOCABULARY 14 -> 19 via a second coordinated ADR-1671 amendment: flag:--ingest, flag:--prd, flag:--research-phase, flag:--reviews, state:chunked-mode - state:chunked-mode is `--chunked` OR config workflow.plan_chunked, and that disjunction is resolved in the FACT, never in the grammar, so a compound condition never becomes an operator - parse the new flags on the plan-phase route; extract six gated bodies to gsd-core/workflows/plan-phase/steps/ behind manifest-gated stubs - prd-express-path.md was already extracted but read unconditionally; its wrapper is now gated, so the existing extraction finally pays off plan-phase.md 94,483 -> 87,575 bytes (cap 94,519): headroom goes from 36 bytes to 6,944. Also closes a surfaced docs gap: five real plan-phase flags (--chunked, --skip-ui, --bounce, --skip-bounce, --granularity) were documented in neither the argument-hint nor help. Making --chunked load-bearing without fixing its siblings would leave the defect class half-open. Refs #2993 * fix(#2993): forward flags to the init bundle so section gating actually fires Blocker found by the correctness review, confirmed directly, and missed by both the isolated reviewer and every test in this branch. Neither workflow forwarded its flags to the init CLI: plan-phase.md:71 INIT=$(gsd_run query init.plan-phase "$PHASE" $GRAN_PARAM) execute-phase.md:84 INIT=$(gsd_run query init.execute-phase "${PHASE_ARG}") So every flag: atom was permanently false in production and its section permanently excluded. For plan-phase that made the PRD express path UNREACHABLE — a regression, since it was an unconditional read before. For execute-phase this is PRE-EXISTING: #2932 shipped `flag:--wave` gating that has never once been true, so `--wave` silently dropped its own wave-filtering guidance. Fixed here under the no-defer rule. Why every test missed it: they drive the init CLI directly with flags, which works. Production goes through the workflow's bash line, which did not pass them — the exact "assert against the shape production uses" trap this branch's own test matrix warns about. - parse and forward --prd/--ingest/--research-phase/--reviews/--chunked (plan-phase) and --wave (execute-phase), using the anchored regex idiom the neighbouring GRAN_PARAM line already uses - add a regression guard DERIVED FROM THE MANIFEST: for every flag:--X section, the owning workflow's init line must forward --X. It fails against the pre-fix files and covers any future atom, rather than spot-checking today's six. Verified through the workflow shape, not the CLI shape: `3 --prd spec.md` now yields ["prd-express-gate"] (was []), `2 --wave 2` yields ["partial-wave"] (was []). Refs #2993 * test(#2993): acknowledge the execute-phase ripple and regenerate install-tree fixtures Remote matrix was red with 46 unique failures, identical on both lanes. Both causes are mechanical consequences of changing shipped workflow content, and neither is visible to any local gate. - emitted-attribution: execute-phase.md grew 163 bytes from the WAVE_PARAM forwarding fix and was unacknowledged, while the ack fragment named plan-phase.md, which SHRANK and therefore needed no ack at all — a stale entry is itself a failure. The reason now names the real ripple. The entry had to merge into the existing 2930 fragment: the ack linter does unconditional cross-fragment duplicate-key detection with no spent/live exception, so a second fragment declaring execute-phase.md collides even when the first is already merged and inert. Resolved per the linter's own guidance and that file's precedent of appending successive ripple reasons to one entry. - golden-install-tree: tests/fixtures/install-tree/*.json are committed and deliberately excluded from the ADR-2719 attribution cutover, so they must be regenerated when shipped tree content changes. Regenerated after build:lib per the ordering landmine. 19 runtimes each gained exactly the six new plan-phase step files; zero paths removed, which is the absolute failure shape those fixtures exist to catch. Refs #2993 * fix(#2993): restore the launcher preamble in an extracted step and follow moved content in its drift guards Second red run: 26 unique failures, identical on both lanes, in two classes. RUNTIME BUG (runtime-launcher-parity, 7 failures) — chunked-planning-mode.md calls gsd_run but carried no canonical launcher preamble, which is what DEFINES gsd_run(). On any non-Claude runtime that step would fail outright. The preamble is now copied verbatim from the canonical source of truth, gsd-core/workflows/_runtime-launcher.snippet.sh, and the fence dedented to column 0 to match the prd-express-path.md sibling (a list-continuation indent breaks the byte-equal preamble match). prd-express-path.md already had a correct one. This is the same defect #2932 hit when it extracted steps; the parity test caught a real bug, not a stale assertion. DRIFT GUARDS (plan-phase-drift-guard, issue-2762-plan-reviews-chunked, skill-frontmatter-contract) — these assert plan-phase.md contains content this branch moved into step files. Retargeted at where the content now lives, with the asserted property unchanged; the ALL-RUNTIMES label COUNT test now reads host + every step file so the count is preserved across the split rather than reduced. Each retargeted guard was verified to still fail when its step file is stripped, so none was weakened into vacuity. No emitted-drift ack was needed: currentSizes() enumerates gsd-core/workflows/*.md non-recursively, so files under plan-phase/steps/ are never in the size ratchet's scope. Refs #2993 * chore(#2993): backfill changeset pr number to 3019 --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -63,9 +63,13 @@ const PILOT_REL = path.join('gsd-core', 'workflows', 'execute-phase.md');
|
||||
const PILOT_PATH = path.join(REPO_ROOT, PILOT_REL);
|
||||
// plan-phase.md was the original #2930 pilot but was reverted to unmarked
|
||||
// (chore/2930 retarget: it sits 36 B under the ADR-857 Phase-6 PRE_PHASE6
|
||||
// gate and cannot absorb marker overhead) — it is now a genuinely unmarked
|
||||
// file again, so row 33 uses it instead of plan-phase.md.
|
||||
const UNMARKED_REL = path.join('gsd-core', 'workflows', 'plan-phase.md');
|
||||
// gate and cannot absorb marker overhead) — it was a genuinely unmarked
|
||||
// file again, so row 33 used it instead of plan-phase.md. #2993 (epic #1671
|
||||
// Phase 6.2) now marks plan-phase.md itself (6 sections, the fragmentization
|
||||
// this change ships), so it is no longer a valid "genuinely unmarked" fixture
|
||||
// either — retargeted a second time to discuss-phase.md, which carries no
|
||||
// gsd:section markers as of this change.
|
||||
const UNMARKED_REL = path.join('gsd-core', 'workflows', 'discuss-phase.md');
|
||||
|
||||
const RUNTIMES = Object.keys(RUNTIME_META);
|
||||
|
||||
@@ -292,8 +296,8 @@ test('unmarkedWorkflowEmitsByteIdenticalForEveryRuntime', () => {
|
||||
);
|
||||
const realPath = path.join(real.configDir, UNMARKED_REL);
|
||||
const stubPath = path.join(stub.configDir, UNMARKED_REL);
|
||||
assert.ok(fs.existsSync(realPath), `${runtime}: real install is missing plan-phase.md`);
|
||||
assert.ok(fs.existsSync(stubPath), `${runtime}: stub install is missing plan-phase.md`);
|
||||
assert.ok(fs.existsSync(realPath), `${runtime}: real install is missing discuss-phase.md`);
|
||||
assert.ok(fs.existsSync(stubPath), `${runtime}: stub install is missing discuss-phase.md`);
|
||||
|
||||
// Normalize each side's own randomly-generated temp root out of the
|
||||
// content before hashing: some runtimes (opencode) embed the
|
||||
@@ -306,14 +310,14 @@ test('unmarkedWorkflowEmitsByteIdenticalForEveryRuntime', () => {
|
||||
assert.equal(
|
||||
Buffer.byteLength(realText, 'utf8'),
|
||||
Buffer.byteLength(stubText, 'utf8'),
|
||||
`${runtime}: plan-phase.md byte size drifted between real compose and identity-stub compose`,
|
||||
`${runtime}: discuss-phase.md byte size drifted between real compose and identity-stub compose`,
|
||||
);
|
||||
const realHash = crypto.createHash('sha256').update(realText).digest('hex');
|
||||
const stubHash = crypto.createHash('sha256').update(stubText).digest('hex');
|
||||
assert.equal(
|
||||
realHash,
|
||||
stubHash,
|
||||
`${runtime}: plan-phase.md content drifted between real compose and identity-stub compose`,
|
||||
`${runtime}: discuss-phase.md content drifted between real compose and identity-stub compose`,
|
||||
);
|
||||
} finally {
|
||||
cleanup(real.root);
|
||||
@@ -461,26 +465,34 @@ test('nonWorkflowMarkdownWithMarkerShapedLineIsNotComposed', () => {
|
||||
|
||||
test('leavesUnmarkedWorkflowEmissionByteIdentical', () => {
|
||||
const workflowsDir = path.join(REPO_ROOT, 'gsd-core', 'workflows');
|
||||
// execute-phase.md (#2932 Phase 5) and plan-phase.md (#2993 Phase 6.2) are
|
||||
// the two files this repo has fragmentized with gsd:section markers — both
|
||||
// excluded here since composeWorkflow is deliberately NOT a no-op for them.
|
||||
const MARKED_WORKFLOWS = new Set(['execute-phase.md', 'plan-phase.md']);
|
||||
const workflowFiles = fs
|
||||
.readdirSync(workflowsDir, { withFileTypes: true })
|
||||
.filter((d) => d.isFile() && d.name.endsWith('.md'))
|
||||
.map((d) => d.name);
|
||||
assert.ok(workflowFiles.length > 1, 'sanity: there must be more than the pilot workflow on disk');
|
||||
assert.ok(workflowFiles.length > MARKED_WORKFLOWS.size, 'sanity: there must be more than the marked workflows on disk');
|
||||
|
||||
let checkedCount = 0;
|
||||
for (const fileName of workflowFiles) {
|
||||
if (fileName === 'execute-phase.md') continue; // the one file #2932 Phase 5 migrates
|
||||
if (MARKED_WORKFLOWS.has(fileName)) continue;
|
||||
const filePath = path.join(workflowsDir, fileName);
|
||||
const source = fs.readFileSync(filePath, 'utf8');
|
||||
const composed = composeWorkflow(source, { sourcePath: filePath });
|
||||
assert.equal(
|
||||
composed,
|
||||
source,
|
||||
`${fileName}: emission drifted — Phase 5's execute-phase.md extraction must not touch any other workflow`,
|
||||
`${fileName}: emission drifted — a marked workflow's extraction must not touch any other workflow`,
|
||||
);
|
||||
checkedCount += 1;
|
||||
}
|
||||
assert.equal(checkedCount, workflowFiles.length - 1, 'every workflow file except execute-phase.md must have been checked');
|
||||
assert.equal(
|
||||
checkedCount,
|
||||
workflowFiles.length - MARKED_WORKFLOWS.size,
|
||||
'every workflow file except the marked ones must have been checked',
|
||||
);
|
||||
});
|
||||
|
||||
test('malformedMarkersFailInstallWithoutPartialEmit', () => {
|
||||
|
||||
Reference in New Issue
Block a user