#!/usr/bin/env python3
"""Intake original money type failures without masking them with future repair."""
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-subsidy1281/verify_independent.py'
    assert hashlib.sha256(p.read_bytes()).hexdigest() == 'ad15caa0da2f0328e48042b912a28eb9f397de69dd46e6c649507e5303f1158b'
    r = json.loads(subprocess.check_output([sys.executable, '-B', str(p)]))
    assert r['passed'] and not r['business_compatibility_pass']
    assert r['repository'] == 'store' and r['unique_keys'] == 2
    assert r['SQL'] == {'B': 50, 'C': 62} and r['new_SQL_HTTP_CLI'] == 0
    assert r['sealed_files'] == 17269 and r['source_files'] == 17146 and r['checks'] == 51876
    return r

if __name__ == '__main__':
    audit = Path(__file__).with_name('integration-20261014-subsidy1281.json')
    assert not audit.exists(), 'Never replay main'
    report = 'work/2026-09-28-smart-canteen-dm8-poc/matrix-integration/ROOT_SUBSIDY1281_RED_20261014.md'
    specs = [item('store', 'POST', '/api/subsidyRule/' + action, '', evidence=report,
        from_repo='unreviewed', from_source='apifox-2026-05-08',
        scope='own-disabled-zero-money-rule-original-HTTP-ORM-native-PDO',
        mysql_state='tested-pass', dm_state='tested-fail-money-JSON-number-versus-MySQL-string',
        success_case='failed-nonempty-money-output-type-difference',
        readback='tested-pass-owned-rule17-actor6-config6-values-types-unchanged',
        parity='failed-money-MySQL-string-0.00-versus-DM-number0',
        boundary_empty_min_max=('partial-evidence-page2-empty-current-page1-original' if action == 'list' else 'not-tested'),
        cleanup='disabled-rule-retained-no-grant-private-worker-stopped') for action in ('list', 'detail')]
    tool.main(specs, audit, verify)
