textures: require the requested history before provisional export #2254

Manually merged
github merged 1 commit from gh-pr/2254/head into gh-pr/2254/base 2026-11-27 00:10:06 +00:00
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 07:59 UTC · original
RavenCurseBurg:textures/require-requested-history → main · +46 −9 · 3 files · 1 commits · merged 2026-11-25 08:24 UTC

Refs #458. A batch run with --allow-provisional --history chosen.json could publish a DDS and report success after silently substituting the decoder default for a missing file or JSON null. Malformed JSON produced a warning and the same output. On a generated pool with a test decoder whose output depends on the chosen history, all three cases returned 0 with the default bytes. A valid object produced different bytes.

Read and validate an explicitly requested provisional history before opening the pool or changing any output. A missing or unreadable file, invalid UTF-8, malformed JSON or a non-object value now produces a CLI usage error (2). An empty object is passed to the decoder as supplied. The existing default still applies when the caller omits the history path.

Verification on Windows:

  • python -B tests/ttpf_batch_export_check.py -v ran 13 tests: 12 passed, 1 skipped because the optional external reference decoder was unavailable.
  • The new regression preserves an existing DDS and manifest byte for byte for five bad inputs. It also verifies delivery of both an empty object and a populated profile to the decoder.
  • The standalone CLI experiment with a generated pool and test decoder now returns 2 for the missing, malformed and null histories without creating a DDS. The valid file returns 0 with the selected bytes.
  • python -B tests/docs_links_check.py (428 links), python -B tests/bidi_controls_check.py (1,535 files) and git diff --check passed.
**@⁠RavenCurseBurg** on GitHub · 2026-11-25 07:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2254) `RavenCurseBurg:textures/require-requested-history` → `main` · +46 −9 · 3 files · 1 commits · merged 2026-11-25 08:24 UTC Refs #458. A batch run with `--allow-provisional --history chosen.json` could publish a DDS and report success after silently substituting the decoder default for a missing file or JSON `null`. Malformed JSON produced a warning and the same output. On a generated pool with a test decoder whose output depends on the chosen history, all three cases returned 0 with the default bytes. A valid object produced different bytes. Read and validate an explicitly requested provisional history before opening the pool or changing any output. A missing or unreadable file, invalid UTF-8, malformed JSON or a non-object value now produces a CLI usage error (2). An empty object is passed to the decoder as supplied. The existing default still applies when the caller omits the history path. Verification on Windows: - `python -B tests/ttpf_batch_export_check.py -v` ran 13 tests: 12 passed, 1 skipped because the optional external reference decoder was unavailable. - The new regression preserves an existing DDS and manifest byte for byte for five bad inputs. It also verifies delivery of both an empty object and a populated profile to the decoder. - The standalone CLI experiment with a generated pool and test decoder now returns 2 for the missing, malformed and null histories without creating a DDS. The valid file returns 0 with the selected bytes. - `python -B tests/docs_links_check.py` (428 links), `python -B tests/bidi_controls_check.py` (1,535 files) and `git diff --check` passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:10:03 +00:00
github manually merged commit 4dff6d9d94 into gh-pr/2254/base 2026-11-27 00:10:06 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 08:02 UTC · original · reviewed

Review of head 4dff6d9d94 (comment only).

Result: no blocking findings. P1=0, P2=0.

Commands executed locally (Linux):

  • git diff --stat origin/main...HEAD: 3 files, +46/-9.
  • python3 -B tests/ttpf_batch_export_check.py: Ran 13 tests, OK (skipped=1, optional external decoder).
  • python3 tests/docs_links_check.py: 18 Markdown files, 428 links OK.
  • python3 tests/bidi_controls_check.py: 1535 files, no bidirectional controls.
  • git diff --check origin/main...HEAD: clean.
  • Mutation 1: replaced the isinstance(history_dict, dict) check with if False:. Result: 2 failures. The new test kills it.
  • Mutation 2: narrowed except (OSError, ValueError) to except OSError. Result: 2 failures. The new test kills it.
  • Both mutations were reverted with git checkout -- ..

Notes:

  • The history is now read and validated before load_tools and before the pool is opened. A bad file therefore leaves the existing DDS and manifest untouched. The test checks this byte for byte.
  • Moving the calibration conflict check ahead of load_tools is safe. The error text is the same, and it now fails earlier.
  • Nit (non-blocking): --history without --allow-provisional is still ignored without any message, as before. A short warning would help, but it is outside this PR's scope.
  • Nit (non-blocking): str(exc) for a UnicodeDecodeError is verbose in the CLI message. It is acceptable.
  • Title is neutral and the diff looks clean-room. Docs are updated.
  • CI at review time: the Linux Python checks passed. The Windows jobs were still pending. I did not run the Windows pipeline, because this PR is pure Python with no shader or C++ change.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 08:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2254#pullrequestreview-6053825931) · **reviewed** Review of head 4dff6d9d942a680d0b109a2d73605b702e263319 (comment only). Result: no blocking findings. P1=0, P2=0. Commands executed locally (Linux): - `git diff --stat origin/main...HEAD`: 3 files, +46/-9. - `python3 -B tests/ttpf_batch_export_check.py`: Ran 13 tests, OK (skipped=1, optional external decoder). - `python3 tests/docs_links_check.py`: 18 Markdown files, 428 links OK. - `python3 tests/bidi_controls_check.py`: 1535 files, no bidirectional controls. - `git diff --check origin/main...HEAD`: clean. - Mutation 1: replaced the `isinstance(history_dict, dict)` check with `if False:`. Result: 2 failures. The new test kills it. - Mutation 2: narrowed `except (OSError, ValueError)` to `except OSError`. Result: 2 failures. The new test kills it. - Both mutations were reverted with `git checkout -- .`. Notes: - The history is now read and validated before `load_tools` and before the pool is opened. A bad file therefore leaves the existing DDS and manifest untouched. The test checks this byte for byte. - Moving the calibration conflict check ahead of `load_tools` is safe. The error text is the same, and it now fails earlier. - Nit (non-blocking): `--history` without `--allow-provisional` is still ignored without any message, as before. A short warning would help, but it is outside this PR's scope. - Nit (non-blocking): `str(exc)` for a `UnicodeDecodeError` is verbose in the CLI message. It is acceptable. - Title is neutral and the diff looks clean-room. Docs are updated. - CI at review time: the Linux Python checks passed. The Windows jobs were still pending. I did not run the Windows pipeline, because this PR is pure Python with no shader or C++ change. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.