turing_atlas: handle BOM/deep JSON, bool/unhashable deviceType, OSError/None stderr, and atomic --out (TURING-ATLAS-VALIDATION-AND-ATOMIC-IO) #1586

Merged
IlyassRS3 merged 1 commit from upstream-pr/1586 into main 2026-11-28 10:21:50 +00:00
IlyassRS3 commented 2026-11-25 05:14:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by IlyassRS3 on 2026-11-25T05:14:19Z.


Item: TURING-ATLAS-VALIDATION-AND-ATOMIC-IO (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch tools/turing_atlas.py).

Summary

  • Fix TypeError: 'NoneType' object is not subscriptable in validate_cases() when spirv-as fails with stderr=None, and report "missing" when spirv-val fails to launch (rv is None); catch OSError (including PermissionError) in run() rather than only FileNotFoundError.
  • Read VP_VULKANINFO_*.json with utf-8-sig (handling Windows UTF-8 BOM) and skip RecursionError on malformed deeply nested JSON instead of aborting vulkan_matrix().
  • Reject whitespace-only deviceName in _extract_profile() and guard deviceType lookup in _device_rank() to type(dtype) in (int, str) so unhashable values do not raise TypeError and bool (True == 1) does not falsely rank as VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU.
  • Publish --out atomically via file_mode.published_mode + replace_retry.replace (leaving any previous atlas intact on write failure and keeping direct writes for non-regular targets), enforce allow_nan=False, and accept optional argv=None in main().

Verification

  • python3 -W error -I tests/test_turing_atlas.py -v: 21/21 passed.
  • python3 -I tools/turing_atlas.py --help: passed.
  • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • python3 -I scripts/check_no_game_data.py tools/turing_atlas.py tests/test_turing_atlas.py: passed.
  • python3 -m compileall -q tools/turing_atlas.py tests/test_turing_atlas.py: passed.
  • Mutation check (running the new test suite against unpatched main:tools/turing_atlas.py): failures=2, errors=3 across all 5 new regression tests.

AI-assisted: yes
GPUs tested: none (synthetic vulkaninfo/SPIR-V mocks only, no game data)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5485598650 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1586). Originally posted by [IlyassRS3](https://github.com/IlyassRS3) on 2026-11-25T05:14:19Z. --- Item: `TURING-ATLAS-VALIDATION-AND-ATOMIC-IO` (unclaimed — coordination issue #14 is at GitHub's 2,500-comment cap with no successor open issue yet, and 0 open PRs touch `tools/turing_atlas.py`). ### Summary - Fix `TypeError: 'NoneType' object is not subscriptable` in `validate_cases()` when `spirv-as` fails with `stderr=None`, and report `"missing"` when `spirv-val` fails to launch (`rv is None`); catch `OSError` (including `PermissionError`) in `run()` rather than only `FileNotFoundError`. - Read `VP_VULKANINFO_*.json` with `utf-8-sig` (handling Windows UTF-8 BOM) and skip `RecursionError` on malformed deeply nested JSON instead of aborting `vulkan_matrix()`. - Reject whitespace-only `deviceName` in `_extract_profile()` and guard `deviceType` lookup in `_device_rank()` to `type(dtype) in (int, str)` so unhashable values do not raise `TypeError` and `bool` (`True == 1`) does not falsely rank as `VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU`. - Publish `--out` atomically via `file_mode.published_mode` + `replace_retry.replace` (leaving any previous atlas intact on write failure and keeping direct writes for non-regular targets), enforce `allow_nan=False`, and accept optional `argv=None` in `main()`. ### Verification - `python3 -W error -I tests/test_turing_atlas.py -v`: 21/21 passed. - `python3 -I tools/turing_atlas.py --help`: passed. - `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. - `python3 -I scripts/check_no_game_data.py tools/turing_atlas.py tests/test_turing_atlas.py`: passed. - `python3 -m compileall -q tools/turing_atlas.py tests/test_turing_atlas.py`: passed. - Mutation check (running the new test suite against unpatched `main:tools/turing_atlas.py`): `failures=2, errors=3` across all 5 new regression tests. AI-assisted: yes GPUs tested: none (synthetic vulkaninfo/SPIR-V mocks only, no game data)
copilot-pull-request-reviewer[bot] commented 2026-11-25 05:14:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T05:14:29Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6052191275 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1586#pullrequestreview-6052191275). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-25T05:14:29Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
MoonEyes commented 2026-11-28 10:21:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:21:32Z.


Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237844046 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1586#issuecomment-7237844046). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T10:21:32Z. --- Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18). Targeted batch of 18 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13. AI-assisted (Claude Code, Claude Opus 5.5)
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
ProjectLeonida/mandy!1586
No description provided.