#!/usr/bin/env python3
"""Append source-only findings; never turn pure routing into HTTP/DB passes."""
import hashlib
import json
import subprocess
import sys
from pathlib import Path
import integrate_20261010 as tool
from integrate_20261011_batches46_48 import item

def verify():
    path = Path('/private/tmp/cdx-ai-hk-course-b.Kmdirn/review-s3-641/verify_review.py')
    assert hashlib.sha256(path.read_bytes()).hexdigest() == '7d7e7f0124088d30feff3bbf4cb8e7d0fc1516a44a1a0d69bb4fe547f3f26eef'
    r = json.loads(subprocess.check_output([sys.executable, '-B', str(path)]))
    assert r['offline'] and r['checks'] == 645 and len(r['exact_keys']) == 13
    assert r['HTTP_SQL_calls'] == r['business_pass_increment'] == 0
    assert r['runtime_cached_routes_not_examined'] and r['no_patch']
    return r

if __name__ == '__main__':
    audit = Path(__file__).with_name('integration-20261013-legacy-route-source.json')
    assert not audit.exists(), 'Never replay main'
    r = verify()
    report = tool.STORE + 'parallel-legacy-route-source-20261013/ROOT_REVIEW.md'
    rows = [item('store', *key.split(' ', 1), '', evidence=report, evidence_only=True,
                 risk='source-only-registered-invalid-module-runtime-cache-unverified') for key in r['exact_keys']]
    tool.main(rows, audit, verify)
