Skip to content

refactor(game-center): narrow LeaderboardLoader to local-player centring (#150) - #285

Merged
wei18 merged 1 commit into
mainfrom
refactor/leaderboard-local-only-150
Jun 3, 2026
Merged

wei18 merged 1 commit into
mainfrom
refactor/leaderboard-local-only-150

Conversation

@wei18

@wei18 wei18 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Closes #150 (PR #146 CR S3 follow-up).

loadSlice(around: PlayerID?) was dishonest — the live GKLeaderboardLoader only branched on != nil and always centred on GKLocalPlayer.local (the id payload was dead). Replaced with aroundLocalPlayer: Bool (Leader-approved Option 2), narrowing the FULL chain so the VM-facing surface stops lying: GameCenterClient.fetchLeaderboardSlice → LeaderboardSliceService.fetch → LeaderboardLoader.loadSlice, both fakes, the FakeGameCenterOperation enum case, both test files, and the one outside consumer CompletionViewModel (around: nil → aroundLocalPlayer: false). Arbitrary non-local centring deferred to a future friends-leaderboard feature (friends scope hands back GKPlayer directly, sidestepping the teamPlayerID↔gamePlayerID mapping).

Code Review: APPROVE-WITH-NITS. Verified: true path = the unchanged PR #146 local-player centring; false = top-of-board; CompletionViewModel's false preserves its pre-change nil→top behavior (no silent regression); full chain consistent (zero leftover around:/String?); friends-auth gate untouched; 53 tests pass. Sole nit is a doc-only mismatch in the impl-notes (mentions a = false default that isn't in the code) — non-functional.

🤖 Generated with Claude Code

…ing (#150)

PR #146's loadSlice(around: PlayerID?) silently substituted GKLocalPlayer.local
for any passed id — a dishonest contract (CR S3). True non-local centring isn't
reachable via public GameKit API (teamPlayerID->GKPlayer has no mapping). Make
the signature honest (aroundLocalPlayer: Bool); update Live/GK/Fake impls + doc,
drop the narrowing note. Real non-local centring deferred to a friends feature.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit f167431 into main Jun 3, 2026
@wei18
wei18 deleted the refactor/leaderboard-local-only-150 branch June 3, 2026 09:39
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.

feat(game-center): support centring leaderboard slice on non-local player (PR #146 CR S3 follow-up)

1 participant