fix(01): CR-01 bind review digest to selected receipt bytes

This commit is contained in:
UnixNight committed 2026-11-13 17:00:47 -05:00
1 parent 5915128570
commit 5569bc2b8b
2 files changed
+25 -3

No files matched your search

+4 -3
View File
@@ -130,16 +130,17 @@ def audit(checkpoint, results):
paths = read_json(selection).get('receipts', []) if selection.exists() else []
if not isinstance(paths, list) or len(paths) > 120 or len(set(paths)) != len(paths):
raise ValueError('Current receipt selection must be a bounded unique array')
records = []
records, selected = [], []
for name in paths:
path = contained_path(results, name)
records.append((read_receipt(path), path.parent))
selected.append(path)
review_path = results / 'human-review.json'
review = read_json(review_path) if review_path.exists() else {}
# Bind review to actual receipt bytes, not just reusable labels.
for receipt, directory in records:
for (receipt, _), path in zip(records, selected):
expected = review.get('receipt_sha256', {}).get(receipt['receipt_id'])
if expected != identify_file(directory / 'receipt.json')['sha256']:
if expected != identify_file(path)['sha256']:
review = dict(review, checks={})
break
return audit_records(read_json(root / 'protocol/scenarios.json'), manifest, records, review)