feat: opt-in unit-major iteration for construction design stages (2.2.13) - #512
Merged
Merged
Conversation
leandrodamascena
approved these changes
Jul 8, 2026
leandrodamascena
left a comment
Contributor
There was a problem hiding this comment.
I read the walk and checked it against current v2. It works — knob-off is byte-identical, the walk covers every unit, and the gate cascade runs on stock machinery.
What holds:
- Knob-off is byte-identical. The routing guard is
node.mode === "inline" && readConstructionIteration(...) === "unit-major"; anything but the exact trimmed "unit-major" falls through to the sameemitPerUnitRunStagecall, and code-generation (mode subagent) short-circuits before the read. t210's deep-equal across absent/stage-major/junk pins it. - The walk covers every unit and resumes mid-walk. It re-scans from the first uncovered (unit, stage) pair each time, so no skip and no double-emit; once the grid is covered it delegates to
emitPerUnitRunStage(node)and the per-stage gate cascade runs unchanged. - Unit-outer ordering is dependency-safe — within a unit the block runs in graph order (respects requires_stage), and units are topo-ordered.
Two things worth doing, non-blocking:
- The four-gate cascade isn't pinned end-to-end. t209's fixture hardcodes Current Stage = functional-design, so only gate 1 is observed. A case seeding Current Stage at nfr-design (earlier stages
[x], grid covered) asserting that stage's gate presents would catch a regression in the post-first-gate advance. - Sensor dispatch keys on Current Stage, so a mid-walk write for a later design stage fires the earlier stage's sensors. Harmless only because all four design stages declare identical sensors, and nothing pins that — a comment or an assertion that the four share
sensors_applicablewould document the assumption.
Merge-order note: this and #511 both call unitCovered / buildRunStageDirective, so whichever lands second needs the mechanical align (read readBoltDagUnitKinds once, pass kinds.get(u) ?? null through both). Against current v2 this compiles as-is. The CONFLICTING status is the usual series rebase (CHANGELOG/README/version), not a code conflict.
apackeer
force-pushed
the
feature/issue-503-unit-major-construction-ordering
branch
from
July 9, 2026 03:47
50b821b to
35c583d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the first increment of #503 (RFC).
What
Opt-in unit-major iteration for the four inline construction design stages (functional-design, nfr-requirements, nfr-design, infrastructure-design): with the knob on, the engine designs unit 1 across all four stages, then unit 2, and so on - instead of running each stage across all units before the next stage starts.
emitUnitMajorRunStagewalks units outer (Bolt DAG topological order) and block stages inner (graph order, which respectsrequires_stage), routed from a single strictly-guarded branch inemitForSlug.Construction Iteration: unit-majorruntime state field, set via the newaidlc-state.ts set-construction-iterationsubcommand (a sibling ofset-skeleton-stance), recorded at delivery-planning so the Bolt plan's sequencing finally has an executable effect. The read is strict (exact value only): absent, junk, orstage-majorall take the byte-identical pre-existing path, proven by deep-equal directive comparisons in t210.Version 2.2.13, CHANGELOG entry (states the opt-in, the exact command, and the default-unchanged guarantee), README badge, docs and all four harness SKILL.md updated. Tests: t209 (unit-major walk order, gate presentation, early-approve refusal, revision re-entry) and t210 (knob absent/junk/stage-major byte-equivalence + a diverging knob-on negative control; swarm still first-refusal with knob on).
Why
The engine iterates construction stage-major, so with N units the first line of code appears after 4xN design-document passes, and the human-approved Bolt plan's sequencing has no executable meaning. This increment restores per-unit design coherence (a unit is designed as a whole, immediately before what follows) and gives delivery-planning an executable knob, while explicitly NOT yet changing time-to-first-code (code-generation still runs last; that is the follow-up, by widening the walk's block filter).
Relationship to siblings (merge order matters)
unitCovered, which fix: exempt optional produces from per-unit coverage so conditional artifacts can be skipped (2.2.9) #509 makes exemption-aware).unitCovered's arity (adds aunitKindparam) andbuildRunStageDirective; this branch'semitUnitMajorRunStagecalls both with the pre-feat: prune per-unit design artifacts by unit kind (2.2.18) #511 arity. Whichever merges second gets a typecheck failure; the fix is mechanical: readreadBoltDagUnitKinds(projectDir)once in the walk and passkinds?.get(u) ?? nullthrough both calls, mirroring feat: prune per-unit design artifacts by unit kind (2.2.18) #511'semitPerUnitRunStagepattern. Plus a trivial import-block union.Verification
package.ts --checkclean on all four harnesses, typecheck clean, coverage registry fresh, t68 version sync green.--statusshows Current Stage as the first block stage during the walk (cosmetic, documented); a follow-up integration test could drive the full four-gate approve cascade live.Gate: the combined pre-merge live gate ran GREEN on 2026-07-06 against a local integration branch composing all five sibling PRs (2.2.9-2.2.13) in version order - smoke+unit, Claude SDK integration, deterministic e2e, Claude TUI, Kiro ACP, Kiro TUI, and Codex exec slices, live vars set explicitly per slice. The one codex red (compose-front) reproduced identically on clean v2 and is a pre-existing sandbox fragility, not from this series. Merge in version order; whoever merges later re-bumps per the CHANGELOG conflict-trap policy.