Files
TheTree_mock/tools/run_upkeep_ui_flow.py
T
Takeshi 5dde0c5ec2 Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
2026-09-30 23:52:24 +09:00

38 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""Verify closed-facility upkeep across two independent Godot processes."""
import argparse
import json
import os
from pathlib import Path
import subprocess
import time
import uuid
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--godot', default='godot')
parser.add_argument('--rendered', action='store_true')
parser.add_argument('--output', type=Path, default=Path('artifacts/upkeep-ui-flow'))
args = parser.parse_args()
root = Path(__file__).resolve().parents[1]
output = args.output.resolve()
output.mkdir(parents=True, exist_ok=True)
env = os.environ.copy()
env['THE_TREE_UPKEEP_UI_SAVE'] = f'user://tests/upkeep_ui_{uuid.uuid4().hex}/manual'
base = [args.godot] + ([] if args.rendered else ['--headless']) + ['--path', str(root), '--script', 'res://tests/ui/test_upkeep_closed_ui.gd']
results = []
for phase in ('write', 'read'):
start = time.monotonic()
log_path = output / f'{phase}.log'
with log_path.open('w') as log:
try:
code = subprocess.run(base + (['--', '--read'] if phase == 'read' else []), cwd=root, env=env, stdout=log, stderr=subprocess.STDOUT, timeout=600).returncode
except subprocess.TimeoutExpired:
code = 124
content = log_path.read_text()
passed = code == 0 and 'PASS:' in content and 'ERROR:' not in content
results.append({'phase':phase, 'exit_code':code, 'passed':passed, 'seconds':round(time.monotonic()-start,2), 'log':str(log_path)})
(output/'result.json').write_text(json.dumps(results, indent=2)+'\n')
print(json.dumps(results[-1]), flush=True)
if not passed:
raise SystemExit(1)