Scripts: decode coverage sweeps as UTF-8 #2640

Open
luckyteagirl wants to merge 1 commit from upstream-pr/2650 into main
luckyteagirl commented 2026-11-26 05:04:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:04:10Z.


The direct coverage gate decodes XCL's redirected output with the Windows process locale. XCL writes UTF-8, so a shader name containing characters that are invalid in a local code page can raise UnicodeDecodeError before the gate reads the JSON report. Decode the sweep output as UTF-8 explicitly.

What is in it

  • Pass encoding="utf-8" to the live sweep subprocess.
  • Add a regression using UTF-8 output with Ł under a simulated CP1252 default.

Tested

  • On current main b49be183, the new regression raised UnicodeDecodeError (9 passed, 1 error in the coverage gate tests). On this branch, full Python script discovery passed 26/26 on Windows.
  • A Windows check with an existing debug xcl.exe, a nonexistent Ł.rpf, and CP1252 reproduced the old traceback. The fixed gate returned exit 2 and printed the Unicode path in the diagnostic without a decoding traceback. This was an error-path check, not a real shader sweep.
  • git diff --check passed. The patch applies cleanly alongside the separate atomic baseline change in PR #2645. PR #2099 wraps the same subprocess call for OS errors and may need a small rebase if merged first.

Regression run

  • Not applicable. This changes only the Python coverage script and its test.

Not tested

  • A real shader pack sweep, Rust workspace tests, GPU tests, and retail title smoke.

AI use

  • Codex (GPT-6.2 Sol) implemented and tested the change; Codex reviewed the patch and prepared this description.
<!-- greyfinch-sync:ivall/xcl:issue:5504327154 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2650). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:04:10Z. --- The direct coverage gate decodes XCL's redirected output with the Windows process locale. XCL writes UTF-8, so a shader name containing characters that are invalid in a local code page can raise `UnicodeDecodeError` before the gate reads the JSON report. Decode the sweep output as UTF-8 explicitly. **What is in it** - Pass `encoding="utf-8"` to the live sweep subprocess. - Add a regression using UTF-8 output with `Ł` under a simulated CP1252 default. **Tested** - On current main `b49be183`, the new regression raised `UnicodeDecodeError` (9 passed, 1 error in the coverage gate tests). On this branch, full Python script discovery passed 26/26 on Windows. - A Windows check with an existing debug `xcl.exe`, a nonexistent `Ł.rpf`, and CP1252 reproduced the old traceback. The fixed gate returned exit 2 and printed the Unicode path in the diagnostic without a decoding traceback. This was an error-path check, not a real shader sweep. - `git diff --check` passed. The patch applies cleanly alongside the separate atomic baseline change in PR #2645. PR #2099 wraps the same subprocess call for OS errors and may need a small rebase if merged first. **Regression run** - Not applicable. This changes only the Python coverage script and its test. **Not tested** - A real shader pack sweep, Rust workspace tests, GPU tests, and retail title smoke. **AI use** - Codex (GPT-6.2 Sol) implemented and tested the change; Codex reviewed the patch and prepared this description.
github-actions[bot] commented 2026-12-01 02:32:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-12-01T02:32:07Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7298720321 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2650#issuecomment-7298720321). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T02:32:07Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 08:34:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:34:06Z.


Triage (#1607) – head cfc5192

No open or merged PR makes the same change. #2653 (Unicode line separators in sweep_json) and #2669 (--run-json read as bytes) fix other decoding paths of coverage_gate.py; #2253 is about empty sweeps.
No problems found in the diff: the mocked subprocess.run decodes with cp1252 unless encoding is passed, so the test would fail without the fix.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7305489029 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2650#issuecomment-7305489029). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:34:06Z. --- **Triage (#1607)** – head cfc5192 No open or merged PR makes the same change. #2653 (Unicode line separators in `sweep_json`) and #2669 (`--run-json` read as bytes) fix other decoding paths of `coverage_gate.py`; #2253 is about empty sweeps. No problems found in the diff: the mocked `subprocess.run` decodes with cp1252 unless `encoding` is passed, so the test would fail without the fix. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Decodere commented 2026-12-02 09:00:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T09:00:58Z.


merge-check
base: 1c8b551475
head: cfc5192219
merge: clean (git merge --no-edit onto 1c8b5514, git diff --check clean; scripts/coverage_gate.py and scripts/test_coverage_gate.py, +22/-1)
build: not run (Tier 0 Python script diff; no Rust code changed)
tests: python -m unittest discover -s scripts -p "test_coverage_gate.py" -v -> 10 passed, 0 failed (base 1c8b5514: 9 passed; new test_live_sweep_decoding_ignores_system_encoding passed); python -m unittest discover -s scripts -p "test_*.py" -> 66 passed, 1 error (test_discord_mirror.py on Windows, same failure on base 1c8b5514). Rust workspace tests not run (Tier 0).
review: Read the full diff (+22/-1). Switching subprocess.run(..., text=True) to encoding="utf-8" (scripts/coverage_gate.py:71) stops coverage_gate.py from decoding xcl shaders --json stdout with Windows cp1252 when output contains non-ASCII UTF-8 characters. The new unit test mocks subprocess.run defaulting to cp1252 and fails without the fix. No problems found.
performance: none (offline script in scripts/; zero runtime impact)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ivall/xcl:comment:7340245520 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2650#issuecomment-7340245520). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T09:00:58Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: cfc5192219307be520587eedb65888e261b6a480 merge: clean (`git merge --no-edit` onto `1c8b5514`, `git diff --check` clean; `scripts/coverage_gate.py` and `scripts/test_coverage_gate.py`, +22/-1) build: not run (Tier 0 Python script diff; no Rust code changed) tests: `python -m unittest discover -s scripts -p "test_coverage_gate.py" -v` -> 10 passed, 0 failed (base `1c8b5514`: 9 passed; new `test_live_sweep_decoding_ignores_system_encoding` passed); `python -m unittest discover -s scripts -p "test_*.py"` -> 66 passed, 1 error (`test_discord_mirror.py` on Windows, same failure on base `1c8b5514`). Rust workspace tests not run (Tier 0). review: Read the full diff (+22/-1). Switching `subprocess.run(..., text=True)` to `encoding="utf-8"` (`scripts/coverage_gate.py:71`) stops `coverage_gate.py` from decoding `xcl shaders --json` stdout with Windows `cp1252` when output contains non-ASCII UTF-8 characters. The new unit test mocks `subprocess.run` defaulting to `cp1252` and fails without the fix. No problems found. performance: none (offline script in `scripts/`; zero runtime impact) verdict: safe to merge hardware / tool and model: NVIDIA GeForce RTX 4060 8 GB (driver 621.40), Intel Core i5-11400F, 32 GB RAM, Windows 11 Build 26200, Python 3.15.2, Rust 1.100.1 MSVC, DXC 1.9.2602.17 / Antigravity (Gemini 4 Neon)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2650:upstream-pr/2650'
git switch 'upstream-pr/2650'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2650'
git switch 'upstream-pr/2650'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2650'
git switch 'upstream-pr/2650'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2650'
git switch 'main'
git merge --squash 'upstream-pr/2650'
git switch 'main'
git merge --ff-only 'upstream-pr/2650'
git switch 'main'
git merge 'upstream-pr/2650'
git push origin 'main'
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
xcl-dev/xcl!2640
No description provided.