feat: consult only the pillars a change affects directly (iteration 5 step 3)
A graded question per pillar (not at all, only indirectly, directly) picks the pillar advisors to consult again on a Revision or a Change request; the design advisor is told which, and keeps its earlier advice for the rest. As a yes or no the answer was yes for nearly every pillar of every change. A completed Execution now writes working.json with each pillar's advice and checklist review, and a Change request starts from its Baseline's, so only the pillars a change touches are consulted afresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -631,3 +631,85 @@ async def test_a_change_request_writes_changes_json_and_a_full_set_of_files(tmp_
|
||||
assert set(manifest["deliverables"]) == {kind.value for kind in DEPENDENCY_GRAPH}
|
||||
assert (case / "v2" / "solution-architecture-guide.md").is_file()
|
||||
assert not (case / "v1" / "changes.json").exists()
|
||||
|
||||
|
||||
# --- only the pillars a change touches are consulted again ------------------------------
|
||||
|
||||
|
||||
async def test_a_change_request_starts_from_the_baselines_pillar_advice(tmp_path):
|
||||
"""The design advisor is told which pillars the change affects, and has the
|
||||
Baseline's advice for the rest."""
|
||||
from app.adk.fake_runtime import FakeDecider
|
||||
from app.adk.runtime import Answer
|
||||
from app.tools.pillars import ADVICE_KEY
|
||||
|
||||
await delivered(tmp_path)
|
||||
# A Baseline whose design advisor consulted two pillars.
|
||||
folder = tmp_path / "deliverables" / "cases" / CASE / "executions" / "v1"
|
||||
advice = {"security": "Use a dedicated identity.", "reliability": "Two zones."}
|
||||
(folder / "working.json").write_text(
|
||||
json.dumps({"design_recommendations": {ADVICE_KEY: advice}})
|
||||
)
|
||||
seen: dict = {}
|
||||
|
||||
def advisor(task):
|
||||
seen["pillars_to_consult"] = task.context["pillars_to_consult"]
|
||||
return [sample_submission(K.DESIGN_RECOMMENDATIONS)]
|
||||
|
||||
decider = FakeDecider(
|
||||
{"security": Answer(0.3, 0.8), "reliability": Answer(1.9, 0.9)}
|
||||
)
|
||||
runtime = FakeAgentRuntime(changed(**{"design-advisor": [advisor]}))
|
||||
engine = ExecutionEngine(
|
||||
runtime=runtime,
|
||||
roles=ROLES,
|
||||
recorder=InMemoryRecorder(),
|
||||
checkpointer=InMemorySaver(),
|
||||
output_root=tmp_path,
|
||||
orchestrator=Router(NoDecider(), None, Thresholds()),
|
||||
decider=decider,
|
||||
)
|
||||
|
||||
result = await engine.start(
|
||||
"Availability goes up.",
|
||||
customer_case=CASE,
|
||||
pre_approved=True,
|
||||
execution_id="v2",
|
||||
baseline="v1",
|
||||
)
|
||||
|
||||
assert seen["pillars_to_consult"] == ["reliability"]
|
||||
state, _, _ = decider.asked[0]
|
||||
assert "Requirement NFR-1 changed: 99.99% availability." in state
|
||||
# The advice is carried into the new Execution, and written for the next change.
|
||||
assert result.state["working"]["design_recommendations"][ADVICE_KEY] == advice
|
||||
assert json.loads((folder.parent / "v2" / "working.json").read_text()) == {
|
||||
"design_recommendations": {ADVICE_KEY: advice}
|
||||
}
|
||||
|
||||
|
||||
async def test_a_first_consultation_is_given_no_hint(tmp_path):
|
||||
seen: dict = {}
|
||||
|
||||
def advisor(task):
|
||||
seen["pillars_to_consult"] = task.context["pillars_to_consult"]
|
||||
return [sample_submission(K.DESIGN_RECOMMENDATIONS)]
|
||||
|
||||
from app.adk.fake_runtime import FakeDecider
|
||||
|
||||
decider = FakeDecider({})
|
||||
turns = once()
|
||||
turns["design-advisor"] = [advisor]
|
||||
engine = ExecutionEngine(
|
||||
runtime=FakeAgentRuntime(turns),
|
||||
roles=ROLES,
|
||||
recorder=InMemoryRecorder(),
|
||||
checkpointer=InMemorySaver(),
|
||||
output_root=tmp_path,
|
||||
orchestrator=Router(NoDecider(), None, Thresholds()),
|
||||
decider=decider,
|
||||
)
|
||||
|
||||
await engine.start("Ingest webhooks", pre_approved=True)
|
||||
|
||||
assert seen["pillars_to_consult"] is None and decider.asked == []
|
||||
|
||||
Reference in New Issue
Block a user