Read saved coverage reports with JSON encoding detection #2659

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

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


coverage_gate.py --run-json rejected saved sweep reports with a UTF-8 or UTF-16 byte-order mark. Pass the file bytes to Python's JSON decoder so it can recognize the encoding.

What is in it

  • Load saved sweep reports from bytes.
  • Exercise plain UTF-8, UTF-8 with a byte-order mark, and UTF-16 with a byte-order mark against the same baseline.

Tested

  • The new test passed for plain UTF-8 and failed for both BOM formats on main b49be183.
  • python -B -m unittest discover -s scripts -p 'test_*.py': 26 passed, 0 failed, 0 skipped on Windows with Python 3.11.
  • The saved-report fixture includes the unsupported counter required by open PR #2536; the three encoding cases pass with that PR's coverage gate applied.
  • The combined source tree of #2536, #2650, #2653, and this amended head merged cleanly; its coverage tests passed 20/20.
  • git diff --check passed.

Regression run

  • Not applicable. The change affects only saved-report loading in a Python script.

Not tested

  • A live sweep, Rust/GPU tests, or a retail title run. The test uses saved synthetic reports.

AI use

  • Codex (GPT-6.2 Sol) implemented the change and test, verified behavior against main, and drafted this description.
<!-- greyfinch-sync:ivall/xcl:issue:5504684985 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2669). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T05:41:12Z. --- `coverage_gate.py --run-json` rejected saved sweep reports with a UTF-8 or UTF-16 byte-order mark. Pass the file bytes to Python's JSON decoder so it can recognize the encoding. **What is in it** - Load saved sweep reports from bytes. - Exercise plain UTF-8, UTF-8 with a byte-order mark, and UTF-16 with a byte-order mark against the same baseline. **Tested** - The new test passed for plain UTF-8 and failed for both BOM formats on main `b49be183`. - `python -B -m unittest discover -s scripts -p 'test_*.py'`: 26 passed, 0 failed, 0 skipped on Windows with Python 3.11. - The saved-report fixture includes the `unsupported` counter required by open PR #2536; the three encoding cases pass with that PR's coverage gate applied. - The combined source tree of #2536, #2650, #2653, and this amended head merged cleanly; its coverage tests passed 20/20. - `git diff --check` passed. **Regression run** - Not applicable. The change affects only saved-report loading in a Python script. **Not tested** - A live sweep, Rust/GPU tests, or a retail title run. The test uses saved synthetic reports. **AI use** - Codex (GPT-6.2 Sol) implemented the change and test, verified behavior against main, and drafted this description.
github-actions[bot] commented 2026-11-30 08:43:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:43:03Z.


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:7273254616 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2669#issuecomment-7273254616). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:43:03Z. --- 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:38:38 +00:00 (Migrated from github.com)

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


Triage (#1607) – head 06e6c86

No open or merged PR makes the same change. #2099 changes the --run-json error handling but still uses read_text(encoding="utf-8"), and #2650 is about decoding the sweep's stdout. json.loads(bytes) detects UTF-8 with a BOM and UTF-16/32, so a report saved by Windows PowerShell with > (UTF-16LE) now loads. The test covers utf-8, utf-8-sig and utf-16.
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:7305589672 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2669#issuecomment-7305589672). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T08:38:38Z. --- **Triage (#1607)** – head 06e6c86 No open or merged PR makes the same change. #2099 changes the `--run-json` error handling but still uses `read_text(encoding="utf-8")`, and #2650 is about decoding the sweep's stdout. `json.loads(bytes)` detects UTF-8 with a BOM and UTF-16/32, so a report saved by Windows PowerShell with `>` (UTF-16LE) now loads. The test covers utf-8, utf-8-sig and utf-16. 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:01:01 +00:00 (Migrated from github.com)

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


merge-check
base: 1c8b551475
head: 06e6c86d16
merge: clean (git merge --no-edit onto 1c8b5514, git diff --check clean; scripts/coverage_gate.py and scripts/test_coverage_saved_report.py, +28/-1)
build: not run (Tier 0 Python script diff; no Rust code changed)
tests: python -m unittest discover -s scripts -p "test_coverage_saved_report.py" -v -> 1 passed, 0 failed (3 subtests covering utf-8, utf-8-sig, utf-16; new test file); 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 (+28/-1). Passing args.run_json.read_bytes() to json.loads (scripts/coverage_gate.py:64) lets Python's JSON decoder detect UTF-8, UTF-8 with BOM, and UTF-16/UTF-32 (including files saved by Windows PowerShell redirection) without breaking plain UTF-8 inputs. Clean and minimal.
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:7340246771 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2669#issuecomment-7340246771). Originally posted by [Decodere](https://github.com/Decodere) on 2026-12-02T09:01:01Z. --- merge-check base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: 06e6c86d168bcf97f8832151fa12bbad06e10a45 merge: clean (`git merge --no-edit` onto `1c8b5514`, `git diff --check` clean; `scripts/coverage_gate.py` and `scripts/test_coverage_saved_report.py`, +28/-1) build: not run (Tier 0 Python script diff; no Rust code changed) tests: `python -m unittest discover -s scripts -p "test_coverage_saved_report.py" -v` -> 1 passed, 0 failed (3 subtests covering `utf-8`, `utf-8-sig`, `utf-16`; new test file); `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 (+28/-1). Passing `args.run_json.read_bytes()` to `json.loads` (`scripts/coverage_gate.py:64`) lets Python's JSON decoder detect UTF-8, UTF-8 with BOM, and UTF-16/UTF-32 (including files saved by Windows PowerShell redirection) without breaking plain UTF-8 inputs. Clean and minimal. 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/2669:upstream-pr/2669'
git switch 'upstream-pr/2669'

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/2669'
git switch 'upstream-pr/2669'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2669'
git switch 'upstream-pr/2669'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2669'
git switch 'main'
git merge --squash 'upstream-pr/2669'
git switch 'main'
git merge --ff-only 'upstream-pr/2669'
git switch 'main'
git merge 'upstream-pr/2669'
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!2659
No description provided.