xgameruntime: XUserFindForDevice answers E_GAMEUSER_USER_NOT_FOUND until XUserAddAsync (OLD-9860 / RT-382) #1137

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

@⁠ambroseautomation on GitHub · 2026-11-24 19:08 UTC · original
ambroseautomation:carry/old-9860-xuser-find-device → main · +40 −7 · 4 files · 1 commits · open

Claimed in the coordination issue as: OLD-9860 (#14)

What and why

Carries forward old-pr/9860 (draft #126, original commit author Salim Hammami preserved; indexed in #17; RT-382), rebased cleanly onto current main (6293c1c4f).

Matches the GDK XUserFindForDevice contract ("cannot return a user handle to a user that hasn't been signed in with a call to XUserAddAsync"):

  • Tracks whether the offline user has been added (g_user_added in runtime/shims/xgameruntime_user.cpp, set on XUserAddAsync and on XUserAddByIdWithUiAsync for the local user).
  • XUserFindForDevice (runtime/shims/xgameruntime_offline.cpp) clears *out = nullptr and returns E_GAMEUSER_USER_NOT_FOUND until the user has been added, then returns a new XUserHandle afterward.
  • Updates docs/runtime_imports.md (marking the HRESULT choice as an explicit ASSUMPTION) and extends runtime/test/xgameruntime_offline_test.cpp to assert behavior both before and after XUserAddAsync.

Tested

  • Compiled and ran xgameruntime_offline_test.exe natively on Windows 11 with MSVC (/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2): xgameruntime_offline_test: 72 checks, 0 failures.
  • python -I tests/test_docs_links.py: 16 tests, OK.
  • python -I scripts/check_no_game_data.py docs/runtime_imports.md runtime/shims/xgameruntime_offline.cpp runtime/shims/xgameruntime_user.cpp runtime/test/xgameruntime_offline_test.cpp: exit 0 (no game data).

GPUs tested: n/a (CPU/OS runtime shim; built and tested on Windows 11 Pro 64-bit, MSVC VS 18)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a — xgameruntime shim)
**@⁠ambroseautomation** on GitHub · 2026-11-24 19:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1137) `ambroseautomation:carry/old-9860-xuser-find-device` → `main` · +40 −7 · 4 files · 1 commits · open Claimed in the coordination issue as: OLD-9860 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Carries forward `old-pr/9860` (draft #126, original commit author `Salim Hammami` preserved; indexed in #17; RT-382), rebased cleanly onto current `main` (`6293c1c4f`). Matches the GDK `XUserFindForDevice` contract ("cannot return a user handle to a user that hasn't been signed in with a call to `XUserAddAsync`"): - Tracks whether the offline user has been added (`g_user_added` in `runtime/shims/xgameruntime_user.cpp`, set on `XUserAddAsync` and on `XUserAddByIdWithUiAsync` for the local user). - `XUserFindForDevice` (`runtime/shims/xgameruntime_offline.cpp`) clears `*out = nullptr` and returns `E_GAMEUSER_USER_NOT_FOUND` until the user has been added, then returns a new `XUserHandle` afterward. - Updates `docs/runtime_imports.md` (marking the HRESULT choice as an explicit `ASSUMPTION`) and extends `runtime/test/xgameruntime_offline_test.cpp` to assert behavior both before and after `XUserAddAsync`. ### Tested - Compiled and ran `xgameruntime_offline_test.exe` natively on Windows 11 with MSVC (`/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`): `xgameruntime_offline_test: 72 checks, 0 failures`. - `python -I tests/test_docs_links.py`: 16 tests, OK. - `python -I scripts/check_no_game_data.py docs/runtime_imports.md runtime/shims/xgameruntime_offline.cpp runtime/shims/xgameruntime_user.cpp runtime/test/xgameruntime_offline_test.cpp`: exit 0 (no game data). GPUs tested: n/a (CPU/OS runtime shim; built and tested on Windows 11 Pro 64-bit, MSVC VS 18) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — `xgameruntime` shim)
The GDK reference says XUserFindForDevice cannot return a user handle to a user that
was not signed in with a call to XUserAddAsync. Track whether the offline user was
added (XUserAddAsync, or the local user by id) and answer E_GAMEUSER_USER_NOT_FOUND
with no handle before that. The HRESULT is an assumption: the reference names no code.
docs/runtime_imports.md updated; the offline test asks before and after the add.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

# Conflicts:
#	docs/runtime_imports.md
#	runtime/test/xgameruntime_offline_test.cpp
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:54 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:14 UTC · original · approved these changes

Reviewed and verified. Conforms XUserFindForDevice to GDK specification by clearing *out = nullptr and returning E_GAMEUSER_USER_NOT_FOUND prior to XUserAddAsync sign-in. Verified with xgameruntime_offline_test.exe (72/72 PASS). 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1137#pullrequestreview-6045708341) · **approved these changes** Reviewed and verified. Conforms `XUserFindForDevice` to GDK specification by clearing `*out = nullptr` and returning `E_GAMEUSER_USER_NOT_FOUND` prior to `XUserAddAsync` sign-in. Verified with `xgameruntime_offline_test.exe` (72/72 PASS). 100% clean-room.
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:33 UTC · original

Tested d93d8ed0e on Arch Linux + Wine 11.22 (clang-cl + xwin cross-build):

  • ctest --test-dir runtime/build/win -R "^xgameruntime_offline$" --output-on-failure: Passed (5.33 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1137#issuecomment-7142262438) Tested `d93d8ed0e` on Arch Linux + Wine 11.22 (clang-cl + xwin cross-build): - `ctest --test-dir runtime/build/win -R "^xgameruntime_offline$" --output-on-failure`: **Passed** (5.33 s) AI-assisted: yes
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:14 UTC · original

Recommendation: [MERGE]

Reasoning: Carries #126: XUserFindForDevice returns E_GAMEUSER_USER_NOT_FOUND until the offline user has been added via XUserAddAsync, matching the documented GDK contract. Small shim change with test and docs updates. Verified on Wine by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 3/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1137#issuecomment-7143234187) **Recommendation:** [MERGE] **Reasoning:** Carries #126: `XUserFindForDevice` returns `E_GAMEUSER_USER_NOT_FOUND` until the offline user has been added via `XUserAddAsync`, matching the documented GDK contract. Small shim change with test and docs updates. Verified on Wine by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 3/10
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/1137/head:github-bot/gh-1137'
git switch 'github-bot/gh-1137'

Merge

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