tooling: scan Zig, SPIR-V assembly and assembler sources in the bidi controls check #1527

Merged
RenzoWit35 merged 2 commits from upstream-pr/1534 into main 2026-11-25 14:46:18 +00:00
RenzoWit35 commented 2026-11-24 13:43:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T13:43:42Z.


Change

tests/bidi_controls_check.py scans tracked source files, scripts and build/CI configuration for explicit bidirectional controls (#254). Its suffix list omits three source kinds that the repository now tracks:

Suffix Files on main Example
.spvasm 13 tests/spirv_window/address_float.spvasm
.zig 3 tests/cpu/archive/reader.zig
.s 3 tests/compute_mimg_msaa.s

This adds .zig, .spvasm and .s to SOURCE_SUFFIXES. Nothing else about the scope changes: data tables (.tsv, .json), images, licence files, .txt, .svg, .gitignore, the .patch file and Markdown stay out of scope, and there is no binary-extension list.

.s is the one kind beyond the two named in review. The three files are assembler sources that the fixtures assemble with llvm-mc, the same kind as the .asm files already listed. It is a one-token removal if it should stay out.

self_test() reuses its existing synthetic controls in a .zig, a .spvasm and a .s file, each of which must be reported, and asserts that a .tsv data table with a control is not in scope.

The first commit on this branch replaced the allowlist with an exclusion list. The second commit takes that back; the net diff against main is the suffix line and the self-test cases (+10/-2 in one file).

Verification

Windows 11, Python 3.14.5.

  • python -B tests/bidi_controls_check.py on this branch: Self-test passed. then Checked 1258 tracked source, script and build/CI files: no bidirectional controls. (exit 0).
  • Applied to the file list and contents of origin/main be484d0f: scope goes from 1255 to 1274 files (13 .spvasm, 3 .zig, 3 .s added, none removed), and no control is found in them.
  • Negative control: with the suffix line as on main and the new self-test, --self-test fails with an AssertionError; the three new findings are missing from the list.
  • python -B tests/docs_links_check.py: Checked 16 Markdown files and 340 links. (exit 0).

Not run: the other pure-Python checks, the C++ build and ctest (only this script changes; it is already in the python-linux job and in AGENTS.md).

Evidence and follow-up

The synthetic files are written by the self-test into a temporary directory. No issue is linked beyond the scope decision in #254.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583160606 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1534). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T13:43:42Z. --- ## Change `tests/bidi_controls_check.py` scans tracked source files, scripts and build/CI configuration for explicit bidirectional controls (#254). Its suffix list omits three source kinds that the repository now tracks: | Suffix | Files on `main` | Example | |---|---|---| | `.spvasm` | 13 | `tests/spirv_window/address_float.spvasm` | | `.zig` | 3 | `tests/cpu/archive/reader.zig` | | `.s` | 3 | `tests/compute_mimg_msaa.s` | This adds `.zig`, `.spvasm` and `.s` to `SOURCE_SUFFIXES`. Nothing else about the scope changes: data tables (`.tsv`, `.json`), images, licence files, `.txt`, `.svg`, `.gitignore`, the `.patch` file and Markdown stay out of scope, and there is no binary-extension list. `.s` is the one kind beyond the two named in review. The three files are assembler sources that the fixtures assemble with `llvm-mc`, the same kind as the `.asm` files already listed. It is a one-token removal if it should stay out. `self_test()` reuses its existing synthetic controls in a `.zig`, a `.spvasm` and a `.s` file, each of which must be reported, and asserts that a `.tsv` data table with a control is not in scope. The first commit on this branch replaced the allowlist with an exclusion list. The second commit takes that back; the net diff against `main` is the suffix line and the self-test cases (+10/-2 in one file). ## Verification Windows 11, Python 3.14.5. - `python -B tests/bidi_controls_check.py` on this branch: `Self-test passed.` then `Checked 1258 tracked source, script and build/CI files: no bidirectional controls.` (exit 0). - Applied to the file list and contents of `origin/main` be484d0f: scope goes from 1255 to 1274 files (13 `.spvasm`, 3 `.zig`, 3 `.s` added, none removed), and no control is found in them. - Negative control: with the suffix line as on `main` and the new self-test, `--self-test` fails with an `AssertionError`; the three new findings are missing from the list. - `python -B tests/docs_links_check.py`: `Checked 16 Markdown files and 340 links.` (exit 0). Not run: the other pure-Python checks, the C++ build and ctest (only this script changes; it is already in the `python-linux` job and in `AGENTS.md`). ## Evidence and follow-up The synthetic files are written by the self-test into a temporary directory. No issue is linked beyond the scope decision in #254. AI-assisted.
upstream-sync changed title from [PR #1534] tooling: scan every tracked text file in the bidi controls check to [PR #1534] tooling: scan Zig, SPIR-V assembly and assembler sources in the bidi controls check 2026-11-24 15:01:54 +00:00
R0Y00 commented 2026-11-24 15:01:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:26:01Z.

Review: CHANGES_REQUESTED


Please keep the #254 boundary for explicit bidi controls in source, scripts and build/CI configuration. Zig and SPIR-V assembly belong in that set and the existing synthetic controls can cover them. Scanning data tables and every future binary extension would also make unrelated tracked inputs fail, which the prior scope decision excluded. Please limit this PR to omitted source and configuration kinds.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041002778 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1534#pullrequestreview-6041002778). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:26:01Z. **Review:** CHANGES_REQUESTED --- Please keep the #254 boundary for explicit bidi controls in source, scripts and build/CI configuration. Zig and SPIR-V assembly belong in that set and the existing synthetic controls can cover them. Scanning data tables and every future binary extension would also make unrelated tracked inputs fail, which the prior scope decision excluded. Please limit this PR to omitted source and configuration kinds.
RenzoWit35 commented 2026-11-24 15:02:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T14:41:01Z.


Thanks, that makes sense. I went too far with the exclusion list.

The branch now keeps the #254 allowlist and only adds .zig, .spvasm and .s. The .s one is my own addition: three assembler fixtures, the same kind as the .asm files already listed. Happy to drop it if you'd rather keep this to the two you named.

I also updated the title and description so they match what the PR does now.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134776493 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1534#issuecomment-7134776493). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T14:41:01Z. --- Thanks, that makes sense. I went too far with the exclusion list. The branch now keeps the #254 allowlist and only adds `.zig`, `.spvasm` and `.s`. The `.s` one is my own addition: three assembler fixtures, the same kind as the `.asm` files already listed. Happy to drop it if you'd rather keep this to the two you named. I also updated the title and description so they match what the PR does now.
tedin7 commented 2026-11-24 16:03:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:50:19Z.

Review: COMMENTED


Technical review (Linux only; no Windows run needed for this change, but none was done).

Checked out the PR head (6027e253, "keep the bidi check to source kinds and add Zig, SPIR-V and .s") in a clean tree. This head already follows the earlier scope request: the data-table scan is gone and only .s, .spvasm and .zig are added to SOURCE_SUFFIXES.

What I ran:

  • tests/bidi_controls_check.py: self-test passes, and the real run reports "Checked 1258 tracked source, script and build/CI files: no bidirectional controls."
  • Coverage of the tracked tree by suffix: in scope are .py (471), .cpp (226), .def (205), .asm (192), .h, .hlsl, .spvasm (13), .s (3), .zig (3) and the other source/script/config kinds. Still out of scope: .md, .tsv, .svg, .png, .patch (1), two .json files, two .txt files and the licence files. I scanned those that decode as UTF-8 for the ten controls and found none, so today's tree is clean either way.
  • The new self-test content covers each added kind plus a .tsv that must stay out of scope, and the exact finding list (path, line, code point and name) is asserted.

Local mutation check on tests/bidi_controls_check.py (each reverted afterwards; tree clean):

  • drop .zig, drop .s, drop .spvasm from SOURCE_SUFFIXES: each caught by the self-test assertion.
  • put .tsv in scope: caught.
  • make the suffix test case-sensitive (remove .lower()): not caught. No control uses an upper-case suffix such as .S or .PY, so the case-insensitive match is unpinned. Today no tracked file needs it.

Suggestion (non-blocking): add one control file with an upper-case suffix (for example tests/KERNEL.S) to the synthetic set, so the .lower() behaviour stays covered.

Observation (no change requested): .patch is the one tracked kind that carries code and is not scanned. That matches the scope decision in the earlier review, so I only note it.

No defects found.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6042620100 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1534#pullrequestreview-6042620100). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:50:19Z. **Review:** COMMENTED --- Technical review (Linux only; no Windows run needed for this change, but none was done). Checked out the PR head (`6027e253`, "keep the bidi check to source kinds and add Zig, SPIR-V and .s") in a clean tree. This head already follows the earlier scope request: the data-table scan is gone and only `.s`, `.spvasm` and `.zig` are added to `SOURCE_SUFFIXES`. What I ran: - `tests/bidi_controls_check.py`: self-test passes, and the real run reports "Checked 1258 tracked source, script and build/CI files: no bidirectional controls." - Coverage of the tracked tree by suffix: in scope are `.py` (471), `.cpp` (226), `.def` (205), `.asm` (192), `.h`, `.hlsl`, `.spvasm` (13), `.s` (3), `.zig` (3) and the other source/script/config kinds. Still out of scope: `.md`, `.tsv`, `.svg`, `.png`, `.patch` (1), two `.json` files, two `.txt` files and the licence files. I scanned those that decode as UTF-8 for the ten controls and found none, so today's tree is clean either way. - The new self-test content covers each added kind plus a `.tsv` that must stay out of scope, and the exact finding list (path, line, code point and name) is asserted. Local mutation check on `tests/bidi_controls_check.py` (each reverted afterwards; tree clean): - drop `.zig`, drop `.s`, drop `.spvasm` from `SOURCE_SUFFIXES`: each caught by the self-test assertion. - put `.tsv` in scope: caught. - make the suffix test case-sensitive (remove `.lower()`): **not caught**. No control uses an upper-case suffix such as `.S` or `.PY`, so the case-insensitive match is unpinned. Today no tracked file needs it. Suggestion (non-blocking): add one control file with an upper-case suffix (for example `tests/KERNEL.S`) to the synthetic set, so the `.lower()` behaviour stays covered. Observation (no change requested): `.patch` is the one tracked kind that carries code and is not scanned. That matches the scope decision in the earlier review, so I only note it. No defects found. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 17:01:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:44:55Z.

Review: COMMENTED


Supplementary verification of head 6027e2534d32039b3e650e840a7e21604af5d5f6 (adds the Windows Server 2025 run and more mutations to the earlier Linux review).

Linux:

  • git diff --check origin/main...HEAD: clean.
  • python3 tests/docs_links_check.py: Checked 16 Markdown files and 340 links.
  • python3 tests/bidi_controls_check.py: self-test passes; Checked 1258 tracked source, script and build/CI files: no bidirectional controls.

Windows Server 2025 (Build 26100, MSVC 14.44.35207) via x2w_pipe.py win2025 1534: tests/bidi_controls_check.py self-test passed, 1258 files, no controls, exit 0 (1.0s). The change touches only this Python check and has no downstream C++ target, so there is no Debug or Release /O2 build or ctest to run (0 of 0 downstream tests).

Local mutation checks on tests/bidi_controls_check.py, each reverted with git checkout -- . (tree clean afterwards):

  1. drop .zig from SOURCE_SUFFIXES: self-test fails (AssertionError, reader.zig finding missing).
  2. drop .s: fails (kernel.s finding missing).
  3. drop .spvasm: fails (case.spvasm finding missing).
  4. add .tsv to scope: fails (the out-of-scope table.tsv assertion).
  5. delete the tests/kernel.s entry from the expected finding list: fails.

The diff only adds suffixes and synthetic cases; no existing assertion is weakened, and the test writes only inside its temp directory. The earlier note about the unpinned .lower() remains non-blocking and pre-existing.

0 P1, 0 P2.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043510592 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1534#pullrequestreview-6043510592). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T16:44:55Z. **Review:** COMMENTED --- Supplementary verification of head `6027e2534d32039b3e650e840a7e21604af5d5f6` (adds the Windows Server 2025 run and more mutations to the earlier Linux review). Linux: - `git diff --check origin/main...HEAD`: clean. - `python3 tests/docs_links_check.py`: Checked 16 Markdown files and 340 links. - `python3 tests/bidi_controls_check.py`: self-test passes; Checked 1258 tracked source, script and build/CI files: no bidirectional controls. Windows Server 2025 (Build 26100, MSVC 14.44.35207) via `x2w_pipe.py win2025 1534`: `tests/bidi_controls_check.py` self-test passed, 1258 files, no controls, exit 0 (1.0s). The change touches only this Python check and has no downstream C++ target, so there is no Debug or Release `/O2` build or ctest to run (`0 of 0 downstream tests`). Local mutation checks on `tests/bidi_controls_check.py`, each reverted with `git checkout -- .` (tree clean afterwards): 1. drop `.zig` from `SOURCE_SUFFIXES`: self-test fails (AssertionError, `reader.zig` finding missing). 2. drop `.s`: fails (`kernel.s` finding missing). 3. drop `.spvasm`: fails (`case.spvasm` finding missing). 4. add `.tsv` to scope: fails (the out-of-scope `table.tsv` assertion). 5. delete the `tests/kernel.s` entry from the expected finding list: fails. The diff only adds suffixes and synthetic cases; no existing assertion is weakened, and the test writes only inside its temp directory. The earlier note about the unpinned `.lower()` remains non-blocking and pre-existing. 0 P1, 0 P2. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 15:01:23 +00:00
R0Y00 commented 2026-11-25 15:01:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T14:46:11Z.

Review: APPROVED


Rechecked this head. The tracked-source filter now adds Zig and the two assembler source forms while keeping data tables out of scope. The synthetic controls and the Windows scan of 1,258 tracked entries both passed. This clears the earlier scope finding.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6059809249 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1534#pullrequestreview-6059809249). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T14:46:11Z. **Review:** APPROVED --- Rechecked this head. The tracked-source filter now adds Zig and the two assembler source forms while keeping data tables out of scope. The synthetic controls and the Windows scan of 1,258 tracked entries both passed. This clears the earlier scope finding.
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!1527
No description provided.