#!/usr/bin/env python3
"""Six actual AI Config/Health POST keys; preserve original candidate methods."""
import hashlib
from pathlib import Path
import subprocess
import sys
import integrate_20261010 as tool

E=tool.AI+'parallel-ai-staff-config-health-20261010/'
def verify():
    for file in ['compare.py','test_compare.py']:
        subprocess.run([sys.executable,str(tool.ROOT/E/file)],check=True,capture_output=True)
    p=tool.ROOT.parent/'zhctproject/ai_api/app/store/service/staff/Config.php'
    assert hashlib.sha256(p.read_bytes()).hexdigest()=='6ad093c02710e3646e11b68abce705beb9ad15dab6bc7f6aa85f7a6fac615237'
    r=tool.load(E+'resource-cleanup.json')
    assert all(r[k] for k in ['B_worker_stopped','C_worker_stopped','B_token_absent','C_token_absent','B_cache_directory_absent','C_cache_directory_absent'])
    assert r['B_18321_listeners']==r['C_18322_listeners']==r['cache_files_each']==0
    assert r['real_external_calls_or_athlete_recomputation']==r['permission_account_relationship_writes']==0

def targets():
    return [dict(repo='ai_api',method='POST',path='/store/store.'+module+'/'+action,
        module='运动员配置/健康标记',terminal='PC',role='isolated-owned-cache-context',risk='owned-write-or-read',
        scope='ai-primary-owned-five-table-config-health-no-recompute-external-or-finance',evidence=E+'REPORT.md',
        request_type='current-PC-form-CSV-arrays-and-controller-POST',
        parity='partial-evidence-20-strict-scenarios-original-ID-zero-preserved-PAL-DEC5-2-only-response-fix',
        boundary_empty_min_max='partial-evidence-empty-detail-repeat-record-health-replace-clear-retain-and-99-refusal',
        cleanup='retained-owned-user-staff-master2-PAL10-health1-natural-seven-table-sha-unchanged-private-resources-reclaimed')
        for module,actions in [('Config',['getStaffInfo','setRecord','lists','detail']),('Health',['detail','setHealth'])]
        for action in actions]

if __name__=='__main__':
    audit=Path(__file__).with_name('integration-20261010-batch27.json')
    if audit.exists():raise RuntimeError('Do not overwrite original transition audit')
    tool.main(targets(),audit,verify)
