Skip to content

feat(minesweeper): launch-time Game Center authentication handshake (#313) - #355

Merged
wei18 merged 1 commit into
mainfrom
feat/ms-gc-launch-auth-313
Jun 5, 2026
Merged

wei18 merged 1 commit into
mainfrom
feat/ms-gc-launch-auth-313

Conversation

@wei18

@wei18 wei18 commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Closes #313. From #291.

New MinesweeperRootViewModel (@mainactor @observable) mirrors SudokuUI.RootViewModel — bootstrap() runs gameCenter.authenticate() from MinesweeperRoot's .task, idempotent (guard !hasBootstrapped). Auth-only scope (MS has no resume/saved-game flow to mirror). Failure degrades to .unauthenticated + ErrorReporter funnel — GC is optional, never blocks gameplay.

CR: APPROVE-WITH-NITS — faithful mirror (same mechanism/placement/latch), graceful-failure verified (non-throwing bootstrap, content never gates on authState), idempotency proven, composition wiring + Swift 6 isolation clean, no retain cycle; 3 tests assert meaningfully (failure test stronger than Sudoku's baseline — also pins the funnel). Leader inline-deleted the one Low (orphaned PreviewRouteFactory left dead by the removed root #Preview). 97 package tests green.

🤖 Generated with Claude Code

…313)

Mirror Sudoku's launch GC auth: add `MinesweeperRootViewModel` (@mainactor
@observable) owning `gameCenter.authenticate()`, kicked from
`MinesweeperRoot.task` — matching `SudokuUI.RootView.task →
RootViewModel.bootstrap()`. Scoped to the auth handshake only; MS has no
saved-game / resume flow so the persistence-bootstrap portion of Sudoku's
RootViewModel is intentionally omitted.

Failures degrade gracefully: a thrown / declined auth lands on
`.unauthenticated` (never crashes or blocks gameplay — GC is optional) and
funnels through `ErrorReporter` as `.gameCenterUnauthenticated`, mirroring
Sudoku's auth catch block. `bootstrap()` is idempotent so a `.task` re-entry
won't re-trigger GameKit auth.

Wire the VM through `MinesweeperAppComposition` (`.live()` shares the bag's
real `gameCenter` + `errorReporter`; `.preview()` the fakes), held on the bag
mirroring Sudoku's `AppComposition.rootViewModel`.

Removed `MinesweeperRoot`'s root-level `#Preview` (it would need to name the
GC protocol's `SudokuEngine.Difficulty` to stub a client, not importable from
this leaf module without a new dep) — mirrors `SudokuUI.RootView`, which has
no `#Preview`; the root is exercised via `MinesweeperAppComposition.preview()`.

Tests: `MinesweeperRootViewModelTests` covers success / graceful-failure +
funnel / idempotency. Full MinesweeperKit suite green (97 tests).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit 4cf38b7 into main Jun 5, 2026
@wei18
wei18 deleted the feat/ms-gc-launch-auth-313 branch June 5, 2026 06:44
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(minesweeper): launch-time Game Center authentication handshake

1 participant