Skip to content

fix(minesweeper): run persistence.bootstrap() so AdGate/banner works (#448) - #450

Merged
wei18 merged 2 commits into
mainfrom
fix/ms-rootvm-persistence-bootstrap-448
Jun 9, 2026
Merged

wei18 merged 2 commits into
mainfrom
fix/ms-rootvm-persistence-bootstrap-448

Conversation

@wei18

@wei18 wei18 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Problem (#448 item ②)

The Minesweeper Home banner never appears. Root cause chain:

  1. MinesweeperRootViewModel skipped persistence.bootstrap() (which Sudoku's RootViewModel runs).
  2. So the CloudKit user zone is never provisioned.
  3. So AdGate's LiveMonetizationStateStore.loadState() throws when it tries to seed the first-launch record.
  4. So AdGate.shouldShowBanner() hits its conservative catch { return false } and suppresses the banner.

Fix

Surgical parity change — give Minesweeper the same persistence-bootstrap that SudokuUI.RootViewModel already has:

  • MinesweeperRootViewModel now holds persistence: any PersistenceProtocol and, in bootstrap(), calls try await persistence.bootstrap() inside a do/catch that funnels failures through ErrorReporter (source: "MinesweeperRootViewModel.bootstrap.persistence"), before the existing Game Center authenticate() block. Bootstrap is idempotent + non-blocking, so a transient failure (e.g. no iCloud account) retries next launch and does not block GC auth or Root — mirrors RootViewModel.bootstrap.persistence exactly.
  • Both MinesweeperRootViewModel( construction sites in MinesweeperAppComposition/Live.swift (.live() + .preview()) now pass persistence: (already in scope).
  • Stale comment that claimed persistence.bootstrap was intentionally skipped is corrected.

Out of scope

Resume-candidate / latestInProgress() / ResumePill is issue #448 item ① (a separate feature) and is intentionally NOT copied here.

Verification

  • swift build --package-path Packages/MinesweeperKit — succeeds.
  • swift test --package-path Packages/MinesweeperKit — 127 tests pass.
  • swift test --package-path Packages/MinesweeperCoreKit — 81 tests pass.

Refs #448

🤖 Generated with Claude Code

…448)

MinesweeperRootViewModel skipped persistence.bootstrap() (which Sudoku's
RootViewModel runs), so the CloudKit user zone was never provisioned. As a
result AdGate's LiveMonetizationStateStore.loadState() threw when seeding the
first-launch record, AdGate.shouldShowBanner() hit its conservative
`catch { return false }`, and the Minesweeper Home banner never appeared.

Mirror SudokuUI.RootViewModel: hold `persistence: any PersistenceProtocol` and
call `try await persistence.bootstrap()` in a do/catch (funneled through
ErrorReporter, source "MinesweeperRootViewModel.bootstrap.persistence") BEFORE
the Game Center auth block. Bootstrap is idempotent + non-blocking so a failure
does not block GC auth or Root.

Out of scope (issue #448 item ①): resume-candidate / latestInProgress() — not
copied.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) June 9, 2026 10:26
…ength (#448)

CI lint:swift_strict treats file_length warning as error; the +2 call-site lines tipped Live.swift to 403 (>400). Drop 4 redundant comment lines (PR-number parentheticals + one wrapped clause) — no factual loss; PR refs remain in git history.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit dd31b93 into main Jun 9, 2026
4 checks passed
@wei18
wei18 deleted the fix/ms-rootvm-persistence-bootstrap-448 branch June 9, 2026 10:32
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.

1 participant