TEST-NATIVE-FOLDER-FAILURES: cover Windows short-path lookup failures #548

Manually merged
github merged 1 commit from gh-pr/548/head into gh-pr/548/base 2026-11-26 09:07:48 +00:00
Owner

@⁠RedMiS7 on GitHub · 2026-11-24 07:30 UTC · original
RedMiS7:codex/test-native-folder-failures → main · +53 −0 · 1 files · 1 commits · merged 2026-11-24 09:25 UTC

Claimed in the coordination issue as: TEST-NATIVE-FOLDER-FAILURES (claim)

Depends on: #483 (the existing UTF-8-code-page test failure on this Windows host; its fix is not copied into this PR)

What and why

Add four Windows-only tests in NativeFolderLookup to exercise five controlled outcomes of GetShortPathNameW:

  • A zero return must reject even usable text left in the output buffer.
  • A return equal to the buffer capacity must be rejected.
  • A return greater than the buffer capacity must be rejected.
  • A returned short path outside the explicitly selected ASCII code page must be rejected.
  • A successful ASCII short path must be returned unchanged as a positive control.

The API is mocked, so these tests do not create directories or depend on a volume keeping 8.3 short names. The existing code-page tests are untouched, and there are no runtime changes.

Tested

Windows 11 build 26200, CPython 3.10.11 and Anaconda Python 3.13.9; CPU only, no game files.

  • python -I tests/test_native_tool_paths.py NativeFolderLookup: 4 tests passed, no skips.
  • py -3.13 -I tests/test_native_tool_paths.py NativeFolderLookup: 4 tests passed, no skips.
  • In-memory mutation checks detected all five deliberate regressions: accepting zero, accepting an exactly full buffer, ignoring the upper bound, ignoring the code page, and rejecting every lookup. No mutated runtime code is committed.
  • py -3.13 -I tests/test_native_tool_paths.py: 12 tests, 8 passed, 1 failed, 3 skipped. The failure is the original NativeFolder.test_a_folder_outside_the_code_page_gets_its_short_name_or_none, also reproduced before this change on the same base. The three skips need spirv-as and spirv-val.
  • With #483's three test-only edits applied in memory: 13 tests, 10 passed, 3 skipped, no failures. Those edits are not in this branch.
  • py -3.13 -I scripts/check_no_game_data.py tests/test_native_tool_paths.py and git diff --check: passed.
  • py -3.13 -I scripts/run_semantic_tests.py tests/semantic: 465 files, 6105 tests, 2 files failed in 289 s with 12 jobs. Both test_sopc_validation and test_unary_f16_validation report missing spirv-as / spirv-val on PATH. This PR does not change the translator or any semantic-suite file.

GPUs tested: n/a (mocked Windows API and CPU tests only)

AI-assisted: yes (OpenAI Codex)

Checklist

  • Based on current main at d42773d07; GitHub reports Able to merge.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • No new translator rule (contract-table change not applicable).

Draft while #483 remains open and the environment limitations above remain recorded.

**@⁠RedMiS7** on GitHub · 2026-11-24 07:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/548) `RedMiS7:codex/test-native-folder-failures` → `main` · +53 −0 · 1 files · 1 commits · merged 2026-11-24 09:25 UTC Claimed in the coordination issue as: TEST-NATIVE-FOLDER-FAILURES ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) Depends on: #483 (the existing UTF-8-code-page test failure on this Windows host; its fix is not copied into this PR) ### What and why Add four Windows-only tests in `NativeFolderLookup` to exercise five controlled outcomes of `GetShortPathNameW`: - A zero return must reject even usable text left in the output buffer. - A return equal to the buffer capacity must be rejected. - A return greater than the buffer capacity must be rejected. - A returned short path outside the explicitly selected ASCII code page must be rejected. - A successful ASCII short path must be returned unchanged as a positive control. The API is mocked, so these tests do not create directories or depend on a volume keeping 8.3 short names. The existing code-page tests are untouched, and there are no runtime changes. ### Tested Windows 11 build 26200, CPython 3.10.11 and Anaconda Python 3.13.9; CPU only, no game files. - `python -I tests/test_native_tool_paths.py NativeFolderLookup`: 4 tests passed, no skips. - `py -3.13 -I tests/test_native_tool_paths.py NativeFolderLookup`: 4 tests passed, no skips. - In-memory mutation checks detected all five deliberate regressions: accepting zero, accepting an exactly full buffer, ignoring the upper bound, ignoring the code page, and rejecting every lookup. No mutated runtime code is committed. - `py -3.13 -I tests/test_native_tool_paths.py`: 12 tests, 8 passed, 1 failed, 3 skipped. The failure is the original `NativeFolder.test_a_folder_outside_the_code_page_gets_its_short_name_or_none`, also reproduced before this change on the same base. The three skips need `spirv-as` and `spirv-val`. - With #483's three test-only edits applied in memory: 13 tests, 10 passed, 3 skipped, no failures. Those edits are not in this branch. - `py -3.13 -I scripts/check_no_game_data.py tests/test_native_tool_paths.py` and `git diff --check`: passed. - `py -3.13 -I scripts/run_semantic_tests.py tests/semantic`: 465 files, 6105 tests, 2 files failed in 289 s with 12 jobs. Both `test_sopc_validation` and `test_unary_f16_validation` report missing `spirv-as` / `spirv-val` on PATH. This PR does not change the translator or any semantic-suite file. GPUs tested: n/a (mocked Windows API and CPU tests only) AI-assisted: yes (OpenAI Codex) ### Checklist - [x] Based on current `main` at `d42773d07`; GitHub reports Able to merge. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [x] No new translator rule (contract-table change not applicable). Draft while #483 remains open and the environment limitations above remain recorded.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:07:43 +00:00
github manually merged commit 9be0932042 into gh-pr/548/base 2026-11-26 09:07:48 +00:00
Author
Owner

@⁠kawaii-shakal on GitHub · 2026-11-24 07:55 UTC · original

Reviewed head 9be0932042 (AI-assisted review). Environment: Linux (WSL2), Python venv, no Windows, no GPU.

What ran:

  • python -I tests/test_native_tool_paths.py: OK, but all 8 tests skipped on Linux, the 4 new ones included (skipUnless(os.name == "nt")).
  • To run the new NativeFolderLookup class anyway, I used a small harness. It put a stub ctypes.windll.kernel32 in place, cleared the class skip and patched os.name to "nt" for the call. All 4 tests pass on the unchanged code.

Mutations to native_folder in scripts/run_gpu_tests.py (all caught):

  • 0 < n -> 0 <= n: caught (failed-lookup test)
  • n < len(buf) -> n <= len(buf): caught (insufficient-buffer test, extra=0)
  • n <= len(buf) + 1: caught (both subtests)
  • dropping the fits(short) check: caught (code-page test)
  • ignoring the return value (short = buf.value): caught (3 failures)

Findings: none blocking. Each new test covers a separate branch of the return-value and code-page checks, and nothing duplicates an existing test.

Not tested: a real GetShortPathNameW call on Windows, or a volume with 8.3 names turned off. I could only run the tests through the Linux harness above.


Review written by Claude (Claude Code, Opus 5.5), an AI agent, posted from a contributor's account.

**@⁠kawaii-shakal** on GitHub · 2026-11-24 07:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/548#issuecomment-7125519934) Reviewed head 9be0932042e1af23abc1e4837f8a0b3552ea74bb (AI-assisted review). Environment: Linux (WSL2), Python venv, no Windows, no GPU. What ran: - `python -I tests/test_native_tool_paths.py`: OK, but all 8 tests skipped on Linux, the 4 new ones included (`skipUnless(os.name == "nt")`). - To run the new `NativeFolderLookup` class anyway, I used a small harness. It put a stub `ctypes.windll.kernel32` in place, cleared the class skip and patched `os.name` to `"nt"` for the call. All 4 tests pass on the unchanged code. Mutations to `native_folder` in `scripts/run_gpu_tests.py` (all caught): - `0 < n` -> `0 <= n`: caught (failed-lookup test) - `n < len(buf)` -> `n <= len(buf)`: caught (insufficient-buffer test, extra=0) - `n <= len(buf) + 1`: caught (both subtests) - dropping the `fits(short)` check: caught (code-page test) - ignoring the return value (`short = buf.value`): caught (3 failures) Findings: none blocking. Each new test covers a separate branch of the return-value and code-page checks, and nothing duplicates an existing test. Not tested: a real `GetShortPathNameW` call on Windows, or a volume with 8.3 names turned off. I could only run the tests through the Linux harness above. --- _Review written by Claude (Claude Code, Opus 5.5), an AI agent, posted from a contributor's account._
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 09:25 UTC · original

Merging. Why merged: four Windows tests for run_gpu_tests.native_folder's short-path lookup failures (failed lookup, too-small buffer, name outside the code page, success).
Why it's good: test-only (mocks GetShortPathNameW); test_native_tool_paths 5 -> 9 passed; clean on main 7430f59; consistency set 565/0 before and after.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-24 09:25 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/548#issuecomment-7127397113) Merging. Why merged: four Windows tests for run_gpu_tests.native_folder's short-path lookup failures (failed lookup, too-small buffer, name outside the code page, success). Why it's good: test-only (mocks GetShortPathNameW); test_native_tool_paths 5 -> 9 passed; clean on main 7430f59; consistency set 565/0 before and after. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.