from pathlib import Path
import json,ast
R=Path(__file__).resolve().parent
cases=json.loads((R/'fixtures/cases.json').read_text(encoding='utf-8'))['cases']
assert len(cases)==8
required={'expected_digest','actual_digest','source_bound','provenance_bound','rights_basis','rights_scope_ok','rights_active','variant_role','parent_expected','parent_actual','recipe_bound','qc_profile_current','technical_qc','semantic_qc','rights_qc','aesthetic_qc'}
for c in cases:
    assert required.issubset(c),(c['id'],sorted(required-set(c)))
    assert c['variant_role'] in {'MASTER','MOBILE','POSTER','PROXY'}
    for q in ['technical_qc','semantic_qc','rights_qc','aesthetic_qc']:
        assert c[q] in {'PASS','FAIL','UNKNOWN'}
text=(R/'starter.py').read_text(encoding='utf-8')
tree=ast.parse(text)
assert any(isinstance(n,ast.FunctionDef) and n.name=='evaluate_asset' for n in tree.body)
forbidden=['oracle'+'_expected','internal'+'_verification','answer'+'_key']
assert not any(x in text.lower() for x in forbidden)
print('PASS 8/8 learner fixture structural checks')
