#!/usr/bin/env python3
"""Record original alias HTTP as framework-only limited evidence, never DB pass."""
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():
    p = tool.ROOT.parent / 'worktrees/dm8-compat-20261012/private-prepay-harness/review-user1841/verify_independent.py'
    assert hashlib.sha256(p.read_bytes()).hexdigest() == 'f685a6f6ebc159c691dd61d4c21e92380ed50fa7cd8fa300a88b06cbfbc8e109'
    r = json.loads(subprocess.check_output([sys.executable, '-B', str(p)]))
    assert r['passed'] and r['checks'] == 258792 and r['framework_only']
    assert r['new_SQL'] == r['new_HTTP'] == r['new_PHP'] == 0
    assert r['manifest_files'] == 68 and r['source_pins'] == 17143

if __name__ == '__main__':
    audit = Path(__file__).with_name('integration-20261014-testhealth1841.json')
    assert not audit.exists(), 'Never replay main'
    report = 'work/2026-09-28-smart-canteen-dm8-poc/matrix-integration/ROOT_TESTHEALTH1841_ACCEPTANCE_20261014.md'
    rows = [item('store', method, '/testhealth/' + action, '', evidence=report,
        scope='no-db-framework-test-probe-original-alias-controlled-PHP-ini',
        mysql_state='partial-evidence-original-tool-route-no-DB',
        dm_state='partial-evidence-approved-host-PHP-tool-route-no-DB',
        success_case='partial-evidence-framework-probe-HTTP-only-not-business-database',
        readback='not-applicable-no-database-connection-or-rows',
        parity='partial-evidence-full-original-HTTP-JSON-types-values-equal-except-trace',
        cleanup='zero-business-writes-private-log1060bytes-own-workers-stopped-original-failures-retained')
        for method, action in [('GET', 'ping'), ('POST', 'echopayload')]]
    tool.main(rows, audit, verify)
