tooling: skip a UTF-8 byte-order mark in check listings #2810

Manually merged
github merged 1 commit from gh-pr/2810/head into gh-pr/2810/base 2026-11-27 01:24:26 +00:00
Owner

@⁠RenzoWit35 on GitHub · 2026-11-26 11:02 UTC · original
RenzoWit35:tooling/run-checks-listing-bom → main · +23 −2 · 2 files · 1 commits · merged 2026-11-26 11:09 UTC

Change

read_check_files in tools/run_checks_parallel.py (the code behind --from-dir, which reads the
fragments under tests/checks/) read each listing as plain utf-8. A listing saved with a UTF-8
byte-order mark (Notepad, or Windows PowerShell 5.1 Set-Content -Encoding UTF8) therefore kept
U+FEFF at the start of line 1. Two symptoms, both a clean refusal rather than a wrong result:

  • a script path on line 1 was reported missing: x.txt:1: script path does not exist: \ufeff<path>;
  • a comment or blank first line was not recognised as one (\ufeff# is not #), so the comment
    was treated as a script path and refused the same way.

The error text gives no hint that a BOM is the cause. The listing is now read as utf-8-sig, so a
leading BOM is ignored. This is the same treatment tests/docs_links_check.py and
tests/rdna2_tools_check.py (BOM-skipping assembly parser) already use. Nothing else about parsing
changes (comment rule, argument splitting, duplicate and missing-script refusals, empty-run
behaviour). The read_check_files docstring now says a leading BOM is skipped.

tests/run_checks_fragments_check.py gains cases: for a listing whose line 1 is a script path, a
comment, or a blank line, the listing with a BOM (written as the explicit bytes \xef\xbb\xbf)
and the same listing without one both run the script with its argument and report
all 1 checks passed.

Verification

Repro on origin/main (temporary directory, ok.py prints ok ran; exit code, then output):

  • BOM, path on line 1: exit 1, x.txt:1: script path does not exist: \ufeff<T>\ok.py
  • no BOM, same path: exit 0, all 1 checks passed
  • BOM, # note then path: exit 1, x.txt:1: script path does not exist: \ufeff#
  • BOM, blank line then path: exit 1, x.txt:1: script path does not exist: \ufeff
  • no BOM, # note then path: exit 0

With the change, all five exit 0 with all 1 checks passed.

Commands (from the worktree root, out/pe-env Python 3.14.5, Windows 11):

  • python -B tests/run_checks_fragments_check.py -> run_checks_fragments_check ok, exit 0
  • python -B tests/run_checks_parallel_check.py -> run_checks_parallel_check: ok

Negative control: the new test file run against git show origin/main:tools/run_checks_parallel.py
(copied into a scratch tools/ beside a copy of the test) fails at the first new case:
AssertionError: ('path', '...case_bom_path_bom\x.txt:1: script path does not exist: \ufeff...echo.py').

Not run: Linux (the new cases use explicit BOM bytes, os.path and "wb" writes, no
platform encoder default); the full CI workflow.

Evidence and follow-up

No open PR touches run_checks_parallel (gh pr list -R R0Y00/Xbox2Windows --state open --search "run_checks_parallel" returned nothing). tests/checks/README.md says nothing about encoding.
Impact is modest: the old behaviour was a clean but misleading error, never a wrong result or a
silently skipped check.

AI-assisted.

**@⁠RenzoWit35** on GitHub · 2026-11-26 11:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2810) `RenzoWit35:tooling/run-checks-listing-bom` → `main` · +23 −2 · 2 files · 1 commits · merged 2026-11-26 11:09 UTC ## Change `read_check_files` in `tools/run_checks_parallel.py` (the code behind `--from-dir`, which reads the fragments under `tests/checks/`) read each listing as plain `utf-8`. A listing saved with a UTF-8 byte-order mark (Notepad, or Windows PowerShell 5.1 `Set-Content -Encoding UTF8`) therefore kept U+FEFF at the start of line 1. Two symptoms, both a clean refusal rather than a wrong result: - a script path on line 1 was reported missing: `x.txt:1: script path does not exist: \ufeff<path>`; - a comment or blank first line was not recognised as one (`\ufeff#` is not `#`), so the comment was treated as a script path and refused the same way. The error text gives no hint that a BOM is the cause. The listing is now read as `utf-8-sig`, so a leading BOM is ignored. This is the same treatment `tests/docs_links_check.py` and `tests/rdna2_tools_check.py` (BOM-skipping assembly parser) already use. Nothing else about parsing changes (comment rule, argument splitting, duplicate and missing-script refusals, empty-run behaviour). The `read_check_files` docstring now says a leading BOM is skipped. `tests/run_checks_fragments_check.py` gains cases: for a listing whose line 1 is a script path, a comment, or a blank line, the listing with a BOM (written as the explicit bytes `\xef\xbb\xbf`) and the same listing without one both run the script with its argument and report `all 1 checks passed`. ## Verification Repro on `origin/main` (temporary directory, `ok.py` prints `ok ran`; exit code, then output): - BOM, path on line 1: exit 1, `x.txt:1: script path does not exist: \ufeff<T>\ok.py` - no BOM, same path: exit 0, `all 1 checks passed` - BOM, `# note` then path: exit 1, `x.txt:1: script path does not exist: \ufeff#` - BOM, blank line then path: exit 1, `x.txt:1: script path does not exist: \ufeff` - no BOM, `# note` then path: exit 0 With the change, all five exit 0 with `all 1 checks passed`. Commands (from the worktree root, `out/pe-env` Python 3.14.5, Windows 11): - `python -B tests/run_checks_fragments_check.py` -> `run_checks_fragments_check ok`, exit 0 - `python -B tests/run_checks_parallel_check.py` -> `run_checks_parallel_check: ok` Negative control: the new test file run against `git show origin/main:tools/run_checks_parallel.py` (copied into a scratch `tools/` beside a copy of the test) fails at the first new case: `AssertionError: ('path', '...case_bom_path_bom\x.txt:1: script path does not exist: \ufeff...echo.py')`. Not run: Linux (the new cases use explicit BOM bytes, `os.path` and `"wb"` writes, no platform encoder default); the full CI workflow. ## Evidence and follow-up No open PR touches `run_checks_parallel` (`gh pr list -R R0Y00/Xbox2Windows --state open --search "run_checks_parallel"` returned nothing). `tests/checks/README.md` says nothing about encoding. Impact is modest: the old behaviour was a clean but misleading error, never a wrong result or a silently skipped check. AI-assisted.
read_check_files read each fragment with utf-8, so a listing saved with a
BOM (Notepad, Windows PowerShell 5.1 Set-Content -Encoding UTF8) kept U+FEFF
on its first line: the first script path was reported missing, and a leading
comment or blank line was treated as a path. Read with utf-8-sig, as other
readers in the repository already do. Parsing is otherwise unchanged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:24:24 +00:00
github manually merged commit be45ce18e2 into gh-pr/2810/base 2026-11-27 01:24:26 +00:00
Author
Owner

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

Review of head be45ce18.

Checked against origin/main (6 commits behind; a trial merge with main is clean):

  • tools/run_checks_parallel.py: reading listings as utf-8-sig is the minimal correct fix. A leading BOM is dropped, nothing else in parsing changes. The docstring is updated.
  • tests/run_checks_fragments_check.py: new cases cover a BOM before a script path, before a comment and before a blank line, each compared with the same listing without a BOM. The BOM is written as explicit bytes, so the result does not depend on the platform.
  • No other open or merged PR covers this slice (searched "byte-order mark check listings").

Commands run locally on this head:

  • python3 -B tests/run_checks_fragments_check.py -> ok
  • python3 tests/docs_links_check.py -> ok
  • python3 tests/bidi_controls_check.py -> ok
  • git diff --check origin/main...HEAD -> clean
  • Mutation (utf-8-sig put back to utf-8): the check script fails (rc 1).
  • CI on this head: Linux Python checks, Windows build/test and gfx1013 fixtures all pass.

No blockers.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 11:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2810#pullrequestreview-6073075685) · **reviewed** Review of head be45ce18. Checked against origin/main (6 commits behind; a trial merge with main is clean): - `tools/run_checks_parallel.py`: reading listings as `utf-8-sig` is the minimal correct fix. A leading BOM is dropped, nothing else in parsing changes. The docstring is updated. - `tests/run_checks_fragments_check.py`: new cases cover a BOM before a script path, before a comment and before a blank line, each compared with the same listing without a BOM. The BOM is written as explicit bytes, so the result does not depend on the platform. - No other open or merged PR covers this slice (searched "byte-order mark check listings"). Commands run locally on this head: - `python3 -B tests/run_checks_fragments_check.py` -> ok - `python3 tests/docs_links_check.py` -> ok - `python3 tests/bidi_controls_check.py` -> ok - `git diff --check origin/main...HEAD` -> clean - Mutation (`utf-8-sig` put back to `utf-8`): the check script fails (rc 1). - CI on this head: Linux Python checks, Windows build/test and gfx1013 fixtures all pass. No blockers. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 11:09 UTC · original

Win2025 WARP receipt for head be45ce18 (Python-only PR; real-GPU run not available, RunPod stopped).

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit be45ce18e265e057683c51109db8ed196a2ce1ea:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev -- -j 2): 0.00s (configure 0.00s)
    • Test (ctest --preset dev -R 'run_checks' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.42s: ci_run_checks_parallel_cli_check 1.30s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release -- -j 2): 0.00s (configure 0.00s)
    • Test (ctest --preset release -R 'run_checks' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (1.42s: ci_run_checks_parallel_cli_check 1.31s)
  • Windows Python checks: tests/run_checks_fragments_check.py ok (1.9s)
  • Wall: 9.9s

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 11:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2810#issuecomment-7190346335) Win2025 WARP receipt for head be45ce18 (Python-only PR; real-GPU run not available, RunPod stopped). Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `be45ce18e265e057683c51109db8ed196a2ce1ea`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev -- -j 2`): `0.00s` (configure `0.00s`) - Test (`ctest --preset dev -R 'run_checks' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`1.42s`: `ci_run_checks_parallel_cli_check` `1.30s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release -- -j 2`): `0.00s` (configure `0.00s`) - Test (`ctest --preset release -R 'run_checks' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`1.42s`: `ci_run_checks_parallel_cli_check` `1.31s`) - **Windows Python checks**: `tests/run_checks_fragments_check.py` ok (`1.9s`) - Wall: `9.9s` AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.