From 20bdcfc14098deb274527fad83af6bc4a9173890 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya0@users.noreply.github.com> Date: Fri, 24 Jul 2026 22:05:42 -0400 Subject: [PATCH] Phase 0: correct the test_assets.py claim The "filtered subset" was a misread. The log line prints the pre-recursion yml count (1320); setup_scratch's external_files recursion then pulls in the remaining 130, so an unfiltered run copies all 1450 - verified by replaying the logic. So the gates use test_assets.py, the same tool that produced the existing 14/14, with a TORCH_BIN env override as the only harness patch. Gate A2 keeps the check.sh path, since it needs two extractions in one process and test_assets.py execs the binary once per ROM. --- torch-migration/PHASE0.md | 104 ++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/torch-migration/PHASE0.md b/torch-migration/PHASE0.md index b36c93192c..7259b51f47 100644 --- a/torch-migration/PHASE0.md +++ b/torch-migration/PHASE0.md @@ -46,41 +46,55 @@ Reading the source says all six should be fine. Reading is how we got here; runn ## How the gates are actually run -**Do not use `tools/test_assets.py` for these gates.** It hardcodes `TORCH` to -`torch/build/torch`, and it copies a *filtered subset* of the yml into a scratch dir (1,320 of -1,450 files for `pal_gc`) — which is not the invocation SoH will make. It's the right tool for -bisecting a single failing asset, not for proving a configuration. +**`tools/test_assets.py`, unfiltered — the same tool that produced the existing 14/14.** Using +anything else would make the gate results not directly comparable to the baseline they're being +measured against. -Use the **full-tree + `check.sh`** path instead. It points Torch at the entire yml tree — the same -shape as Phase 1's `srcdir = assets/` — and diffs the two archives file-by-file: +An unfiltered run is a genuine full-tree, both-directions comparison: -```sh -OUT=$(mktemp -d) # fresh every run — see below -"$TORCH_BIN" o2r -s assets/yml -d "$OUT" -u 9.2.3 roms/.z64 -cp "$OUT/oot.o2r" o2r/torch.o2r -cp "o2r/.o2r" o2r/reference.o2r -./check.sh # missing / extra / mismatched, all three +- `list_assets` with no `--category/--file/--type` returns **every** key in + `manifests/.json` — all 35,386 for `pal_gc`. +- `collect_yaml_files` reverse-maps those asset paths to yml files (1,320), then `setup_scratch`'s + `copy_yaml_with_externals` recursion follows `external_files:` and pulls in the remaining 130 — + **all 1,450 land in the scratch dir.** Verified by replaying the logic: `copied == on-disk`, zero + yml files omitted. +- It hashes what Torch produced and diffs it against the manifest in *both* directions — + `not generated` (in the reference, missing from ours) and `not in reference` (extras, computed + over the whole zip, not just the filtered set). +- The destdir is a fresh `mkdtemp` per run, which matters: `Process()` writes + `destdir/torch.hash.yml` and reads it back next run to skip unchanged files. Reuse a destdir and + the second run silently produces a partial archive. (Same constraint that forces Phase 3's + `Mkdtemp()`.) + +> The `Copying 1320 YAMLs to scratch dir` line in the logs is printed *before* the `external_files` +> recursion runs — it's the pre-recursion count, not what actually gets copied. Easy to misread as +> a filtered subset. It isn't one. + +**One harness patch is needed:** the torch binary path is hardcoded in two places — +`tools/test_assets.py:34` and `lib.sh:12`. Make both honour a `TORCH_BIN` environment override so +Gate A's driver can be dropped in without editing files between runs: + +```python +TORCH = os.environ.get("TORCH_BIN") or os.path.join(SOH_DIR, "torch", "build", "torch") ``` -`check.sh` never invokes Torch, so it takes any binary — Gate A's driver drops straight in with no -harness patching. - -> **The fresh destdir is mandatory, not hygiene.** `Process()` writes `destdir/torch.hash.yml` and -> reads it back on the next run to skip unchanged files. Reuse a destdir and the second run -> silently produces a partial archive. (This is the same constraint that forces Phase 3's -> `Mkdtemp()`.) +`./check.sh` stays as the secondary whole-archive check — it compares two extracted `.o2r` +directly, so it's the tool to reach for if a gate fails and you want the raw file-list diff rather +than a per-asset table. ### New: `tools/matrix.sh` -One script, used by every gate: +There's no 19-ROM loop script today; every gate needs one. It's a thin wrapper, not new comparison +logic: ```sh -tools/matrix.sh