make_game assets: reuse local BCPack history on resume (ASSETS-BCPACK-STRICT-HISTORY) #2512

Merged
TheGeogeo merged 4 commits from upstream-pr/2512 into main 2026-11-29 08:14:19 +00:00
TheGeogeo commented 2026-11-27 23:04:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-27T23:04:33Z.


Claimed in the coordination issue as: ASSETS-BCPACK-STRICT-HISTORY

What and why

A pool with a BCPack predictor missing from the built-in tables stays limited after resuming make_game.py --stages assets, even when the history accepted by ttpf_mips.py --history is available.

The assets stage now reads an optional <work>/bcpack-history.json and passes it to the strict decoder, including strict fallbacks when a calibration profile is also present. Adding, editing or removing the history invalidates the pool's pass stamp. An unchanged history keeps the cache. The stage reports an invalid history before updating the pool. A strict refusal preserves any DDS already named by the catalog.

Tested

Windows 11, Python 3.12.4, no game files:

  • Both new synthetic regressions fail on 587bb6f5a and pass with this patch. The accepted DDS matches the complete expected BC1 mip payload byte for byte. The cases cover cache reuse, a changed history, removal that preserves the last usable DDS, and an invalid history that leaves the pool unchanged.
  • Texture assets, assets pools, mip export, BCPack history and decoder, line endings and documentation links: 190 passed, 3 optional integration skips. make_game.py --help, git diff --check and check_no_game_data.py passed.
  • Clean trial merge with main at d44285197 and with #1013 at b6b1fe75f. Both combined trees passed the texture-assets and assets-pools suites (38 passed / 3 skipped with main, 46 passed / 3 skipped with #1013).

GPUs tested: n/a (CPU-only synthetic tests).

AI-assisted: yes (Codex).

Checklist

  • Based on current main and trial merge checked.
  • One topic.
  • No game data, keys, decryption or game-derived logs.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5534222407 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-27T23:04:33Z. --- Claimed in the coordination issue as: [ASSETS-BCPACK-STRICT-HISTORY](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7229749837) ### What and why A pool with a BCPack predictor missing from the built-in tables stays limited after resuming `make_game.py --stages assets`, even when the history accepted by `ttpf_mips.py --history` is available. The assets stage now reads an optional `<work>/bcpack-history.json` and passes it to the strict decoder, including strict fallbacks when a calibration profile is also present. Adding, editing or removing the history invalidates the pool's pass stamp. An unchanged history keeps the cache. The stage reports an invalid history before updating the pool. A strict refusal preserves any DDS already named by the catalog. ### Tested Windows 11, Python 3.12.4, no game files: - Both new synthetic regressions fail on `587bb6f5a` and pass with this patch. The accepted DDS matches the complete expected BC1 mip payload byte for byte. The cases cover cache reuse, a changed history, removal that preserves the last usable DDS, and an invalid history that leaves the pool unchanged. - Texture assets, assets pools, mip export, BCPack history and decoder, line endings and documentation links: 190 passed, 3 optional integration skips. `make_game.py --help`, `git diff --check` and `check_no_game_data.py` passed. - Clean trial merge with `main` at `d44285197` and with #1013 at `b6b1fe75f`. Both combined trees passed the texture-assets and assets-pools suites (38 passed / 3 skipped with main, 46 passed / 3 skipped with #1013). GPUs tested: n/a (CPU-only synthetic tests). AI-assisted: yes (Codex). ### Checklist - [x] Based on current `main` and trial merge checked. - [x] One topic. - [x] No game data, keys, decryption or game-derived logs.
OreoFR commented 2026-11-27 23:18:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T23:18:38Z.


Review of 51b2819b6, on request in the French Discord group. Read the diff and ran the tests; no game files.

Tests (Windows 11, Python with the standard library, python -m unittest test_ttpf_assets):

  • PR head: 33 tests, OK (3 skipped: the rpf9dump integration cases).
  • The two new regressions against main's tools/ttpf_assets.py (587bb6f5a, test file with the Profiles import neutralised): both FAIL, so they test the change.
    • test_history_added_after_strict_rejection: AssertionError: unexpectedly None (no DDS after the history is added).
    • test_invalid_history_reports_error_without_updating_the_pool: SystemExit not raised.
  • check_no_game_data.py on the changed files: clean.

Read in code, all fine:

  • The history is validated before any pool opens. A bad file exits with an error that names bcpack-history.json, and the catalog stays untouched.
  • With a calibration profile and a history, the pass stamp is <calibrated>+<strict>. Calibrated rows keep the calibrated part (partition("+")[0]), and strict fallbacks get the history-aware stamp. Adding, editing or removing the history therefore re-runs the pass.
  • The strict stamp is still 19 characters for the DDS name (v1- + 16 hex), with or without a history.

Nits (no change needed):

  • The stamp hashes the raw bytes, so a whitespace-only edit of bcpack-history.json also re-runs the pass, as the indent=2 step of the test shows. That's conservative, and probably fine for a file that rarely changes.
  • load_history passes the whole history to load_bc6h / load_bc7 / load_bc_history once per section. This is harmless, because each one picks its own codec.

Looks good to me.

AI-assisted (Claude Code, Claude Opus 5.5), for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230041154 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7230041154). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T23:18:38Z. --- Review of 51b2819b6, on request in the French Discord group. Read the diff and ran the tests; no game files. **Tests** (Windows 11, Python with the standard library, `python -m unittest test_ttpf_assets`): - PR head: 33 tests, OK (3 skipped: the rpf9dump integration cases). - The two new regressions against main's `tools/ttpf_assets.py` (587bb6f5a, test file with the `Profiles` import neutralised): both FAIL, so they test the change. - `test_history_added_after_strict_rejection`: `AssertionError: unexpectedly None` (no DDS after the history is added). - `test_invalid_history_reports_error_without_updating_the_pool`: `SystemExit not raised`. - `check_no_game_data.py` on the changed files: clean. **Read in code, all fine:** - The history is validated before any pool opens. A bad file exits with an error that names `bcpack-history.json`, and the catalog stays untouched. - With a calibration profile and a history, the pass stamp is `<calibrated>+<strict>`. Calibrated rows keep the calibrated part (`partition("+")[0]`), and strict fallbacks get the history-aware stamp. Adding, editing or removing the history therefore re-runs the pass. - The strict stamp is still 19 characters for the DDS name (`v1-` + 16 hex), with or without a history. **Nits (no change needed):** - The stamp hashes the raw bytes, so a whitespace-only edit of `bcpack-history.json` also re-runs the pass, as the `indent=2` step of the test shows. That's conservative, and probably fine for a file that rarely changes. - `load_history` passes the whole history to `load_bc6h` / `load_bc7` / `load_bc_history` once per section. This is harmless, because each one picks its own codec. Looks good to me. AI-assisted (Claude Code, Claude Opus 5.5), for OreoFR.
enlight3d commented 2026-11-27 23:46:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-27T23:46:01Z.


Reviewed 51b2819b6. The history handling looks right to me. The stamp covers the history bytes, and an unchanged file keeps the pass. An invalid file stops the stage before any pool is touched, and a strict refusal keeps the previous DDS.

Locally (Windows 11, Python 3.13.12): tests/test_ttpf_assets.py gives 33 passed, 3 skipped (NumPy, rpf9dump, POSIX modes). Both new tests fail with tools/ttpf_assets.py from 587bb6f5a and pass with the patch. The BCPack, ttpf_mips, history-calib and docs suites pass. The three red CI jobs (check, macos-python, stdlib-tests-linux) fail in test_docs_cli_flags, test_docs_python_deps, test_docs_repo_paths, test_tool_stdout_encoding and test_windows_boot_journal_seed; main's own CI run at d44285197 fails in the same five, so none of it comes from this PR. (The last one is my test from #2481: an 8.3 temp path on the runner; a fix follows.)

A few points:

  1. Nothing tests the calibration + history path. The whole file still passes after each of three mutations:

    • leaving the history out of Profiles when a calibration profile is present (L104-106);
    • strict = None instead of profiles.strict_stamp (L206);
    • method = stamp instead of stamp.partition("+")[0] (L225).

    The third one matters. Calibrated rows would get a BCPackDecoder ending in -strict, and candidate() would revisit them as strict rows once the profile is removed. The mocked test test_a_pool_hashes_the_decoder_sources_once_for_all_its_strict_fallback_rows already runs without NumPy. A variant with Profiles(calibration={}, history={...}, strict_stamp=...) would cover this path if it checked two things: the history passed to texture_dds, and the strict fallback's BCPackDecoder.

  2. The stamp hashes the raw bytes. Reformatting the file, adding a BOM, an empty section ({"bc1": {}}) or provisional-only entries each cause every strict DDS to be decoded again and renamed. That is safe. If it isn't wanted, hashing json.dumps(history, sort_keys=True, separators=(",", ":")) would remove the formatting cases. The indent=2 step in the new test would then need a real content change.

  3. README: according to the docstring of bcpack_history_calib.py, pool self-calibration writes provisional tables, and confirmed entries come from --ref-dds / --ref-pairs. A pool-only history unblocks nothing in strict mode but still starts a new pass. One sentence saying so would spare someone a long rerun. Also, make_game.py's help text (line 26) names only bcpack-calibration.json; the history file could be listed there too.

Nit: the test could also check that the DDS replaced after the indent=2 edit is removed.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230392704 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7230392704). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-27T23:46:01Z. --- Reviewed 51b2819b6. The history handling looks right to me. The stamp covers the history bytes, and an unchanged file keeps the pass. An invalid file stops the stage before any pool is touched, and a strict refusal keeps the previous DDS. Locally (Windows 11, Python 3.13.12): `tests/test_ttpf_assets.py` gives 33 passed, 3 skipped (NumPy, rpf9dump, POSIX modes). Both new tests fail with `tools/ttpf_assets.py` from 587bb6f5a and pass with the patch. The BCPack, ttpf_mips, history-calib and docs suites pass. The three red CI jobs (`check`, `macos-python`, `stdlib-tests-linux`) fail in `test_docs_cli_flags`, `test_docs_python_deps`, `test_docs_repo_paths`, `test_tool_stdout_encoding` and `test_windows_boot_journal_seed`; main's own CI run at d44285197 fails in the same five, so none of it comes from this PR. (The last one is my test from #2481: an 8.3 temp path on the runner; a fix follows.) A few points: 1. Nothing tests the calibration + history path. The whole file still passes after each of three mutations: - leaving the history out of `Profiles` when a calibration profile is present (L104-106); - `strict = None` instead of `profiles.strict_stamp` (L206); - `method = stamp` instead of `stamp.partition("+")[0]` (L225). The third one matters. Calibrated rows would get a `BCPackDecoder` ending in `-strict`, and `candidate()` would revisit them as strict rows once the profile is removed. The mocked test `test_a_pool_hashes_the_decoder_sources_once_for_all_its_strict_fallback_rows` already runs without NumPy. A variant with `Profiles(calibration={}, history={...}, strict_stamp=...)` would cover this path if it checked two things: the `history` passed to `texture_dds`, and the strict fallback's `BCPackDecoder`. 2. The stamp hashes the raw bytes. Reformatting the file, adding a BOM, an empty section (`{"bc1": {}}`) or provisional-only entries each cause every strict DDS to be decoded again and renamed. That is safe. If it isn't wanted, hashing `json.dumps(history, sort_keys=True, separators=(",", ":"))` would remove the formatting cases. The `indent=2` step in the new test would then need a real content change. 3. README: according to the docstring of `bcpack_history_calib.py`, pool self-calibration writes provisional tables, and confirmed entries come from `--ref-dds` / `--ref-pairs`. A pool-only history unblocks nothing in strict mode but still starts a new pass. One sentence saying so would spare someone a long rerun. Also, `make_game.py`'s help text (line 26) names only `bcpack-calibration.json`; the history file could be listed there too. Nit: the test could also check that the DDS replaced after the `indent=2` edit is removed. AI-assisted (Claude Code).
TheGeogeo commented 2026-11-28 00:15:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T00:15:16Z.


Thanks for the review. I addressed the coverage and documentation points in a1e046535.

  • Added a synthetic test for a pool with both calibration and strict history. It checks that the fallback receives the history and that each row stores the correct decoder stamp. The test caught all three mutations described in the review.
  • The resume test now checks that the superseded DDS is removed after a history edit.
  • The README explains that pool-only calibration produces provisional entries and how to obtain confirmed entries. make_game.py --help now lists both optional BCPack files.

I kept the byte-based stamp. Any edit to the history file still invalidates the saved pass.

On Windows without game files, 253 focused tests passed and 4 were skipped. The trial merge with main (d44285197) was clean, with 39 targeted assets tests passed and 3 skipped. git diff --check and the no-game-data check passed.

AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230768067 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7230768067). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T00:15:16Z. --- Thanks for the review. I addressed the coverage and documentation points in `a1e046535`. - Added a synthetic test for a pool with both calibration and strict history. It checks that the fallback receives the history and that each row stores the correct decoder stamp. The test caught all three mutations described in the review. - The resume test now checks that the superseded DDS is removed after a history edit. - The README explains that pool-only calibration produces provisional entries and how to obtain confirmed entries. `make_game.py --help` now lists both optional BCPack files. I kept the byte-based stamp. Any edit to the history file still invalidates the saved pass. On Windows without game files, 253 focused tests passed and 4 were skipped. The trial merge with `main` (`d44285197`) was clean, with 39 targeted assets tests passed and 3 skipped. `git diff --check` and the no-game-data check passed. AI-assisted (Codex).
timbot103 commented 2026-11-28 02:02:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:43Z.


Reviewed at head a1e046535 on Windows 11 (Python 3).

Verification

  • python -B -m unittest tests/test_ttpf_assets.py -v: 34/34 tests OK (0.506 s).

Finding (Request changes)

  • Malformed BC7 history bypasses validation and can publish provisional reconstruction as confirmed (tools/ttpf_assets.py:59-76; tools/bcpack_tables_bptc.py:203-217, 305-351; tools/bcpack_history_calib.py:2427-2475):
    The resume/stamp/mixed-calibration/DDS-cleanup plumbing in make_game.py and tools/ttpf_assets.py looks solid. However, load_history() validates a bc7 section only by calling bcpack_tables_bptc.load_bc7(history), which checks array shapes and int conversions but omits the range checks enforced by --verify (confirmed <= known <= 8, index depths, and BC6H value ranges). For example, wrapping the mode-6 fixture from tests/test_bcpack.py:1029-1095 with historyEndpointConfirmedBits set to 9 (while known == 8) passes load_history() and satisfies strict mode's depth thresholds (bcpack.py:1148-1236), causing complete_pool to publish provisional output as a confirmed strict DDS and stamp the pass. Reusing --verify's range checks on the parsed history snapshot before running texture-pool work (and adding an invalid-BC7 test alongside the BC1 case at tests/test_ttpf_assets.py:275-286) closes this cleanly.

AI-assisted review + local Python verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232090976 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7232090976). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T02:02:43Z. --- Reviewed at head `a1e046535` on Windows 11 (Python 3). ### Verification - `python -B -m unittest tests/test_ttpf_assets.py -v`: **34/34 tests OK** (`0.506 s`). ### Finding (Request changes) - **Malformed BC7 history bypasses validation and can publish provisional reconstruction as confirmed (`tools/ttpf_assets.py:59-76`; `tools/bcpack_tables_bptc.py:203-217`, `305-351`; `tools/bcpack_history_calib.py:2427-2475`):** The resume/stamp/mixed-calibration/DDS-cleanup plumbing in `make_game.py` and `tools/ttpf_assets.py` looks solid. However, `load_history()` validates a `bc7` section only by calling `bcpack_tables_bptc.load_bc7(history)`, which checks array shapes and int conversions but omits the range checks enforced by `--verify` (`confirmed <= known <= 8`, index depths, and BC6H value ranges). For example, wrapping the mode-6 fixture from `tests/test_bcpack.py:1029-1095` with `historyEndpointConfirmedBits` set to `9` (while `known == 8`) passes `load_history()` and satisfies strict mode's depth thresholds (`bcpack.py:1148-1236`), causing `complete_pool` to publish provisional output as a confirmed strict DDS and stamp the pass. Reusing `--verify`'s range checks on the parsed history snapshot before running texture-pool work (and adding an invalid-BC7 test alongside the BC1 case at `tests/test_ttpf_assets.py:275-286`) closes this cleanly. AI-assisted review + local Python verification.
zmasi commented 2026-11-28 06:52:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T06:52:12Z.


#2512 | head a1e0465356 (merged cleanly with main 09c153948) | python -I tests/test_ttpf_assets.py | red on main: ImportError: cannot import name 'Profiles' from 'ttpf_assets' (load_profile(work) on plain main also ignores bcpack-history.json, returning (strict_stamp(), None)) | green on PR+main: 34 tests OK (skipped=3) (-k test_history_added_after_strict_rejection: 1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yes

Verified the merged tree across tests/test_ttpf_mips.py (93 OK), tests/test_bcpack.py (20 OK), tests/test_docs_links.py (17 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py. Note: independently reproduced the range-validation finding noted in review above — bcpack_tables_bptc.load_bc7 accepts historyEndpointConfirmedBits [9]*6 with historyEndpointKnownBits [8]*6, so ttpf_assets.load_history currently rejects out-of-range bc1–bc5 entries via load_bc_history while letting out-of-range bc6h/bc7 depth bounds pass preflight.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7235568795 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7235568795). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T06:52:12Z. --- #2512 | head a1e04653561ba65cfbfb924b1e601283e461cb0c (merged cleanly with main 09c153948) | `python -I tests/test_ttpf_assets.py` | red on main: `ImportError: cannot import name 'Profiles' from 'ttpf_assets'` (`load_profile(work)` on plain `main` also ignores `bcpack-history.json`, returning `(strict_stamp(), None)`) | green on PR+main: `34 tests OK (skipped=3)` (`-k test_history_added_after_strict_rejection`: `1 test OK`) | Windows 11, Python 3.12.10 | AI-assisted: yes Verified the merged tree across `tests/test_ttpf_mips.py` (`93 OK`), `tests/test_bcpack.py` (`20 OK`), `tests/test_docs_links.py` (`17 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py`. Note: independently reproduced the range-validation finding noted in review above — `bcpack_tables_bptc.load_bc7` accepts `historyEndpointConfirmedBits` `[9]*6` with `historyEndpointKnownBits` `[8]*6`, so `ttpf_assets.load_history` currently rejects out-of-range `bc1`–`bc5` entries via `load_bc_history` while letting out-of-range `bc6h`/`bc7` depth bounds pass preflight.
DadaCap commented 2026-11-28 07:21:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T07:21:22Z.


Thanks for this! Reusing a local bcpack-history.json on resume, with cache invalidation when it changes, lifts the limit on pools whose predictor is missing from the built-in tables.

During maintainer testing (local, 2026-11-28) (head a1e046535, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found:

  • The blocker is timbot103's open change request: a malformed BC7 history passes load_history() (only the load_bc7 shape checks run) and can publish a provisional decode as a confirmed strict DDS.

To get this merged:

  • Apply the range checks --verify uses to the parsed BC7 (and BC6H) history before the pool work.
  • Add an invalid-BC7 test next to the BC1 one, then re-request review.

AI-assisted (Claude Code), posted for DadaCap (maintainer).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7235881427 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7235881427). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T07:21:22Z. --- Thanks for this! Reusing a local `bcpack-history.json` on resume, with cache invalidation when it changes, lifts the limit on pools whose predictor is missing from the built-in tables. During maintainer testing (local, 2026-11-28) (head a1e046535, merged on main b1619e0a3 / 6dfca6428, Windows 11, Python tests via pytest/unittest) we found: - The blocker is timbot103's open change request: a malformed BC7 history passes `load_history()` (only the `load_bc7` shape checks run) and can publish a provisional decode as a confirmed strict DDS. To get this merged: - Apply the range checks `--verify` uses to the parsed BC7 (and BC6H) history before the pool work. - Add an invalid-BC7 test next to the BC1 one, then re-request review. _AI-assisted (Claude Code), posted for DadaCap (maintainer)._
timbot103 commented 2026-11-28 14:36:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T14:36:16Z.

Review: COMMENTED


Request changes after a static code audit against a1e046535 + ec740bcc3, with in-memory synthetic checks.

  • tools/ttpf_assets.py:68 passes BC6H/BC7 history through the loaders without the full schema checks. A synthetic BC7 pool published a strict DDS with confirmed depth 9 and known depth 8. It also published incorrect bytes when the depth declarations survived but the endpoint row was absent. Please share the --verify bounds checks, enforce confirmed value-row presence and add an assets regression.
  • tools/ttpf_assets.py:254 runs cleanup against a manifest snapshot. Overlapping A → B → A history passes can delete both stamped DDS files and leave the final catalog pointing to a missing file. Please serialize the manifest read, publish and cleanup across writers.
  • tools/ttpf_assets.py:224 rewrites already valid calibrated DDS files when only history changes. A denied replacement can abort the pass before later strict fallbacks. Please reuse calibrated rows with matching stamps and complete output.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098417673 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#pullrequestreview-6098417673). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T14:36:16Z. **Review:** COMMENTED --- Request changes after a static code audit against `a1e046535` + `ec740bcc3`, with in-memory synthetic checks. - `tools/ttpf_assets.py:68` passes BC6H/BC7 history through the loaders without the full schema checks. A synthetic BC7 pool published a strict DDS with confirmed depth 9 and known depth 8. It also published incorrect bytes when the depth declarations survived but the endpoint row was absent. Please share the `--verify` bounds checks, enforce confirmed value-row presence and add an assets regression. - `tools/ttpf_assets.py:254` runs cleanup against a manifest snapshot. Overlapping A → B → A history passes can delete both stamped DDS files and leave the final catalog pointing to a missing file. Please serialize the manifest read, publish and cleanup across writers. - `tools/ttpf_assets.py:224` rewrites already valid calibrated DDS files when only history changes. A denied replacement can abort the pass before later strict fallbacks. Please reuse calibrated rows with matching stamps and complete output. AI-assisted.
TheGeogeo commented 2026-11-28 15:47:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T15:47:20Z.


Thanks for the review. I pushed two commits on top of a1e046535.

0507555a5: history ranges. load_history() checked the bc6h and bc7 sections with the table loaders only. So a BC7 confirmed depth of 9 over a known depth of 8 passed. I moved the range checks of bcpack_history_calib.py --verify into a shared check_history_tables(). load_history() now runs it on the parsed history before any pool is opened. The checks also require the value row for every entry that has confirmed bits (BC7 historyEndpoints / historyIndices, BC6H endpointHistory / indexHistory). Without that row, the decoder read zeros as confirmed values. --verify uses the same function, so it rejects those tables too. bcpack_tables_bptc.py is unchanged, so the decoder digest and saved passes are unchanged.

a23d69194: calibrated rows on a history edit. With a calibration profile, a history edit re-decoded every calibrated row and replaced its DDS with the same bytes under the same name. A row whose decoder stamp and file name already match the pass, and whose file exists, is now kept as is. So a history edit re-decodes only the strict fallbacks.

Overlapping A → B → A passes: I did not change this here. Run one after the other, each pass removes only the files its rows no longer name. Losing a file needs two builds running on the same work folder at the same time. Nothing in make_game.py serializes two builds on one work folder, and main has the same race when the calibration profile is edited. A lock across the manifest read, publish and cleanup is a separate change from the history support.

New tests:

  • test_out_of_range_bc6h_and_bc7_history_reports_error_without_updating_the_pool, next to the BC1 one. It covers BC7 confirmed above known, BC7 confirmed bits without values, a BC6H value out of range and BC6H confirmed bits without values.
  • test_verify_rejects_confirmed_bits_without_values in tests/test_bcpack_history_calib.py.
  • A second pass in test_calibrated_and_strict_rows_use_separate_stamps_with_history: after a history edit, the calibrated decoder is not called again and its file is not replaced.

Tested on Windows 11 with Python 3.12.4:

  • PR head a1e046535: python -I tests/test_ttpf_assets.py gave 34 tests OK (3 skipped). python -I tests/test_bcpack_history_calib.py gave 19 OK.
  • The new tests against the old code: the 4 history subtests fail with SystemExit not raised, and the 4 --verify subtests fail with 0 != 2. The second pass fails with (2, 0) != (1, 0).
  • New head a23d69194: tests/test_ttpf_assets.py gave 35 OK (3 skipped). tests/test_bcpack_history_calib.py gave 20 OK.
  • Trial merge with main c1ecf04ed (clean):
    • test_ttpf_assets 35 OK (3 skipped), test_ttpf_mips 93 OK, test_bcpack 20 OK, test_json_bom_inputs 10 OK, test_calibrated_texture 2 OK (1 skipped), test_text_write_line_endings 3 OK, test_docs_links 17 OK.
    • python -I -m unittest discover -s tests -p test_dstorage_history.py gave 6 OK (1 skipped).
    • test_bcpack_history_calib gave 24 tests with 1 failure, test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive. It fails the same way on main alone (23 tests, 1 failure), so this PR does not cause it.
  • scripts/check_no_game_data.py on the changed files and git diff --check are clean.

@timbot103, could you take another look?

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241735246 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7241735246). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T15:47:20Z. --- Thanks for the review. I pushed two commits on top of `a1e046535`. **`0507555a5`: history ranges.** `load_history()` checked the `bc6h` and `bc7` sections with the table loaders only. So a BC7 confirmed depth of 9 over a known depth of 8 passed. I moved the range checks of `bcpack_history_calib.py --verify` into a shared `check_history_tables()`. `load_history()` now runs it on the parsed history before any pool is opened. The checks also require the value row for every entry that has confirmed bits (BC7 `historyEndpoints` / `historyIndices`, BC6H `endpointHistory` / `indexHistory`). Without that row, the decoder read zeros as confirmed values. `--verify` uses the same function, so it rejects those tables too. `bcpack_tables_bptc.py` is unchanged, so the decoder digest and saved passes are unchanged. **`a23d69194`: calibrated rows on a history edit.** With a calibration profile, a history edit re-decoded every calibrated row and replaced its DDS with the same bytes under the same name. A row whose decoder stamp and file name already match the pass, and whose file exists, is now kept as is. So a history edit re-decodes only the strict fallbacks. **Overlapping A → B → A passes:** I did not change this here. Run one after the other, each pass removes only the files its rows no longer name. Losing a file needs two builds running on the same work folder at the same time. Nothing in `make_game.py` serializes two builds on one work folder, and `main` has the same race when the calibration profile is edited. A lock across the manifest read, publish and cleanup is a separate change from the history support. New tests: - `test_out_of_range_bc6h_and_bc7_history_reports_error_without_updating_the_pool`, next to the BC1 one. It covers BC7 confirmed above known, BC7 confirmed bits without values, a BC6H value out of range and BC6H confirmed bits without values. - `test_verify_rejects_confirmed_bits_without_values` in `tests/test_bcpack_history_calib.py`. - A second pass in `test_calibrated_and_strict_rows_use_separate_stamps_with_history`: after a history edit, the calibrated decoder is not called again and its file is not replaced. Tested on Windows 11 with Python 3.12.4: - PR head `a1e046535`: `python -I tests/test_ttpf_assets.py` gave 34 tests OK (3 skipped). `python -I tests/test_bcpack_history_calib.py` gave 19 OK. - The new tests against the old code: the 4 history subtests fail with `SystemExit not raised`, and the 4 `--verify` subtests fail with `0 != 2`. The second pass fails with `(2, 0) != (1, 0)`. - New head `a23d69194`: `tests/test_ttpf_assets.py` gave 35 OK (3 skipped). `tests/test_bcpack_history_calib.py` gave 20 OK. - Trial merge with `main` `c1ecf04ed` (clean): - `test_ttpf_assets` 35 OK (3 skipped), `test_ttpf_mips` 93 OK, `test_bcpack` 20 OK, `test_json_bom_inputs` 10 OK, `test_calibrated_texture` 2 OK (1 skipped), `test_text_write_line_endings` 3 OK, `test_docs_links` 17 OK. - `python -I -m unittest discover -s tests -p test_dstorage_history.py` gave 6 OK (1 skipped). - `test_bcpack_history_calib` gave 24 tests with 1 failure, `test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive`. It fails the same way on `main` alone (23 tests, 1 failure), so this PR does not cause it. - `scripts/check_no_game_data.py` on the changed files and `git diff --check` are clean. @timbot103, could you take another look? AI-assisted: yes
enlight3d commented 2026-11-29 00:46:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:46:42Z.


RUN for #2512 (make_game assets: reuse local BCPack history on resume)

Kind: Python (make_game.py, tools/, tests/). Tester: second machine, not the author.

Heads

  • PR head: a23d691944 (merge base 587bb6f5ac)
  • origin/main: 48bae6cade
  • merged tree: origin/main + git merge --no-edit --no-ff pr-2512 (clean, no conflict), local only

Commands (repo root, one process per file)
python -I tests/test_ttpf_assets.py
python -I tests/test_bcpack_history_calib.py
python -m compileall -q make_game.py tools tests
python -I make_game.py --help
plus the 29 other tests that mention make_game, ttpf_assets or bcpack_history_calib (python -I tests/)

RED (PR non-test changes reverted to the merge base, tests kept)

  • tests/test_bcpack_history_calib.py: FAILED (failures=4), all four subtests of test_verify_rejects_confirmed_bits_without_values (rc 0 != 2). Behavioural red.
  • tests/test_ttpf_assets.py: ImportError (cannot import name 'Profiles'). That is only a build-style red because of the new API, so I also ran behavioural reds: PR kept, one piece of logic reverted per run, tests unchanged:
    • history not passed to texture_dds: 2 failures (test_calibrated_and_strict_rows_use_separate_stamps_with_history, test_history_added_after_strict_rejection)
    • strict_stamp ignoring raw_history: same 2 failures
    • the "same decoder already wrote this file" skip removed: 1 failure (test_calibrated_and_strict_rows_use_separate_stamps_with_history)
    • check_history_tables call removed from load_history: 5 failures (test_invalid_history_reports_error_without_updating_the_pool, test_out_of_range_bc6h_and_bc7_history_reports_error_without_updating_the_pool x4 subtests)
    • bcpack-history.json not read at all: 7 failures
      Each revert is caught by at least one test.

GREEN at PR head

  • test_ttpf_assets.py: Ran 35, OK (skipped=3: POSIX file modes only, needs the built rpf9dump, needs numpy - numpy is not installed here, so test_profile_added_after_strict_rejection did not run)
  • test_bcpack_history_calib.py: Ran 24, OK
  • compileall: exit 0; tests/test_docs_cli_flags.py: OK

GREEN merged into current main

  • test_ttpf_assets.py: Ran 35, OK (skipped=3, same reasons)
  • test_bcpack_history_calib.py: Ran 24, 1 failure: test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive (1 != 2). Pre-existing on plain main (same test, same failure, 23 tests on main): it comes from 4f383c8ae and assumes a case-sensitive file system, Windows is case-insensitive. Not caused by this PR (the test is not in the PR branch).
  • make_game.py --help: exit 0. 29 related tests: all OK except tests/test_docs_cli_flags.py (README.md:94 scripts/play-d3d12.ps1 -Game), which fails identically on plain main and passes at the PR head, so also pre-existing on main.

Not covered: no game files used, so nothing exercised an actual pool decode here; runtime/ and Rust are untouched (no link/import check needed).

Machine: Windows 11 Pro, RTX 3090 24 GB, NVIDIA 621.40, Python 3.13.12 (uv build, no numpy).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248343728 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7248343728). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T00:46:42Z. --- RUN for #2512 (make_game assets: reuse local BCPack history on resume) Kind: Python (make_game.py, tools/, tests/). Tester: second machine, not the author. Heads - PR head: a23d69194462e9bd41212c39b80b946aaa07ceb5 (merge base 587bb6f5ac47950277285417f546f9ceeca9c1f1) - origin/main: 48bae6cade49aea69f63eb8871572dcd6931cd4b - merged tree: origin/main + git merge --no-edit --no-ff pr-2512 (clean, no conflict), local only Commands (repo root, one process per file) python -I tests/test_ttpf_assets.py python -I tests/test_bcpack_history_calib.py python -m compileall -q make_game.py tools tests python -I make_game.py --help plus the 29 other tests that mention make_game, ttpf_assets or bcpack_history_calib (python -I tests/<file>) RED (PR non-test changes reverted to the merge base, tests kept) - tests/test_bcpack_history_calib.py: FAILED (failures=4), all four subtests of test_verify_rejects_confirmed_bits_without_values (rc 0 != 2). Behavioural red. - tests/test_ttpf_assets.py: ImportError (cannot import name 'Profiles'). That is only a build-style red because of the new API, so I also ran behavioural reds: PR kept, one piece of logic reverted per run, tests unchanged: - history not passed to texture_dds: 2 failures (test_calibrated_and_strict_rows_use_separate_stamps_with_history, test_history_added_after_strict_rejection) - strict_stamp ignoring raw_history: same 2 failures - the "same decoder already wrote this file" skip removed: 1 failure (test_calibrated_and_strict_rows_use_separate_stamps_with_history) - check_history_tables call removed from load_history: 5 failures (test_invalid_history_reports_error_without_updating_the_pool, test_out_of_range_bc6h_and_bc7_history_reports_error_without_updating_the_pool x4 subtests) - bcpack-history.json not read at all: 7 failures Each revert is caught by at least one test. GREEN at PR head - test_ttpf_assets.py: Ran 35, OK (skipped=3: POSIX file modes only, needs the built rpf9dump, needs numpy - numpy is not installed here, so test_profile_added_after_strict_rejection did not run) - test_bcpack_history_calib.py: Ran 24, OK - compileall: exit 0; tests/test_docs_cli_flags.py: OK GREEN merged into current main - test_ttpf_assets.py: Ran 35, OK (skipped=3, same reasons) - test_bcpack_history_calib.py: Ran 24, 1 failure: test_resolve_pools_deduplicates_macos_case_and_accents_and_keeps_case_sensitive (1 != 2). Pre-existing on plain main (same test, same failure, 23 tests on main): it comes from 4f383c8ae and assumes a case-sensitive file system, Windows is case-insensitive. Not caused by this PR (the test is not in the PR branch). - make_game.py --help: exit 0. 29 related tests: all OK except tests/test_docs_cli_flags.py (README.md:94 scripts/play-d3d12.ps1 -Game), which fails identically on plain main and passes at the PR head, so also pre-existing on main. Not covered: no game files used, so nothing exercised an actual pool decode here; runtime/ and Rust are untouched (no link/import check needed). Machine: Windows 11 Pro, RTX 3090 24 GB, NVIDIA 621.40, Python 3.13.12 (uv build, no numpy).
OreoFR commented 2026-11-29 02:33:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T02:33:48Z.

Review: APPROVED


Approve. Checked timbot103's three points against a23d69194:

  1. History ranges: fixed. load_history() now runs the --verify checks (check_history_tables) before any pool opens, and requires a value row for every confirmed entry. I fed 25 malformed histories to load_history: BC7 confirmed above known, confirmed bits without values, BC6H class 3 without rows, bad keys, Infinity, deep nesting, BOM. Each one either gave a clean ValueError or was a valid table. Nothing escaped as a traceback.
  2. Overlapping A→B→A writers: not changed, and I agree. make_game.py has no lock on the work folder, and main has the same race when the calibration profile is edited. It belongs in a separate change.
  3. Calibrated rewrite: fixed. A row whose decoder, name and file all match is skipped, and publish() is atomic, so a file that exists is complete.

Tests: merged on origin/main 791899f65 (clean), Windows 11, Python 3.12.10, python -I:

  • test_ttpf_assets 35 OK (3 skipped).
  • test_bcpack_history_calib 24 with 1 failure, test_resolve_pools_deduplicates_macos_case.... That test assumes a case-sensitive file system, and it fails the same way on main.
  • test_text_write_line_endings, --help, git diff --check and check_no_game_data all pass.

Review by OreoFR's agent (AI-assisted, Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6101089895 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#pullrequestreview-6101089895). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T02:33:48Z. **Review:** APPROVED --- **Approve.** Checked timbot103's three points against a23d69194: 1. **History ranges: fixed.** `load_history()` now runs the `--verify` checks (`check_history_tables`) before any pool opens, and requires a value row for every confirmed entry. I fed 25 malformed histories to `load_history`: BC7 confirmed above known, confirmed bits without values, BC6H class 3 without rows, bad keys, `Infinity`, deep nesting, BOM. Each one either gave a clean `ValueError` or was a valid table. Nothing escaped as a traceback. 2. **Overlapping A→B→A writers: not changed, and I agree.** `make_game.py` has no lock on the work folder, and `main` has the same race when the calibration profile is edited. It belongs in a separate change. 3. **Calibrated rewrite: fixed.** A row whose decoder, name and file all match is skipped, and `publish()` is atomic, so a file that exists is complete. Tests: merged on origin/main 791899f65 (clean), Windows 11, Python 3.12.10, `python -I`: - `test_ttpf_assets` 35 OK (3 skipped). - `test_bcpack_history_calib` 24 with 1 failure, `test_resolve_pools_deduplicates_macos_case...`. That test assumes a case-sensitive file system, and it fails the same way on `main`. - `test_text_write_line_endings`, `--help`, `git diff --check` and `check_no_game_data` all pass. Review by OreoFR's agent (AI-assisted, Claude Code, Claude Opus 5.5).
MoonEyes commented 2026-11-29 08:14:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T08:14:21Z.


Merged after OreoFR's check (check: red/green on main + this PR) and a re-check here: no conflict with main 0125399d4, same head as checked, not frozen, no-game-data green.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7252975478 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2512#issuecomment-7252975478). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T08:14:21Z. --- Merged after **OreoFR**'s check ([check](): red/green on `main` + this PR) and a re-check here: no conflict with `main` 0125399d4, same head as checked, not frozen, `no-game-data` green. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2512
No description provided.