* chore(#2992): widen the when= grammar and key the section manifest per workflow Epic #1671 Phase 6.1. Two blockers stopped the fragment model reaching any file beyond execute-phase.md: the when= vocabulary was frozen at 4 atoms (3 execute-phase-specific), and the section manifest was single-workflow by construction with 'execute-phase' hardcoded into buildSectionManifestField. - widen WHEN_VOCABULARY 4 -> 14 via a coordinated ADR-1671 amendment; the grammar stays CLOSED (one atom, no operators, negation or nesting) and WHEN_PREDICATES stays a hand-written literal map, never deriving a predicate from its atom string - InvocationFacts gains flags: ReadonlySet<string> plus three computed state booleans; add the missing reverse vocabulary/predicate parity guard - key the manifest artifact per workflow; a stale flat {sections:[...]} artifact now fails shape validation instead of being misattributed - wire the field into six init entry points and parse the flags each needs An atom ships only with both a real consuming section and a fact the init seam actually computes. Six surveyed atoms are withheld because their workflows have no dedicated init entry point; an atom without a computed fact evaluates false forever and silently disables its own section. Fixes a defect found while wiring: parseNamedArgs always materializes a boolean flag key, so folding its false into the absent sentinel is required or every flag reads as present and gating is silently always-on. Also resolves ADR-1671:194 by measurement: --mvp stays unmarkable, because its interleaved sites are always-run flag resolution and a ~340 byte block that already delegates lazily. Refs #2992 * fix(#2992): treat any falsy option value as an absent flag and reject unsafe manifest read paths Findings from two orthogonal reviews (Claude /code-review + an isolated adversarial pass); both independently reproduced the first one. - MAJOR: the flags-builder treated only `undefined` as absent, but parseNamedArgs yields `null` for an absent value-flag and `false` for an absent boolean-flag, so `--granularity` read as present on every plan-phase invocation. Fixed at the root: a flag is present iff its option value is truthy. The six per-handler `|| undefined` folds are now redundant and removed, which also closes the duplicate-translation and missed-onboard-handler findings. - MAJOR: state:needs-codebase-map had zero coverage. Added unit, property and real-CLI integration tests. - MINOR: reject absolute, UNC/drive and `..`-traversing `read` paths in the manifest, degrading the whole load to null like every other shape violation. Verified: `/etc/passwd` previously reached section_manifest.read. - MINOR: corrected a stale "4 to 20" doc comment; the vocabulary is 14. Refs #2992 * test(#2992): update the generator suite for the per-workflow manifest shape The remote matrix went red with 5 unique failures, identical on linux-node22 and linux-node24, all in tests/gen-section-manifest.test.cjs. Re-keying the artifact to {workflows:{...}} left this suite asserting the old flat {sections:[...]} shape; nothing else in the tree still does. - three tests read manifest.sections.length, now undefined; retargeted at workflows.<name> with their original intent preserved (a fenced or loop-host marker still asserts NO section is produced, not merely a changed count) - the stale-manifest test wrote its fixture in the OLD shape, so it tripped shape validation and stopped exercising staleness at all. Its fixture is now valid-but-mismatched so FAIL_STALE is genuinely reached again. - added the coverage that exposed: a pre-6.1 flat artifact must report FAIL_MANIFEST_MALFORMED_SHAPE. That is the real upgrade path for an installed tree and nothing covered it. Refs #2992 * chore(#2992): backfill changeset pr number to 3013 --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -90,12 +90,38 @@ import contextComposer = require('./context-composer.cjs');
|
||||
* Frozen, CLOSED applicability vocabulary for the `when=` attribute.
|
||||
* Extending this list requires an ADR amendment, not an organic edit
|
||||
* (Greenspun's Tenth Rule — see the module doc comment).
|
||||
*
|
||||
* Widened from 4 to 14 entries via the ADR-1671 amendment for #2992 (epic
|
||||
* #1671 Phase 6.1; see `.gsd/phase/chore-2992-widen-when-vocabulary/
|
||||
* 40-design.md`). The vocabulary remains CLOSED: no operators, no negation,
|
||||
* no nesting. Cardinality is not expressiveness — a 14-entry flat list with
|
||||
* no composition is still not a language.
|
||||
*
|
||||
* Held at 14, not wider: an atom whose fact is never computed always
|
||||
* evaluates FALSE, so a section marked with it would silently never
|
||||
* include — a silent-exclusion bug, not a feature. Six further atoms
|
||||
* (`flag:--converge`, `flag:--fix`, `flag:--verify-only`,
|
||||
* `state:fallow-enabled`, `state:git-create-tag`, `state:is-monorepo`) were
|
||||
* surveyed and are justified in principle, but their workflows
|
||||
* (docs-update, autonomous, code-review, complete-milestone) have no
|
||||
* dedicated `cmdInit*` entry point yet to compute the backing fact, so they
|
||||
* are withheld until that entry point exists (#2992 / ADR-1671 Phase 6.1).
|
||||
*/
|
||||
export const WHEN_VOCABULARY: readonly string[] = Object.freeze([
|
||||
'always',
|
||||
'flag:--wave',
|
||||
'state:gap-closure-phase',
|
||||
'state:has-prior-phases',
|
||||
'flag:--auto',
|
||||
'flag:--discuss',
|
||||
'flag:--forensic',
|
||||
'flag:--full',
|
||||
'flag:--research',
|
||||
'flag:--reset-phase-numbers',
|
||||
'flag:--validate',
|
||||
'state:needs-codebase-map',
|
||||
'state:phase-mvp-mode',
|
||||
'state:worktrees-enabled',
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user