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

@@ -47,6 +47,7 @@ def test_every_phase_groups_at_least_one_deliverable_with_a_distinct_specialist(
assert PHASE_ORDER == (
PhaseId.REQUIREMENTS_DISCOVERY,
PhaseId.SOLUTION_ARCHITECTURE,
PhaseId.SOLUTION_IMPLEMENTATION,
PhaseId.SOLUTION_VALIDATION,
PhaseId.PACKAGING,
)
@@ -56,55 +57,68 @@ def test_every_phase_groups_at_least_one_deliverable_with_a_distinct_specialist(
assert len(specialists) == len(set(specialists))
def test_graph_matches_the_upstream_skill_dependencies():
def test_the_target_architecture_sits_between_the_design_and_the_code():
depends = {kind: set(spec.depends_on) for kind, spec in DEPENDENCY_GRAPH.items()}
K = DeliverableKind
assert depends[K.REQUIREMENTS] == set()
assert depends[K.TECHNICAL_DECOMPOSITION] == {K.REQUIREMENTS}
assert depends[K.PRODUCT_SELECTION] == {K.TECHNICAL_DECOMPOSITION}
assert depends[K.ARCHITECTURE_DIAGRAM] == {K.PRODUCT_SELECTION}
assert depends[K.ARCHITECTURE_DESCRIPTION] == {
K.ARCHITECTURE_DIAGRAM,
K.PRODUCT_SELECTION,
}
assert depends[K.DESIGN_RECOMMENDATIONS] == {K.PRODUCT_SELECTION, K.REQUIREMENTS}
assert depends[K.DEPLOYMENT_GUIDANCE] == {
assert depends[K.TARGET_ARCHITECTURE] == {
K.PRODUCT_SELECTION,
K.DESIGN_RECOMMENDATIONS,
}
# Everything after the graph is derived from it.
assert depends[K.ARCHITECTURE_DESCRIPTION] == {K.TARGET_ARCHITECTURE}
assert depends[K.DEPLOYMENT_GUIDANCE] == {K.TARGET_ARCHITECTURE}
assert depends[K.VALIDATION_RESULTS] == {K.DEPLOYMENT_GUIDANCE}
assert depends[K.SOLUTION_GUIDE] == set(
deliverables_in(PhaseId.SOLUTION_VALIDATION)
)
def test_the_design_is_approved_before_code_is_written():
design = PhaseId.SOLUTION_ARCHITECTURE
implementation = PhaseId.SOLUTION_IMPLEMENTATION
assert DEPENDENCY_GRAPH[DeliverableKind.TARGET_ARCHITECTURE].phase is design
assert DEPENDENCY_GRAPH[DeliverableKind.DEPLOYMENT_GUIDANCE].phase is implementation
assert PHASE_ORDER.index(design) < PHASE_ORDER.index(implementation)
def test_inputs_are_earlier_phases_plus_indirect_dependencies_in_graph_order():
assert inputs_of(DeliverableKind.REQUIREMENTS) == ()
assert inputs_of(DeliverableKind.DEPLOYMENT_GUIDANCE) == (
design = (
DeliverableKind.REQUIREMENTS,
DeliverableKind.TECHNICAL_DECOMPOSITION,
DeliverableKind.PRODUCT_SELECTION,
DeliverableKind.DESIGN_RECOMMENDATIONS,
DeliverableKind.TARGET_ARCHITECTURE,
)
assert inputs_of(DeliverableKind.ARCHITECTURE_DESCRIPTION) == (
DeliverableKind.REQUIREMENTS,
DeliverableKind.TECHNICAL_DECOMPOSITION,
DeliverableKind.PRODUCT_SELECTION,
DeliverableKind.ARCHITECTURE_DIAGRAM,
)
assert inputs_of(DeliverableKind.REQUIREMENTS) == ()
assert inputs_of(DeliverableKind.DEPLOYMENT_GUIDANCE) == design
assert inputs_of(DeliverableKind.ARCHITECTURE_DESCRIPTION) == design
assert inputs_of(DeliverableKind.TARGET_ARCHITECTURE) == design[:4]
assert set(inputs_of(DeliverableKind.SOLUTION_GUIDE)) == set(DeliverableKind) - {
DeliverableKind.SOLUTION_GUIDE
}
def sections_missing(kind: DeliverableKind, content: str) -> list[str]:
return [m for m in check_submission(kind, content, {}) if m.startswith("section:")]
def test_submission_meeting_the_contract_has_nothing_missing():
content = (
"# Deployment guidance\n"
"## 6.1. Deployment prerequisites\nEnable APIs.\n"
"## 6.2. Step-by-step deployment instructions\nRun terraform.\n"
)
attachments = {"terraform/main.tf": "resource {}", "terraform/variables.tf": ""}
attachments = {
"terraform/main.tf": "resource {}",
"terraform/variables.tf": "variable {}",
"implementation.json": "[]",
}
assert (
check_submission(DeliverableKind.DEPLOYMENT_GUIDANCE, content, attachments)
@@ -122,6 +136,7 @@ def test_submission_reports_missing_sections_and_attachments():
assert missing == (
"section: Step-by-step deployment instructions",
"attachment: terraform/variables.tf",
"attachment: implementation.json",
)
@@ -143,7 +158,7 @@ def test_section_matching_ignores_numbering_case_and_trailing_punctuation(headin
"## Sustainability\n"
)
assert check_submission(DeliverableKind.DESIGN_RECOMMENDATIONS, content, {}) == ()
assert sections_missing(DeliverableKind.DESIGN_RECOMMENDATIONS, content) == []
def test_section_matches_a_provider_prefixed_heading_but_not_a_longer_word():
@@ -152,7 +167,7 @@ def test_section_matches_a_provider_prefixed_heading_but_not_a_longer_word():
"## Non-functional requirements\n"
)
assert check_submission(DeliverableKind.PRODUCT_SELECTION, content, {}) == ()
assert sections_missing(DeliverableKind.PRODUCT_SELECTION, content) == []
assert "section: Functional requirements" in check_submission(
DeliverableKind.REQUIREMENTS, content, {}
)
@@ -173,3 +188,32 @@ def test_empty_content_is_refused():
assert check_submission(DeliverableKind.TECHNICAL_DECOMPOSITION, " \n", {}) == (
"content: must not be empty",
)
# --- contracts beyond headings ---------------------------------------------------------
def test_architecture_description_needs_component_and_flow_sections():
missing = check_submission(
DeliverableKind.ARCHITECTURE_DESCRIPTION, "The system works.", {}
)
assert missing == ("section: Components", "section: Flow")
assert (
check_submission(
DeliverableKind.ARCHITECTURE_DESCRIPTION,
"## Architecture components\nA.\n## Data flow\nB.\n",
{},
)
== ()
)
def test_a_required_attachment_must_have_content():
missing = check_submission(
DeliverableKind.VALIDATION_RESULTS,
"## Deployment dry-run\nPass.\n## Architecture and policy analysis\nPass.\n",
{"verdicts.json": " \n"},
)
assert missing == ("attachment: verdicts.json must not be empty",)