Accept modern interpretation markers in embedded hypothesis context schema
This commit is contained in:
1 parent
d6749001bb
commit
77919c40f8
2 files changed
+44
No files matched your search
@@ -109,6 +109,12 @@
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"model_encoding": {
|
||||
"const": "shared_json_v1"
|
||||
},
|
||||
"context_selection": {
|
||||
"const": "phase_selection_v1"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -467,3 +467,41 @@ def test_description_matches_prioritize_specific_names_without_automatic_selecti
|
||||
assert next(m for m in matches if m['candidate_id']=='K0002')['more_specific_matches']==['K0001']
|
||||
assert next(m for m in matches if m['candidate_id']=='K0001')['more_specific_matches']==[]
|
||||
assert 'selected' not in str(guidance)
|
||||
|
||||
|
||||
def test_resolved_selected_interpretation_transitions_to_hypotheses_and_replays(built_case):
|
||||
from viano_bug_analysis.analysis import HypothesisBuilder
|
||||
from test_hypothesis_builder import ProposalAdapter
|
||||
store=built_case[0]
|
||||
model=Model();service=service_for(store)
|
||||
interpreter=CaseInterpreter(store,gateway(model),project_research=service)
|
||||
interpreted=asyncio.run(interpreter.interpret('case-A','stable-package'))
|
||||
assert interpreted.status=='COMPLETED'
|
||||
with PackageReader(interpreted.package) as reader:
|
||||
doc=json.loads(reader.read_bytes(interpreted.interpretation_ref))
|
||||
context=json.loads(reader.read_bytes(doc['context_ref']))
|
||||
assert context['model_encoding']=='shared_json_v1'
|
||||
assert context['context_selection']=='phase_selection_v1'
|
||||
frozen={n:reader.read_bytes(n) for n in reader.files if n!='manifest.json'}
|
||||
proposal=ProposalAdapter()
|
||||
builder=HypothesisBuilder(store,gateway(proposal))
|
||||
builder.interpreter=interpreter
|
||||
result=asyncio.run(builder.build('case-A','stable-package'))
|
||||
assert result.status=='COMPLETED' and PackageValidator().validate(result.package).valid
|
||||
assert proposal.requests[0]['prompt_version']=='hypotheses_v4'
|
||||
assert len(model.requests)==3 and len(service.database.calls)==1
|
||||
assert asyncio.run(builder.build('case-A','stable-package')).reused
|
||||
assert len(proposal.requests)==1 and len(model.requests)==3
|
||||
with PackageReader(result.package) as reader:
|
||||
for name,raw in frozen.items():assert reader.read_bytes(name)==raw
|
||||
|
||||
|
||||
def test_embedded_interpretation_context_contract_stays_in_sync():
|
||||
from importlib.resources import files
|
||||
schemas=files('viano_bug_analysis.schemas')
|
||||
canonical=json.loads(schemas.joinpath('case-interpretation-context-v1.schema.json').read_text())
|
||||
hypothesis=json.loads(schemas.joinpath('hypothesis-context-v1.schema.json').read_text())
|
||||
embedded=hypothesis['properties']['case_context']
|
||||
assert embedded['properties']==canonical['properties']
|
||||
assert embedded['required']==canonical['required']
|
||||
assert embedded['additionalProperties']==canonical['additionalProperties']
|
||||
Reference in new issue
Block a user