Skip to content

test(libSceUserService): pin the initialization check and membership answers of IsLoggedIn - #17141

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
olegon85:test/libsceuserservice-is-logged-in
Nov 11, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
olegon85:test/libsceuserservice-is-logged-in

Conversation

@olegon85

@olegon85 olegon85 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What

docs/dev/debt/libSceUserService.md records for sceUserServiceIsLoggedIn and sceUserServiceIsLoggedInWithoutLock that "firmware 13.60 checks membership in its logged-in user list and returns 1 or 0 after checking initialization. AnyPS5 uses its connected-user list for the same query." Neither export had a test. The lifecycle test now pins exactly that: both exports answer USER_SERVICE_ERROR_NOT_INITIALIZED before sceUserServiceInitialize (the initialization check comes first); after initialization the connected initial user answers 1 through both exports, while a never-connected slot and USER_SERVICE_USER_ID_INVALID answer 0; connecting user index 1 — already pinned by this test through its login event and login id list — flips both exports to 1, and disconnecting returns them to 0. No console measurement is claimed beyond the recorded contract, and no other UserService export is touched.

Tested

  • Debian 12 x86-64 (WSL), head a915c52ac6111eff82fe1dedeed8b540dbcda466 on base d03beaf110: cmake --build build --target guest_user_service_lifecycle_tests, ctest -R '^guest_user_service_lifecycle$' — Passed, two consecutive runs.
  • Windows cross-compile syntax check of the changed test (x86_64-w64-mingw32-g++ -fsyntax-only, GCC 12-win32): clean.
  • python tools/check_conventions.py --base origin/main: passed. git diff --check: clean. python tools/pr_overlap.py --branch test/libsceuserservice-is-logged-in: no overlap with open pull requests (1797 probed).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@JJenkx

JJenkx commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 1368badcc0, merged onto main 105c9e4d91 (1368badcc0, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • guest_user_service_lifecycle passes in 3 of 3 runs, none skipped.

AI-assisted: yes.

@coptergui-ops coptergui-ops left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at current head. Pure test addition: lifecycle test pins sceUserServiceIsLoggedIn / IsLoggedInWithoutLock exactly as docs/dev/debt/libSceUserService.md records them (NOT_INITIALIZED before initialize wins over userId validation; connected initial user answers 1 through both exports; unconnected and UP_USER ids answer 0; NULL out rejected with ERROR_PARAMETER regardless of init state; post-terminate NOT_INITIALIZED). No production-code change. Overlap vs PR 14890 (shared debt file): different entry, no shared lines; same holds for the other listed old PRs (16543, 16690, 16848, 16981, 15163, 16255, 16535, 16654, 16708, 16742 - all different bullets). Conventions checker: no new findings from this diff.

@olegon85

olegon85 commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review and the Windows run. For the record, this diff adds eight checks to core/libs/tests/GuestUserServiceLifecycle.cpp and nothing else: both exports answer USER_SERVICE_ERROR_NOT_INITIALIZED before sceUserServiceInitialize (re-checked after the first Terminate through RequireNotInitialized), the connected initial user answers 1 through both exports once initialized, a never-connected slot and USER_SERVICE_USER_ID_INVALID answer 0, and connecting / disconnecting index 1 flips both exports between 1 and 0.

Two details in the review text do not describe this PR: there is no null-output / ERROR_PARAMETER check (sceUserServiceIsLoggedIn takes an int userId and writes nothing), and the diff touches no file under docs/dev/debt, so there is no shared debt file with #14890.

@olegon85

olegon85 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Acknowledging the pr-overlap hit against #17634: both pull requests append to the end of RequireNotInitialized() in GuestUserServiceLifecycle.cpp — this PR adds the two IsLoggedIn checks after the sceUserServiceGetEvent(nullptr) line, #17634 adds its GetNpAccountId block at the same position. The additions are independent and order-insensitive; either landing order resolves to keeping both blocks. If #17634 merges first I will rebase this branch onto main promptly (the two checks move below its block); no Depends on is declared because neither PR builds on the other's code.

@olegon85
olegon85 force-pushed the test/libsceuserservice-is-logged-in branch from 1368bad to a915c52 Compare November 9, 2026 06:46
@oneandonlydean
oneandonlydean merged commit df172fe into boykopovar:main Nov 11, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants