tooling: write dependency_paths JSON as ASCII #635

Manually merged
github merged 1 commit from gh-pr/635/head into gh-pr/635/base 2026-11-26 22:07:38 +00:00
Owner

@⁠louisdibiasi on GitHub · 2026-11-22 16:55 UTC · original
louisdibiasi:tooling/dependency-paths-ascii-json → main · +24 −2 · 2 files · 1 commits · merged 2026-11-22 17:15 UTC

Change

tools/dependency_paths.py printed its report with ensure_ascii=False. With a narrow stdout code page, an image name outside that page made the tool exit with UnicodeEncodeError. In the documented PowerShell pipeline (dependency_paths.py ... | Set-Content -Encoding utf8, docs/experiments.md "dependency_paths" section) the same input exited 0 and wrote a different character instead of the original. The default JSON escapes decode to the same names and do not depend on the console encoding, so the change drops ensure_ascii=False.

Independent problem, no linked issue.

Verification

Commit under test: b41c44e on 1947e97, Windows 11, Python 3.12.10.

Base, narrow stdout:
PYTHONIOENCODING=cp1252 python -B tools/dependency_paths.py inventory.json (image pkg/Ωmega.dll)
-> UnicodeEncodeError: 'charmap' codec can't encode character 'Ω', exit 1.

Base, documented pipeline, image pkg/café.dll, Windows PowerShell with Remove-Item Env:PYTHONUTF8:
python -B tools/dependency_paths.py inventory.json | Set-Content out.json -Encoding utf8 -> exit 0, out.json contains "pkg/cafΘ.dll".

With this change the same pipeline writes "pkg/café.dll", and json.loads returns the original name.

New check in tests/dependency_paths_check.py (dependency_paths_controls in CTest): runs the CLI with PYTHONIOENCODING=cp1252 on an inventory containing U+03A9 and requires exit 0 and the name in the parsed output.

  • Base: python -B tests/dependency_paths_check.py -> UnicodeEncodeError, exit 1.
  • This branch: passes.
  • All 20 pure-Python checks from AGENTS.md pass.

Evidence and follow-up

Synthetic inventory only, no game files. Not run: Linux or macOS (the cp1252 case uses PYTHONIOENCODING, so it does not need a Windows code page). The report text is otherwise unchanged; only non-ASCII characters are now escaped.

Checklist

  • One reviewable behavior.
  • Exact commands and results above.
  • Negative control: the new check fails on base.
  • No README/docs change needed (no capability or build step changed).
  • No game files, dumps, links or secrets.

AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.

**@⁠louisdibiasi** on GitHub · 2026-11-22 16:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/635) `louisdibiasi:tooling/dependency-paths-ascii-json` → `main` · +24 −2 · 2 files · 1 commits · merged 2026-11-22 17:15 UTC ## Change `tools/dependency_paths.py` printed its report with `ensure_ascii=False`. With a narrow stdout code page, an image name outside that page made the tool exit with `UnicodeEncodeError`. In the documented PowerShell pipeline (`dependency_paths.py ... | Set-Content -Encoding utf8`, docs/experiments.md "dependency_paths" section) the same input exited 0 and wrote a different character instead of the original. The default JSON escapes decode to the same names and do not depend on the console encoding, so the change drops `ensure_ascii=False`. Independent problem, no linked issue. ## Verification Commit under test: b41c44e on 1947e97, Windows 11, Python 3.12.10. Base, narrow stdout: `PYTHONIOENCODING=cp1252 python -B tools/dependency_paths.py inventory.json` (image `pkg/Ωmega.dll`) -> `UnicodeEncodeError: 'charmap' codec can't encode character 'Ω'`, exit 1. Base, documented pipeline, image `pkg/café.dll`, Windows PowerShell with `Remove-Item Env:PYTHONUTF8`: `python -B tools/dependency_paths.py inventory.json | Set-Content out.json -Encoding utf8` -> exit 0, `out.json` contains `"pkg/cafΘ.dll"`. With this change the same pipeline writes `"pkg/café.dll"`, and `json.loads` returns the original name. New check in `tests/dependency_paths_check.py` (`dependency_paths_controls` in CTest): runs the CLI with `PYTHONIOENCODING=cp1252` on an inventory containing U+03A9 and requires exit 0 and the name in the parsed output. - Base: `python -B tests/dependency_paths_check.py` -> UnicodeEncodeError, exit 1. - This branch: passes. - All 20 pure-Python checks from AGENTS.md pass. ## Evidence and follow-up Synthetic inventory only, no game files. Not run: Linux or macOS (the cp1252 case uses `PYTHONIOENCODING`, so it does not need a Windows code page). The report text is otherwise unchanged; only non-ASCII characters are now escaped. ## Checklist - [x] One reviewable behavior. - [x] Exact commands and results above. - [x] Negative control: the new check fails on base. - [x] No README/docs change needed (no capability or build step changed). - [x] No game files, dumps, links or secrets. AI-assisted: I used Claude to find the bug and draft the change. I ran the reproductions and tests above myself.
dependency_paths printed its report with ensure_ascii=False. When stdout
uses a narrow code page, an image name outside it made the tool exit with
UnicodeEncodeError. In the documented PowerShell pipeline that Windows
PowerShell 5 feeds to Set-Content, the same path exited 0 and wrote a
different character in place of the original.

Emit the default JSON escapes instead. They decode to the same names and
do not depend on the console encoding. The new case runs the CLI with
PYTHONIOENCODING=cp1252 on an inventory whose image name contains U+03A9.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:07:37 +00:00
github manually merged commit b41c44ee50 into gh-pr/635/base 2026-11-26 22:07:38 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.