"""Preserve the matching committed GUI build separately from native acceptance.""" import datetime import hashlib import json from pathlib import Path import shutil source = Path(__file__).resolve().parent root = source.parents[1] target = root / "harness/experiments/text-navigation-native-20260911/build" build = json.loads((source / "gui-build-v2.json").read_text(encoding="utf-8")) preserved = json.loads((source / "gui-preserved.json").read_text(encoding="utf-8")) assert build["exitCode"] == 0 and build["head"] == "36db9356cce3c7614ae37eec9fe17678ca210afe" assert hashlib.sha256(Path(preserved["binary"]).read_bytes()).hexdigest() == build["sha256"] names = ["gui-build-v2.json", "gui-build-v2-messages.jsonl", "gui-build-v2-stderr.log", "build_gui_v2.py", "gui-preserved.json", "native_v2.py", "index-navigation.json", "stage.py", "archive_followup.py", "archive_build.py"] target.mkdir(parents=True, exist_ok=False) for name in names: shutil.copy2(source / name, target / name) assert (target / name).read_bytes() == (source / name).read_bytes() (target / ".gitattributes").write_text("* -text\n", encoding="utf-8", newline="\n") (target / "README.md").write_text("""# Matching navigation GUI build Codex-9e8r6t /root. Windows development GUI built successfully at 2026-09-11 18:24:17 UTC from committed source36db9356 and exact inputs4. The source snapshot and final focused/Clippy records are in [the follow-up archive](../../text-navigation-followup-20260911/README.md). Cargo JSON identifies the actual executable. The helper verifies every frozen input before/after compilation; the preserved executable matches DF7126B8FC14C90985C2A0C55A640990F990E487D95A33F194AA7238754CEABD, 113197056 bytes. The large binary is excluded from Git and preserved privately for the pending native trial; this archive is not a runnable distribution. `native_v2.py` is the prepared launch/check helper, **not an executed native result**. It uses a pinned GUI copy, runtime DLL and full-model/source oracle, fresh work copies and process-private Windows profile variables. Historical paths identify the actual producer environment; do not run archived helpers in place as if they were portable entrypoints. `index-navigation.json` is the earlier exact staging verification for the208-file source/evidence checkpoint, including185 raw evidence blobs; it does not cover this later archive. `manifest.json` indexes only this build directory's payload bytes. No native UI, oracle, process-close or publication pass is implied. Later native stages must carry their own evidence. Linux/WSL remains user-paused. """, encoding="utf-8", newline="\n") entries = [] for path in sorted(target.iterdir()): raw = path.read_bytes() entries.append({"path":path.name,"bytes":len(raw),"sha256":hashlib.sha256(raw).hexdigest()}) record = {"atUtc":datetime.datetime.now(datetime.timezone.utc).isoformat(),"files":entries, "sourceCopiesVerified":len(names),"binaryReadbackSha256":build["sha256"],"nativeAcceptance":False} with (target / "manifest.json").open("x",encoding="utf-8",newline="\n") as out: json.dump(record,out,indent=2) out.write("\n") print(json.dumps({"payloadFiles":len(entries),"payloadBytes":sum(e["bytes"] for e in entries), "manifestSha256":hashlib.sha256((target/"manifest.json").read_bytes()).hexdigest()}))