Skip to content

feat: domain-design + contract-design restructure; infra-design conso… - #711

Merged
SiddhJog merged 1 commit into
v2from
feature/design-output-restructure
Aug 13, 2026
Merged

feat: domain-design + contract-design restructure; infra-design conso…#711
SiddhJog merged 1 commit into
v2from
feature/design-output-restructure

Conversation

@SiddhJog

@SiddhJog SiddhJog commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Restructures the Inception design outputs and consolidates Infrastructure Design, rebased onto current v2 (2.5.36) as a single commit. Ships as v2.6.1.

Domain / Contract design

  • application-designdomain-design (2.6): the five artifacts (components, component-methods, services, component-dependency, decisions) collapse into a single consolidated components.md — a fenced ```yaml component catalogue (source of truth: behaviour, responsibilities, depends_on/dependents, external_dependencies, owned entities with identifier + cross-component references) plus a derived human view (mermaid + summary/ownership/rationale tables).
  • NEW contract-design stage (2.8, CONDITIONAL — skips single-unit systems): formalises inter-unit contracts so teams build in parallel; produces contract-summary. Delivery Planning → 2.9.
  • functional-design outputs → entities / rules / functional-spec (yaml sources of truth + derived human view).
  • aidlc-architect-agent reframed to own the logical/application concerns (domain + contract design), distinct from infrastructure.

Infrastructure design consolidation

  • infrastructure-design five artifacts → three: deployment-architecture + infrastructure-services + shared-infrastructure fold into a tabular infrastructure-specification.md; monitoring-design and cicd-pipeline stay dedicated (Operation stages consume them independently). Closer to the pre-v2 single-infra-doc shape.

Numbering

Uses v2's engine-driven numbering (no authored number: frontmatter): the rename is carried by the stage-graph.json pin (domain-design@2.6), contract-design and the renumbered delivery-planning@2.9 ride the pins, and v2's numeric topo-tiebreak keeps ordering consistent.

Breaking changes

Consumers that read Inception design or infrastructure artifacts must migrate: the five app-design names, three functional-design names, and deployment-architecture/infrastructure-services/shared-infrastructure are gone. Read components.md, contract-summary.md, entities.md/rules.md/functional-spec.md, and infrastructure-specification.md instead. See CHANGELOG 2.6.0/2.6.1.

Counts

  • Stages 32 → 33 (new contract-design); artifact registry → 117.

Review

Two /code-review --effort high rounds addressed (12 findings). During the v2 rebase, four v2-owned surfaces were reconciled with the rename: the ars-priors.json composer data, the 05-scopes-and-depth.md stage-by-scope matrix, and two auto-merged test helpers.

Testing

  • bun scripts/package.ts --check clean across all 5 harness trees.
  • Smoke + unit + affected integration tiers green.
  • Two failures remain and are pre-existing/environmentalt248-codekb-scope-diff and t255-workspace-sync, both v2-owned git/LFS/worktree integration tests with zero overlap with this change (verified: our diff touches neither subject, and neither test references any renamed stage/artifact).

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the substantial design and artifact-model improvements. The focused suites and package parity pass, but I found four behavioral/documentation gaps plus the current merge conflict.

1. P1: upgrading can strand in-flight workflows

The latest 2.6.1 entry tells users to re-copy the shell, but the graph removes application-design without an alias or state migration. A workflow whose Current Stage is still application-design reaches emitRunStageForSlug() and fails because that slug no longer exists.

References: CHANGELOG.md:6, core/tools/aidlc-orchestrate.ts:2525-2559, :2785-2790.

Please migrate/alias persisted state, or make the latest upgrade instructions explicitly prevent shell replacement while an old-schema workflow is active.

2. P1: Code Generation does not receive contract-summary

Code Generation reads contract-summary.md in its stage prose, but does not declare contract-summary in consumes. Consequently it is absent from the resolved directive and from the architecture reviewer’s permitted shared-contract context.

Reproduction:

$ bun dist/claude/.claude/tools/aidlc-graph.ts consumers contract-summary
functional-design

References: core/aidlc-common/stages/construction/code-generation.md:16-32, :75; core/aidlc-common/protocols/stage-protocol.md:964; core/knowledge/aidlc-architecture-reviewer-agent/reviewing.md:27.

Please add contract-summary as an optional consume and add a directive-resolution test.

3. P2: Workshop always skips Contract Design

The workshop scope says it runs the full Inception design pass and executes Units Generation, but contract-design excludes workshop. A multi-unit workshop therefore cannot run the new stage even when its execution condition is satisfied.

References: core/aidlc-common/stages/inception/contract-design.md:28-31, core/scopes/aidlc-workshop.md:24-38, dist/claude/.claude/tools/data/scope-grid.json:315-318.

Please include workshop, or document and enforce the intended alternative contract source.

4. P2: current surfaces still advertise the removed graph

Several active and user-facing surfaces still describe 32 stages, Inception 2.1-2.8, and Application Design. This includes the Claude session announcement, scope descriptions, agent metadata, depth guidance, and Delivery Planning’s own numbering.

Representative references:

  • harness/claude/settings.json:3
  • core/scopes/aidlc-enterprise.md:28
  • core/scopes/aidlc-feature.md:27
  • core/aidlc-common/protocols/stage-protocol.md:725-737
  • core/aidlc-common/stages/inception/delivery-planning.md:80

Please complete the repository-wide rename/count/numbering sweep and regenerate dist/.

Merge blocker

The PR is currently CONFLICTING / DIRTY and is based on 2.5.36, while v2 has advanced. It needs a rebase and version/changelog reconciliation.

Verification

  • 30 affected smoke/unit test files passed.
  • 13 affected integration test files passed.
  • bun scripts/package.ts --check passed.
  • git diff --check passed.
  • Remote CI is green.

I recommend keeping this at CHANGES_REQUESTED until these gaps and the merge conflict are resolved.

@apackeer apackeer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional review findings beyond the existing changes-requested review. The Domain -> Units -> Contract -> Delivery direction is sound; these comments focus on responsibilities and end-to-end wiring that the core-stage change still needs.

One non-inline plugin issue: plugins/test-pro/contributions/construction/build-and-test.md:74 still asks for the removed business-rules artifact instead of rules, so its requirement traceability can omit the new source of truth.

The focused smoke/unit/integration slice passed (16 files, 472 assertions), but both new stages remain behaviorally uncovered in tests/.coverage-registry.json.

Comment thread CHANGELOG.md Outdated

## [2.6.0] - 2026-07-22

Inception design output restructure. Application Design becomes **Domain Design** (2.6): it now produces a single consolidated `components.md` — a fenced `yaml` component catalogue (source of truth) plus a derived human view (mermaid diagram + summary/ownership/rationale tables) — instead of the five separate `components`/`component-methods`/`services`/`component-dependency`/`decisions` artifacts. Entities are captured at the ownership level (identifier, attributes, cross-component references, external dependencies), with the full schema still deferred to Functional Design. A new **Contract Design** stage (2.8, CONDITIONAL, produces `contract-summary.md`) formalises inter-unit contracts so teams can build in parallel; Delivery Planning moves to 2.9. Functional Design's outputs are restructured into `entities.md` + `rules.md` (fenced `yaml` sources of truth) + `functional-spec.md` (derived human view), replacing `business-logic-model`/`business-rules`/`domain-entities`. The `aidlc-architect-agent` is reframed to own the logical/application concerns (domain + contract design) distinct from infrastructure. **Breaking for consumers that read inception design artifacts:** the five old app-design artifact names and the three old functional-design names are gone — read `components.md`, `contract-summary.md`, `entities.md`, `rules.md`, `functional-spec.md` instead. **Upgrade:** re-copy your `dist/<harness>/` shell into the project; existing in-flight workflows on the old stage names should finish on the prior shell.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 - upgrade can strand any v7 workflow crossing the changed Inception graph. The state schema still reports version 7, so an old state passes --doctor even though it has an application-design row and no domain-design or contract-design rows. When the new graph advances to one of those slugs, setCheckbox() is a no-op for the missing row but Current Stage is still updated; report then fails with Stage "..." is not present in the state file. The active-application-design case also fails because that slug no longer exists. Please add a state migration/alias or bump the state version so old states are rejected, and make the 2.6.0/2.6.1 upgrade instruction unambiguous.

reviewer: aidlc-architecture-reviewer-agent
reviewer_max_iterations: 2
produces:
- contract-summary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 - the approved contract is not propagated through the workflow. aidlc-graph consumers contract-summary currently returns only functional-design. Delivery Planning cannot map contract ownership/blockers to Bolts or the walking skeleton; NFR and Infrastructure Design do not receive the retry/failure and integration-mechanism decisions; and Code Generation omits the artifact from consumes even though its body explicitly says to read it. This is especially risky for unit-major design and autonomous code-generation batches, which need one shared boundary contract. Please wire contract-summary into the relevant downstream stage contracts and read steps.

- **domain-entities.md**: Entities, relationships, data structures, attributes, lifecycle states, and entity interaction patterns
- **entities.md**: The entity model. Carries a fenced ```yaml source-of-truth block listing each entity with its description, attributes (name, logical type, required/unique, references, allowed values, defaults, min/max, constraints), entity-level constraints, and relationships (cardinality + direction). Follow the block with a short human-readable summary of the entity set.
- **rules.md**: The business rules. Carries a fenced ```yaml source-of-truth block listing each numbered rule (`id: BR-NNN`) with its statement, category (validation/authorization/constraint/calculation/policy), what it applies to, trigger, logic (IF…THEN in plain language), violation behaviour, and source (FR-n/NFR-n). Follow the block with a short human-readable rules summary table.
- **functional-spec.md**: The derived human view. An entity-relationship `mermaid` diagram (reflecting entities.md — the YAML is source of truth), state machines for lifecycle entities, workflows as numbered step sequences, and a rules summary. Everything here is derived from entities.md and rules.md.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 - functional-spec.md cannot be fully derived from the declared sources. entities.md and rules.md do not define workflow sequences or state-transition models, yet this requires workflows and state machines and says everything is derived from those two files. UI units make the contradiction concrete: produces_kinds gives them functional-spec but neither entities nor rules. Please add authoritative workflow/state schemas or define functional-spec as an independently authoritative artifact with explicit upstream sources.

slug: contract-design
phase: inception
execution: CONDITIONAL
condition: Execute when the system decomposes into more than one unit that must integrate. Skip for a single-unit system where there are no inter-unit boundaries to formalise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 - single-unit public APIs no longer have a contract-design owner. The removed Application Design stage specified component public interfaces and service communication contracts. Domain Design deliberately omits interfaces, this condition skips Contract Design for every single-unit system, and Functional Design declares no API-spec output. A single deployable API can therefore reach Code Generation with no approved external contract. Please broaden this condition to formal contracts rather than only inter-unit contracts, or assign public API specifications to another explicit stage/artifact.

- **Component Summary** — a table: `| Component | Purpose | Depends On | Dependents | Entities Owned |`.
- **Entity Ownership** — a table: `| Entity | Owning Component | Identifier | Attributes | References |`.
- **External Dependencies** — a table: `| Component | Dependency | Kind | Purpose |`.
- **Rationale** — a table explaining why each component is a separate building block (distinct lifecycle, distinct concern, distinct data ownership, distinct change rate — pick what applies).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 - removing decisions.md leaves the mandatory ADR contract unsatisfied. core/memory/phases/inception.md still requires ADRs with Context, Decision, Consequences, and Alternatives Rejected, and the architect persona still says it produces ADRs for significant choices. This rationale table records component-boundary reasoning but is not an ADR and has no place for the required structure. Please retain an explicit decisions/ADR artifact or update the phase rule and persona with a concrete replacement location and schema.

- The Q&A file path (e.g., `<record>/<phase>/<stage>/<stage>-questions.md`)
- All artifact file paths produced by the stage (the `produces` artifacts)
- For a per-unit stage (`directive.unit` present), also the resolved paths in `directive.consumes` (all upstream artifacts the stage declares, including the shared inception contracts that pin cross-unit boundaries - `components.md`, `component-methods.md`, `services.md`, `unit-of-work.md` - paths only, per the context-budget rule)
- For a per-unit stage (`directive.unit` present), also the resolved paths in `directive.consumes` (all upstream artifacts the stage declares, including the shared inception contracts that pin cross-unit boundaries - `components.md`, `contract-summary.md`, `unit-of-work.md` - paths only, per the context-budget rule)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 - the new Contract Design reviewer is not passed the evidence it must verify. This protocol passes directive.consumes only when directive.unit exists. Contract Design is workflow-level, so its architecture reviewer receives the produced summary but not the unit DAG, unit definitions, requirements, or component catalogue used to justify it. Pass declared upstream artifacts to non-per-unit reviewers as well, or add a contract-stage-specific evidence rule.

Comment thread CHANGELOG.md Outdated
* Stage `application-design` renamed to `domain-design` (2.6); its per-stage runner becomes `/aidlc-domain-design`. Its `produces` collapses from five artifacts to a single `components` (`components.md`).
* NEW stage `contract-design` (2.8, CONDITIONAL — skips for single-unit systems); per-stage runner `/aidlc-contract-design`; produces `contract-summary`. Delivery Planning renumbered 2.8 → 2.9. The framework now ships 33 stages (was 32).
* Functional Design `produces` renamed: `business-logic-model` → `functional-spec`, `business-rules` → `rules`, `domain-entities` → `entities`. Downstream consumes in `nfr-requirements`, `nfr-design`, `infrastructure-design`, and `code-generation` were rewired accordingly.
* Stage frontmatter now honours an authored `number:` / `name:` field (the compiler prefers it over the pinned graph value), so a renamed or inserted stage controls its own display number without a manual graph edit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 - this describes compiler behavior that is not implemented. compileStageGraph() explicitly keeps the pinned number and name for an existing slug. For new slugs, authored number: is only a relative tie-break hint; the engine assigns the next contiguous index, so the authored absolute number never overrides the graph. Please either implement this stated contract with collision/ordering safeguards or revise the release note to match the current pinning behavior.

@SiddhJog
SiddhJog force-pushed the feature/design-output-restructure branch from 31ba59f to 0510a82 Compare August 7, 2026 10:52
@SiddhJog

SiddhJog commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest v2 (2.5.55) and addressed all findings.

P1

State schema bumped 7→8 — pre-2.6 states now fail --doctor with a clear message instead of breaking on renamed rows (leandro #1, apackeer #1).
contract-summary wired into delivery-planning, nfr-requirements, nfr-design, infrastructure-design, code-generation; consumers contract-summary now returns all six. Added directive-resolution + graph tests (leandro #2, apackeer #2).

P2

workshop added to contract-design scopes (leandro #3).
Repo-wide stale sweep: 32→33, AD→DD/CD, Inception 2.1–2.9, personas, settings legend, docs (leandro #4).
functional-spec is now source of truth for workflows/state machines; ER + rules views derived (apackeer #3).
contract-design condition broadened to cover single-unit public APIs (apackeer #4).
Retained decisions.md ADR log on domain-design (apackeer #5).
Reviewer evidence now passed to workflow-level reviewers too (apackeer #6).
Dropped the inaccurate compiler-behavior CHANGELOG note (apackeer #7).
Cleanup: plugin fixture business-rules→rules; both new stages now covered.

Verified: package --check, coverage --check, t68 green. Residual test failures are known-environmental (t248/t255/t92), SDK-gated, or pre-existing t260 cases (confirmed identical on clean v2).

@SiddhJog
SiddhJog force-pushed the feature/design-output-restructure branch from 0510a82 to 557b18d Compare August 7, 2026 10:59
@apackeer

apackeer commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Round-2 verification of 557b18d5. Most prior asks are now addressed in the authored source: the v8 doctor gate, six-consumer contract-summary wiring, functional-spec authority, single-unit public API ownership, retained ADR log, compiler-note removal, plugin rename, workshop scope, and coverage-registry entries all check out.

I am keeping this at changes requested for the following:

P1: two deterministic test regressions from the artifact rename

  • tests/unit/t272-unit-major-code-gen.test.ts:67-92 still creates the removed functional- and infrastructure-design artifact names. Functional Design therefore never settles and the unit-major walk repeatedly returns to it. This is the current smoke/unit CI failure: three assertions fail. The fixture also retains State Version 7 and application-design at :143 and :162.
  • tests/e2e/t134-swarm-referee.test.ts:185-188 creates the same removed functional-design artifacts. Required-artifact fingerprinting then rejects the review receipt, producing six deterministic failures in the swarm-finalize paths. CI does not run this e2e file.

Both are branch-caused: t272 and t134 pass on clean current v2, but fail on this branch.

P2: workflow-level reviewer evidence is not wired through the harnesses

core/aidlc-common/protocols/stage-protocol.md:1023-1025 correctly says to pass directive.consumes to every reviewer-bearing stage, including workflow-level Contract Design. However, the actual harness orchestrator instructions still restrict those paths to per-unit stages (harness/claude/skills/aidlc/SKILL.md:83, harness/codex/skills/aidlc/SKILL.md:79, with the same wording in the other harnesses).

tests/unit/t217-reviewer-read-scope.test.ts:26-31,62-72 also continues to pin only the old per-unit rule. Please update every harness skill and add a workflow-level assertion so Contract Design reliably receives its unit DAG, components, and requirements evidence.

P2: the state-upgrade remediation points at a retired layout

The new doctor check works, but its fix text tells users to run mv aidlc-docs aidlc-docs.v7-archive (core/tools/aidlc-utility.ts:1877,1883). The current layout is under aidlc/spaces/<space>/intents/; core/tools/aidlc-lib.ts:1402-1407 explicitly says there is no flat aidlc-docs/ root.

Please provide a valid archive/restart command and add a regression test for "v7 state -> failing doctor row + non-zero exit". Current tests only pin the happy-path State Version 8 text.

P2: the repository-wide semantics and numbering sweep is incomplete

  • CHANGELOG.md:14 still calls functional-spec a derived human view, while the stage now makes workflows/state machines authoritative there.
  • CHANGELOG.md:17 says Contract Design skips single-unit systems, contradicting the new public/external API condition.
  • core/aidlc-common/stages/inception/contract-design.md:35 still describes only inter-unit contracts.
  • core/knowledge/aidlc-delivery-agent/workflow-planning-guide.md:53,57 calls Bolt/Delivery Planning Stage 2.8; it is now 2.9.
  • docs/guide/workshop-mode.md:59,63 still says Inception ends at 2.8 and Delivery Planning is 2.8.

Merge/rebase blockers

The PR is currently CONFLICTING/DIRTY against v2 at 5f6b310f (2.5.59).

  • Current v2 already contains t273-scope-aware-phase-dirs.test.ts and t274-voice-parity.test.ts; the new t273-contract-design-wiring.test.ts needs renumbering, and its describe block still says t271.
  • The modify/delete conflict on application-design.md includes the newer completion-handoff wording from the base. Port that wording into both replacement stages: domain-design.md:165 and contract-design.md:105 still use the old sentence.
  • Reconcile the version/changelog and regenerate dist/ after rebasing.

Verification:

  • Focused 16-file slice: tests/logs/2026-08-08T09-53-37Z, Result: FAIL - only t272, three assertions.
  • Branch t134: tests/logs/2026-08-08T10-10-08Z, Result: FAIL - six assertions.
  • Clean-v2 controls: t272 PASS at tests/logs/2026-08-08T09-55-30Z; t134 PASS at tests/logs/2026-08-08T10-12-07Z.
  • bun scripts/package.ts --check passes across all five harnesses on the current branch.

@apackeer apackeer mentioned this pull request Aug 10, 2026
4 tasks
@SiddhJog
SiddhJog force-pushed the feature/design-output-restructure branch from 557b18d to 847d397 Compare August 11, 2026 03:49
@SiddhJog

Copy link
Copy Markdown
Contributor Author

Rebased onto latest v2 and worked through apackeer's round-2 findings.

Fixed

  • P1 — test regressions from the artifact rename: t272-unit-major-code-gen and t134-swarm-referee updated to the new functional/infra artifact names (+ State Version 7→8, application-designdomain-design in the t272 fixture). Their remaining failures reproduce identically on a clean v2 checkout — environmental, not branch-caused.
  • P2 — workflow-level reviewer evidence: broadened the reviewer-consumes wording across all 6 harness SKILLs (Claude, Codex, Copilot, Kiro, Kiro IDE, opencode) so a workflow-level stage like contract-design receives its upstream evidence, not only per-unit stages. Added a workflow-level assertion to t217.
  • P2 — state-upgrade remediation: doctor fix text now points at the current aidlc/ layout (mv aidlc aidlc.v<n>-archive), not the retired aidlc-docs/. New t276 regression test pins "v7 → failing doctor row + non-zero exit" and the v8 happy path.
  • P2 — semantics/numbering sweep: CHANGELOG now states functional-spec is authoritative for workflows/state machines and that Contract Design covers inter-unit and public/external APIs; contract-design.md outputs line, workflow-planning-guide.md, and workshop-mode.md corrected to Delivery Planning 2.9 / Inception 2.1–2.9.

Rebase / new v2 surface

  • Absorbed v2's new GitHub Copilot harness (6th dist tree); seeded its stage-graph pins (domain-design@2.6, contract-design@2.8, delivery-planning@2.9).
  • Renumbered the wiring test to t275 (avoids collision with v2's new t273/t274).
  • Ported v2's newer de-jargoned wording (completion-handoff, intent-create) into domain-design/contract-design and reconciled CHANGELOG/README/settings/SKILLs/docs.

Verification

  • bun scripts/package.ts --check, coverage --check, and t68 version sync all green.
  • Every deterministic regression this branch introduced is fixed (t06, t131, t181, t184, t66).
  • Residual test failures are SDK-gated (*.sdk), env timeouts, or pre-existing environmental cases confirmed identical on clean v2 (t27, t260, t272, t248, t255).

Merge-tree against current v2 shows 0 conflicts at time of push. Given how fast v2 is moving, a prompt merge avoids another overlap.

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of 847d397e: the previously reported graph, artifact, harness, remediation, and test-fixture issues are substantially addressed. CI is green, but two behavioral blockers and six P2 gaps remain.

1. P1: Contract Design bypasses deterministic summary confirmation

core/aidlc-common/stages/inception/contract-design.md:9-13 omits summary_confirmation: required, despite defining a question flow before artifact generation.

Because checkSummaryConfirmationEvidence() returns success when that field is absent (core/tools/aidlc-lib.ts:2753-2755), Contract Design can complete without a human-backed consolidated-summary receipt. This removes the deterministic checkpoint that comparable question-bearing design stages enforce.

Add summary_confirmation: required and test that Contract Design cannot generate or complete before the receipt exists.

2. P1: incompatible state is rejected only when the user voluntarily runs doctor

The v8 check exists only inside the doctor implementation at core/tools/aidlc-utility.ts:2034-2049. Normal orchestration loads active state without validating its schema version.

I reproduced aidlc-orchestrate.ts next against a v7 state on this head. It exited 0 and emitted a normal load-steering directive:

{
  "status": 0,
  "kind": "load-steering",
  "stage": "requirements-analysis"
}

The workflow can therefore continue until it reaches the removed application-design row or needs the new domain-design/contract-design rows. This contradicts the changelog’s claim that stale state is rejected instead of failing later.

Validate State Version whenever an active state file is loaded by runtime/mutating commands, not only in doctor. Add a regression covering next or report against v7 state.

3. P2: the retained ADR log has no downstream consumer

domain-design produces decisions, but units-generation removed the previous required consume (core/aidlc-common/stages/inception/units-generation.md:18-24). No replacement consumer exists:

$ bun dist/claude/.claude/tools/aidlc-graph.ts consumers decisions
<no output>

Consequently the retained architectural decisions are absent from downstream directives. Restore the consume where those decisions influence decomposition, or document and test that decisions.md is intentionally archival only.

4. P2: composer selection omits the single-unit public API condition

Contract Design’s authoritative condition includes either an inter-unit boundary or a single unit exposing a public/external API (core/aidlc-common/stages/inception/contract-design.md:5).

The composer’s inclusion rule only mentions multiple integrating units (core/agents/aidlc-composer-agent.md:360). A composed single-unit public API workflow can therefore skip the only stage that owns its external contract.

Mirror the complete stage condition in the composer and add a single-unit external API composition test.

5. P2: the 32-to-33 topology sweep remains incomplete

The runtime protocol still mandates /32 progress output at core/aidlc-common/protocols/stage-protocol.md:277-292.

All six authored harness skills still advertise:

28 inline / 2 subagent / 1 pipeline / 1 mob

The compiled graph is actually:

29 inline / 2 subagent / 1 pipeline / 1 mob

Active user documentation also retains the removed Application Design stage, Delivery Planning 2.8, and the 32-stage topology. Representative locations:

  • docs/guide/04-phases-and-stages.md:3,158-211,417
  • docs/guide/06-agents.md:109-270
  • docs/guide/agents/architect-agent.md:14-28
  • docs/reference/01-architecture.md:374,458,464
  • harness/copilot/skills/aidlc/SKILL.md:195,241

Complete the authored-source sweep and regenerate dist.

6. P2: v8 state fixtures remain structurally stale

For example, tests/fixtures/state-completed.md:15-28,59-68 claims State Version 8 but:

  • Declares 32 total stages.
  • Omits Contract Design.
  • Ends Inception at Delivery Planning without the new 2.8/2.9 shape.

t12-state-fixture-validation.test.ts:93-146 checks headings and the version field but never compares stage rows or totals with the compiled graph, so these inconsistent fixtures pass.

Update the fixtures and add graph-parity validation for their stage rows and totals.

7. P2: the documented upgrade leaves the removed runner installed

The changelog instructs users to re-copy the distribution and says /aidlc-application-design becomes /aidlc-domain-design. The documented installation mechanism uses merging cp -R commands (README.md:103-127), which do not remove files absent from the new distribution.

An upgraded project therefore retains the old Application Design runner, which invokes a stage no longer present in the graph.

Add an explicit removal/pruning instruction for renamed generated surfaces, or provide an upgrade command that synchronizes deletions.

8. P2: changelog release chronology is invalid

The new entries are dated:

2.6.1 - 2026-07-27
2.6.0 - 2026-07-22

They appear above the existing 2.5.62 - 2026-08-08 entry, and the PR commit was produced on August 11. Use the actual release date so version history remains chronological and auditable.

Verification

  • Remote CI: green
  • bun scripts/package.ts --check: passed across all six harnesses
  • Typecheck: passed
  • Lint: passed with three informational notices
  • Focused branch slice: 232 passed, 3 failed
  • The three t272 failures reproduce identically on base v2, so they are not attributed to this PR
  • t134-swarm-referee: 18/18 passed
  • git diff --check: passed

Recommendation: keep CHANGES_REQUESTED until the two P1 runtime guarantees are fixed.

@apackeer

Copy link
Copy Markdown
Contributor

Siddhesh, this PR restructures Inception design into Domain/Contract Design, renames the Functional Design artifacts, and consolidates Infrastructure Design outputs. I reviewed 847d397e, including the round-2 fixes and the newer review comments; t272, t134, graph wiring, doctor, package parity, and version sync are now green.

I agree this should remain changes requested. I independently verified the following blockers:

P1: Contract Design bypasses the summary-confirmation guard

core/aidlc-common/stages/inception/contract-design.md:63-79 defines a question flow before artifact generation, but its frontmatter omits summary_confirmation: required. checkSummaryConfirmationEvidence() treats an absent field as not required (core/tools/aidlc-lib.ts:2728-2755), unlike the comparable Domain, Units, Requirements, and Delivery design stages.

Please add the field and a regression proving Contract Design cannot complete without a fresh human-backed consolidated-summary receipt.

P1: State Version 8 is doctor-only, not a runtime gate

The version check exists only at core/tools/aidlc-utility.ts:2034-2054. I replaced a current fixture's State Version with 7 and ran normal orchestration; next returned a successful run-stage for requirements-analysis instead of rejecting the state:

{"status":0,"kind":"run-stage","stage":"requirements-analysis","steeringCount":1}

That stale workflow can continue until routing reaches a removed/missing row, where core/tools/aidlc-orchestrate.ts:3247-3267 emits an opaque internal graph error. Validate the schema version whenever active state is loaded by runtime/mutating commands and add a next or report regression.

P2: three new data-flow/harness gaps remain

  • decisions is retained, but has no consumer. Base Units Generation consumed it; current core/aidlc-common/stages/inception/units-generation.md:18-35 does not, and aidlc-graph consumers decisions is empty. Restore the edge or explicitly define/test it as archival-only.
  • The stage condition covers a single unit with a public/external API, but the composer still includes Contract Design only for multiple integrating units at core/agents/aidlc-composer-agent.md:344-360. Mirror the full condition and test single-unit API composition.
  • Domain/Contract Design use advisory review, but harness/copilot/skills/aidlc/SKILL.md:104 hard-codes adversarial posture and does not require advisory findings to be quoted at the human gate. tests/unit/t266-review-class.test.ts:345-353 omits Copilot. Bring it in line with the other harnesses and cover the full harness matrix.

P2: the rename/count/upgrade sweep is still incomplete

The active protocol still mandates /32 progress (core/aidlc-common/protocols/stage-protocol.md:275-292), all harness skills still advertise 28 inline, and current docs retain Application Design, Delivery Planning 2.8, removed artifacts, or old totals. In addition to the locations in the newer review:

  • docs/guide/17-skills.md:20,105 says 29 stage runners; aidlc-runner-gen check reports 30.
  • v8 fixtures such as tests/fixtures/state-completed.md:8,15-28,59-67 still encode 32 stages and omit Contract Design; t12 does not validate graph parity.
  • Overlay cp -R upgrades do not delete /aidlc-application-design. Normal session/runtime hooks do not invoke the runner-pruning aidlc-runner-gen write path, so add explicit removal or a synchronizing upgrade command.

Please complete the authored-source/fixture sweep and regenerate dist.

Release housekeeping before merge: refresh the PR body (118 artifacts, six harnesses), re-date the 2.6.0/2.6.1 changelog entries, and renumber the new t275 if PR #730 merges first.

Verification:

  • Focused unit/e2e slice: tests/logs/2026-08-11T07-18-43Z, RESULT: PASS (63 assertions), including t134, t217, t266, t272, t275, t276, t68, and documentation parity.
  • bun scripts/package.ts --check: pass across all six harnesses.
  • Coverage registry, graph compile/export drift, and git diff --check: pass.
  • GitHub reports the PR mergeable against current v2.

@SiddhJog
SiddhJog force-pushed the feature/design-output-restructure branch 4 times, most recently from cc98fe6 to 6eeffaf Compare August 13, 2026 07:00
@SiddhJog

Copy link
Copy Markdown
Contributor Author

Rebased onto latest v2 + review round 3 addressed

Rebased over the new v2 commits (incl. #617 batch-parallel per-unit waves, the Cursor harness fixes, and #401 per-stage traceability). All conflicts resolved keeping v2's new behavior alongside our restructure.

Conflict resolutions

  • Harness SKILL.md (×7): kept v2's new "per-unit batch waves" paragraph and our 29 inline / 33-stage / contract-design / domain-design deltas
  • t186 / t208: merged v2's new wave assertions with our artifact renames (business-logic-modelfunctional-spec, etc.)
  • CHANGELOG: 2.6.1 / 2.6.0 on top, then v2's entries; README badge + aidlc-version.ts kept at 2.6.1

Ripples from our restructure into v2's new tests

  • t278-per-unit-wave (new on v2): re-authored for State Version 8, domain-design, and the consolidated infrastructure-design shape (5 artifacts → infrastructure-specification + monitoring-design + cicd-pipeline). Its old application-design / v7 seed was correctly rejected by our new runtime state-version guard — confirming the guard works.
  • t277-validate-grid-nearest-stock: feature grid is now 33 stages (contract-design added), so the folded-distance count moved 30→31.
  • Test-number collisions with v2's new files resolved (our wiring / state-doctor tests renumbered to free slots); t275-cursor-packaging domain-entitiesentities fixed.

Verification

  • bun scripts/package.ts --check: clean
  • coverage registry --check: clean
  • Unit tier (canonical runner): green except t248-codekb-scope-diff and t255-workspace-sync, which fail identically on clean v2 (environmental)

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Siddhesh, this PR restructures Inception design into Domain/Contract Design, renames the Functional Design artifacts, and consolidates Infrastructure Design outputs. I reviewed 6eeffaf and ran the affected suites through the official repository runner; t208, t209, t272, t280, and t281 are green with 50/50 assertions.

I agree this should remain changes requested. I independently verified the following blockers:

P1: Domain Design has no traceability upstream resolver

core/aidlc-common/stages/inception/domain-design.md:15-18 produces traceability, and lines 35-38 enable the traceability sensor. However, core/tools/aidlc-sensor-traceability.ts:291 still recognizes only the deleted application-design slug.

A real domain-design traceability run therefore reaches the unsupported-stage fallback at core/tools/aidlc-sensor-traceability.ts:445:

stage "domain-design" has no traceability upstream resolver

The existing regression also uses the obsolete stage and path at tests/unit/t281-sensor-traceability.test.ts:246-250, so it does not exercise the renamed stage.

Please update the resolver and test to use domain-design and prove that Domain Design traceability resolves its requirements/stories upstream correctly.

P2: Inception phase verification still reads the deleted Application Design path

core/aidlc-common/stages/inception/delivery-planning.md:147-160 defines the required Inception → Construction completeness audit, but line 153 still reads:

/inception/application-design/traceability.json

That path no longer exists after the rename. As written, Delivery Planning can omit unresolved Domain Design traceability findings from the phase-boundary verdict.

Please replace it with the Domain Design path and clarify whether Contract Design contributes traceability evidence to the same phase-boundary check.

P2: The release history publishes an unreleased intermediate version

CHANGELOG.md:4 introduces 2.6.1, CHANGELOG.md:12 introduces 2.6.0, and core/tools/aidlc-version.ts:4 publishes 2.6.1. Since 2.6.0 was never released upstream, this PR should be represented by one consolidated release entry/version under the repository’s current release-prep policy.

Please reconcile this during the required rebase.

P2: The Inception reference still describes the removed design model

docs/reference/04-stages/inception.md moves from Stage 2.7 directly to Stage 2.9 without documenting Contract Design. It also says Units Generation reads "all 5 files" from Domain Design at line 953, even though this PR replaces that model with consolidated components.md and decisions.md outputs.

Please add the Contract Design section and update the remaining descriptions of removed method-signature, service-definition, and dependency-matrix artifacts.

P3: Contract Design wiring is checked for only two harnesses

tests/unit/t280-contract-design-wiring.test.ts:87-99 validates Claude and Copilot only, while the repository ships seven harness projections.

Please drive this assertion from the shared harness matrix so missing Codex, Cursor, Kiro, Kiro IDE, or OpenCode wiring cannot pass unnoticed.

Merge blocker: the published branch conflicts with current v2

The PR is currently CONFLICTING/DIRTY. The conflicts include release files, the newer observability requirements/design flow, Infrastructure and NFR stages, documentation, tests, and generated harness trees.

Please rebase onto current v2, preserve the upstream observability artifacts while applying this consolidation, resolve authored sources first, and regenerate dist/ rather than manually resolving generated files.

…lidation (v2.6.1)

Inception design-output restructure plus infrastructure-design consolidation.

Domain/Contract (was 2.6.0):
- application-design -> domain-design (2.6): five artifacts collapse to a single
  consolidated components.md — a fenced yaml component catalogue (source of
  truth: behaviour, responsibilities, depends_on/dependents,
  external_dependencies, owned entities with identifier + cross-component
  references) plus a derived human view (mermaid + summary/ownership/rationale)
- NEW contract-design stage (2.8, CONDITIONAL): formalises inter-unit contracts
  so teams build in parallel; produces contract-summary. Delivery Planning -> 2.9
- functional-design outputs -> entities / rules / functional-spec
- aidlc-architect-agent reframed to own domain + contract design
- compiler: honour authored frontmatter number:/name: over the stale graph pin;
  bump maxIndexByPhasePrefix on every number path; duplicate-number guard

Infra consolidation (was 2.6.1):
- infrastructure-design five artifacts -> three: deployment + services + shared
  fold into a tabular infrastructure-specification.md; monitoring-design and
  cicd-pipeline stay dedicated (Operation stages consume them independently)
- consumers rewired (code-generation, observability-setup, incident-response,
  environment-provisioning, deployment-pipeline)

Artifact registry consolidated (inception + infra design outputs); stages 32 -> 33. Two code-review rounds addressed
(12 findings). All tiers green; package --check clean across all 5 harness trees.
Breaking for consumers of inception design + infra artifacts — see CHANGELOG.
@SiddhJog
SiddhJog force-pushed the feature/design-output-restructure branch from 6eeffaf to 8e4de44 Compare August 13, 2026 13:22
@SiddhJog

Copy link
Copy Markdown
Contributor Author

all five findings on 6eeffaf5 are addressed, and the branch is rebased onto latest v2 (through #404 observability + #412 Kiro MCP). Pushed as 8e4de440.

P1 — Domain Design traceability upstream resolver

aidlc-sensor-traceability.ts only recognized the deleted application-design slug, so a real domain-design run hit the unsupported-stage fallback. Renamed the resolver branch to domain-design. The t281 regression that used the obsolete stage/path now seeds domain-design and exercises the real resolver (no longer the business-rules.md/application-design stale paths).

P2 — Delivery Planning read a dead path

The Inception→Construction phase-boundary audit read <record>/inception/application-design/traceability.json. Repointed to <record>/inception/domain-design/traceability.json, and documented that Contract Design contributes no traceability.json to this check (it owns formal contracts, not requirement coverage).

P2 — Unreleased intermediate version in the changelog

Consolidated 2.6.0 + 2.6.1 into a single ## [2.6.1] - 2026-08-13 entry. This also fixes the chronology finding (real release date). aidlc-version.ts, the top CHANGELOG heading, and the README badge all agree at 2.6.1; t68 is green.

P2 — Inception reference still described the removed model

Added the missing Stage 2.8: Contract Design section to docs/reference/04-stages/inception.md, and corrected the Units Generation "all 5 files" Domain Design read to the consolidated components.md + decisions.md.

P3 — Contract Design wiring checked only two harnesses

t280-contract-design-wiring.test.ts now drives from the shared HARNESS_MATRIX, asserting the wired contract-design stage-graph (with summary_confirmation: required) across all seven shipped harness projections, so a missing Codex/Cursor/Kiro/Kiro-IDE/OpenCode projection can't pass unnoticed.

Rebase / observability reconciliation

Rebased onto 4e8f087c. Preserved the upstream observability artifacts — observability-requirements / observability-design remain in the NFR and Infrastructure Design consumes alongside this PR's renames (functional-spec, contract-summary), and monitoring-design.md is documented as implementing NFR Design's observability-design strategy. Authored sources were resolved first, then dist/ regenerated. Post-merge element counts: 33 stages, 122 artifacts, 14 agents.

Verification

  • bun scripts/package.ts --check: clean across all seven harnesses
  • coverage registry --check: clean
  • Full unit tier: green except t248-codekb-scope-diff, which fails identically on clean v2 (git empty-tree fingerprint — environmental)
  • Affected suites green: t281, t280, t282, t68, t66, t116, t186, t208, t209, t278

Branch is currently 0 behind / 1 ahead of v2.

@leandrodamascena leandrodamascena left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Siddhesh, thanks for addressing the previous review in detail. I re-reviewed 8e4de44 and verified that the earlier blockers are resolved: Domain Design traceability is wired correctly, the phase-boundary path is fixed, Contract Design is documented, the harness-matrix coverage is expanded, stale plugin vocabulary is removed, the branch is rebased, and CI is green.

I do not see a remaining hard runtime blocker, so I am approving. I did identify the following follow-ups that should be addressed before merge:

P2: Functional Design uses two incompatible business-rule ID formats

core/aidlc-common/stages/construction/functional-design.md:121 instructs the agent to author rules as BR-NNN.

However, the same stage requires traceability targets in BRx.y format at lines 125-138, and the deterministic sensor recognizes only BRx.y:

  • core/tools/aidlc-sensor-traceability.ts:63
  • core/tools/aidlc-sensor-traceability.ts:499
  • core/knowledge/aidlc-shared/verification.md:24
  • core/aidlc-common/stages/construction/code-generation.md:214-226

Following the stage instructions therefore produces rule IDs that the traceability sensor cannot discover. Because the sensor is advisory, I am treating this as P2 rather than a merge-blocking P1.

Please select one canonical rule-ID format and apply it consistently across the stage instructions, product-agent guidance, traceability schema/examples, sensor, Code Generation consumers, and tests.

P2: Missing or empty State Version bypasses the runtime compatibility check

core/tools/aidlc-orchestrate.ts:576-578 treats an absent or empty State Version as current:

if (v.length === 0 || v === CURRENT_STATE_VERSION) return null;

Explicit v7 state is correctly rejected, and the new tests cover v7/v8. However, missing, empty, or malformed state can still reach next or report, while --doctor correctly treats the same state as invalid.

Please align runtime behavior with doctor and add regressions for missing, empty, and malformed versions.

P2: Release numbering skips the minor baseline

The PR now has one consolidated release entry, which resolves the previous duplicate-heading issue, but it still moves directly from upstream 2.5.75 to 2.6.1.

Unless a separate 2.6.0 release exists outside upstream history, the consolidated minor release should be 2.6.0. Please align the changelog heading, version constant, README badge, generated harness versions, and PR/commit text.

P3: Domain Design traceability vocabulary should match the consolidated catalogue

core/aidlc-common/stages/inception/domain-design.md:163-176 tells the agent to target a component, service, or public method and uses AuthService.login() as the example.

The new Domain Design source of truth formally identifies components and entities, but not services or public methods. Please constrain the example and target guidance to identifiers represented by components.md, or add mechanical validation for any additional target vocabulary.

P3: The Inception reference still has minor documentation drift

The reference chapter:

  • omits contract-summary.md from Delivery Planning’s All Inception artifacts list;
  • omits traceability.json from Domain Design outputs;
  • says Units Generation writes All 3 artifacts, although traceability is a fourth output;
  • retains removed Domain Design descriptions such as method signatures and service definitions.

Please align these sections with the authored stage contracts.

The implementation direction looks sound and the prior blockers are resolved. Approving with the follow-ups above.

@SiddhJog
SiddhJog merged commit 74a51a1 into v2 Aug 13, 2026
5 checks passed
@SiddhJog
SiddhJog deleted the feature/design-output-restructure branch August 13, 2026 16:15
@SiddhJog

Copy link
Copy Markdown
Contributor Author

I've merged i'll pickup the followups in a separate branch.

SiddhJog added a commit that referenced this pull request Aug 13, 2026
…ity, 2.6.0 baseline

Addresses the approving-review follow-ups on the merged domain/contract
restructure (#711):

- Canonical business-rule ID format is `BRx.y` (the format the traceability
  sensor recognizes). functional-design.md and the product-agent
  functional-design guide no longer instruct `BR-NNN`, which the sensor could
  not discover.
- Runtime state-version guard aligned with `--doctor`: `next`/`report` now
  refuse a state whose State Version is missing, empty, or unparseable (not
  only an explicitly stale one). Regressions added in t282 for missing / empty
  / malformed versions.
- Consolidated release is renumbered 2.6.1 -> 2.6.0 (the minor baseline; no
  2.6.0 shipped upstream). Version constant, CHANGELOG heading, README badge,
  and generated harness versions realigned.
- Domain Design traceability targets are constrained to components/entities in
  components.md (its source of truth); the example no longer uses a service
  method (AuthService.login()).
- Inception reference (docs/reference/04-stages/inception.md) drift fixed:
  contract-summary.md added to Delivery Planning inputs, traceability.json added
  to Domain Design and Units Generation outputs (3 -> 4), a Contract Design (2.8)
  section added, and the removed method-signature/service-definition Domain
  Design descriptions replaced with the consolidated components.md/decisions.md.
SiddhJog added a commit that referenced this pull request Aug 13, 2026
…on guard (v2.6.2)

Addresses the approving-review follow-ups on the merged domain/contract
restructure (#711), then leandro's round-2 review on #751:

- CHANGELOG: preserve the merged `## [2.6.1]` release history and add a new
  `## [2.6.2]` entry for these follow-ups. Version constant, README badge, and
  regenerated per-harness `dist/*/.../tools/aidlc-version.ts` copies are 2.6.2.
- Business-rule ID format is canonical `BRx.y` (the format the traceability
  sensor recognizes). Updated the stage instructions (`functional-design.md`),
  the product-agent functional-design guide, AND the org-level stable-ID
  guidance (`core/memory/org.md`) so agents no longer receive the sensor-
  incompatible `BR-NNN` / `BR-003` example alongside the stage prose.
- Runtime state-version guard aligned with `--doctor` and hardened against
  three fail-open paths the reviewers found:
  * a PRESENT-but-zero-byte `aidlc-state.md` is now rejected (was skipped
    because the call sites tested `if (stateContent)` — an empty string is
    falsy). Both `next` and `report` call sites now check `!== null`.
  * the regex uses `[ \t]*` (horizontal whitespace) rather than `\s*`, so an
    empty version value can no longer capture the leading `-` of the next
    state bullet and be mislabeled as the bogus token "-".
  * the captured version is validated as a bare integer; a non-numeric value
    is reported through the unparseable branch, and a FUTURE numeric version
    (e.g. v9) is reported as newer than this build's v8, not as predating it.
  Doctor's parallel `\s*` regex received the same `[ \t]*` fix.
- Domain Design traceability targets are constrained to components/entities in
  `components.md` (its source of truth); example is `AuthComponent`, not
  `AuthService.login()`.
- Inception reference documentation drift fixed: Contract Design (2.8) section
  added, `contract-summary.md` listed in Delivery Planning inputs,
  `traceability.json` listed in Domain Design and Units Generation outputs,
  Units Generation output count corrected from 3 to 4 in BOTH the Outputs
  table AND its generation-step prose.

Regressions added in t282: exact-remediation assertions (asserting the
unparseable branch rather than either branch), a zero-byte state file case for
both `next` and `report`, and a future-version (v9) case that asserts the
"newer than the current" message rather than "predates".
SiddhJog added a commit that referenced this pull request Aug 14, 2026
…on guard (v2.6.2)

Addresses the follow-up review items from the merged domain/contract restructure (#711),
then leandro's rounds 2 and 3 review on #751. This is a correctness/consistency patch on
top of 2.6.1; no artifact or stage-graph changes.

- CHANGELOG: preserve the merged `## [2.6.1]` release history and add a new
  `## [2.6.2]` entry for these follow-ups. Version constant, README badge, and
  regenerated per-harness `dist/*/.../tools/aidlc-version.ts` copies are 2.6.2.
- Business-rule ID format is canonical `BRx.y` (the format the traceability
  sensor recognizes). Updated the stage instructions (`functional-design.md`),
  the product-agent functional-design guide, AND the org-level stable-ID
  guidance (`core/memory/org.md`) so agents no longer receive the sensor-
  incompatible `BR-NNN` / `BR-003` example alongside the stage prose.
- Runtime state-version guard and doctor now share ONE classifier
  (`classifyStateVersion` in `aidlc-lib.ts`), so they can no longer disagree on
  whether a state is unparseable / past / future / ok:
  * a PRESENT-but-zero-byte `aidlc-state.md` is rejected (was skipped because
    the call sites tested `if (stateContent)` — an empty string is falsy).
    Both `next` and `report` now check `!== null`.
  * the parser uses `[ \t]*` (horizontal whitespace) rather than `\s*`, so an
    empty version value can no longer capture the leading `-` of the next
    state bullet and be mislabeled as the bogus token "-".
  * the value line is anchored to end-of-line, so trailing content such as
    `State Version: 8 garbage` is routed through the unparseable branch
    rather than accepted as v8.
  * the captured version is validated as a bare integer; a non-numeric value
    is reported through the unparseable branch, and a FUTURE numeric version
    (e.g. v9) is reported as newer than this build's v8 with upgrade guidance
    (not archive-and-reinit). Doctor now emits per-branch failing rows
    (`state version readable` / `state version current` / `state version
    compatible`) mirroring the runtime classification.
- Domain Design traceability targets are constrained to components/entities in
  `components.md` (its source of truth); example is `AuthComponent`, not
  `AuthService.login()`.
- Inception reference documentation drift fixed: Contract Design (2.8) section
  added, `contract-summary.md` listed in Delivery Planning inputs,
  `traceability.json` listed in Domain Design and Units Generation outputs,
  Units Generation output count corrected from 3 to 4 in the reference doc
  AND in the authored stage prose (`units-generation.md` Step 6).

Regressions added in t282: exact-remediation assertions (asserting the
unparseable branch rather than either branch), zero-byte state file cases
for both `next` and `report`, a future-version (v9) case that asserts the
"newer than the current" message, trailing-content cases for both `next`
and `report`, and matching doctor cases (malformed → readable-row,
future → compatible-row, trailing → readable-row).
SiddhJog added a commit that referenced this pull request Aug 14, 2026
…on guard (v2.6.2)

Addresses the follow-up review items from the merged domain/contract restructure (#711),
then leandro's rounds 2 and 3 review on #751. This is a correctness/consistency patch on
top of 2.6.1; no artifact or stage-graph changes.

- CHANGELOG: preserve the merged `## [2.6.1]` release history and add a new
  `## [2.6.2]` entry for these follow-ups. Version constant, README badge, and
  regenerated per-harness `dist/*/.../tools/aidlc-version.ts` copies are 2.6.2.
- Business-rule ID format is canonical `BRx.y` (the format the traceability
  sensor recognizes). Updated the stage instructions (`functional-design.md`),
  the product-agent functional-design guide, AND the org-level stable-ID
  guidance (`core/memory/org.md`) so agents no longer receive the sensor-
  incompatible `BR-NNN` / `BR-003` example alongside the stage prose.
- Runtime state-version guard and doctor now share ONE classifier
  (`classifyStateVersion` in `aidlc-lib.ts`), so they can no longer disagree on
  whether a state is unparseable / past / future / ok:
  * a PRESENT-but-zero-byte `aidlc-state.md` is rejected (was skipped because
    the call sites tested `if (stateContent)` — an empty string is falsy).
    Both `next` and `report` now check `!== null`.
  * the parser uses `[ \t]*` (horizontal whitespace) rather than `\s*`, so an
    empty version value can no longer capture the leading `-` of the next
    state bullet and be mislabeled as the bogus token "-".
  * the value line is anchored to end-of-line, so trailing content such as
    `State Version: 8 garbage` is routed through the unparseable branch
    rather than accepted as v8.
  * the captured version is validated as a bare integer; a non-numeric value
    is reported through the unparseable branch, and a FUTURE numeric version
    (e.g. v9) is reported as newer than this build's v8 with upgrade guidance
    (not archive-and-reinit). Doctor now emits per-branch failing rows
    (`state version readable` / `state version current` / `state version
    compatible`) mirroring the runtime classification.
- Domain Design traceability targets are constrained to components/entities in
  `components.md` (its source of truth); example is `AuthComponent`, not
  `AuthService.login()`.
- Inception reference documentation drift fixed: Contract Design (2.8) section
  added, `contract-summary.md` listed in Delivery Planning inputs,
  `traceability.json` listed in Domain Design and Units Generation outputs,
  Units Generation output count corrected from 3 to 4 in the reference doc
  AND in the authored stage prose (`units-generation.md` Step 6).

Regressions added in t282: exact-remediation assertions (asserting the
unparseable branch rather than either branch), zero-byte state file cases
for both `next` and `report`, a future-version (v9) case that asserts the
"newer than the current" message, trailing-content cases for both `next`
and `report`, and matching doctor cases (malformed → readable-row,
future → compatible-row, trailing → readable-row).
SiddhJog added a commit that referenced this pull request Aug 14, 2026
…on guard (v2.6.2) (#751)

Addresses the follow-up review items from the merged domain/contract restructure (#711),
then leandro's rounds 2 and 3 review on #751. This is a correctness/consistency patch on
top of 2.6.1; no artifact or stage-graph changes.

- CHANGELOG: preserve the merged `## [2.6.1]` release history and add a new
  `## [2.6.2]` entry for these follow-ups. Version constant, README badge, and
  regenerated per-harness `dist/*/.../tools/aidlc-version.ts` copies are 2.6.2.
- Business-rule ID format is canonical `BRx.y` (the format the traceability
  sensor recognizes). Updated the stage instructions (`functional-design.md`),
  the product-agent functional-design guide, AND the org-level stable-ID
  guidance (`core/memory/org.md`) so agents no longer receive the sensor-
  incompatible `BR-NNN` / `BR-003` example alongside the stage prose.
- Runtime state-version guard and doctor now share ONE classifier
  (`classifyStateVersion` in `aidlc-lib.ts`), so they can no longer disagree on
  whether a state is unparseable / past / future / ok:
  * a PRESENT-but-zero-byte `aidlc-state.md` is rejected (was skipped because
    the call sites tested `if (stateContent)` — an empty string is falsy).
    Both `next` and `report` now check `!== null`.
  * the parser uses `[ \t]*` (horizontal whitespace) rather than `\s*`, so an
    empty version value can no longer capture the leading `-` of the next
    state bullet and be mislabeled as the bogus token "-".
  * the value line is anchored to end-of-line, so trailing content such as
    `State Version: 8 garbage` is routed through the unparseable branch
    rather than accepted as v8.
  * the captured version is validated as a bare integer; a non-numeric value
    is reported through the unparseable branch, and a FUTURE numeric version
    (e.g. v9) is reported as newer than this build's v8 with upgrade guidance
    (not archive-and-reinit). Doctor now emits per-branch failing rows
    (`state version readable` / `state version current` / `state version
    compatible`) mirroring the runtime classification.
- Domain Design traceability targets are constrained to components/entities in
  `components.md` (its source of truth); example is `AuthComponent`, not
  `AuthService.login()`.
- Inception reference documentation drift fixed: Contract Design (2.8) section
  added, `contract-summary.md` listed in Delivery Planning inputs,
  `traceability.json` listed in Domain Design and Units Generation outputs,
  Units Generation output count corrected from 3 to 4 in the reference doc
  AND in the authored stage prose (`units-generation.md` Step 6).

Regressions added in t282: exact-remediation assertions (asserting the
unparseable branch rather than either branch), zero-byte state file cases
for both `next` and `report`, a future-version (v9) case that asserts the
"newer than the current" message, trailing-content cases for both `next`
and `report`, and matching doctor cases (malformed → readable-row,
future → compatible-row, trailing → readable-row).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants