Bind captured names to typed case entities with provenance
This commit is contained in:
1 parent
3bf7b5bba7
commit
aa6958165d
15 files changed
+285
-23
No files matched your search
@@ -177,3 +177,31 @@ def test_explicit_entity_names_do_not_require_a_neutral_fallback():
|
||||
'N0003':{'kind':'entity','data':{'type':'component','id':'3','roles':['required_tool']}},
|
||||
'F0001':{'kind':'fact','data':{'value':'Use the named tool, no ID/name binding'}}}}
|
||||
assert set(unnamed_entity_reasons(context))=={'N0003'}
|
||||
|
||||
|
||||
def test_bound_name_requires_its_typed_fact_citation():
|
||||
from jsonschema import Draft202012Validator
|
||||
from viano_bug_analysis.analysis.quality import bind_entity_names, unnamed_entity_reasons
|
||||
from viano_bug_analysis.analysis.contracts import output_schema
|
||||
d=fixture()
|
||||
ctx=d['context']
|
||||
ctx['sources']['D0099']={'kind':'data_quality','case_pointer':'/interpretation_quality/identity',
|
||||
'data':{'identity_policy':'explicit_names_v1','name_binding_policy':'typed_name_bindings_v1'}}
|
||||
entity=next(e for e in d['response']['relevant_entities'] if e['entity_id']=='N0001')
|
||||
data=ctx['sources']['N0001']['data']
|
||||
ctx['sources']['F0099']={'kind':'fact','case_pointer':'/test/name','data':{'name':'project_entity_name',
|
||||
'value':{'type':data['type'],'id':data['id'],'name':'Captured display name',
|
||||
'provenance':{'source_ref':'capture.json','json_pointer':'/result/items/0/row/name','id_pointer':'/result/items/0/row/id'}}}}
|
||||
bind_entity_names(ctx)
|
||||
reasons=unnamed_entity_reasons(ctx)
|
||||
assert 'N0001' not in reasons
|
||||
for e in d['response']['relevant_entities']:
|
||||
if e['entity_id'] in reasons:e['reason']=reasons[e['entity_id']]
|
||||
entity['reason']='Captured display name is the interaction participant, not the missing subject.'
|
||||
entity['source_ids']=['N0001']
|
||||
with pytest.raises(InterpretationError,match='INTERPRETATION_ENTITY_NAME_SOURCE'):
|
||||
validate_interpretation(d['response'],ctx)
|
||||
entity['source_ids'].append('F0099')
|
||||
validate_interpretation(d['response'],ctx)
|
||||
Draft202012Validator(output_schema(ctx)).validate(d['response'])
|
||||
assert InterpretationPromptBuilder.version(ctx)=='case_interpretation_resolved_v5'
|
||||
Reference in new issue
Block a user