feat: establish the Target architecture as a graph before code

Design is now approved before any infrastructure code is written (ADR-0005).
A new target-architect Specialist produces one graph of Elements,
Relationships and Checks; the diagram is rendered from it, deployment
guidance must account for every Check, and validation gives a verdict per
Check. Requirements, components, products and recommendations carry ids in
data files, and a submission with a gap in the Requirements chain is refused.

Also in this commit:
- Customer cases group Executions, with an intent history per case
- lesson candidates are captured when an Execution ends
- evaluation gains chain, verdict, judged and interactive checks, and
  per-case thresholds
- Terraform providers are cached between checks
- the requirements analyst proposes defaults instead of asking
- the legacy-baseline case and the checks that only read it are removed
- ADR-0006 (Change requests) accepted; ADR-0004 and ADR-0007 proposed
- plans for iterations 4 to 7 under .agents/plans/

Unproven with a real model: no evaluation run has completed on this design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 13:59:09 +01:00
parent 7ee49ab352
commit e9246828b3
586 changed files with 5166 additions and 22432 deletions

View File

@@ -33,14 +33,11 @@ def through_phase_one(ledger: Ledger) -> None:
def through_phase_two(ledger: Ledger) -> None:
through_phase_one(ledger)
produce(
ledger,
K.PRODUCT_SELECTION,
K.ARCHITECTURE_DIAGRAM,
K.ARCHITECTURE_DESCRIPTION,
K.DESIGN_RECOMMENDATIONS,
K.DEPLOYMENT_GUIDANCE,
ledger, K.PRODUCT_SELECTION, K.DESIGN_RECOMMENDATIONS, K.TARGET_ARCHITECTURE
)
approve(ledger, P.SOLUTION_ARCHITECTURE)
produce(ledger, K.ARCHITECTURE_DESCRIPTION, K.DEPLOYMENT_GUIDANCE)
approve(ledger, P.SOLUTION_IMPLEMENTATION)
def through_phase_three(ledger: Ledger) -> None:
@@ -80,18 +77,18 @@ def test_cross_phase_dependency_needs_the_earlier_phase_approved():
def test_independent_work_becomes_ready_together():
ledger = Ledger()
through_phase_one(ledger)
produce(ledger, K.PRODUCT_SELECTION)
produce(
ledger, K.PRODUCT_SELECTION, K.DESIGN_RECOMMENDATIONS, K.TARGET_ARCHITECTURE
)
assert set(ledger.ready_work()) == {
K.ARCHITECTURE_DIAGRAM,
K.DESIGN_RECOMMENDATIONS,
}
# Nothing in implementation is ready until the design is approved.
assert ledger.ready_work() == ()
produce(ledger, K.ARCHITECTURE_DIAGRAM)
approve(ledger, P.SOLUTION_ARCHITECTURE)
assert set(ledger.ready_work()) == {
K.ARCHITECTURE_DESCRIPTION,
K.DESIGN_RECOMMENDATIONS,
K.DEPLOYMENT_GUIDANCE,
}
@@ -259,10 +256,12 @@ def test_reopen_cascades_to_dependents_and_withdraws_affected_approvals():
assert ledger.status(K.VALIDATION_RESULTS) is DeliverableStatus.PENDING
assert ledger.status(K.PRODUCT_SELECTION) is DeliverableStatus.SUBMITTED
assert ledger.phase_status(P.REQUIREMENTS_DISCOVERY) is PhaseStatus.APPROVED
assert ledger.phase_status(P.SOLUTION_ARCHITECTURE) is PhaseStatus.OPEN
# Revising the code leaves the approved design standing.
assert ledger.phase_status(P.SOLUTION_ARCHITECTURE) is PhaseStatus.APPROVED
assert ledger.phase_status(P.SOLUTION_IMPLEMENTATION) is PhaseStatus.OPEN
assert ledger.phase_status(P.SOLUTION_VALIDATION) is PhaseStatus.OPEN
assert set(result.withdrawn_approvals) == {
P.SOLUTION_ARCHITECTURE,
P.SOLUTION_IMPLEMENTATION,
P.SOLUTION_VALIDATION,
}
assert ledger.revisions(K.DEPLOYMENT_GUIDANCE) == 1
@@ -278,15 +277,15 @@ def test_reopen_invalidates_attempts_of_dependents_already_in_progress():
ledger = Ledger()
through_phase_one(ledger)
produce(ledger, K.PRODUCT_SELECTION)
attempt = ledger.start([K.ARCHITECTURE_DIAGRAM], actor="orchestrator")[
K.ARCHITECTURE_DIAGRAM
attempt = ledger.start([K.DESIGN_RECOMMENDATIONS], actor="orchestrator")[
K.DESIGN_RECOMMENDATIONS
]
ledger.reopen(K.PRODUCT_SELECTION, "user prefers GKE", actor="orchestrator")
assert ledger.status(K.ARCHITECTURE_DIAGRAM) is DeliverableStatus.PENDING
assert ledger.status(K.DESIGN_RECOMMENDATIONS) is DeliverableStatus.PENDING
with pytest.raises(LedgerRefusal, match="attempt"):
ledger.submit(K.ARCHITECTURE_DIAGRAM, attempt, actor="diagrammer")
ledger.submit(K.DESIGN_RECOMMENDATIONS, attempt, actor="design-advisor")
def test_reopen_refuses_deliverables_that_were_never_submitted():
@@ -356,3 +355,27 @@ def test_round_trips_through_plain_data():
assert restored.ready_work() == ledger.ready_work()
assert restored.max_revisions == 5
assert restored.events == ledger.events
def test_revising_the_target_architecture_returns_the_code_to_draft():
ledger = Ledger()
through_phase_three(ledger)
result = ledger.reopen(
K.TARGET_ARCHITECTURE, "NFR-1 has no Check on retention", actor="orchestrator"
)
assert set(result.reset) == {
K.TARGET_ARCHITECTURE,
K.ARCHITECTURE_DESCRIPTION,
K.DEPLOYMENT_GUIDANCE,
K.VALIDATION_RESULTS,
}
assert set(result.withdrawn_approvals) == {
P.SOLUTION_ARCHITECTURE,
P.SOLUTION_IMPLEMENTATION,
P.SOLUTION_VALIDATION,
}
# The code cannot be rewritten until the revised design is approved again.
produce(ledger, K.TARGET_ARCHITECTURE)
assert ledger.ready_work() == ()