Skip to content

feat(minesweeper): wire monetization stack into appcomposition + settings (ms phase 3) - #259

Merged
wei18 merged 1 commit into
mainfrom
feat/ms-monetization-phase3
Jun 3, 2026
Merged

wei18 merged 1 commit into
mainfrom
feat/ms-monetization-phase3

Conversation

@wei18

@wei18 wei18 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

Closes Phase 3 of MS monetization wire. MS now has full monetization composition (IAP + AdGate + Controller + Toast + NoopAdProvider) modulo banner UI (deferred to U15). Mirrors Sudoku's wire shape per `feedback/minesweeper-mirrors-sudoku`.

What landed

  • `MinesweeperAppComposition` bag extended with 7 monetization fields
  • `.live()` wires `LivePersistence(.minesweeper)` + `LiveStoreKit2IAPClient(knownProductIds: [MS])` + `NoopAdProvider` + `AdGate` + `MonetizationStateController` + `ToastController`
  • `.preview()` uses MonetizationTesting fakes (Sudoku precedent)
  • `LiveRouteFactory` threads controller to Settings route
  • `SettingsView` mounts shared `Section("Purchases")` consuming MonetizationUI rows
  • `MonetizationStateController` parameterized via defaulted `productId:` param — Sudoku byte-identical, MS passes its own product id

CR ACCEPT highlights

  • Sudoku byte-identicality verified — all 4 test sites + Live.swift + Preview.swift compile unchanged
  • 30/30 MS tests + 209/209 Sudoku tests pass
  • Cosmetic C3 (docstring tense) applied inline

Deferred (CR-approved, follow-up backlog)

  • Toast overlay on `MinesweeperRoot` — purchase events queue but no visual feedback. Defer per CR: MS has no live monetization surface until U15. Will be filed as issue.
  • FakePersistence for MS Preview — currently uses LivePersistence (lazy-IO safe). Backlog.
  • Hardened MS productId test — sentinel-only this round. Backlog.

Refs

…ings (ms phase 3)

Closes Phase 3 of MS monetization wire (per
meetings/2026-06-02_minesweeper-monetization-wire-proposal.md). MS
app now has full monetization composition modulo banner UI (deferred
to U15 follow-up). Mirrors Sudoku's wire shape per
feedback/minesweeper-mirrors-sudoku.

Code:
- MinesweeperAppComposition bag extended with persistence / iapClient /
  adProvider / adGate / monetizationStateStore / monetizationController /
  toastController
- Live.swift `.live()` wires:
    * LivePersistence(ckConfig: .minesweeper)
    * LiveStoreKit2IAPClient(knownProductIds: [minesweeperRemoveAdsProductId])
    * NoopAdProvider  (LiveAdMobBridge deferred to U15)
    * AdGate + MonetizationStateController(productId: ..., ...)
    * ToastController
- `.preview()` mirrors with MonetizationTesting fakes (matches Sudoku
  precedent of linking MonetizationTesting into production target)
- LiveRouteFactory threads monetizationController to the Settings route
- SettingsView mounts Section("Purchases") with shared MonetizationUI
  rows (RemoveAdsRow / RestorePurchasesRow / AdsRemovedRow)
- minesweeperRemoveAdsProductId published at module level for parity
  with removeAdsProductId in MonetizationUI

MonetizationStateController parameterization (CR-recommended option a):
- Added `productId: String = removeAdsProductId` default param
- 4 internal direct-ref to constant swapped to self.productId
- All 4 Sudoku test sites + Sudoku Live.swift + Preview.swift compile
  byte-identically (no arg = picks up defaulted Sudoku constant)
- Docstring updated to reflect MS Phase 3 landing

Tests:
- MinesweeperKit: 30/30 pass (+ extended AppCompositionTests + new
  MinesweeperSettingsViewTests)
- SudokuKit: 209/209 pass — Sudoku byte-identicality verified by CR

CR ACCEPT (round 1). Cosmetic C3 (docstring tense) applied inline.
Open follow-ups deferred to backlog:
- Toast overlay on MinesweeperRoot (CR Important #1 — defer per CR
  recommendation; MS has no live monetization surface until U15)
- FakePersistence target for MS Preview (CR Important #2)
- Hardened MS productId test (CR Important #3)

Refs:
- meetings/2026-06-02_minesweeper-monetization-wire-proposal.md §Phase 3
- meetings/2026-06-03_ms-monetization-phase3.impl-notes.md
- prereqs: #257 (.minesweeper config), #258 (multi-app iap config)
- closes mirror-monetization-loop (modulo banner U15)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@wei18
wei18 merged commit c24f635 into main Jun 3, 2026
3 checks passed
@wei18
wei18 deleted the feat/ms-monetization-phase3 branch June 3, 2026 03:16
wei18 added a commit that referenced this pull request Jun 3, 2026
…t overlay (u15) (#263)

* feat(minesweeper): wire LiveAdMobAdProvider + BoardView banner + toast overlay (U15)

Closes the MS monetization mirror loop. With #259 wiring the
composition stack and this PR wiring the AdMob bridge + banner UI +
toast surface, MS now has full monetization parity with Sudoku
modulo the production-ID swap (gated to v1 release per Sudoku
precedent).

Code:
- `MinesweeperAppComposition.live()`:
  * #if os(iOS): LiveAdMobAdProvider(bannerAdUnitID:) wired
    - DEBUG: Google universal test banner unit
    - RELEASE: fatalError("REPLACE_IN_MS_V1: ...") gate, mirrors
      Sudoku's REPLACE_IN_v2.5.3 safety pattern (production
      Release builds crash at composition root until the real
      banner unit id is explicitly wired per v1 release checklist)
  * #if os(macOS): NoopAdProvider unchanged (AdMob SDK iOS-only)
- LiveRouteFactory threads adProvider + adGate through to
  MinesweeperBoardView (suppressed on .won / .lost terminal states)
- MinesweeperBoardView mounts new MinesweeperBannerSlotView below
  the grid (mirror of Sudoku's BannerSlotView placement)
- MinesweeperRoot.init takes toastController; body attaches
  .toastOverlay(controller: toastController, successTint:, failureTint:)
- MinesweeperAppComposition.rootView passes toastController through
- MinesweeperBannerSlotView (NEW): mirrors Sudoku's BannerSlotView
  using AdProvider protocol (no GoogleMobileAds direct import).
  Sudoku's slot couples to SudokuUI theme env so a clean shared
  extraction is deferred to a future MonetizationUI consolidation
  (impl-notes D1).

Info.plist:
- `GADApplicationIdentifier` = Google universal test App ID
  `ca-app-pub-3940256099942544~1458002511` (mirrors Sudoku
  convention — defer production App ID swap to v1 release per
  project memory `admob-production-ids` / `minesweeper-admob-ids`)
- `NSUserTrackingUsageDescription` added (ATT prompt copy)

AdMob SDK isolation audit: `rg '^.*import GoogleMobileAds' Packages/`
returns exactly 1 hit (LiveAdMobBridge.swift). Contract preserved
per skill `admob-isolation-audit`.

Sudoku byte-identicality: zero changes under Sudoku/ or SudokuKit/
or AppMonetizationKit/. All 10 edits scoped to Minesweeper/ +
MinesweeperKit/ + meetings/.

Tests:
- MinesweeperKit: 30/30 pass (incl. new
  liveAdProviderIsLiveOnIOSNoopOnMac)
- SudokuKit: 209 root + board tests unchanged green

Code Reviewer round 1 verdict NEEDS_WORK on 2 critical:
- C1 Info.plist production App ID (Leader pre-fixed to test App ID
  before CR; CR saw stale state). Verified test ID now in plist.
- C2 Live.swift hardcoded production banner unit ID (Release
  builds would silently serve real creatives). Applied Sudoku's
  fatalError gate inline; Release build now crashes until v1
  release checklist wires the real id.

Cosmetic stale docstrings updated inline. Remaining CR Important
findings (optional adProvider/adGate/toastController in
LiveRouteFactory + MinesweeperRoot) accepted as Karpathy-minimal
since the #Preview path is the sole rationale.

Follow-up backlog items already filed:
- #260 toast overlay (this PR addresses it for MS Root)
- #261 FakePersistence for MS Preview
- #262 hardened MS productId test

Refs:
- meetings/2026-06-02_minesweeper-monetization-wire-proposal.md (full proposal)
- meetings/2026-06-03_ms-admob-wire-u15.impl-notes.md (this round's notes)
- project memory `minesweeper-admob-ids` (production IDs, held until ship)
- closes MS monetization mirror loop modulo production-ID swap

Co-Authored-By: Claude Opus 4.7 <[email protected]>

* fix(lint): break long fatalError message line for swiftlint 160-char limit

Co-Authored-By: Claude Opus 4.7 <[email protected]>

---------

Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18 added a commit that referenced this pull request Jun 3, 2026
…et injection

Captures 5 PRs merged today (#256 grace inversion / #257 .minesweeper CK
config / #258 multi-app IAP / #259 MS AppComposition wire / #263 U15
LiveAdMobAdProvider + banner + toast / #264 prod-ID comment scrub /
#265 AdMob secret injection PR1) plus 5 issues filed for follow-up
(#260 #261 #262 #266 #267).

Records decisions, rejected alternatives, Architect review hand-off,
and the spec inversion (7-day grace removed). Notes Iron Law violation
on skill writing + remediation via post-hoc CR.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
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