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

Open
opened 2026-11-26 20:21:50 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1586
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/turing-atlas-validation-and-atomic-io


📝 Commits (1)

  • 4694482 turing_atlas: handle BOM/deep JSON, bool/unhashable deviceType, OSError/None stderr, and atomic --out

📊 Changes

2 files changed (+166 additions, -15 deletions)

View changed files

📝 tests/test_turing_atlas.py (+114 -0)
📝 tools/turing_atlas.py (+52 -15)

📄 Description

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)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1586 **Author:** [@IlyassRS3](https://github.com/IlyassRS3) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/turing-atlas-validation-and-atomic-io` --- ### 📝 Commits (1) - [`4694482`](https://github.com/ubiquitarianism/leonida/commit/4694482b7749088d985c390ba6d8558fe6abe57e) turing_atlas: handle BOM/deep JSON, bool/unhashable deviceType, OSError/None stderr, and atomic --out ### 📊 Changes **2 files changed** (+166 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_turing_atlas.py` (+114 -0) 📝 `tools/turing_atlas.py` (+52 -15) </details> ### 📄 Description 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1606
No description provided.