Skip to content

Add API for changing a player with auth's identifier#176

Merged
tudddorrr merged 1 commit intodevelopfrom
change-identifiers
Feb 24, 2026
Merged

Add API for changing a player with auth's identifier#176
tudddorrr merged 1 commit intodevelopfrom
change-identifiers

Conversation

@tudddorrr
Copy link
Contributor

No description provided.

@tudddorrr tudddorrr added the enhancement New feature or request label Feb 24, 2026
@claude
Copy link

claude bot commented Feb 24, 2026

PR Review: Add API for changing a player with auth's identifier

The overall structure is clean and consistent with existing patterns. One issue worth addressing:


🟡 Potential Bugs or Issues

HandleIdentifierUpdated may null out Talo.CurrentPlayer

SessionManager.HandleIdentifierUpdated unconditionally replaces Talo.CurrentAlias with res.alias. Talo.CurrentPlayer is derived directly from _currentAlias?.player, so if the change_identifier endpoint returns an alias without the nested Player object (plausible since the player data itself has not changed, only the identifier), Talo.CurrentPlayer becomes null after the call. Any subsequent access to player props, saves, leaderboards, etc. would then fail.

// SessionManager.cs - current
public void HandleIdentifierUpdated(PlayerAuthChangeIdentifierResponse res)
{
    Talo.CurrentAlias = res.alias;
    SetIdentifierPlayerPref();
}

HandleSessionCreated is safe because Register/Login responses always include the full player graph as part of session creation. For change_identifier, the server may reasonably return a leaner payload.

Suggested fix — preserve the existing player reference if the response omits it:

public void HandleIdentifierUpdated(PlayerAuthChangeIdentifierResponse res)
{
    var existingPlayer = Talo.CurrentAlias.player;
    Talo.CurrentAlias = res.alias;
    if (Talo.CurrentAlias.player == null)
    {
        Talo.CurrentAlias.player = existingPlayer;
    }
    SetIdentifierPlayerPref();
}

Code Quality, Performance, Security, Backwards Compatibility

No issues found. The readonly addition to _sessionManager, the new error code, request/response classes, and the SetIdentifierPlayerPref extraction all look correct and consistent with existing patterns.

@tudddorrr tudddorrr merged commit 29065e1 into develop Feb 24, 2026
2 checks passed
@tudddorrr tudddorrr deleted the change-identifiers branch February 24, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant