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:
@@ -8,7 +8,7 @@ import pytest
|
||||
from langgraph.checkpoint.memory import InMemorySaver
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
from app.adk.fake_runtime import Call, FakeAgentRuntime
|
||||
from app.adk.fake_runtime import Call, FakeAgentRuntime, sample_submission
|
||||
from app.adk.roles import load_roles
|
||||
from app.agent import Assembly, ExecutionEngine
|
||||
from app.config import get_settings
|
||||
@@ -32,17 +32,7 @@ LEGACY_GENERATE_KEYS = {
|
||||
|
||||
|
||||
def submission(kind: DeliverableKind) -> list[Call]:
|
||||
spec = DEPENDENCY_GRAPH[kind]
|
||||
body = "\n".join(f"## {section}\nDetails." for section in spec.sections)
|
||||
return [
|
||||
Call(
|
||||
"submit_deliverable",
|
||||
{
|
||||
"content": f"# {kind}\n{body}\n",
|
||||
"attachments": {name: f"# {name}\n" for name in spec.attachments},
|
||||
},
|
||||
)
|
||||
]
|
||||
return [sample_submission(kind)]
|
||||
|
||||
|
||||
def complete_run_turns() -> dict:
|
||||
@@ -57,9 +47,16 @@ def complete_run_turns() -> dict:
|
||||
[delegate(K.REQUIREMENTS)],
|
||||
[delegate(K.TECHNICAL_DECOMPOSITION)],
|
||||
[approve(PhaseId.REQUIREMENTS_DISCOVERY), delegate(K.PRODUCT_SELECTION)],
|
||||
[delegate(K.ARCHITECTURE_DIAGRAM, K.DESIGN_RECOMMENDATIONS)],
|
||||
[delegate(K.ARCHITECTURE_DESCRIPTION, K.DEPLOYMENT_GUIDANCE)],
|
||||
[approve(PhaseId.SOLUTION_ARCHITECTURE), delegate(K.VALIDATION_RESULTS)],
|
||||
[delegate(K.DESIGN_RECOMMENDATIONS)],
|
||||
[delegate(K.TARGET_ARCHITECTURE)],
|
||||
[
|
||||
approve(PhaseId.SOLUTION_ARCHITECTURE),
|
||||
delegate(K.ARCHITECTURE_DESCRIPTION, K.DEPLOYMENT_GUIDANCE),
|
||||
],
|
||||
[
|
||||
approve(PhaseId.SOLUTION_IMPLEMENTATION),
|
||||
delegate(K.VALIDATION_RESULTS),
|
||||
],
|
||||
[approve(PhaseId.SOLUTION_VALIDATION), delegate(K.SOLUTION_GUIDE)],
|
||||
[approve(PhaseId.PACKAGING), Call("finish")],
|
||||
],
|
||||
@@ -272,7 +269,14 @@ def test_generate_runs_pre_approved_and_keeps_the_legacy_response_keys(tmp_path)
|
||||
assert body["artifacts"]["terraform_code"] == "# terraform/main.tf\n"
|
||||
assert body["artifacts"]["source_discovery_doc"] == "Details."
|
||||
assert "google-cloud-solution-architecture" in body["active_skills"]
|
||||
assert (tmp_path / "deliverables" / "executions" / body["execution_id"]).is_dir()
|
||||
assert (
|
||||
tmp_path
|
||||
/ "deliverables"
|
||||
/ "cases"
|
||||
/ "unassigned"
|
||||
/ "executions"
|
||||
/ body["execution_id"]
|
||||
).is_dir()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("payload", [{}, {"request": " "}])
|
||||
@@ -291,3 +295,27 @@ def test_health_reports_mcp_discovery_gaps(tmp_path):
|
||||
|
||||
assert body["status"] == "healthy"
|
||||
assert body["mcp_discovery_gaps"] == {"compute": "API not enabled"}
|
||||
|
||||
|
||||
def test_generate_groups_the_execution_under_the_callers_customer_case(tmp_path):
|
||||
turns = {
|
||||
"orchestrator": [
|
||||
[Call("delegate", {"kinds": ["requirements"]})],
|
||||
[],
|
||||
],
|
||||
"requirements-analyst": [submission(DeliverableKind.REQUIREMENTS)],
|
||||
}
|
||||
client, _ = client_for(tmp_path, turns)
|
||||
with client:
|
||||
refused = client.post(
|
||||
"/generate", json={"request": "Design ingestion", "customer_case": "../x"}
|
||||
)
|
||||
accepted = client.post(
|
||||
"/generate",
|
||||
json={"request": "Design ingestion", "customer_case": "acme-webhooks"},
|
||||
)
|
||||
|
||||
assert refused.status_code == 400
|
||||
assert "customer_case" in refused.json()["error"]
|
||||
assert accepted.status_code == 200, accepted.json()
|
||||
assert (tmp_path / "lessons" / "candidates" / "acme-webhooks").is_dir()
|
||||
|
||||
Reference in New Issue
Block a user