Repository navigation
feat(minesweeper): launch-time Game Center authentication handshake (#313) - #355
Merged
Merged
Conversation
…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]>
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 #313. From #291.
New
MinesweeperRootViewModel(@mainactor @observable) mirrorsSudokuUI.RootViewModel—bootstrap()runsgameCenter.authenticate()fromMinesweeperRoot'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
PreviewRouteFactoryleft dead by the removed root #Preview). 97 package tests green.🤖 Generated with Claude Code