textures: require the requested history before provisional export #2246

Merged
RavenCurseBurg merged 1 commit from upstream-pr/2254 into main 2026-11-25 08:24:26 +00:00
RavenCurseBurg commented 2026-11-25 07:59:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T07:59:17Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6599918117 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2254). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T07:59:17Z. --- 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.
tedin7 commented 2026-11-25 08:05:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T08:02:07Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6053825931 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2254#pullrequestreview-6053825931). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T08:02:07Z. **Review:** COMMENTED --- 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.
upstream-sync closed this pull request 2026-11-25 09:04:02 +00:00
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
R0Y00/Xbox2Windows!2246
No description provided.