Files
ARCADIA-Studio/harness/experiments/repair-union-windows-33e30c1-20260912/write-report.py
T

50 lines
4.9 KiB
Python

from pathlib import Path
import datetime
import hashlib
import json
import subprocess
folder = Path(__file__).resolve().parent
root = folder.parent.parent
worktree = root / '.local/canvas-union-ytr83r-20260911'
report = root / '.local/repair-union-windows-gates-report.md'
assert not report.exists(), 'Refusing to overwrite report'
names = ('focused', 'desktop-tests', 'desktop-clippy', 'studio-build')
statuses = [json.loads((folder / (name + '-status.json')).read_text(encoding='utf-8-sig')) for name in names]
assert all(s['exit'] == 0 for s in statuses)
manifest = json.loads((folder / 'binary-manifest.json').read_text(encoding='utf-8-sig'))
head = subprocess.run(['git','rev-parse','HEAD'],cwd=worktree,capture_output=True,check=True,text=True).stdout.strip()
lines = [
'# Saved-destination repair union: Windows gates', '',
'Owner: Codex /root/windows_gates. All four authorized gates passed serially, with frozen-input verification between gates and after the final GUI build. No source edits or native launch occurred.', '',
'Source: `33e30c1cd7a6c99513a0ebd02ba68fccbad8f58d`, saved-destination repair on the canvas/grapheme union. The focused test began against these exact bytes before the parent committed them; all subsequent boundaries independently verified the same 530 files against worktree HEAD. Later HEAD at report time: `' + head + '`; parent owns metadata-only integration changes.', '',
'Worktree: `' + str(worktree) + '`. Environment: Windows `stable-x86_64-pc-windows-gnullvm`, Cargo 1.98.1, rustc 1.98.1 / LLVM 22.1.8, configured clang linker, one build job, incremental compilation disabled, shared root `target`. Full environment paths are in `repair-union-windows-20260911/environment.json`. Gates used reviewed `.local/run-gate.ps1` and `.local/toolchain/env.ps1`.', '',
'| Gate | Exact command | Started UTC | Completed UTC | Seconds | Exit |',
'| --- | --- | --- | --- | --- | --- |',
]
for name, status in zip(names, statuses):
lines.append(f"| {name} | `{' '.join(status['command'])}` | {status['started_utc']} | {status['completed_utc']} | {status['seconds']:.3f} | {status['exit']} |")
lines.extend(['', 'Focused repair tests: **5 passed, zero failures**. Desktop all-target tests: **761 passed, zero failed/ignored**. Strict Clippy and final GUI build completed without diagnostics. Build profile: unoptimized dev. Complete logs and closed status JSON are retained beside this report in `repair-union-windows-20260911/`.', '',
'Frozen inputs: **530 files / 9,727,025 bytes**. Manifest SHA256: `0f21b9a852cf44699bf29fce0a35ec460744c85f5e26f0ea4920e8568211e312`. Existing `inputs.json` and `exact-inputs.zip` were never re-frozen or overwritten. Verification receipts:', ''])
for path in sorted(folder.glob('verify-*.json')):
record = json.loads(path.read_text(encoding='utf-8-sig'))
lines.append(f"- `{path.name}`: `{record['mode']}`, {record['utc']}, PASS.")
lines.extend(['', 'No surviving Cargo/compiler processes were observed before gates. Each running Cargo tool session was consumed before the next gate; the final binary preservation also required no cargo/rustc process. Cargo/rustup/Clippy wrappers may produce multiple process entries within one invocation. An initial preflight `python` PATH lookup failed before compiler execution; using the bundled Python path resolved it. No gate retry or source fix was required.', '',
'Immutable GUI and required runtime DLL copies, preserved with source-before/copy/source-after hash agreement and matching lengths:', '',
'| Artifact | Bytes | SHA256 |', '| --- | --- | --- |'])
for item in manifest['binaries']:
lines.append(f"| `{item['copy']}` | {item['bytes']} | `{item['copy_sha256']}` |")
lines.extend(['', 'Both copies were marked read-only. Exact source/copy paths and provenance are in `binary-manifest.json`; `preserve-build.ps1` records the guarded procedure. Preservation UTC: ' + manifest['preserved_utc'] + '.', '',
'Receipt hashes:', ''])
hashes = []
for path in sorted(folder.iterdir()):
if path.is_file():
hashes.append({'path': path.name, 'bytes': path.stat().st_size, 'sha256': hashlib.sha256(path.read_bytes()).hexdigest()})
hash_path = folder / 'receipt-hashes.json'
assert not hash_path.exists()
hash_path.write_text(json.dumps({'recorded_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), 'files': hashes}, indent=2) + '\n', encoding='utf-8')
lines.extend(['`repair-union-windows-20260911/receipt-hashes.json` records complete log/status/input/archive/helper receipt hashes. Binary hashes are separately verified in the binary manifest.', '',
'Scope: Windows Cargo execution and preservation only. No source, Git index, Gitea, STATE, WSL, UI, or launch changes by this worker. Parent owns native behavioral testing, integration, packaging acceptance, and publication. These gates alone do not establish native usability or release completion.', ''])
report.write_text('\n'.join(lines), encoding='utf-8')
print(report)