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

Open
github-bot wants to merge 1 commit from github-bot/gh-2034 into main AGit
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-25 18:36 UTC · original
abnalstlll-byte:feat/rt-console-identity-coverage → main · +212 −0 · 2 files · 1 commits · open

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)

**@⁠abnalstlll-byte** on GitHub · 2026-11-25 18:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2034) `abnalstlll-byte:feat/rt-console-identity-coverage` → `main` · +212 −0 · 2 files · 1 commits · open Claimed in the coordination issue as: RT-CONSOLE-IDENTITY-COVERAGE ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608)) ### 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)
Add standalone CPU-only unit test runtime/test/console_identity_test.cpp covering configured_device_type, console_mode_for, and cross-subsystem consistency across all device types and environment variable inputs.

Register console_identity_test executable and CTest in runtime/CMakeLists.txt.

AI-assisted (Claude Code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:15:29 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2034/head:github-bot/gh-2034'
git switch 'github-bot/gh-2034'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2034'
git switch 'github-bot/gh-2034'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2034'
git switch 'github-bot/gh-2034'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2034'
git switch 'main'
git merge --squash 'github-bot/gh-2034'
git switch 'main'
git merge --ff-only 'github-bot/gh-2034'
git switch 'main'
git merge 'github-bot/gh-2034'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.