Skip to content

chore(gamecenter): harden the presentGameCenter seam left by #685 - #733

Merged
wei18 merged 1 commit into
mainfrom
chore/714-gc-seam-hardening
Jul 8, 2026
Merged

wei18 merged 1 commit into
mainfrom
chore/714-gc-seam-hardening

Conversation

@wei18

@wei18 wei18 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Closes #714 — the two non-blocking residuals from #685's review.

What (4 files, +54/−7)

  1. Latent-seam guard: both apps' SettingsView now route through an internal resolvedOnGameCenter() that asserts presentGameCenter != nil before 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 unguarded GameCenterDashboard.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 existing presentLeaderboard assert precedent.
  2. Test strengthening: 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

  • Reviewer empirically confirmed the assert cannot fire at render time: onGameCenter: resolvedOnGameCenter is a bound method reference consumed only by Button(action:) at tap; the existing nil-default tests/previews render green.
  • SudokuKit 270/270 (full, no segfault this run) · MinesweeperKit 189 tests with the only 2 failures being the pre-existing chore(tests): new banner-reserved snapshots are environment-sensitive — switch to tolerantImage #732 environment-sensitive banner fixtures (stash-control on unmodified base reproduces them) · GameAppKit 29/29 · swiftlint --strict 0.

Review

Dual-model review (sonnet + haiku), both approve, no findings requiring change. The absent assert-fires death test matches the existing presentLeaderboard precedent (no death tests repo-wide); noted, not blocking.

🤖 Generated with Claude Code

- 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]>
@wei18
wei18 enabled auto-merge (squash) July 8, 2026 07:58
@wei18
wei18 merged commit bd1d023 into main Jul 8, 2026
4 checks passed
@wei18
wei18 deleted the chore/714-gc-seam-hardening branch July 8, 2026 07:58
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.

chore(gamecenter): harden the presentGameCenter seam left by #685

1 participant