Qualify final causal review and preserve diagnostic caveats in handoffs

This commit is contained in:
Nico committed 2026-10-20 23:33:21 +02:00
1 parent bb5d128079
commit 85b4fa83eb
15 files changed
+329 -36

No files matched your search

+6 -4
View File
@@ -12,7 +12,7 @@ from test_case_builder import case_setup
from test_investigation_tools import tool_case
from test_case_interpreter import gateway
from test_investigator import LoopAdapter,CASE
from test_diagnosis_builder import FinalAdapter
from test_diagnosis_builder import FinalAdapter, final_phase_loop
class RequestAdapter:
def __init__(self,change=None):self.calls=0;self.contexts=[];self.change=change
@@ -37,7 +37,7 @@ class RequestAdapter:
@pytest.fixture
def diagnosed(tool_case):
store=tool_case[0]
asyncio.run(Investigator(store,gateway(LoopAdapter())).run(*CASE,max_steps=20))
asyncio.run(final_phase_loop(store).run(*CASE,max_steps=20))
r=asyncio.run(DiagnosisBuilder(store,gateway(FinalAdapter(True))).build(*CASE))
return store,r.package
@@ -59,6 +59,8 @@ def test_ready_change_request_policy_provenance_budget_preservation_and_replay(d
if name!='manifest.json':assert a.read_bytes(name)==b.read_bytes(name)
diag=json.loads(b.read_bytes(doc['diagnosis_ref']))
assert doc['root_cause']==diag['diagnosis']['root_cause']
assert doc['diagnostic_caveats']['remaining_uncertainty']==diag['diagnosis']['remaining_uncertainty']
assert doc['diagnostic_caveats']['scope_limits']==diag['diagnosis']['decision_basis']['scope_limits']
assert BudgetManager(store).snapshot(*CASE).state==before
assert build(builder).reused and adapter.calls==1
assert PackageValidator().validate(result.package).valid
@@ -122,7 +124,7 @@ def test_invalid_limit_fallback_and_replay(diagnosed):
assert asyncio.run(OutputValidator(store,gateway(adapter)).publish(*CASE)).status=='OUTPUT_READY'
def test_inconclusive_diagnosis_never_creates_coding_request(tool_case):
store=tool_case[0];asyncio.run(Investigator(store,gateway(LoopAdapter())).run(*CASE,max_steps=20))
store=tool_case[0];asyncio.run(final_phase_loop(store).run(*CASE,max_steps=20))
asyncio.run(DiagnosisBuilder(store,gateway(FinalAdapter())).build(*CASE))
adapter=RequestAdapter();g=gateway(adapter)
assert build(ChangeRequestBuilder(store,g)).status=='INCONCLUSIVE' and adapter.calls==0
@@ -223,7 +225,7 @@ def test_reopened_revision_gets_new_request_and_preserves_previous_output(diagno
CaseBuilder(store).build(*CASE)
asyncio.run(CaseInterpreter(store,gateway(FixtureAdapter())).interpret(*CASE))
asyncio.run(HypothesisBuilder(store,gateway(ProposalAdapter())).build(*CASE))
asyncio.run(Investigator(store,gateway(LoopAdapter())).run(*CASE,max_steps=20))
asyncio.run(final_phase_loop(store).run(*CASE,max_steps=20))
asyncio.run(DiagnosisBuilder(store,gateway(FinalAdapter(True))).build(*CASE))
second=build(ChangeRequestBuilder(store,g));assert document(second)['task']['id']=='CR-0002'
second_output=asyncio.run(OutputValidator(store,g).publish(*CASE))