Files
TheTree_mock/docs/plans/original-completion-2026-10-02/execution/p04-01-current-recheck-20261015/p04-whole-context-r01.py
T

20 lines
3.6 KiB
Python

from pathlib import Path
import hashlib,json,shutil,subprocess,sqlite3
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部');A=R/'artifacts/original-completion-2026-10-02';E=R/'docs/plans/original-completion-2026-10-02/execution/p04-01-current-recheck-20261015';W=Path('/Users/korizatou114/Projects/TheTree-managed-worktrees/p04-01/P04-01-implement');B=W.parent/'.runtime/P04-01/build/audit-support/p04-current-native-series-r01';assert not B.exists();B.mkdir();rows=[]
def copy(src,dst):
dst.parent.mkdir(parents=True,exist_ok=True);subprocess.run(['/bin/cp','-p','-c',str(src),str(dst)],check=True);a=hashlib.sha256(src.read_bytes()).hexdigest();assert a==hashlib.sha256(dst.read_bytes()).hexdigest()and src.stat().st_ino!=dst.stat().st_ino;rows.append({'source':str(src),'copy':str(dst.relative_to(B)),'bytes':dst.stat().st_size,'sha256':a})
for name in ['p04-paid-shift-midnight-native-r01','p04-paid-shift-midnight-formal-native-r01','p04-idempotency-paid-midnight-native-r01','p04-idempotency-paid-formal-native-r01']:
src=A/name
for p in src.rglob('*'):
rel=p.relative_to(src)
if p.is_file() and not any(x in {'stage','.godot'}for x in rel.parts):assert not p.is_symlink();copy(p,B/name/rel)
for role in ['writer','reader']:
receipt=src/'restart-evidence'/(role+'.json')
if receipt.exists():
for point,folder in json.loads(receipt.read_text())['slots'].items():
for p in Path(folder).iterdir():assert p.is_file()and not p.is_symlink();copy(p,B/name/'formal-packages'/role/point/p.name)
for name in ['ROOT_PAID_SHIFT_MIDNIGHT_FORMAL_RESULT.json','ROOT_SAME_MINUTE_RESEND_FORMAL_RESULT.json','ROOT_PROSPECTIVE_PRODUCT_COMPOSITION_R01.json','D05_OWNER_APPROVAL.json','D05_APPROVED_DECISION_SUPPLEMENT.json']:copy(E/name,B/name)
copy(R/'tools/run_all_tests.py',B/'production-runner/run_all_tests.py')
config=json.loads(Path('/Users/korizatou114/Library/Application Support/agent-control/the-tree-p04-01/config.json').read_text());(B/'REGISTERED_VALIDATION_REFERENCE.json').write_text(json.dumps({'validation':config['validations']['p04-acceptance'],'scope':'Exact existing invocation/timeout only; no registered config mutation'},indent=2)+'\n')
source_selector={'source_ref_function':'tools/run_all_tests.py:source_refs','source_dirs':['autoload','scripts','scenes','data','tests','assets','tools'],'root_files':['project.godot','export_presets.cfg','Makefile','AGENTS.md'],'excluded_names':['.DS_Store','__pycache__'],'important':'Native source_before includes tools. New tools/check_p04_order_evidence.py is a newly introduced verifier role, not preexisting native producer. Existing selected source paths still must match. Non-selected preexisting README/.gitignore/.editorconfig/.vscode and unrelated docs stay unchanged from main_anchor; do not require all these preexisting metadata to be worker allowed_paths. Every submitted changed path must remain registered scope. Bidirectional exact selected main_anchor source inventory and additional declared checker-role paths must be proved separately, not a generic path skip.'};(B/'SOURCE_SELECTION_AND_NON_PRODUCT_REFERENCE.json').write_text(json.dumps(source_selector,ensure_ascii=False,indent=2)+'\n');(B/'SOURCE_MANIFEST.json').write_text(json.dumps({'scope':'Actual current paid/retransmission raw/lifecycle/formal packages copied byte-exact without stage/cache copies; engine binary/whole stage remain canonical and available if required. Runtime receipts with original absolute paths are unchanged.','files':rows},ensure_ascii=False,indent=2)+'\n');print({'copied_files':len(rows),'logical_bytes':sum(z['bytes']for z in rows),'target':str(B),'hardlinks':False})