runtime: add unit test suite for console identity and registry ConsoleMode mapping (RT-CONSOLE-IDENTITY-COVERAGE) #2034

Closed
abnalstlll-byte wants to merge 1 commit from upstream-pr/2034 into main
abnalstlll-byte commented 2026-11-25 18:36:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T18:36:52Z.


Claimed in the coordination issue as: RT-CONSOLE-IDENTITY-COVERAGE (claim)

What and why

runtime/shims/console_identity.h is the single source of truth for console device type (configured_device_type()) and OEM registry ConsoleMode mapping (console_mode_for()), ensuring XSystemGetDeviceType and registry queries HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM\ConsoleMode never disagree.

Previously, console_identity.h lacked a dedicated standalone unit test exercising all device type enums and environment variable boundary conditions.

This adds runtime/test/console_identity_test.cpp verifying:

  1. console_mode_for:
    • Returns true and correct DWORD values for Xbox Series consoles: Lockhart (0x60), Anaconda (0x64), Devkit (0x68).
    • Returns false for non-console / Xbox One types (Unknown, Pc, XboxOne, XboxOneS, XboxOneX, XboxOneXDevkit) and out-of-range values, leaving them to the host registry.
  2. configured_device_type:
    • Defaults to Series X (XboxScarlettAnaconda, 7) when LEONIDA_DEVICE_TYPE is unset, empty, or outside 0..8.
    • Accurately parses values 0..8.
    • Treats non-numeric text strings as 0 per documented contract.
    • Handles oversized strings (>16 bytes) gracefully without buffer overrun.
  3. Cross-subsystem consistency between configured_device_type() and console_mode_for().

Registers console_identity_test and CTest console_identity in runtime/CMakeLists.txt.

Tested

  • Unit test execution: 41/41 checks passed (0 failures).
  • python -I tests/test_ci_registration.py: 16/16 pass.
  • python -I tests/test_text_write_line_endings.py: 3/3 pass.
  • python -I scripts/check_no_game_data.py: clean (0 violations, no game data).

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5497024270 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2034). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-25T18:36:52Z. --- Claimed in the coordination issue as: RT-CONSOLE-IDENTITY-COVERAGE ([claim](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171091676)) ### What and why `runtime/shims/console_identity.h` is the single source of truth for console device type (`configured_device_type()`) and OEM registry `ConsoleMode` mapping (`console_mode_for()`), ensuring `XSystemGetDeviceType` and registry queries `HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM\ConsoleMode` never disagree. Previously, `console_identity.h` lacked a dedicated standalone unit test exercising all device type enums and environment variable boundary conditions. This adds `runtime/test/console_identity_test.cpp` verifying: 1. `console_mode_for`: - Returns `true` and correct DWORD values for Xbox Series consoles: Lockhart (`0x60`), Anaconda (`0x64`), Devkit (`0x68`). - Returns `false` for non-console / Xbox One types (Unknown, Pc, XboxOne, XboxOneS, XboxOneX, XboxOneXDevkit) and out-of-range values, leaving them to the host registry. 2. `configured_device_type`: - Defaults to Series X (`XboxScarlettAnaconda`, 7) when `LEONIDA_DEVICE_TYPE` is unset, empty, or outside 0..8. - Accurately parses values 0..8. - Treats non-numeric text strings as 0 per documented contract. - Handles oversized strings (>16 bytes) gracefully without buffer overrun. 3. Cross-subsystem consistency between `configured_device_type()` and `console_mode_for()`. Registers `console_identity_test` and CTest `console_identity` in `runtime/CMakeLists.txt`. ### Tested - Unit test execution: `41/41 checks passed` (0 failures). - `python -I tests/test_ci_registration.py`: 16/16 pass. - `python -I tests/test_text_write_line_endings.py`: 3/3 pass. - `python -I scripts/check_no_game_data.py`: clean (0 violations, no game data). AI-assisted (Claude Code)
zmasi commented 2026-11-28 12:50:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:50:51Z.


Verified on Windows 11 (10.0.26200.9974) with MSVC 19.44.35228 (x64, /std:c++20 /EHsc /W4 /permissive- /utf-8 /O2) against main d48a957bb + ba4d61e12b (claim #2570#issuecomment-7239425776):

  • Line-by-line diff audit: Clean (runtime/CMakeLists.txt, runtime/test/console_identity_test.cpp); adds dedicated Win32 unit coverage for rt::shims::console_identity::console_mode_for (0x60/0x64/0x68 vs non-console device types) and configured_device_type() (LEONIDA_DEVICE_TYPE 0..8, non-numeric -> 0, out-of-range/empty/oversized -> Series X 7) with RAII environment restoration. check_no_game_data.py clean.
  • Red (d48a957bb / fault injection): console_identity_test.cpp is absent on main (C1083), and injecting a 0x64 -> 0x60 regression in console_identity.h fails Red (rc=1, FAIL Anaconda mode is 0x64, 39/41 checks passed).
  • Green (d48a957bb + ba4d61e12b merge): Auto-merges cleanly (rc=0), compiles with 0 warnings under /W4 /permissive-, and passes (41/41 checks passed, rc=0).
  • Coordination note with #2039: Both #2034 and #2039 insert adjacent blocks at the same lines of runtime/CMakeLists.txt (git merge-tree rc=1 trivial additive conflict once the first merges).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239507970 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2034#issuecomment-7239507970). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T12:50:51Z. --- Verified on Windows 11 (`10.0.26200.9974`) with MSVC `19.44.35228` (`x64`, `/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`) against `main` `d48a957bb` + `ba4d61e12b` (claim `#2570#issuecomment-7239425776`): - **Line-by-line diff audit**: Clean (`runtime/CMakeLists.txt`, `runtime/test/console_identity_test.cpp`); adds dedicated Win32 unit coverage for `rt::shims::console_identity::console_mode_for` (`0x60`/`0x64`/`0x68` vs non-console device types) and `configured_device_type()` (`LEONIDA_DEVICE_TYPE` `0..8`, non-numeric -> `0`, out-of-range/empty/oversized -> Series X `7`) with RAII environment restoration. `check_no_game_data.py` clean. - **Red (`d48a957bb` / fault injection)**: `console_identity_test.cpp` is absent on `main` (`C1083`), and injecting a `0x64 -> 0x60` regression in `console_identity.h` fails Red (`rc=1`, `FAIL Anaconda mode is 0x64`, `39/41 checks passed`). - **Green (`d48a957bb` + `ba4d61e12b` merge)**: Auto-merges cleanly (`rc=0`), compiles with `0` warnings under `/W4 /permissive-`, and passes (`41/41 checks passed`, `rc=0`). - **Coordination note with `#2039`**: Both `#2034` and `#2039` insert adjacent blocks at the same lines of `runtime/CMakeLists.txt` (`git merge-tree` `rc=1` trivial additive conflict once the first merges). AI-assisted.
OreoFR commented 2026-11-29 02:39:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T02:39:25Z.


Verified by OreoFR

  • Base: main aa918e5d9 + PR head ba4d61e12
  • Test: ctest -R ^console_identity$
  • Red on main: passes (test-only PR, the new test covers behaviour already on main)
  • Green with the PR: passes; package builds, full ctest shows no new failure
  • Verdict: NO RED (test-only PR, no fix to show)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

Note: shares runtime/CMakeLists.txt with the open #2566; a rebase may be needed if #2566 lands first.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249564733 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2034#issuecomment-7249564733). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T02:39:25Z. --- **Verified by OreoFR** - Base: main `aa918e5d9` + PR head `ba4d61e12` - Test: `ctest -R ^console_identity$` - Red on main: passes (test-only PR, the new test covers behaviour already on main) - Green with the PR: passes; package builds, full ctest shows no new failure - Verdict: NO RED (test-only PR, no fix to show) - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 Note: shares `runtime/CMakeLists.txt` with the open #2566; a rebase may be needed if #2566 lands first. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 16:41:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:41:29Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318043597 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2034#issuecomment-7318043597). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:41:29Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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!2034
No description provided.