Prioritize investigation hypotheses by confidence after bootstrap
This commit is contained in:
1 parent
f4082585ae
commit
c44ccd5ce3
5 files changed
+128
-2
No files matched your search
@@ -270,3 +270,27 @@ def test_provider_configuration_error_blocks_without_abandoning_hypotheses(tool_
|
||||
@pytest.mark.parametrize("name",["investigation-output","investigation-state","investigation-context"])
|
||||
def test_loop_schemas_valid(name):
|
||||
Draft202012Validator.check_schema(json.loads(files("viano_bug_analysis.schemas").joinpath(name+'-v1.schema.json').read_text()))
|
||||
|
||||
|
||||
def test_confidence_scheduler_keeps_growing_candidate_then_switches_after_weakening(tool_case):
|
||||
def change(reply,context):
|
||||
hid=context['selected_hypothesis']
|
||||
turns=sum(c['selected_hypothesis']==hid for c in adapter.contexts)
|
||||
if hid=='H1' and turns in (2,3):
|
||||
reply['update']['confidence']='supported' if turns==2 else 'weakened'
|
||||
reply['next']={'kind':'tool','operation':'source.read_context',
|
||||
'arguments':{'source_ref':'tool/code.cpp','start_line':1,'end_line':2}}
|
||||
adapter=LoopAdapter(change)
|
||||
loop=Investigator(tool_case[0],gateway(adapter))
|
||||
first=run(loop,steps=4)
|
||||
assert first.status=='YIELDED'
|
||||
assert [c['selected_hypothesis'] for c in adapter.contexts]==['H1','H2','H3','H1']
|
||||
# Resume the persisted confidence state; neither cursor nor a restart forces rotation.
|
||||
result=run(Investigator(tool_case[0],gateway(adapter)),steps=2)
|
||||
assert [c['selected_hypothesis'] for c in adapter.contexts]==['H1','H2','H3','H1','H1','H2']
|
||||
saved=state(result)
|
||||
assert saved['hypotheses']['H1']['confidence']=='weakened'
|
||||
assert saved['hypotheses']['H1']['disposition']=='active'
|
||||
account=BudgetManager(tool_case[0]).snapshot(*CASE).state['accounts']['H1']
|
||||
assert account['remaining']>0 and account['status']=='investigating'
|
||||
assert PackageValidator().validate(result.package).valid
|
||||
Reference in new issue
Block a user