Repository navigation
chore(gamecenter): harden the presentGameCenter seam left by #685 - #733
Merged
Merged
Conversation
- SudokuUI/MinesweeperUI SettingsView: extract the onGameCenter fallback
(`presentGameCenter ?? { GameCenterDashboard.present() }`) into an
internal `resolvedOnGameCenter()` that debug-asserts when
`presentGameCenter` was never injected, mirroring
`GameHomeViewModel.select`'s `presentLeaderboard` assert. The nil
default stays (removing it would break the previews/tests that
intentionally construct with no Root VM), but a future call site that
forgets to wire it now fails CI instead of silently reproducing the
pre-#685 unguarded-present() bug.
- Strengthen `settingsViewUsesInjectedPresentGameCenterOverDefault` (both
apps): it previously only asserted construction doesn't eagerly invoke
the closure, which stayed green even if the parameter were never
threaded to SettingsScreen. It now also calls `resolvedOnGameCenter()`
directly and asserts the injected closure — not the fallback — fires.
Closes #714
Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #714 — the two non-blocking residuals from #685's review.
What (4 files, +54/−7)
SettingsViewnow route through an internalresolvedOnGameCenter()thatassertspresentGameCenter != nilbefore falling back — a future call site that forgets the injection now fails loudly in debug instead of silently regressing to the pre-fix(sudoku): Game Center entry points are dead no-ops when signed out (no dashboard, no sign-in alert) #685 unguardedGameCenterDashboard.present(). Chosen over removing the nil default because previews/tests depend on it (byte-identical screens without a Root VM), and it verbatim mirrors the existingpresentLeaderboardassert precedent.settingsViewUsesInjectedPresentGameCenterOverDefault(both apps) now also invokes the exact closure the Button binds and asserts the injected presenter is called — proving the wiring, not just construction-safety.Verification
onGameCenter: resolvedOnGameCenteris a bound method reference consumed only byButton(action:)at tap; the existing nil-default tests/previews render green.Review
Dual-model review (sonnet + haiku), both approve, no findings requiring change. The absent assert-fires death test matches the existing
presentLeaderboardprecedent (no death tests repo-wide); noted, not blocking.🤖 Generated with Claude Code