Skip to content

fix(v2): LiveAdMobBridge.loadBanner throws until real SDK wiring lands - #73

Merged
wei18 merged 1 commit into
mainfrom
fix/v2-admob-loadbanner-stub-throw
May 21, 2026
Merged

wei18 merged 1 commit into
mainfrom
fix/v2-admob-loadbanner-stub-throw

Conversation

@wei18

@wei18 wei18 commented May 21, 2026

Copy link
Copy Markdown
Owner

Audit Blocker B1 fix — LiveAdMobBridge.loadBanner() previously synthesized .loaded(handle) without calling the SDK. Replaced with a visible failure (AdMobBridgeError.loadFailed + cached .failed status) so the UI cannot pretend a creative was fetched.

Real SDK wiring lands in v2.3.5 alongside BannerSlotView.

Verification

  • BannerLoadTests: 8/8 pass (bridge contract honored via FakeAdMobBridge)

Reference

meetings/2026-05-21_appmonetizationkit-code-audit.impl-notes.md Blocker B1.

Audit Blocker B1 (2026-05-21): the v2.2 stub synthesized .loaded(handle)
without invoking the SDK — UI would believe a creative was fetched when
nothing happened. Replace with a visible failure: setCachedStatus(.failed)
+ throw AdMobBridgeError.loadFailed. Banner UI in v2.3.5 will show the
failed state until the real GADBannerView + Request + delegate land.

Test verification: BannerLoadTests 8/8 pass — the suite exercises the
bridge through FakeAdMobBridge, so the live bridge change is contract-
compatible. Real-SDK wiring deferred to v2.3.5.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@wei18
wei18 merged commit be01df8 into main May 21, 2026
@wei18
wei18 deleted the fix/v2-admob-loadbanner-stub-throw branch May 21, 2026 13:12
wei18 added a commit that referenced this pull request May 22, 2026
Address all 5 Medium + 6 Nit findings from 2026-05-21 Code Reviewer audit
(B1 + B2 already merged in #73 + #71). Code Reviewer approved 2026-05-22
after one revision (test fix for M5 false-positive).

M1 — design ↔ code reconciliation
- docs/v2/design.md §How.3 removed misleading lastShownDate gating rule;
  clarified lastShownDate is recorded for telemetry only (matches code)

M2 — onPersistenceError closure
- AdGate.init(store:calendar:onPersistenceError:) — new optional closure
  parameter; MonetizationCore stays Telemetry-free, host wires the route
- Live wiring in SudokuKit/AppComposition/Live.swift fan-outs to Telemetry
- AdGate.mutate(_:) catch now invokes the closure (was a comment)
- Test: saveFailureSurfacesViaOnPersistenceError

M3 — empty displayPrice + catalog-desync telemetry
- LiveStoreKit2IAPClient: empty fallback now "—" (em-dash placeholder)
- New optional onCatalogDesync closure → Telemetry.errorOccurred

M4 — timezone-shift test
- AdGateLogicTests.dismissedTodayAcrossDateLineCrossing

M5 — system-clock-manipulation defense
- AdGateState.lastSeenWallClock: Date? (new optional field)
- AdGate.clockTamperTolerance = 24h
- shouldShowBanner refuses grace if now < lastSeen - tolerance
- Monotonic advance on show/dismiss/purchase paths
- LiveMonetizationStateStore CloudKit field add-via-write
- Tests: clockMovedBackwardsRefusesGraceAdvance (firstLaunch 2024-01-01),
  clockToleranceWithin24hStillShows (verified by flip-guard technique
  per Code Reviewer reject + revision)

N1 — AdPresentationAnchor narrowed AnyHashable → UUID; drop @unchecked
N2 — actor-vs-class re-eval deferred to post-v2.3.5 (noted)
N3 — AdPresentationAnchor resolver split into separate file (Foundation-
     only type vs UIKit/AppKit resolvers); enables future Linux exclude
N4 — LiveStoreKitBridge.transactionUpdates priority .background → .utility
N5 — FakeIAPClient single-consumer constraint — diagnostic tracking
     (purchaseUpdatesWasSubscribed) instead of crashing tests
N6 — ProtocolShapeTests.valueTypesRemainSendable compile-time Sendable
     coverage on AdGateState, IAPProduct, IAPPurchaseEvent variants,
     IAPPurchaseResult, AdBannerStatus, AdPresentationAnchor

Public surface stable: only optional init params + optional struct field
+ resolver file split. No SemVer-breaking additions.

Verification:
- AppMonetizationKit: 87/87 tests (was 82, +5)
- SudokuKit affected suites: 28/28 (HomeViewBanner saveCount assertion
  relaxed from == 1 → >= 1 per new wall-clock advance semantics)
- swift build clean both packages
- Isolation audit: 1 GoogleMobileAds import (LiveAdMobBridge.swift)

§未決 (impl-notes)
- M5 wall-clock advance writes on every shouldShowBanner — acceptable for
  v2; throttle in v2.x if CloudKit quota matters
- N5 Fake vs Live multi-subscriber semantics differ (diagnostic-only)
- AdPresentationAnchorRegistry still v2.2 backlog

Co-authored-by: Claude Opus 4.7 <[email protected]>
wei18 added a commit that referenced this pull request Sep 12, 2026
…k round) (#1069)

Brings in the phase-2 body improvements and references/ splits (#73–#78),
the final-check review fixes across all four scopes (#79–#82), and the
gate hardening: fails on MAJOR, warns when the description listing exceeds
the default budget, README mirrors are manual-only. Pointer-only.

Co-authored-by: Claude Fable 5.1 <[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