Skip to content

fix(monetization): restore cold-launch gate resolution + consent-before-request ordering - #1062

Merged
wei18 merged 25 commits into
mainfrom
fix/1058-bannerslot-task-lifecycle
Sep 14, 2026
Merged

wei18 merged 25 commits into
mainfrom
fix/1058-bannerslot-task-lifecycle

Conversation

@wei18

@wei18 wei18 commented Sep 9, 2026 •

Copy link
Copy Markdown
Owner

The banner's ad gate never resolved, so no ad was ever requested and the C-33
ATT primer never presented
, on both apps. This PR fixes that, and in doing so
replaces the first fix's shape after code review found three BLOCKERs in it.

Scope. Neither app has ever been released (apps.apple.com returns 404 for
both app IDs; ASC shows 2.6.0 as DEVELOPER_REJECTED). This is a v2.6
release blocker
, not a live incident: no App Store users, no revenue lost.
Because the gate never opened, no ad was requested and no IDFA was ever
accessed — this is not a consent violation; the harm is a monetization path
and a consent feature that have never executed.

Both root causes are pre-existing on main (reproduced on pristine main
before any change). Found while diagnosing #1024; not introduced by it.

Root causes

A — .task on a view that renders as EmptyView never runs.
BannerSlotView.body was Group { if … EmptyView() … }.task { resolveGateAndLoad() }.
On cold launch shouldShow is nil, the Group renders EmptyView, SwiftUI
never mounts the .task, and the gate never resolves — a closed loop. The
trigger is "renders as literal EmptyView"; .background {} / .overlay {}
anchors don't mount either.

B — the first ad request raced the boot sequence. Once A was fixed, the load
reached AdMob before bootMonetization's UMP → AdMob-init sequence finished:
initializationFailed("not started"). Also reproduced on main.

Why the first fix was replaced (CR round 1)

The first version (b9f3b970…f271a6c2) swapped the container to ZStack and
threaded a MonetizationBootSignal through ~19 files. Review found, each verified:

  • B1 — layout regression introduced by that swap. A hidden ZStack is a
    real subview, so a non-zero-spacing parent adds spacing around it. Measured:
    bookends 216pt, hidden Group 216, hidden ZStack 232. It hit all four
    board layouts whenever the banner was hidden, and every macOS board
    permanently (NoopAdProvider is always suppressed).
  • B2 — a second, ungated path. The scenePhase repoll reached the provider
    with no readiness wait, so "the sole path to refreshBanner()" was false.
  • B2′ — primer before boot. The ATT primer could present over the UMP
    consent form (fix(settings): daily-reminder primer sheet torn down ~1s after present by duplicate presentation attempt (sheet hosted inside List section) #940 class); the wrong order was locked in by a test.
  • By-construction claim didn't hold. The signal's alreadyReady: true
    defaults on 15 wrapper layers let a caller drop it and still compile; the
    scan:bannerslot_bootsignal text gate could not see through wrappers
    (falsified by mutation one indirection level down).

The fix

Phase 1 / 1b — readiness latch inside the provider

e383fa1a, 553b8fcc

  • MonetizationCore.ReadinessLatch: Mutex-backed, opens once, never re-closes.
    A waiter cancelled while closed throws CancellationError.
  • AdProvider.awaitReady() async throws — no protocol-extension default;
    every conformer implements it explicitly.
  • LiveAdMobAdProvider.initialize() opens the latch on completion — success OR
    failure (defer) — and refreshBanner() awaits it first. The only production
    caller of initialize() is the boot coordinator, after UMP, so readiness ⟹
    consent resolved. A failed init releases waiters to the provider's own
    .failed, never a deadlock.
  • UMP ordering is by SDK contract: the pinned UMP 3.1.0 header
    (UMPConsentForm.h:22-26) says the completion handler fires "after the user
    selects an option and the form is dismissed". This covers the cold-launch
    consent form only (presentPrivacyOptionsForm is not part of boot) and is
    proven from the SDK contract, not exercised on an EEA simulator.
  • Phase 1b pins two invariants that had no falsifier: an already-cancelled task
    on a closed latch throws promptly (mutant hangs → caught by the bound), and
    open() racing cancellation never resumes a continuation twice (mutant crashes
    with CONTINUATION MISUSE).

Phase 2 — session-scoped slot model

2a 45b34e90 · 2b a9a48e1a · 2b.1 52c8b17d · 2c 72264ac9 · 2c.1 12860e11 ·
2d 06ec1ca5 · 2d.1 5f820520 · 2e c78b84ab + d25702c0 · 2f a5ebe93f · 2g ee33a60a
Spec: meetings/2026-09-11_1058-slot-model-design.md (PM-approved, rev 3.2 plus
the 2d / 2e / 2f / 2g sections).

  • BannerSessionModel (one per session, built in makeGameAppCore): gate
    decision, the single awaitReady() → primer → sessionReady sequence, loads,
    repoll, dismiss, purchase. Order per session: gate → suppressed check →
    readiness → primer → loads.
  • BannerSlotView is a pure renderer with zero lifecycle modifiers; hidden
    renders zero subviews (fixes B1). Slots register via a @StateObject lease
    inside a nonisolated DynamicProperty (spike S1: lease init exactly once
    across 10 re-renders; update() runs for a hidden slot; deinit on removal;
    isolated deinit works on Xcode 26.5 / Swift 6.3.2).
  • Per-slot handles: refreshBanner() returns AdBannerHandle, removing the
    shared-status race between concurrently mounted slots.
  • Cancellation is never shown as failure: four catch sites (model, coordinator,
    Live provider, bridge) re-throw CancellationError; "Ad unavailable" only
    means a real load failure.
  • \.bannerSession is injected at the same level as \.theme (outside
    GameRoot, MakeGameApp.swift:367), which production already proves reaches
    fullScreenCover content (boards read @Environment(\.theme), whose default
    is a grayscale NeutralTheme, and ship in brand colours). Re-injected on the
    cover as well (GameRoot.swift:195); a missing session asserts in DEBUG
    (BannerSessionModel.onMissingSession, BannerSlotRegistration.swift:34 /
    :63). .disabled is allowed only in previews, snapshot fixtures and the
    three DEBUG near-win covers.
  • 2c removed the scan:bannerslot_bootsignal gate (added earlier in this PR)
    with the bootSignal: parameter it checked; its guarantee is carried by the
    readiness latch in the carrier and the DEBUG onMissingSession assertion.
  • 2c.1 (2c CR follow-ups): a hide generation counter stops a refreshGate() /
    dismiss hide landing mid-runStart or mid-repoll from being overwritten by a
    stale publish (and a bail never wedges the session); purchase / restore /
    Transaction.updates update their UI before awaiting the entitlement hook.
  • 2d (refactor(monetization): #1058 phase 2d — delete bootSignal, lastKnownShouldShowBanner and composition fields with no production reader #1076): deletions only, 16 files, +91/−292 — MonetizationBootSignal,
    AdGate.lastKnownShouldShowBanner / AdGateLayoutHint, and the
    GameDeps.adProvider / adGate composition fields whose only readers were
    tests. rg for the deleted names returns only FakeAdProvider.markReady() (the
    fake's readiness latch, required) and its 4 test call sites.
  • 2d.1 (PM ruling on the 2d coverage gap): LiveAdMobAdProvider.init(bannerAdUnitID:)
    sits behind #if canImport(GoogleMobileAds), so makeGameAppCore's Live/Noop
    branch is pinned at compile time (macOS must get NoopAdProvider). It
    replaces the runtime test 2d deleted (liveAdProviderIsLiveOnIOSNoopOnMac).
    Negative proof: with the #if os(iOS) guard removed the macOS build goes red
    ('LiveAdMobAdProvider' initializer is inaccessible due to 'internal' protection level);
    the control without 2d.1 compiled clean.
  • 2e (fix(monetization): banner ✕ overlaps the ad creative — tapping "Dismiss ad" opens the ad (accidental click) #1084, found by test(monetization): #1058 simulator evidence E1–E10 for PR #1062 #1077 E6): the ✕ was a 12×12pt button overlaid on the
    creative, and the creative stretched to the 370pt slot width, so a "Dismiss ad"
    tap could land on the ad and open Safari — an accidental-click shape under
    AdMob policy. Now the creative is a fixed 320×50 (sizeThatFits on the
    representable returns BannerSlotView.creativeSize; the SDK's adSize is
    0×0 at first layout, so reading it left the hosted view unpainted), leading-
    aligned and .clipped(); the ✕ is a 44×44pt target in the trailing gutter,
    16pt glyph, theme.text.secondary on the three themed hosts (the two settings
    routes take .secondary). BannerSlotBandLayout keeps 16pt padding while the
    host is ≥380pt and shrinks symmetrically below it (375pt → 5.5pt), and
    d25702c0 clamps a nil / non-finite proposal to the 396pt ideal width. Pinned
    by BannerSlotDismissPlacementTests at 402 / 393 / 375pt plus the
    .infinity / .nan / nil rows.
  • 2f (found by the chore(monetization): finalize PR #1062 — rewrite PR body, whole-PR code review, T6, merge #1078 final-head E2E run): Minesweeper E2E N19 went red at
    d25702c0 while green on main (base 3/3, head 0/4; idb tree dumps identical
    except the settings.storage.cacheReady anchor never appears at head). The
    fix(settings): daily-reminder primer sheet dismisses itself on first tap after launch #909 shape: both apps' .settings destination builders mint
    SettingsViewModel(...) inline, SwiftUI re-invokes that builder on any
    ancestor re-render, and SettingsView held the model as a plain @Bindable
    property, so the instance whose one-shot .task { bootstrap() } had set
    isCacheStateReady was replaced by a fresh one. This PR adds the ancestor
    re-render (GameRoot now reads @Environment(\.scenePhase) for the repoll).
    Fix: SettingsView owns the model as @State, one shared place for both
    apps; correct because every value the builders capture is a composition-time
    let. Pinned by SettingsViewModelIdentityTests (GameAppKit): an ancestor
    that mints "A" then "B" is re-rendered in a headless NSHostingView and the
    pixels must not change; a "B"-first host must differ (no vacuous pass).
    Mutation (plain property restored) → red. Sudoku N19 was already red on
    main for the same class (test(e2e): five Sudoku-E2E rows (N4 ×2, N5, N12, N19) are red on main — puzzle-fault / seed-completed-daily seams and isCacheStateReady #1088).
  • 2g (PM whole-PR CR closures): MAJOR-1 — HubSettingsBannerTests
    deleted: since 2c the slot holds no provider, so its seven tests asserted
    refreshCallCount == 0 against a provider wired to nothing (green for any
    code); the behaviour is pinned by BoardViewBannerTests (gate allows → live
    mount / loaded banner; gate denies → collapses), BannerEntitlementWiringTests
    (purchase / restore / updates collapse) and BannerSessionModelFollowUpTests
    (a load that finds the gate closed collapses every slot) — per-test map in
    the commit body. MINOR-1 — runStart() resolves the provider's
    suppression before publishing an open gate (the repoll already did), so
    isVisible never reads true for one frame on macOS; pinned by
    BannerSessionModelSuppressionOrderTests sampling isVisible while the
    status read is held on a latch (old order → [true, false]). MINOR-2 —
    the two negative ATT-primer rows in TodayTabHostTests drop their fixed
    200 ms sleeps: readiness is held on the fake's markReady() seam and a
    registered slot's load (which runs only after ready → ad context →
    sessionReady) is the positive proof before the negative assertion.

Behaviour changes (PM-approved)

  1. Foreground no longer reloads an already-loaded banner (GADBannerView
    self-refreshes).
  2. ✕ dismisses every mounted slot at once.
  3. Pause keeps the slot's identity and handle (isSuppressed: isPaused), so
    resume doesn't request a new ad. Visually identical to v2.3.5's calm contract
    (no banner while paused); now pinned by rendered-board height tests (2c.1).
  4. Purchase collapses all slots immediately; the purchase / restore UI (message,
    toast, .idle) updates before the banner handles are disposed (2c.1).
  5. The banner creative is 320×50 leading-aligned with the ✕ outside it (2e);
    the band still spans the padded host width.
  6. A cold launch on a host whose provider is suppressed (macOS
    NoopAdProvider) no longer paints a one-frame 50pt spinner band before
    collapsing: suppression is resolved before the open gate is published (2g).

Risks carried (from the mid-PR checkpoint CR)

  • NoopAdProvider.refreshBanner() now always throws (AdProviderError.unsupported).
    It is unreachable by ordering (the suppressed check runs first), so an ordering
    regression on macOS would surface as "Ad unavailable" rather than a silent
    no-op. Guarded by the two providerCanServe tests (start and repoll), and
    test(monetization): #1058 simulator evidence E1–E10 for PR #1062 #1077 E8 shows both macOS apps taking the .suppressed bail with 0 requests.
  • The bridge's cancellation mapping (LiveAdMobBridge.loadBanner rethrowing
    CancellationError) is code-review-only in automated tests: it sits behind
    canImport(GoogleMobileAds) and needs a real BannerView, which the macOS
    test host never compiles. test(monetization): #1058 simulator evidence E1–E10 for PR #1062 #1077 E7 exercised it on the simulator with a real
    in-flight load: Leave during the load → onCancel → throw CancellationError
    → status restored, no "Ad unavailable"; the reverse control (rethrow dropped)
    produced .failed.

Survivors and their production readers (2d, corrected after the 2c CR)

Production reads the ad provider / gate only inside makeGameAppCore; the
GameDeps fields had no production reader and were deleted.

Survivor Production reader
ReadinessLatch BannerSessionModel.swift:71, LiveAdMobAdProvider.swift:30
AdProvider.awaitReady() BannerSessionModel.swift:203
BannerSessionModel (incl. hide generation) GameRoot.swift:62,94,104,121,125,195
makeBannerSession(...) MakeGameApp.swift:173
M1 onMissingSession BannerSlotRegistration.swift:34 (defined), :63
makeGameAppCore local adProvider / adGate declared MakeGameApp.swift:142 / :123; adProvider read at :173, :375; adGate read at :173, :178

Known limits (recorded, not hidden)

Tests

Runtime counts from swift test at the final head ee33a60a, one job at a time
(static @Test counts differ — e.g. AppMonetizationKit was 171 runtime vs 173
static at 2d; none are cited here):

Package / batch Result at ee33a60a
AppMonetizationKit 176 tests / 30 suites passed (171 at 2d + 1 in 2e + 2 in d25702c0 + 2 in 2g)
GameAppKit 92 tests / 20 suites passed (90 + the 2 in 2f)
MinesweeperKit 413 tests / 70 suites passed
SettingsKit swift build passed (the PR's change there is comment-only)
SudokuKit composition (SudokuAppCompositionTests) 69 tests / 14 suites passed
SudokuKit today 106 tests / 15 suites passed
SudokuKit board 188 tests / 43 suites, 1 failure (2 issues): BoardLeaveOrPauseStateTests "live startOrResume() lands in the reachable Ready window" (:123, :126) — the #1082 wall-clock flake, isolated re-run --filter BoardLeaveOrPauseStateTests 7/7; this PR touches neither that test nor GameViewModel.swift. (At d25702c0 the same batch was red on ToastTests.autoDismiss_firesAfterDuration instead, #1087, isolated 7/7; at a5ebe93f it was green)
SudokuKit hubs 62 tests / 9 suites passed (69 / 10 before 2g deleted HubSettingsBannerTests, 7 tests)
SudokuKit settings A 31 tests / 4 suites passed (at a5ebe93f the first attempt crashed in swiftpm-testing-helper — signal 11 after the last logged test passed, no test failure recorded, the known local helper segfault described below — and the retry passed)
SudokuKit settings B 25 tests / 6 suites passed

Snapshot baselines, 15 files in total, two causes:

  • 2c (72264ac9): exactly 12 TXT structure baselines move, line 1 only (the
    root type gains one \.bannerSession environment writer) — 6 TodayTabViewTests
    • 6 MinesweeperTodayTabViewTests; zero PNGs.
  • 2e (c78b84ab): 5 files re-recorded for one cause (the ✕ moved from
    f=(357,796,14,14) to f=(336,793,44,44)) — the two
    snapshotIPhoneLightBannerVisible PNG+TXT pairs (their TXT is also among the 12
    above) and the BannerSlotDarkBandRegressionTests postFix_…_bannerOpen_noBand
    PNG. 3 PNG + 2 TXT; the dark band stays uniform.

SudokuKit method: the whole suite dies mid-run in swiftpm-testing-helper with no
test failure recorded (the known local SudokuKit helper segfault near the
SettingsView / Toast NSWindow tests), so it runs as six --filter batches. The
settings batch in particular runs as two halves: half A
SettingsViewTests|SettingsViewWindowSnapshotTests|SettingsIAPRowTests|SettingsViewAppStoreRowsTests,
half B
AudioSettingsSectionTests|ReminderPrimerCoordinatorTests|ReminderSettingsSectionTests|ReminderSettingsStoreTests|ATTPrimerCoordinatorTests|MonetizationStateControllerUpdatesTests;
neither half crashes. The exact six filter strings are recorded in the
2d verification comment;
since 2g the hubs string drops HubSettingsBannerTests.

Neither swift test nor host-driven E2E runs in CI — lint.yml runs scans + SwiftLint only
and audit.yml is the nightly upkeep cron. Unit pins run in every phase's local verification and
in review; E2E-only pins need a simulator run and can sit red unnoticed (the repoll E2E did for
two weeks, #1072). UI automation is tracked in #1039. Owner decision 2026-09-14 (#1039): unit
tests are not being added to CI.

E2E-only pins, with reasons:

  • Cover-env (the board cover receives the session): E2E-only by design — it
    needs a connected UIWindowScene, which no SwiftPM test has.
  • M1, composition-root injection (makeGameApp's \.bannerSession write,
    MakeGameApp.swift:367): no unit pin is reachable — makeGameAppCore is
    private (MakeGameApp.swift:81) and constructs Live types (LivePersistence,
    LiveAdMobAdProvider), the same limit recorded at MemoizedTabRootsTests.swift:9.
    The loud signal outside E2E is the DEBUG onMissingSession assertion, which
    crashes any simulator or device DEBUG run on the first banner mount; test(monetization): #1058 simulator evidence E1–E10 for PR #1062 #1077 E1
    ran that path on both apps (3 slots registered, 0 onMissingSession fires).

Unit pins added in 2c.1: Pause host wiring (BoardViewBannerTests,
MinesweeperBoardBannerSuppressionTests — rendered board, banner height running 50 / paused 0 /
Minesweeper terminal 0); start / repoll hide race + recovery (BannerSessionModelRaceTests);
entitlement UI order (EntitlementHookOrderingTests). Added in 2e: BannerSlotDismissPlacementTests.
Added in 2f: SettingsViewModelIdentityTests (GameAppKit, rendered, macOS host).
Added in 2g: BannerSessionModelSuppressionOrderTests (AppMonetizationKit); deleted in 2g: HubSettingsBannerTests (7 green no-op tests, see the 2g bullet).

E2E (host-driven XCUITest, not in CI): both apps — near-win win/N8/N9/N10 (Sudoku) and
win/N8/N9/N11 (Minesweeper), test_bannerSlotRepollsOnForeground (label query + ATT primer
when present; #1072), test_boardCoverRendersBannerSlot (Today+1 presented, Today paused).
Final-head run at ee33a60a (mise run test:ui all, iPhone 17 Pro / iOS 26.5
simulator, one job at a time), reported red where red:

Suite Result This PR's pins Other rows
Minesweeper-E2E 16 tests, 0 failures test_bannerSlotRepollsOnForeground, test_boardCoverRendersBannerSlot, N15, N8/N9/N11, test_winToCompletion; N19 (the 2f row) green here and 2/2 at a5ebe93f (in-suite + solo) all passed
Sudoku-E2E 20 tests, 4 failures test_bannerSlotRepollsOnForeground, test_boardCoverRendersBannerSlot, N15, N8/N9/N10, test_winToCompletion all passed N4 ×2, N5, N12 failed — the -uitest-puzzle-fault / -uitest-seed-completed-daily seams; identical failures on origin/main d89dba47 (5/5 red on base incl. N19), tracked in #1088. Sudoku N19 is green at this head as a side effect of 2f (red on base)

At a5ebe93f (2f, before 2g) the run had the same shape. At d25702c0 (before
2f) it was Minesweeper 16 / 2 failures (N19; the cover pin failed in-suite "got 1"
and passed solo) and Sudoku 20 / 5 failures (the #1088 five). The 2f base-vs-head-vs-fixed N19 evidence is in the
2f comment;
the 2g closures (coverage map, suppression-order mutation, de-sleeped negatives)
in the 2g comment.

Red evidence

Every row in the design doc's test plan
(meetings/2026-09-11_1058-slot-model-design.md §Test plan) names its red: B1 /
C1 / C2 are red on the base directly; every other row is a hand-applied
mutation, restored by hand and never committed, named in the phase commit
message. Recorded runs by phase:

Phase Red runs
1 e383fa1a latch rows red against 85c65cb4 (base)
1b 553b8fcc 2 mutants: cancel-before-register (hangs → bound), single resume (CONTINUATION MISUSE)
2a 45b34e90 C1, C2 red on base; Gap 2 via "coordinator re-reads shared bannerStatus"
2b a9a48e1a R1, B2, B2′, C3, Gap 1, Gap 2 — one mutation each, named in the commit
2b.1 52c8b17d every new row (seed, refreshGate open gate, late handle, stale cleanup, suppressed result, bannerView(for:), retry trigger) — one mutation each
2c.1 12860e11 8 named mutations, re-run by a fresh-context reviewer: 2c.1 mutation re-check
2d.1 5f820520 compile-time negative proof (guard removed → macOS build red): 2d.1 proof
2e c78b84ab 3 mutations (✕ back over the creative; shrink rule dropped; threshold 396 two-sided) → red at the named widths: 2e evidence
2e d25702c0 drop the isFinite check → 3 rows red (BannerSlotDismissPlacementTests)
2f a5ebe93f @State reverted to the plain @Bindable property → identity row red (after == before fails, the "B" render; output in the commit body); the vacuity row stays green
2g ee33a60a old publish-then-await order restored in runStart() → samples → [true, false] ≠ [false, false] (BannerSessionModelSuppressionOrderTests); the closed-gate row stays green

Device verification

#1077 simulator evidence E1–E10
at 5f820520, iPhone 17 Pro / iOS 26.5, DEBUG (Google test creatives), gate
store swapped to UserDefaults with the real gate logic running; probes are
throwaway NSLog lines, never committed.

# Row Result
E1 signed-out cold launch PASS, both apps — 0 ad requests, 0 onMissingSession, 3 slots registered
E2 gate open → primer → creative PASS, both — awaitReady → primer present → sessionReady → one AD REQUEST → loaded
E3 creative in board cover PASS, both — one request per slot
E4 pause keeps the handle PASS, both — no unregister / dispose / reload across pause → resume
E5 foreground does not reload PASS, both — ensureLoads, request count unchanged
E6 ✕ dismiss FAIL on the pre-existing layout (✕ over the creative → Safari, 2 of 9 taps) → addressed by 2e (#1084): 10/10 dismiss taps, both apps, 0 Safari opens
E7 real cancellation PASS, Sudoku (the bridge is shared) — plus the reverse control
E8 macOS PASS at log level, both apps (.suppressed bail, 0 requests); the visual band check is NOT MEASURED — macOS XCUITest needs an interactive automation-mode grant and window capture failed
E9 repoll with board cover up PASS, both — registered=3, no new request
E10 purchase scenePhase bounce NOT MEASURED — the E2E scheme's .storekit applies only to the LaunchAction, an XCUITest-launched app gets no local StoreKit, and the sim has no sandbox account (product not found)

Also in this PR

  • CLAUDE.md's opening line called these "two shipping games"; it is false and
    it is what framed this as a live incident. Corrected here (85c65cb4) because
    this PR's own framing depends on it.

Related

Closes #1058
Closes #1078

🤖 Generated with Claude Code

wei18 and others added 6 commits September 9, 2026 14:41
… + consent-before-request ordering

BannerSlotView's .task was attached to a Group whose conditional content
collapses to EmptyView() on cold launch (shouldShow starts nil) - SwiftUI
never runs a .task attached to a view that renders as EmptyView, so gate
resolution never started: zero ad impressions on both shipping apps, and
the ATT primer (which only fires once the gate opens) never presented
either (C-33 dormant consent flow).

Hoist .task onto a ZStack, a real container that keeps its own identity
even when its child resolves to EmptyView, so the task always mounts.
Separately, gate the slot's first ad request behind a new
MonetizationBootSignal that bootMonetization marks ready once the
UMP-consent -> ATT -> AdMob-init boot sequence has run, so a request can
never reach the provider before consent resolves - by construction of the
sequential boot coordinator, not by timing luck. Only the Today-tab slot
(the one proven to race cold boot) is wired to the real signal; every
other call site and every test defaults to an already-fired signal, so
their behavior is unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>
…iew call site

#1058 follow-up per review: the previous commit only wired
MonetizationBootSignal into TodayTabHost's slot, on the reasoning that
Board/Practice/Settings slots mount only after user navigation, well
after boot finishes in practice. That is a timing argument, and the
consent-before-request guarantee must hold by construction, not in
practice - a resume pill or reminder deep link can land a player on
the board within moments of launch, before bootMonetization finishes.

Add bootSignal to GameDeps (built once alongside adGate in
makeGameAppCore) and thread it through every layer that constructs a
BannerSlotView in both apps: LiveRouteFactory + its extension files
(board/daily/replay destinations), BoardLoaderView/BoardView (Sudoku),
and the Minesweeper board-loader chain (MinesweeperBoardLoaderView,
MinesweeperFreshBoardLoaderView, MinesweeperDailyOpenGuardView,
MinesweeperDailyReplayLoaderView, MinesweeperBoardView). Every
signature keeps `bootSignal: MonetizationBootSignal = .init(alreadyReady:
true)` as a default so tests and previews are unaffected; only the
live composition roots (Live.swift in both apps) explicitly forward
deps.bootSignal, so no production call site can silently fall back to
the always-ready default.

Trimmed two doc comments (MakeGameApp.swift, SudokuKit's
LiveRouteFactory.swift) to stay under the 400-line file_length gate
after the new parameter's doc comment pushed them one line over.

Co-Authored-By: Claude Fable 5 <[email protected]>
Root-caused the 10 TodayTabViewTests/MinesweeperTodayTabViewTests
baseline diffs flagged in review: they were not a "corrected baseline"
from the gate genuinely resolving, they were a real layout regression
introduced by the .task fix.

Three call sites (TodayTabHost.bannerSlot, Sudoku's
LiveRouteFactory.themedBanner, Minesweeper's
LiveRouteFactory+Helpers.bannerSlot) chained
`.padding(.horizontal, 16).padding(.vertical, 12)` onto the whole
BannerSlotView value. That only ever collapsed to zero when hidden
because of an accidental SwiftUI optimization: a value that is
STATICALLY EmptyView-typed (reachable only through Group's transparent
pass-through) lets an external .padding() collapse right along with
it. Swapping the outer container to ZStack (needed to fix the
.task-never-runs defect) makes the value concrete and non-Empty-typed,
so the SAME external padding stopped collapsing and started rendering
a real 24pt dead gap whenever the banner is hidden - confirmed by
temporarily stripping the vertical padding and watching the 24pt
snapshot diff disappear.

Fix: give BannerSlotView its own horizontalPadding/verticalPadding
parameters (default 0, matching every call site that never wanted
padding) and apply them ONLY inside the `banner` branch, in the same
conditional that decides shown-vs-hidden - so the 0pt-when-hidden
contract is self-contained and no longer depends on the outer
container's type. All three affected call sites now pass
horizontalPadding: 16, verticalPadding: 12 instead of chaining
.padding() externally.

Result: all 10 previously-perturbed snapshot tests (5 Sudoku + 5
Minesweeper TodayTabView baselines) now pass byte-identical against
the ORIGINAL, untouched committed baselines - no re-recording needed.
MinesweeperKit's full suite (411 tests) and SudokuKit's Board/banner/
route-factory suites are all green.

Co-Authored-By: Claude Fable 5 <[email protected]>
…ght, per host

PM addition to the #1058 review: the padding-materializes-when-hidden
regression the team lead caught via an unrelated snapshot diff should
fail loudly on its own, and must cover every host that embeds
BannerSlotView, not just Today (the padding leak is a property of the
container change itself, so board and hub slots are equally exposed
even though the audit below shows only three of the five actually
depended on the collapsed-padding contract).

Adds a parameterized test (5 cases, one per production BannerSlotView
call site, audited via `grep -rn "BannerSlotView(" Packages/*/Sources`
in both apps) asserting a gate-denied BannerSlotView measures zero
height via a real NSHostingView, using each host's actual production
horizontalPadding/verticalPadding arguments. A companion sanity test
confirms the same harness measures non-zero height for a visible
banner, so the zero-height assertions can't be passing for the wrong
reason (a broken measurement always returning 0).

Verified red-then-green in a throwaway worktree at this branch's own
tip (avoids the shared worktree's unrelated dirty state at time of
writing): temporarily moved BannerSlotView's padding back outside the
shown/hidden conditional (the exact bug shape) - the 3 hosts with
non-zero padding (Today, Practice, Settings; all 16h/12v) failed with
exactly 24pt, matching the team lead's own measurement precisely; the
2 Board hosts (0 padding either way) correctly reported no failure.
Restoring the fix returns all 5 cases + the sanity check to green.

Co-Authored-By: Claude Fable 5 <[email protected]>
Closes the silent hole in #1058's RULING 1: bootSignal defaults to an
already-fired signal so tests/previews compile without a real
composition-root boot latch, but a future production call site that
forgets to pass it explicitly compiles clean and tests green while
silently dropping the consent-before-request guarantee - precisely
the "looks fine because nothing complains" failure mode this incident
shipped with twice already (the .task-never-runs defect, then the
padding regression the fix itself introduced).

New mise-tasks/scan/bannerslot_bootsignal (pure python3 stdlib,
follows scan:store_baseline_orphans' structure): finds every
BannerSlotView(...) construction under Packages/*/Sources (excluding
Preview.swift and test targets), walks each call's balanced parens to
correctly handle multi-line constructor calls, and fails with the
offending file:line if bootSignal: is missing. Wired into
.github/workflows/lint.yml as its own ubuntu-latest job, mirroring the
settings-root job's minimal shape.

Verified red-then-green directly: temporarily stripped bootSignal:
from TodayTabHost.swift's call site, confirmed the gate fails with
the exact file:line and a non-zero exit code, restored it, confirmed
PASS again (5/5 production call sites).

Also documents the bootSignal init parameter itself (previously
undocumented while every parameter around it had a doc comment) and
refreshes the stored property's own doc, which had gone stale after
RULING 1 widened bootSignal from a Today-only signal to every
production call site.

Co-Authored-By: Claude Fable 5 <[email protected]>
…as shipped

CLAUDE.md's first substantive line claimed the repo holds "two shipping
Apple-platform games". It is false and it is the first thing every agent in
this repo reads. It misled this very investigation: #1058 was framed as a live
revenue incident affecting 100% of users, and an expedited hotfix from a
TestFlight tag was nearly cut on that basis.

Evidence that neither app has ever been released:
- apps.apple.com returns HTTP 404 for both app IDs (6771248206 Sudoku,
  6775733519 Minesweeper) — a live listing always has a public page.
- ASC read-only preflight reports the editable version as 2.6.0 with
  state=DEVELOPER_REJECTED, i.e. withdrawn, never approved.
- docs/v2/v2.5-readiness.md leaves "TestFlight build promoted to App Store
  version" unticked, and the asc-ops-handoff skill names v2.6 as the first
  App Store release.

Part of #1058.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18

wei18 commented Sep 11, 2026

Copy link
Copy Markdown
Owner Author

CR round 1 (PM) — 1 MAJOR, must-fix before merge. Opus review still owed.

Status note for whoever resumes this: the account hit its weekly usage limit (resets 2026-09-14 12:00 Asia/Taipei) mid-review. The sonnet review completed and is recorded below. The opus architecture review did not run at all and must be re-dispatched after the reset — it was scoped to attack whether the consent-ordering guarantee is structural or merely arranged. Do not merge on sonnet alone.

MAJOR — the scan gate has a demonstrated blind spot one indirection level down

Three wrapper inits carry bootSignal: MonetizationBootSignal = MonetizationBootSignal(alreadyReady: true) defaults:

  • Packages/GameAppKit/Sources/GameAppKit/TodayTabHost.swift:60 (TodayTabHost.init)
  • Packages/SudokuKit/Sources/SudokuAppComposition/LiveRouteFactory.swift:380 (themedBanner)
  • Packages/MinesweeperKit/Sources/MinesweeperAppComposition/LiveRouteFactory+Helpers.swift:42 (bannerSlot)

mise-tasks/scan/bannerslot_bootsignal only text-matches bootSignal: inside BannerSlotView(...) calls. Each wrapper's own internal BannerSlotView(...) already contains bootSignal: bootSignal, — so the gate cannot see whether the wrapper's caller supplied a real signal or fell through to the always-ready default.

Falsified by mutation, not inferred: editing LiveRouteFactory.swift:321 to call themedBanner(adProvider:adGate:) without bootSignal: compiles clean, and the gate still prints PASS … 5 production BannerSlotView(...) construction(s), all pass bootSignal: explicitly. That is exactly the silent-regression shape this issue was, one indirection level down, inside the PR's own new safety net.

Nothing is broken today — all three existing callers pass bootSignal: explicitly. But "consent-before-request holds by construction" does not extend past BannerSlotView itself.

Required fix: remove the = MonetizationBootSignal(alreadyReady: true) default from all three wrapper parameters. Production always has a real GameDeps.bootSignal; tests and previews of the wrappers pass one explicitly. This makes the guarantee compiler-enforced rather than text-scanned, and needs no allowlist maintenance as wrappers are added. (Extending the regex to wrapper call sites was considered and rejected: it is an ever-growing allowlist that recreates the same gap at the next wrapper.)

Verified clean (evidence in the reviewer's run, throwaway worktree at 85c65cb4)

  • Gate goes red on a direct BannerSlotView( mutation, naming the exact file:line; lint.yml wiring present.
  • git diff 26cec630...85c65cb4 -- '**/__Snapshots__/**' is empty — the padding move changed no baseline.
  • BannerSlotCollapsedHeightTests covers all 5 real hosts, not just Today.
  • AppMonetizationKit 124/124, GameAppKit 85/85, MinesweeperKit 411/411 — exact matches; SudokuKit filtered failures are the documented BoardLeaveOrPauseStateTests wall-clock flake (7/7 in isolation).
  • No production AdMob identifiers anywhere in the diff.
  • The ordering test's 500ms margin (raised from a 50ms false green) is documented inline.

Not re-verified by the reviewer: the iOS-only cold-launch tests on a simulator (host swift test excludes #if os(iOS) files), and the iOS-Simulator-destination build.

wei18 and others added 11 commits September 11, 2026 15:41
…ze (#1058)

Phase 1 of the #1058 rework: additive, provider layer only. BannerSlotView,
MonetizationBootSignal and the scan gate are untouched here.

- MonetizationCore.ReadinessLatch: one-way, Mutex-backed awaitable latch.
  Opens once, never re-closes. A waiter cancelled while it is still closed
  throws CancellationError, so a slot that goes away during cold launch
  cannot resume later into an ad request nobody renders or disposes.
- AdProvider gains `awaitReady() async throws` with NO protocol-extension
  default. Every conformer implements it explicitly: Live awaits the
  latch; Noop and UITestNoop return immediately; FakeAdProvider can be
  held via `readinessHeld:` + `markReady()`, and its refreshBanner()
  deliberately does not wait, so a caller that skips awaitReady() still
  shows up in refreshCallCount. The two test-only witnesses return
  immediately.
- LiveAdMobAdProvider opens the latch when initialize() COMPLETES,
  success or failure (defer). Retry-on-failure semantics are unchanged.
  refreshBanner() awaits the latch first. After a failed start it falls
  through to the existing didStart == false path and returns "not
  started" instead of deadlocking.
- Docs: MonetizationBootCoordinator now says plainly that the ATT slot is
  a no-op in live wiring and the system dialog is driven by the primer at
  ad context. It also states that initialize() is only called after UMP,
  so readiness implies consent resolved. The latch semantics are
  documented on AdProvider and LiveAdMobAdProvider.

Tests (every wait is bounded; a stuck latch fails the test, never hangs):
- ProviderReadinessTests (new): refresh waits for initialize and then
  loads; refresh waits while bridge.start() is in flight; a failed
  initialize releases the refresh with the provider's own "not started"
  failure; awaitReady returns only after initialize completes; a retry
  after a failure still loads. The first three are red against 85c65cb.
- BannerLoadTests.refreshBeforeInitializeFails was rewritten as
  refreshBeforeInitializeWaitsWithoutReachingBridge. The old test pinned
  fail-fast, and under the new contract it would hang the suite. The new
  test cancels the waiting refresh and asserts CancellationError, zero
  bridge loads, and status still .notInitialized. Red against 85c65cb.
- ReadinessLatchTests (new) and FakeAdProvider readiness tests (new).
- FakeAdMobBridge gains an optional start gate; ObservedTask is a new
  test helper for polling task completion with a bound.
- ProtocolShapeTests witness exercises awaitReady().

Co-Authored-By: Claude Opus 5 <[email protected]>
Phase 2 design only; no code. It covers:

- A session-scoped BannerSessionModel owns gate resolution, readiness,
  the primer, reload and dispose. BannerSlotView becomes a pure renderer
  with no lifecycle modifiers.
- Slots register through a @StateObject lease inside a DynamicProperty.
  Spike S1 must confirm this before anything is built.
- The document also covers: start order and idempotency; how
  CancellationError is handled; what repoll guarantees beyond the Phase 1
  latch; handles that survive a pause; the #723 seed and pending window;
  the #931 E2E path; the deletion list; batch items; prerequisites; and
  the test plan with its red-evidence strategy.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
Folds the PM's three requirements into the Phase 2 design. Still doc
only; no code.

1. Cancellation is kept distinct from failure at every catch that could
   see a cancelled wait or load:
   - BannerSessionModel.load
   - BannerReloadCoordinator, which becomes throws(CancellationError)
   - the load do/catch in LiveAdMobAdProvider.refreshBanner
   - the catch-all in LiveAdMobBridge.loadBanner, which today wraps
     cancellation as loadFailed
   Tests C1, C2 and C3 pin that a cancelled wait produces no status
   change.
2. BannerSessionModel.adProvider is the same instance bootMonetization
   initializes. awaitReady() is called exactly once, in
   beginReadinessOnce() through `readyTask ??=`. Per-slot loads wait on
   the model-owned sessionReady latch instead. Test R1 pins
   awaitReadyCallCount == 1.
3. The #723 seed is BannerSessionModel.shouldShow. BannerSlotView.body
   reads it synchronously through the environment. It is initialized in
   makeGameAppCore step 5 and resolved by start() step 1. The remaining
   first-read window is stated honestly.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…me (#1058)

Phase 1b: three concurrency-review MINORs on the Phase 1 readiness latch.
Changes are additive only: tests plus one disclosure comment. No
behaviour changes.

- 1b-1: add alreadyCancelledTaskThrowsIfLatchClosed. A task that is
  already cancelled before it calls wait() on a CLOSED latch must throw
  CancellationError promptly. The existing
  alreadyCancelledTaskReturnsIfLatchOpen returns at the isOpen fast path
  and never reached the Task.isCancelled check. Mutation evidence: with
  that check deleted, the test fails at its 2s bound ("wait() on a closed
  latch from an already-cancelled task never returned") instead of
  hanging.
- 1b-2: add openRacingCancellationResumesEveryWaiterExactlyOnce: 200
  iterations x 20 waiters, with open() running concurrently while half
  the waiters are cancelled. Every wait is bounded. Mutation evidence:
  without `state.waiters = [:]` in open(), the run crashes with "SWIFT
  TASK CONTINUATION MISUSE: wait() tried to resume its continuation more
  than once".
- 1b-3: comment at BannerReloadCoordinator's blanket catch. A cancelled
  readiness wait currently surfaces as .failed ("Ad unavailable"), and
  Phase 2 of #1058 closes that seam. Catch behaviour is unchanged.

Both mutants were applied locally, shown red, restored by hand, and never
committed. AppMonetizationKit swift test: 140/140. swiftlint --strict:
clean.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
Doc only. The PM's final rev 3 list:
1. Struck the "signed-out CloudKit read can hang" rationale.
2. Recorded the pre-first-read reflow as a known limit, at parity with
   #723. Its fix seeded from lastKnownShouldShowBanner, which is nil
   until the first resolution.
3. Primer note: maybePresentOnAdContext returns without awaiting the
   sheet, so the first ad may be non-personalised. This matches today,
   and C-33 (primer requested before any load) still holds.
4. readyTask's silent catch is written down as the accepted failure
   mode: reserved .notInitialized, no ad, no false "Ad unavailable".
5. Noop's unsupported throw is unreachable by ordering, not by type.
6. Alternative C (an empty 50pt rect while paused) is recorded as
   considered and deferred.
Also added a pause-to-resume test row: same lease, no second refresh.
Pause keeps isSuppressed, as approved in rev 2.

Updates from the S1 spike results:
- Prerequisites P1 and P2 are now verified. The spike was re-run under
  AppMonetizationKit's exact Swift 6 settings with warnings as errors:
  0 warnings, 0 errors.
- The Swift 6 code shape for BannerSlotRegistration is recorded: a
  nonisolated update() wrapped in MainActor.assumeIsolated, plus a
  @mainactor init.
- P3 is split. Push propagation is verified. The cover is not
  measurable in a SwiftPM iOS test bundle, so it is pinned by an
  app-hosted or E2E row.
- BoardViewBannerTests: its assertions and PNG baselines stay untouched.
  Only its construction and seed lines adapt.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…position

A doc-only follow-up to rev 3 (98a4bff). It covers the lead's S1 findings
and the PM-approved P3a disposition.

- Registration code shape: nonisolated BannerSlotRegistration with a
  @mainactor init and a nonisolated update() wrapped in
  MainActor.assumeIsolated. The doc explains why (#ConformanceIsolation)
  and that an off-main call traps loudly, which is the accepted failure
  mode.
- attach(to:) idempotency is stated as a tested invariant (new row I1).
  update() runs 2 times on first mount and 12 times across 11 renders.
- Restores the missing-model section (DEBUG onMissingSession assertion
  and the .disabled preview model, new row M1). Rev 3 dropped it by
  mistake.
- The \.bannerSession injection moves to the GameRoot(...) value in
  makeGameApp, next to \.theme, instead of shellContent in GameRoot.body.
  Explicit cover re-injection stays as belt-and-braces.
- Prerequisites: P1 and P2 verified with S1 numbers (fallback not
  needed). P3b verified. P3a verified by production evidence: theme is
  injected at MakeGameApp.swift:374 and never re-injected in GameRoot;
  ThemeKey.defaultValue is the grayscale NeutralTheme (Theme.swift:391);
  boards read @Environment(\.theme) and ship in brand colours. The MS
  near-win re-injection explanation is marked as unverified inference.
- Test plan: B1 cites the S1 measurements 216/216/232. The SwiftPM cover
  test becomes an E2E board-in-cover assertion on
  monetization.banner.slot, scoped to the board root.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…uling

A doc-only follow-up to rev 3.1 (0ef4a87). The P3a disposition was
already folded into rev 3.1.

- Records the lead's ruling on BoardViewBannerTests. "Untouched" means
  its assertions and PNG baselines (running/paused outcomes and the
  banner-reserved snapshots) stay byte-identical. Only the BoardView
  construction lines and the lastKnownShouldShowBanner warm-up change,
  to injecting a BannerSessionModel with shouldShow == true. If any
  baseline moves, stop and report; do not re-record.
- Marks the isolated-conformance rejection as reasoning only, not tried
  in S1.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
… not failure (#1058)

Phase 2a of the approved slot-model spec (meetings/2026-09-11_1058-slot-
model-design.md, "PM 1" and "Split state (Gap 2)"). The changes are at the
provider and coordinator layer only: no BannerSessionModel yet, and no view
rewrite.

Seams:
1. AdProvider.refreshBanner() now returns AdBannerHandle
   (@discardableResult), declared explicitly on all 6 conformers.
   - LiveAdMobAdProvider returns the handle bridge.loadBanner() produced.
   - NoopAdProvider throws the new AdProviderError.unsupported. It is
     unreachable by ordering, not by type: load paths stop on
     .suppressed first.
   - FakeAdProvider returns the scripted .loaded handle, or a fresh one.
   - UITestNoop and the two test-only witnesses return a fresh handle.
2. BannerReloadCoordinator.reloadIfGateOpen is now
   async throws(CancellationError). It builds .loaded(handle) from
   refreshBanner()'s return value and never re-reads the provider's
   shared bannerStatus, which was the Gap 2 race. CancellationError is
   rethrown before the generic catch, so .failed only ever means a real
   load failure. The Phase 1b disclosure comment is replaced.
3. LiveAdMobAdProvider.refreshBanner: a load cancelled in flight
   restores the prior status and rethrows, instead of recording .failed.
4. LiveAdMobBridge.loadBanner: after the existing view cleanup, a
   CancellationError (its own onCancel path) or Task.isCancelled is
   thrown as CancellationError instead of being wrapped as loadFailed.
   `import GoogleMobileAds` stays confined to that file.

Transitional view adaptation (Phase 2c rewrites BannerSlotView):
- The two reloadIfGateOpen call sites use try?, so a cancellation leaves
  `status` untouched.
- repollGate gains the same #968 `.suppressed` guard that
  resolveGateAndLoad already has. Without it, macOS NoopAdProvider (which
  now throws `unsupported`) would turn every foreground into
  "Ad unavailable".
- The file stays at the 400-line ceiling.

Tests (every wait bounded):
- C1 cancelledRefreshThrowsCancellationInsteadOfFailed: red on the base.
- C2 cancelledInFlightLoadRestoresPreviousStatus, using the new
  FakeAdMobBridge.setLoadGate: red on the base.
- Gap 2 concurrentReloadsEachReturnTheirOwnHandle: red via the mutation
  "coordinator re-reads the shared bannerStatus after refreshBanner()".
- FakeAdProvider: returns the scripted handle; awaitReadyCallCount (for
  2b's R1).
- Existing tests adapted, compile-only:
  - BannerReloadCoordinatorTests gains `try`/`throws`.
  - Protocol witness and RecordingAdProvider now return a handle.
  - BannerLoadTests: `_ = try?`.
- The bridge's cancellation mapping is behind
  #if canImport(GoogleMobileAds) and needs a real BannerView. It is not
  unit-testable in SwiftPM, so it is covered by code read plus the iOS
  build-for-testing.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ss and slots (#1058)

Phase 2b of the approved slot-model spec
(meetings/2026-09-11_1058-slot-model-design.md). Additive, MonetizationUI
only: the new type and its model-level tests. It is not wired into
makeGameApp or GameRoot yet, BannerSlotView is untouched, and nothing is
deleted; those are 2c and 2d.

New types
- BannerSlotID: identity of one mounted slot, backed by a UUID.
- BannerSessionModel: @mainactor @observable.
  - Observed: shouldShow (Bool?), providerSuppressed, and
    slots [BannerSlotID: AdBannerStatus].
  - Also isVisible, status(for:), and `disabled` for previews/snapshots.
  - start(): idempotent. Order: gate, then the `.suppressed` check
    (never waits or primes), then beginReadinessOnce(), then
    ensureLoads().
  - beginReadinessOnce() makes the app's only AdProvider.awaitReady()
    call, then the primer, then opens sessionReady.
  - load(id): waits on sessionReady, checks cancellation, runs
    reloadIfGateOpen, then stores the result (or disposes it if the slot
    unregistered, or hides everything on `.suppressed`). A cancellation
    writes nothing.
  - register/unregister: unregister cancels the slot's load, disposes
    its handle and removes its entry.
  - sceneDidBecomeActive(): start(), re-resolve the gate, the
    suppressed check, beginReadinessOnce(), ensureLoads(). A loaded
    handle is never reloaded.
  - dismiss(): records the dismissal on AdGate, then hideAll().
  - refreshGate(): re-resolves the gate and runs hideAll() when it is
    closed.
- onMissingSession and the slot registration/lease are deferred to 2c,
  with the view.

Tests: 13 across two suites. Each row was proven red by one hand-applied
mutation that was restored by hand; no mutant was committed.
- R1: awaitReady() once per session. Mutation: per-slot awaitReady in
  load.
- B2: a repoll with readiness held makes no load and shows no primer.
  Mutation: bypass sessionReady.
- B2': ready, then primer, then adLoadStarted. Mutation: open
  sessionReady before onAdContext.
- C3: a cancelled wait makes no observed change. Mutation: the
  cancellation catch writes .failed.
- Gap 1: yesterday's dismissal comes back on foreground. Mutation: drop
  repoll step 2.
- Gap 2: distinct per-slot handles, disposed independently. Mutation:
  store status for every registered slot.
- Seed: isVisible reads synchronously after start(). Mutation: derive
  visibility from slots.
- Cold launch: start() resolves the gate with no slot. Mutation: skip
  the gate read.
- No reload on foreground. Mutation: ensureLoads ignores live handles.
- Dismiss hides and disposes. Mutation: dismiss() skips hideAll().
- Purchase hides without loading. Mutation: refreshGate() skips
  hideAll().
- macOS, start. Mutation: runStart skips the suppressed check.
- macOS, repoll. Mutation: sceneDidBecomeActive skips the suppressed
  check.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
Addresses the PM's mutation-focused checkpoint on c88b034..a9a48e1 and
rulings (b) and (c). Scope is BannerSessionModel and its tests only: no host,
composition or view changes.

MAJOR, now pinned:
- refreshGate() hides only when the re-resolved gate is closed. New row:
  refreshGateWithOpenGateKeepsBanner.
- A handle that returns after its load was cancelled is disposed. New
  row: lateHandleAfterCancellationIsDisposed. It uses HeldLoadAdProvider,
  whose hold deliberately ignores cancellation; a cancellable wait would
  never reach the branch.
- 14c: a stale load's cleanup keeps the newer load's LoadEntry. New row:
  staleLoadCleanupKeepsNewerLoad.

MINOR:
- 14d: a .suppressed load result collapses every slot. New row:
  suppressedLoadResultHidesEverySlot.
- 14b: the readyTask guard in ensureLoads() is kept, with a comment that
  corrects the premise. It is reachable (runStart publishes shouldShow
  before its suppression await) but not observable, so it stays
  belt-and-braces and unpinned.
- `disabled` is now a `static let` (MainActor-isolated). It compiled with
  no isolation diagnostic.
- The unreachable generic catch in load() is reworded so it does not read
  as a live path.

Rulings:
- (b) bannerView(for:) returns the provider's view for the slot's
  .loaded handle, or nil. New row: bannerViewOnlyForLoadedHostedSlot.
- (c) trigger-aware retry: a .failed slot reloads only on its own
  (re-)registration or on a repoll. New row:
  failedSlotRetriesOnlyOnItsOwnTrigger.

Every new row was proven red by a hand-applied mutation, restored by hand,
and not committed:
- unconditional hideAll() in refreshGate()
- dispose deleted in the late-handle branch
- unconditional loads[id] = nil in the defer
- .suppressed written to that slot only
- bannerView(for:) always returning nil
- retrying every .failed slot on any trigger

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…rulings

Doc only.

- The Shape section gains bannerView(for:) (ruling b). It records that
  `disabled` is a MainActor `static let` for preview/snapshot injection
  only, and that the \.bannerSession default stays nil so a missing
  injection still fires onMissingSession.
- Records three benign deviations in the unobserved state: the
  coordinator is built inside init, an extra startTask makes start()
  idempotent, and `now` is injected.
- Pairs the bannerView cast note with the Noop note as one
  "unreachable by ordering, not by type" rule.
- Records ruling (a), dismiss() as record-then-hide, and why: a banner
  that is hidden but whose dismissal never persisted is the worse
  failure.
- New "Spec resolutions" list: the five 2b/2b.1 resolutions plus ruling
  (c), each with the test that pins it. 14b is moved out of the pinned
  list, with the reason.
- Corrects the threading list to 25 production files, each named. The
  lead's count of 23 is right apart from the two *AppComposition/
  Preview.swift files, which also build FakeAdProvider/AdGate and pass
  them into the composition struct's init.
- The test plan gains the six 2b.1 rows and their named mutations.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…del (#1058)

This is the atomic swap of phase 2c. `BannerSlotView` becomes a pure renderer
of the one `BannerSessionModel` per app session, and every host stops
threading `adProvider` / `adGate` / `bootSignal` into it.

Why it cannot be split: changing `BannerSlotView`'s init (dropping the
provider, gate and boot signal, adding `isSuppressed`) breaks every host at
once — `TodayTabHost`, both apps' boards, loaders and route factories, the
Practice/Settings banner builders, and every test that constructs them. There
is no compiling intermediate state without a compatibility shim, which is
ruled out.

What changes
- MonetizationUI: `BannerSlotView` has no lifecycle modifiers and no `@State`;
  it registers through `BannerSlotRegistration` (a nonisolated
  `DynamicProperty` holding a `@StateObject` lease with idempotent attach and
  `isolated deinit`). `\.bannerSession` defaults to nil; a slot mounted
  without one calls `BannerSessionModel.onMissingSession` (asserts in DEBUG).
- GameAppKit: `makeGameApp` builds the model once, over the same provider,
  with the ATT primer as its `onAdContext` hook, and injects it on the
  `GameRoot` value next to `\.theme`; `GameRoot` re-injects it on the board
  cover, starts it in the existing `.onAppear { Task }` and repolls it from
  `.onChange(of: scenePhase)`. `TodayTabHost` drops its four monetization
  parameters and `todayTabHostFireOnAdContext`.
- Entitlement hook: `MonetizationStateController(onEntitlementChanged:)`
  calls `bannerSession.refreshGate()` from `markPurchased()`, which is
  reached by `purchaseRemoveAds` `.success`, by `restorePurchases` when an
  entitlement is restored, and by the `Transaction.updates` listener's
  `.purchased`. Not reached: `.revoked` (clears `hasPurchasedRemoveAds`
  without recording to the gate) and `bootstrap()` (reads products without
  recording a purchase). Isolation: the controller is `@MainActor`, the hook
  is `@MainActor () async -> Void` and is awaited directly — no `Task` wrapper.
- Hosts: boards always build the slot with `isSuppressed: viewModel.isPaused`
  (Minesweeper `|| viewModel.isTerminal`); board padding moved into the slot
  as `horizontalPadding: theme.spacing.medium`.
- `.disabled` is allowed only in previews (the Minesweeper board `#Preview`),
  snapshot fixtures, and the three DEBUG near-win covers
  (`SudokuNearWinCoverView`, `SudokuNearWinModalCoverView`,
  `MinesweeperNearWinCoverView`), which sit outside `makeGameApp`'s injection.
  The modal cover's missing injection crashed Sudoku's near-win E2E with M1's
  assertion and is fixed here; the modal hook exists only in Sudoku (#1073),
  so a Minesweeper counterpart would need the same `.disabled`.
- Root-modifier audit (all hooks attached above GameRoot's \.bannerSession write): *NearWinModifier (both apps) already .disabled; SudokuNearWinModalModifier fixed here (.disabled, DEBUG+iOS, -uitest-near-win-modal only); UITestRouteModifier (GameAppKit) only sets selectedTab/setPath, so its boards open through GameRoot's cover with the real session.

Scan gate removed
- `mise-tasks/scan/bannerslot_bootsignal`, its `lint.yml` job and the
  `lint.yml` header index line are deleted here (PM ruling), not in 2d: 2c
  removes the `bootSignal:` parameter the gate checks. Its guarantee is now
  carried by the readiness latch inside the carrier (`AdProvider`), and a
  lost `\.bannerSession` injection fires M1's DEBUG `onMissingSession`
  assertion. The one remaining mention is the design doc line recording
  this deletion.

Survivors (kept on purpose)
- `GameDeps` / `GameConfig` `adProvider` + `adGate`: `bootMonetization` and
  the composition structs read them.
- `SudokuAppComposition` / `MinesweeperAppComposition` `adProvider` + `adGate`
  (and the `Live.swift` / `Preview.swift` args that fill them): public
  composition surface.
- `makeBannerSession(adProvider:adGate:attPrimer:)`: builds the one model.
- `MonetizationBootSignal`, `GameDeps.bootSignal`, `bootMonetization`'s
  `bootSignal` and `AdGate.lastKnownShouldShowBanner`: removed in phase 2d.

Tests
- New `BannerSlotViewTests` (B1, S1, I1, M1, Pause) and
  `BannerEntitlementWiringTests`; `TodayTabHostTests` and
  `BannerSlotCollapsedHeightTests` retargeted; `BannerSlotColdLaunchTests`
  deleted (it compiled the removed init).
- Snapshot fixtures inject `.disabled` or a started session over a
  readiness-held fake per call site. Exactly 12 TXT structure baselines move,
  line 1 only (the root type gains one environment writer); zero PNGs:
    MinesweeperTodayTabViewTests/*.txt | 6 files, 1 +, 1 - each
    TodayTabViewTests/*.txt            | 6 files, 1 +, 1 - each
- E2E: the repoll assertion queries the slot by its "Advertisement" label
  and dismisses the ATT primer when present — `game.today.root` shadows the
  slot identifier on base 7ca5d73 too (pre-existing, #1072). New cover-env
  E2E in both apps counts slots with a board presented (Today + 1) and paused
  (Today).

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
…te purchase UI before the entitlement hook (#1058)

2c CR follow-ups: MINOR-3, MINOR-4, the 2c.1 part of MINOR-1, and the pins
PM's CR part 2 made a condition of accepting 2c.

MINOR-3 — repoll/start vs refreshGate() race (BannerSessionModel)
- `runStart` read the gate, published `shouldShow = open`, then awaited
  `providerCanServe` before loading; `sceneDidBecomeActive` awaited `start()`,
  the gate read and `providerCanServe` before publishing `shouldShow = true`.
  A `refreshGate()` → `hideAll()` (a purchase, or a dismiss) landing inside one
  of those awaits was overwritten: the slot showed a spinner that later
  collapsed with no ad request.
- Fix: a plain `hideGeneration` counter on the `@MainActor` model, bumped by
  `hideAll()`. Both paths capture it before their first await and bail before
  publishing `shouldShow` and before `ensureLoads` when it changed.
  `refreshGate()` with an open gate still does nothing (no bump); dismiss →
  `hideAll()` bumps, as intended. A bail leaves no sticky state: the next open
  repoll publishes, begins readiness if needed and loads; `start()` stays a join.
- Tests (`BannerSessionModelRaceTests`), each holding the gate read with an
  uncancellable latch-held store:
  - start window: hold `runStart`'s first gate load, land `refreshGate()` on a
    closed (dismissed-today) gate, release → hidden, no refresh. Then reopen the
    gate (next day) and repoll → visible, loaded, exactly one refresh.
  - repoll window: after a completed start, hold the wall-clock save inside
    `sceneDidBecomeActive`'s gate read (the cached gate never reloads), record a
    dismissal and land `refreshGate()`, release → hidden, no new refresh. Then
    reopen and repoll → visible, loaded, exactly one more refresh.
  - Red runs: drop `runStart`'s checks → start row red; drop
    `sceneDidBecomeActive`'s check → repoll row red; a sticky bail flag that
    no-ops later publishes → both rows red on recovery; skip
    `beginReadinessOnce()` in the repoll → start row red on recovery.

MINOR-4 — markPurchased() ordering (MonetizationStateController)
- `markPurchased()` awaited `onEntitlementChanged` (→ `refreshGate` → handle
  disposal) before its callers set the message, toast and `flowState = .idle`.
  It now only sets the flag and `recordPurchase()`s; each path — purchase
  `.success`, restore with a restored entitlement, and the updates listener's
  `.purchased` — updates its UI first, then awaits the hook. Isolation is
  unchanged: `@MainActor`, awaited directly, no `Task` wrapper. No ordering
  reason required the old order.
- Tests (`EntitlementHookOrderingTests`): with the hook held on a latch, the
  purchase and restore rows observe `.idle`, their message and a success toast,
  and the listener row its message and toast, before the hook returns. Red on
  all three rows when the hook is awaited inside `markPurchased()` again.

Pause host wiring pins (CR part 2 MAJOR)
- `BoardViewBannerTests` (Sudoku) and new `MinesweeperBoardBannerSuppressionTests`
  render the real `BoardView` / `MinesweeperBoardView` over a started session
  with a loaded slot whose fake provider serves a height probe, and read the
  height the banner is laid out at: running 50, paused 0, Minesweeper terminal 0.
  No production hooks.
- Red runs: Sudoku host `isSuppressed: false` → paused row red; Minesweeper host
  `isSuppressed: false` → paused and terminal rows red; Minesweeper drops
  `isTerminal` → terminal row red.
- `paused_bannerIsSuppressed` only constructed the view; it is replaced by the
  real pins and the header's claim of a running/paused snapshot pair is gone.

M1 composition write — E2E-only
- No unit pin is reachable for `makeGameApp`'s `\.bannerSession` write:
  `makeGameAppCore` is `private` (MakeGameApp.swift:81) and builds
  `LivePersistence` / `LiveAdMobAdProvider`, which an unentitled SwiftPM runner
  cannot construct — the same limit recorded at MemoizedTabRootsTests.swift:9.
- Outside E2E the loud signal is the DEBUG `onMissingSession` assertion: it
  crashes any simulator or device DEBUG run on the first banner mount (device
  evidence E1 exercises that path).
- Recorded in the design doc as E2E-only, with "host-driven E2E does not run in
  CI (#1039)" next to it and next to the cover-env row.

MINOR-1 (2c.1 part) — `MakeGameApp.swift`'s tab-root comment no longer says the
ATT primer rides the Today slot's first load: the banner session requests it
after provider readiness, before the first load (`onAdContext`). Net lines
unchanged (400). The bootSignal comments stay for 2d.

Part of #1058.

Co-Authored-By: Claude Opus 5 <[email protected]>
@wei18

wei18 commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Phase 2c.1 mutation re-check: PASS. Range 72264ac9..12860e11. This unblocks #1076 (phase 2d).

Run by a fresh-context reviewer in a throwaway worktree at 12860e11, suites run one at a time. Baselines green: AppMonetizationKit 177/177, SudokuKit BoardViewBannerTests 6/6, MinesweeperKit MinesweeperBoardBannerSuppressionTests 3/3.

# Mutation Result
1 Remove runStart hide-generation checks red: hideDuringStartReadWins
2 Remove sceneDidBecomeActive hide-generation check red: hideDuringRepollReadWins
3 A bail sets a sticky flag red: both race tests fail their recovery assertion
4 Repoll skips beginReadinessOnce() red on the start-window row only, as expected
5 Sudoku host isSuppressed: false red: pausedBoard_suppressesLoadedBanner (height 50 vs 0)
6 Minesweeper host isSuppressed: false red: paused and terminal rows
7 Minesweeper drops isTerminal red: terminal row only
8 Entitlement hook awaited before the purchase UI updates red: purchase, restore and updates-listener rows

Also verified by reading the code:

  • Only hideAll() bumps the hide generation. Both paths capture it before their first await and check it before publishing and before loading. It is a monotonic counter, so a bailed pass recovers on the next repoll.
  • adGate.recordPurchase() runs before the hook on all three entitlement paths.
  • The pause pins render the production board views in NSHostingView over a fake provider. No production test hook was added.
  • Scope: exactly 8 files, 0 snapshots, 0 nonisolated(unsafe), MakeGameApp.swift at 400 lines, no production identifiers, every #NNN real, and the design doc M1 row citations check out.

No BLOCKER, MAJOR or MINOR findings.

… composition ad fields with no production reader

Phase 2d of #1058: deletions only, no behaviour change. The session-scoped
BannerSessionModel (2c) and the provider's own readiness latch replaced
every consumer of these, so each item below had no production reader.

Deleted:
- MonetizationBootSignal (type + file), GameDeps.bootSignal,
  bootMonetization's bootSignal parameter and both markReady calls, and
  the stale bootSignal comments in MakeGameApp.swift and GameConfig.swift.
- AdGate.lastKnownShouldShowBanner, its Mutex, the hint writes in
  shouldShowBanner / recordBannerDismissed / recordPurchase, the orphaned
  doc sentence on resolveShouldShowBanner, and AdGateLayoutHintTests
  (subject deleted; no reader since 2c).
- GameDeps.adProvider / adGate. makeGameAppCore never read them off
  GameDeps; their only readers were the two Live.swift fills of the
  composition fields below.
- SudokuAppComposition / MinesweeperAppComposition stored adProvider /
  adGate, their init params, Live.swift fills and Preview.swift args.
  Only CompositionTests / MinesweeperAppCompositionTests read them.

Tests:
- CompositionTests: adProvider type assertions and the adGate smoke
  dropped (subject deleted); the iapClient assertion stays.
- MinesweeperAppCompositionTests: adProvider / adGate smoke lines dropped,
  liveAdProviderIsLiveOnIOSNoopOnMac deleted (subject deleted). Known
  coverage gap: no test now pins makeGameAppCore's Live/Noop AdProvider
  platform choice (MakeGameApp.swift:142-160); no seam exists and 2d adds
  none.
- FakeAdProvider.markReady stays: it is the fake's provider readiness
  latch for AdProvider.awaitReady(), not the boot signal. It and its 4
  test call sites are the only remaining hits of the 2d rg.

Comments: ReminderSettingsSection's scenePhase note now points at
GameRoot's banner repoll instead of the retired BannerSlotView re-poll.
Every #931 comment was checked and is current.

Survivors and their production readers:
- ReadinessLatch: BannerSessionModel.swift:71, LiveAdMobAdProvider.swift:30
- AdProvider.awaitReady(): BannerSessionModel.swift:203
- BannerSessionModel: GameRoot.swift:62,94,104,121,125,195
- makeBannerSession(...): MakeGameApp.swift:173
- M1 onMissingSession: BannerSlotRegistration.swift:34 (defined), :63
- makeGameAppCore's local adProvider (MakeGameApp.swift:142): read at
  :173 and :375; local adGate (:123): read at :173 and :178

Design doc: 2d list marked done; new "Phase 2d — deletions and survivors"
section.

Part of #1058.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ompile time

Phase 2d.1 of #1058 (PM ruling on the 2d coverage gap). 2d deleted
MinesweeperAppCompositionTests.liveAdProviderIsLiveOnIOSNoopOnMac, the only
test of makeGameAppCore's Live/Noop AdProvider selection
(MakeGameApp.swift:142-160). That selection is a closure inside
makeGameAppCore, and no unit test can reach it without refactoring
production code.

Pin it in the carrier instead: LiveAdMobAdProvider.init(bannerAdUnitID:) is
now wrapped in #if canImport(GoogleMobileAds), the same guard
LiveAdMobBridge uses. On macOS the SDK is absent, so the public init does
not exist, and a branch that constructs the live provider on macOS fails
the macOS build. internal init(bridge:) stays unguarded, so the macOS-host
provider tests with fake bridges keep running. The only caller of the
public init is MakeGameApp.swift:156, inside #if os(iOS).

Negative proof (macOS host, swift build GameAppKit, with the #if os(iOS)
branch in MakeGameApp.swift temporarily removed):
- guard temporarily removed: "Build complete!" (the flip compiles, so
  nothing else pins it)
- guard in place: "MakeGameApp.swift:155:16: error: 'LiveAdMobAdProvider'
  initializer is inaccessible due to 'internal' protection level" (with
  "incorrect argument label in call (have 'bannerAdUnitID:', expected
  'bridge:')")
The mutation was restored; the MakeGameApp.swift diff is empty.

Design doc: the 2d coverage-gap note now records it as closed by 2d.1 and
names the mechanism.

Part of #1058.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@wei18

wei18 commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Phase 2d.1 (#1076, PM ruling): Live/Noop ad provider choice pinned at compile time, pushed at 5f820520

Range 06ec1ca5..5f820520, one commit: 2 files, +13/−4. This closes the coverage gap 2d disclosed when it deleted liveAdProviderIsLiveOnIOSNoopOnMac.

Change

  • AdsAdMob/LiveAdMobAdProvider.swift: public init(bannerAdUnitID:) is now wrapped in #if canImport(GoogleMobileAds), the same guard LiveAdMobBridge uses. A one-line comment states the purpose: macOS must get NoopAdProvider, and the guard pins makeGameAppCore's Live/Noop branch at compile time.
  • internal init(bridge:) is left unguarded, so the macOS-host provider tests with fake bridges keep running.
  • Callers of init(bannerAdUnitID:): only MakeGameApp.swift:156, inside #if os(iOS). BannerViewProvidingTests.swift:45 calls LiveAdMobBridge(bannerAdUnitID:), which is a different type and unaffected. No test or source needed adapting.
  • Design doc: the 2d coverage-gap note now says the gap is closed by 2d.1 and names the mechanism.

Negative proof, macOS host

Mutation: remove #if os(iOS) / #else / return NoopAdProvider() / #endif in MakeGameApp.swift:142-160, so macOS compiles LiveAdMobAdProvider(bannerAdUnitID:). Build with swift build --package-path …/Packages/GameAppKit.

Run Result
Control: guard temporarily removed Build complete!. The flipped branch compiles, so nothing else pins it.
Guard in place red: MakeGameApp.swift:155:16: error: 'LiveAdMobAdProvider' initializer is inaccessible due to 'internal' protection level plus MakeGameApp.swift:155:35: error: incorrect argument label in call (have 'bannerAdUnitID:', expected 'bridge:')

The mutation was restored afterwards:

  • git diff --quiet -- …/MakeGameApp.swift exited 0.
  • The whole working-tree diff was byte-identical to the pre-verification snapshot (diff exit 0).
  • The commit contains only the two files above.

Green

  • AppMonetizationKit swift test: runtime Test run with 171 tests in 28 suites passed. This matches 2d's runtime count exactly, since 2d.1 changes no tests. The reviewer's figure of 173 is a static @Test count, not a run.
  • GameAppKit: swift build gives Build complete!; swift test gives Test run with 90 tests in 19 suites passed.
  • App-scheme builds with CODE_SIGNING_ALLOWED=NO, run one at a time, all ** BUILD SUCCEEDED **:
    • Sudoku: iOS Simulator and macOS
    • Minesweeper: iOS Simulator and macOS
    • The macOS builds show the NoopAdProvider branch still compiles with the guard present.
  • swiftlint lint --strict on LiveAdMobAdProvider.swift: 0 violations. The pre-commit hooks (gitleaks, hygiene, swiftlint) passed.
  • import GoogleMobileAds: still 1 real site, LiveAdMobBridge.swift:7. The other 3 hits are comments.
  • 0 __Snapshots__ changes.
  • Before pushing I confirmed origin/fix/1058-bannerslot-task-lifecycle was still 06ec1ca5. Pushed with HEAD:fix/1058-bannerslot-task-lifecycle, no force.

@wei18

wei18 commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner Author

#1077 — simulator evidence E1–E10 for #1062 (head 5f820520)

Result: E1–E5, E7, E9 PASS on both apps (E7 on Sudoku; the bridge is shared) · E6 FAIL → #1084 (pre-existing layout, not introduced by this PR) · E8 PASS at log level (visual band check not captured) · E10 NOT MEASURED

Setup

  • Code: throwaway detached worktree at 5f820520 (head verified with git fetch before starting), seeded (mise run worktree:seed, mise trust, tuist generate). Nothing committed or pushed; the worktree is removed once this evidence is reviewed.
  • iOS: a dedicated simulator created for this run, e1077-evidence (iPhone 17 Pro, iOS 26.5), deleted at the same point. Fresh device, no iCloud account, online. Debug build, so AdMob serves Google test creatives only.
  • Launch: a hold-open XCUITest (xcodebuild test-without-building) gives the Personal-team build its entitlements; driven with idb; logs from simctl spawn … log stream --predicate 'eventMessage BEGINSWITH "E1077"'.

Gate store substitution (every E2–E10 run). With -e1077-gate-open, AdGate ran its real decision logic (purchased → grace → dismissed-today → clock tamper) over a UserDefaults-backed AdGateState instead of the CloudKit store. loadState and saveState were swapped; resolveShouldShowBanner was not touched. This is what exercises the dismissed-today persistence in E6, and it would have exercised the purchased flag in E10 had a purchase gone through (it did not). A plain return true would have bypassed both checks.

Residual gap: the real CloudKit read and write of AdGateState for a signed-in iCloud user is not demonstrated. E1 shows only the signed-out path, where the store throws and the gate stays closed.

Throwaway instrumentation (not committed)

Every line tagged E1077 below is NSLog only. Three sites hoist an already-awaited expression into a let before the unchanged guard/if, so evaluation order is the same: BannerReloadCoordinator.swift:45-46 (reloadIfGateOpen), BannerSessionModel.swift:154-156 (refreshGate), BannerSessionModel.swift:174-176 (unregister). Five files also gain internal import Foundation. E5 and E9 log lines are in the continuing E2 run logs (logs/E2-sudoku.log, logs/E2-minesweeper.log).

File (Packages/…) Probe lines (log only) Behaviour switches (launch arg)
AppMonetizationKit/Sources/MonetizationCore/AdGate.swift 147, 155, 161, 169, 175, 179 (gate resolve -> …), 211, 279 -e1077-gate-open: 210–224 currentState() reads UserDefaults["e1077.adGateState"] (fresh default firstLaunchAt: .distantPast) instead of store.loadState(); 275–279 mutate writes there instead of store.saveState. -e1077-reset-gate: 215–216 clears that key once per launch
AppMonetizationKit/Sources/AdsAdMob/LiveAdMobBridge.swift 153 AD REQUEST (immediately before bannerView.load(Request())), 163 onCancel, 168 load success, 173 catch, 180 throw CancellationError, 184 throw loadFailed, 199 dispose, 277 didReceiveAd, 282 didFailToReceiveAd -e1077-load-delay: 144–149 sleep 15 s inside the MainActor load task before load; skips the load if onCancel already removed the view. -e1077-no-rethrow: 179 drops the CancellationError rethrow (E7 reverse control only)
AppMonetizationKit/Sources/AdsAdMob/LiveAdMobAdProvider.swift 68, 73, 97, 103, 107 —
AppMonetizationKit/Sources/MonetizationCore/BannerReloadCoordinator.swift 49, 54, 59, 62 —
AppMonetizationKit/Sources/MonetizationUI/BannerSessionModel.swift 125, 128, 133, 139, 145, 155, 165, 175, 189, 217, 220, 248, 258, 263, 268, 270, 290 —
AppMonetizationKit/Sources/MonetizationUI/ATTPrimerCoordinator.swift 61, 68, 73, 80, 88 —
AppMonetizationKit/Sources/MonetizationUI/BannerSlotRegistration.swift 36 onMissingSession FIRED (before the existing assertionFailure) —
AppMonetizationKit/Sources/MonetizationUI/MonetizationStateController.swift 269, 274, 282, 286, 292, 373 —
GameAppKit/Sources/GameAppKit/GameRoot.swift 121 scenePhase old -> new, 123 —
GameAppKit/Sources/GameAppKit/MakeGameApp+BannerSession.swift 31 —
App/{Sudoku,Minesweeper}E2ETests/E1077HoldOpenTests.swift (new) hold-open launcher (E1077_ARGS → launch args), testMacE8, one SKTestSession attempt (Sudoku, E10) —

Probe-derived observations are the quoted E1077 … log lines. Everything else is the a11y tree (idb ui describe-all / describe-point), screenshots, or foreground-app checks.

Matrix

# Result Proof
E1 signed-out cold launch PASS (both) Today / Practice / board: no monetization.banner.slot in the a11y tree, no band. Sudoku: gate resolve -> false purchased=<unknown> (CloudKit store threw) → session start gate=false → sceneDidBecomeActive outcome=hideAll → hideAll gen=1 disposing=0. Slots register (total=3) with 0 AD REQUEST and 0 onMissingSession FIRED. Minesweeper identical
E2 gate open → primer → creative PASS (both) Sudoku 11:55:13.907 awaitReady done -> onAdContext · 13.933 primer present · 13.933 sessionReady open · 14.099 bridge AD REQUEST handle=54B4A912 · 15.604 load result … loaded · 48.619 primer resolved choice=notNow. Test creative in the Today slot (a11y Advertisement y=729). MS: 12:05:46.636 primer present → 46.982 AD REQUEST → loaded. The request fires while the sheet is still up, as the design doc accepts (meetings/2026-09-11_1058-slot-model-design.md:77-80, P5): the primer is requested before sessionReady opens
E3 creative in board cover PASS (both) Sudoku 11:57:10.533 register slot=766FF216 total=3 → 10.753 AD REQUEST AD9C2255 → 11.462 load result slot=766FF216 loaded; slot y=480 inside the cover. MS board slot 7A949A7E → AD REQUEST 90C9FB8D → loaded; slot y=704. One request per slot
E4 pause keeps the handle PASS (both) Paused: no slot in the a11y tree. Resumed: slot back, no unregister / dispose / load begin between pause and resume, AD REQUEST count unchanged (Sudoku stays 3, handle AD9C2255)
E5 foreground does not reload PASS (both) Sudoku 11:56:20 active->inactive->background · 11:56:38.205 inactive->active · 1× GameRoot calling sceneDidBecomeActive · outcome=ensureLoads registered=1 · AD REQUEST total stays 1. MS same (12:06:12.533, stays at 1)
E6 ✕ dismiss FAIL → #1084 See the #1084 section below. When the tap reaches the ✕ (Sudoku 11:59:11): session dismiss → gate mutate saved(local) dismissed=2026-09-13 16:00 UTC → hideAll gen=1 disposing=3 → dispose AD9C2255/54B4A912/D7CA4BB3 found=true; board, Practice and Today slots all gone. Same-day relaunch (no reset): gate resolve -> false dismissed=2026-09-13 16:00 UTC → hideAll disposing=0, 3 slots register, 0 requests, no primer. But on Minesweeper the ✕ tap opened the ad in Safari twice; the Sudoku PASS above was on a letterboxed render
E7 real cancellation PASS (Sudoku) -e1077-load-delay; board opened 12:02:16, Leave 12:02:22 while the board load was in its delay: 22.534 bridge onCancel handle=8F11E545 · 22.534 unregister slot=29BA48DF · 22.549 bridge catch error=CancellationError taskCancelled=true · 22.550 bridge throw CancellationError · 22.550 provider cancelled status restored to loading · coordinator … result=cancelled · 22.555 load result slot=29BA48DF status=cancelled · 32.293 bridge skip load after cancel (view already released; no request ever sent). Today and Practice loaded normally; no "Ad unavailable" anywhere. Reverse control (+ -e1077-no-rethrow): 12:04:08.718 bridge throw loadFailed · provider status=failed reason=loadFailed(reason: "CancellationError()") · coordinator result=failed(…) · load result … dropped (cancelled or unregistered) — the rethrow is what keeps a cancel from becoming .failed
E8 macOS PASS (logs); visual band check NOT MEASURED Both macOS apps built (platform=macOS). XCUITest on macOS stopped at Timed out while enabling automation mode (needs user authentication, not bypassed). So each app binary was run directly, 25 s, with OS_ACTIVITY_DT_MODE=YES (macOS redacts NSLog("%@") in the unified log) and -e1077-gate-open -e1077-reset-gate. Sudoku (-uitest-route practice): gate resolve -> true · session start gate=true · sceneDidBecomeActive outcome=bail (provider reports .suppressed) · AD REQUEST 0 · primer 0 · awaitReady 0 · onMissingSession FIRED 0. Minesweeper (-uitest-route board:beginner, board slot registered): identical, 0 / 0 / 0 / 0. The gate was forced open, so the hiding comes from the macOS provider path, not a closed gate. Not captured: a window-only screenshot of the board (window on another Space; screencapture -l "could not create image from window"; no Accessibility for scripting). Sudoku's board needs a click, so it was not reached
E9 repoll with board cover up PASS (both) Sudoku 11:57:39.780 inactive->active · 1× GameRoot calling sceneDidBecomeActive · outcome=ensureLoads registered=3 · no unregister / dispose / load · AD REQUEST stays 3; board slot back after the auto-pause Resume. MS (no auto-pause) 12:07:12.688, registered=3, no new request, slot y=704
E10 purchase scenePhase bounce NOT MEASURED One attempt. The E2E scheme's .storekit is set only on the LaunchAction (Sudoku-E2E.xcscheme:78-80), so an XCUITest-launched app gets no local StoreKit; schemes left unmodified. The hold-open test created SKTestSession(contentsOf: Sudoku.storekit) in the runner, which logged Error saving configuration file: SKInternalErrorDomain Code=3 (also for setting values and deleting transactions). Tapping Remove Ads: purchase begin → purchase result=failed(product not found: <Remove Ads product id>) 19 ms later. No sheet, no scenePhase change, row shows "Last attempt failed", banner unchanged. The simulator has no sandbox account. Apple's docs don't say a UI-test SKTestSession controls the app process (WWDC20 10659 only says StoreKitTest "works with XCTest for … UI test coverage")

E6 / #1084 — ✕ tap reaches the creative

The ✕ is a 12×12 pt button (xmark.circle.fill, frame {x367, slot_y+6.7}), so the a11y hit target is 12 pt. The layout is pre-existing (docs/v2/design.md:230, #441 overlay).

  • Failing taps. Minesweeper, board slot, full-width render, taps at the a11y centre (373,716), 12:07:27 and again 12:09:23. Log: only scenePhase active -> inactive -> background, no session dismiss. Foreground app: Safari (ad click-through).
  • Render width varies per render. Pixel scan of the slot row: letterbox = creative 41–361 pt (320 pt) with black gutters 16–41 / 361–386, ✕ over gutter; full = 16–386 pt, ✕ over the creative. First renders included. It is not caused by pause→resume.
  • a11y blind spot. The a11y tree exposes no creative frame, only the slot {16,y,370×50} and the inner Test mode text {149.3,y+4,103.7×34}, identical in both render modes.

Isolation: every tap below ran in its own fresh run, except the two MS E6 taps (one session) and Sudoku E6 11:59:11 (the E2 run).

Case App / slot History Render ✕ over Result
E6 tap 1, 12:07:27 MS board pause→resume full creative Safari, no dismiss
E6 tap 2, 12:09:23 MS board same session, after Safari full creative Safari, no dismiss
12:12:24 Sudoku Today first render full creative dismiss
(b) 12:21:40 MS Today first render full creative dismiss
retry 12:27:52 Sudoku board first render full creative dismiss
E6 11:59:11 Sudoku board pause→resume letterbox gutter dismiss
(a) 12:20:02 Sudoku board first render letterbox gutter dismiss
(c) 12:23:17 MS board first render letterbox gutter dismiss
(d) 12:24:53 MS board pause→resume letterbox gutter dismiss

The click-through reproduced twice, within one Minesweeper session. Seven other taps dismissed, including three with the ✕ over a full-width creative. So it is intermittent, not "always on the cover". The fix direction is set by #1084 either way.

Other observations (not matrix rows)

  • Letterbox width. The same creative renders either 370 pt full width or 320 pt letterboxed, on first renders as well as after a re-host. Examples: letterbox on the Sudoku board first render (12:16) vs full width after resume (E9).
  • Practice subtitle. After leaving a Sudoku board, the Practice "Ready to play" subtitle shows a raw id (Medium · practice-7KWJ44JQ7YFKE-medium).

Local evidence (uncommitted, not uploaded)

/Users/zw/GitHub/Wei18/evidence-1077/

  • results.md — full notes
  • logs/*.log — probe streams + xcodebuild
  • E1…E10/*.png
  • isolation/*.png
  • letterbox/*.png
  • E8/*.xcresult

…the creative to 320×50 (#1084)

The dismiss ✕ was a 12pt glyph drawn over the top-trailing corner of the
AdMob creative (design.md §How.6, #441). Tapping it reached the ad on 2 of
9 taps in #1077 E6, and AdMob policy forbids app content over or adjacent
to the creative. Both apps share this slot, so one implementation moves.

Ad size: the bridge already requested the fixed 320×50 standard banner via
`BannerView(adSize: AdSizeBanner)` (unchanged). The 370pt full-width render
came from `BannerViewRepresentable` having no `sizeThatFits`, so SwiftUI
stretched the hosted `BannerView` to whatever `BannerSlotView` proposed.
`sizeThatFits` now returns `BannerSlotView.creativeSize` (320×50), the same
constant the slot frames the creative with, so both sides agree by
construction. A first cut returned `cgSize(for: uiView.adSize)` at layout
time; a base-vs-new simulator A/B showed that leaves the hosted view 0×0
(creative never paints: the XCUITest hierarchy shows `Other {{176,754},{0,0}}`
where base 5f82052 shows `WebView {{16,729},{370,50}}` + "Test mode"). A
runtime probe explains it: at the first `sizeThatFits` call `uiView.adSize`
is `GADAdSize(size: (0,0), flags: 1)` and `cgSize(for:)` returns (0,0),
while `cgSize(for: AdSizeBanner)` is (320,50); the SDK rewrites `adSize`
to 320×50 only ~11 ms later. The macOS snapshot suites cannot see any of
this (the bridge is iOS-only). A DEBUG assert checks the SDK's `AdSizeBanner`
still matches the constant when it reports a non-zero size.

Slot layout (`BannerSlotView`, option B from the #1084 preview):
- creative fixed at 320×50, leading-aligned in the band;
- ✕ in the gutter past the creative's trailing edge, 44×44pt hit target
  (`.frame` + `.contentShape` on the label, under `.buttonStyle(.plain)`),
  glyph 12 → 16pt; the `.opacity(0.7)` dropped from the default tint and
  the four host tints, and the three themed hosts now pass
  `theme.text.secondary` instead of the pale `theme.accent.muted` —
  `SudokuUI/Board/BoardView+Layout.swift`,
  `MinesweeperUI/MinesweeperBoardView.swift`, `GameAppKit/TodayTabHost.swift`
  (`SudokuAppComposition/LiveRouteFactory.swift` keeps `Color.secondary`)
  (uiux-bugfix-plan P1-6: 44pt target + glyph contrast), same "Dismiss ad"
  label, same `session.dismiss()` path;
- `BannerSlotBandLayout` (custom `Layout`) owns the horizontal inset:
  padding = 16 while width ≥ 320 + 44 + 16 (380pt), else symmetric
  (width − 364) / 2. 402 → 16…386 band, ✕ 336…380; 393 → same; 375 →
  5.5 symmetric, ✕ 325.5…369.5. The band background is proposed the
  padded-in width so it never bleeds into the host inset.

Tests: `BannerSlotDismissPlacementTests` reads creative / ✕ / band anchors
at 402, 393 and 375pt hosts and asserts ✕ ≥ 44×44, no intersection with the
creative, ✕.minX ≥ creative.maxX, ✕.maxX ≤ host width, plus the exact
numbers above. Mutations: ✕ back over the creative → red at every width;
shrink rule dropped → 375 red; threshold back to 396 → 393 red.

Snapshots re-recorded (same cause, ✕ 14×14 @ (357,796) → 44×44 @ (336,793);
padding unchanged at the 393pt fixture):
- SudokuKit TodayTabViewTests/snapshotIPhoneLightBannerVisible (png, txt)
- MinesweeperKit MinesweeperTodayTabViewTests/snapshotIPhoneLightBannerVisible (png, txt)
- SudokuKit BannerSlotDarkBandRegressionTests/postFix_…_bannerOpen_noBand (png)

Docs: design.md §How.6 placement line and the #1058 design doc's phase list
(Phase 2e).

Part of #1058 (PR #1062 phase 2e). Closes #1084.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@wei18

wei18 commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner Author

Phase 2e (#1084): banner ✕ moved outside the creative — c78b84ab

Range 5f820520..c78b84ab, one commit: 14 files, +470/−18. Implements the PM decision on #1084 (option B: 320×50 creative, ✕ fully outside the ad frame, 44pt target) plus the two follow-up rulings taken on the issue (narrow-width padding rule; ✕ glyph contrast). Ready for PM review; PR #1062 merges later under #1078.

Scope items from the decision comment

# Item What landed
1 Ad size The bridge already requested the fixed 320×50 size — BannerView(adSize: AdSizeBanner) at LiveAdMobBridge.swift:105, unchanged. The 370pt full-width render came from BannerViewRepresentable having no sizeThatFits, so SwiftUI stretched the hosted BannerView to the slot's proposal. sizeThatFits now returns BannerSlotView.creativeSize (320×50), the same constant the slot frames the creative with, plus a DEBUG assert that the SDK's AdSizeBanner matches it. A first cut read cgSize(for: uiView.adSize) at layout time; a base-vs-new simulator A/B (same sim, same probes) showed that leaves the hosted BannerView 0×0 — XCUITest hierarchy Other {{176,754},{0,0}} vs base WebView {{16,729},{370,50}} + "Test mode" — so the creative never painted, invisible to the macOS snapshot suites. A runtime probe: at the first sizeThatFits call uiView.adSize is GADAdSize(size: (0,0), flags: 1) (cgSize(for:) → (0,0)) while cgSize(for: AdSizeBanner) is (320,50); the SDK rewrites adSize to 320×50 ~11 ms later. The base frame also shows the 370pt stretch this item fixes; with the constant the hosted WebView measures {{16,729},{320,50}}
2 ✕ placement (shared BannerSlotView) Creative fixed at 320×50, leading-aligned; ✕ overlaid past the creative's trailing edge (.overlay(alignment: .trailing) + .alignmentGuide(.trailing) { $0[.leading] }), 44×44pt .frame + .contentShape on the label (under .buttonStyle(.plain)). "Dismiss ad" label and session.dismiss() → recordBannerDismissed → hideAll path unchanged
2b Narrow-width rule (PM ruling) BannerSlotBandLayout (custom Layout): padding = 16 while width ≥ 320 + 44 + 16 = 380pt, else symmetric (width − 364) / 2. 402 → creative 16…336, ✕ 336…380, band 16…386; 393 → same padding, band 16…377 (✕ 3pt past the band, 13pt inside the screen); 375 → 5.5 symmetric, ✕ 325.5…369.5. The band background is proposed the padded-in width, so it never bleeds into the host inset
2c Glyph contrast (PM ruling, uiux-bugfix-plan P1-6) Glyph 12 → 16pt; .opacity(0.7) dropped from the default tint and from every host tint. Five slot sites in total: the three themed hosts (BoardView+Layout, MinesweeperBoardView, TodayTabHost) pass theme.text.secondary instead of the pale theme.accent.muted; Sudoku's settings route (LiveRouteFactory.swift) keeps Color.secondary; Minesweeper's settings route (LiveRouteFactory+Helpers.swift:36) passes no tint and inherits the changed default (.secondary), mirroring Sudoku
3 Spec docs/v2/design.md §How.6 line rewritten (320×50 leading-aligned, 16pt ✕, 44pt target, padding rule); meetings/2026-09-11_1058-slot-model-design.md gains a Phase 2e section
4 Both apps, one implementation Only BannerSlotView + the bridge representable changed; four of the five slot sites changed one argument (tint) each, the fifth inherits the default

Unit pin — BannerSlotDismissPlacementTests (AppMonetizationKit)

Renders BannerSlotView with a loaded slot (HostingAdProvider), reads creative / ✕ / band anchors through a test-only BannerSlotGeometryKey anchor preference, at 402, 393 and 375pt hosts (horizontalPadding: 16, displayScale 2 so 5.5pt is a whole pixel as on the SE class). Asserts: ✕ ≥ 44×44; !✕.intersects(creative); ✕.minX ≥ creative.maxX; ✕.maxX ≤ hostWidth; creative.minX ≥ 0; plus the exact numbers above per width.

Mutations (each run, then reverted):

  • ✕ back over the creative (drop the alignment guide) → red at all three widths (intersects … → true, dismiss.minX 292 ≥ creative.maxX 336 fails).
  • shrink rule dropped (padding always 16) → 375 row red (dismiss.maxX 380 ≤ 375 fails).
  • threshold back to two-sided 396 → 393 row red (creative.minX 14.5 == 16 fails).

swift test AppMonetizationKit: 172 tests / 29 suites passed (171 at base + 1 parameterized test).

Snapshots (re-recorded; one cause, nothing moved for padding at the 393pt fixture)

Baseline Change
SudokuKit/…/TodayTabViewTests/snapshotIPhoneLightBannerVisible….{png,txt} txt: one line, ✕ f=(357,796,14,14) → f=(336,793,44,44)
MinesweeperKit/…/MinesweeperTodayTabViewTests/snapshotIPhoneLightBannerVisible….{png,txt} identical one-line txt diff
SudokuKit/…/BannerSlotDarkBandRegressionTests/postFix_…_bannerOpen_noBand….png PNG only; the dark band stays uniform

No-record pass before recording (exact --filter strings from the 2d comment): GameAppKit 90/90 · MinesweeperKit 413 tests, 1 failure (the Today baseline) · SudokuKit today 106 tests, 1 failure · SudokuKit board 188 tests, 1 failure + #1082 flake once (isolated re-run 7/7) · SudokuKit hubs 69/69 · composition / settings A / settings B skipped (no slot). After recording: today 106/106, MinesweeperKit 413/413, board 188/188. SnapshotConfig.swift flipped to .all only for the record runs and restored (diff empty).

Before/after crops (slot row, 786×160 @2x) are in the local evidence dir /Users/zw/GitHub/Wei18/evidence-1084/snapshots/crop-{before,after}-{sudoku-today,minesweeper-today,sudoku-darkband}.png: before = placeholder centred in the 370 band, 14pt ✕ in the top-right corner; after = placeholder centred in the 320 creative, 16pt ✕ vertically centred in the gutter.

Simulator (own sim 1084-evidence, iPhone 17 Pro, iOS 26.5, DEBUG, AdMob test IDs)

Setup mirrors #1077: throwaway detached tree at the commit + launch-arg-gated probes (-e1084-gate-open swaps only the AdGate state store for a UserDefaults-backed one, the real gate logic runs; -e1084-reset-gate clears it per launch; E1084 … NSLog lines at BannerSessionModel.dismiss() / hideAll(), LiveAdMobBridge request / didReceiveAd / dispose, GameRoot scenePhase), hold-open XCUITest launcher, driven with idb. Patch archived locally at evidence-1084/experiment.patch, never committed. The runs were made on cebbfbc6, whose tree is identical to c78b84ab (git diff cebbfbc6 c78b84ab empty; the amend only added the probe values to the message).

10 independent launches, 10/10 dismissed, 0 Safari opens (each launch a fresh gate; every ✕ tap at the a11y centre):

# App / slot Creative pixel extent (pt) describe-point at creative centre ✕ frame (a11y) Hosted WebView frame (XCUITest tree) Log after tap scenePhase → background? Result
1–2, 5 Sudoku Today ×3 16.0…334.3 "Test mode" {336, 732, 44×44} {{16,729},{320,50}} session dismiss → gate mutate saved → hideAll disposing=1 → dispose no PASS
3–4 Sudoku board ×2 16.0…335.7 "Test mode" {124.3,484,103.7×34} {336, 483, 44×44} {{16,480},{320,50}} (case 4; case 3's dump landed before navigation, see results.md) … hideAll disposing=2 → dispose ×2 (Today + board, by design) no PASS
6–7, 10 Minesweeper Today ×3 16.0…334.3 "Test mode" {336, 732, 44×44} {{16,729},{320,50}} … hideAll disposing=1 → dispose no PASS
8–9 Minesweeper board ×2 16.0…335.7 "Test mode" {124.3,708,103.7×34} {336, 707, 44×44} {{16,704},{320,50}} … hideAll disposing=2 → dispose ×2 no PASS

So: the creative renders at 320pt leading-aligned (hosted view 320×50, not the 370pt stretch seen at base), the ✕ a11y frame is 44×44 with minX = creative maxX = 336 (outside its pixel extent), and every tap took the dismiss path with the app staying in front (idb list-apps: Safari never launched). This closes #1077 E6.

Base-vs-new A/B on the same sim (why the bridge fix exists): base 5f820520 paints the creative with WebView {{16,729},{370,50}} + ✕ {367,735.7,12×12}; the first cut of this commit left it Other {{176,754},{0,0}} (unpainted, not hit-testable) — see item 1 above. Full notes, tree dumps, logs and screenshots: /Users/zw/GitHub/Wei18/evidence-1084/results.md (local, uncommitted).

Gates

  • nonisolated(unsafe): 27 at base, 27 at head (0 added; the test uses displayScale env, no unsafe statics).
  • import GoogleMobileAds: still only the AdsAdMob target (LiveAdMobBridge.swift, AdMobBridge.swift, UMPConsentPresenter.swift, all under canImport).
  • swiftlint --strict on the 7 changed Swift files: 0 violations; lefthook pre-commit ran gitleaks / hygiene / swiftlint ✔ on the commit.
  • No production IDs in the diff (scanned).
  • iOS Simulator builds: Sudoku and Minesweeper Debug builds BUILD SUCCEEDED; both E2E schemes build-for-testing succeeded on the final tree.

Closes #1084 when merged. Part of #1058.

🤖 Generated with Claude Code

…reative (#1084 review)

Follow-ups from the PM review of c78b84a (#1084), no behaviour change on
any real host:

- `BannerSlotBandLayout.sizeThatFits` returned `proposal.width` unclamped,
  so an infinite proposal yielded an infinite width, contradicting the
  comment above it. nil and non-finite proposals now both resolve to the
  ideal width (`needed + 2 * nominalPadding` = 396pt at the shipped
  constants) through `resolvedBannerBandWidth(proposal:ideal:)`, a pure
  `internal` function (test seam; the Layout stays private).
  `BannerSlotDismissPlacementTests` gains two tests: a direct one feeding
  `.infinity`, `-.infinity`, `.nan`, nil and 402 (mutation: drop the
  `isFinite` check → three rows red), and a view-level one under a
  horizontal `ScrollView` expecting finite anchors (band 396, creative
  16…336, ✕ 336…380). The view-level path only reaches the nil branch in
  the headless macOS harness (a `ScrollView` there proposes nil, then a
  concrete width, never `.infinity`), which is why the direct test exists.
  AppMonetizationKit: 174 tests.
- The 320×50 creative frame is `.clipped()`, so an oversized creative can
  never paint under the ✕ even if the bridge ever mis-sizes the hosted
  view. No new test.
- Site count: the tint change reaches five slot sites, not four. Four pass
  a tint (`BoardView+Layout`, `MinesweeperBoardView`, `TodayTabHost` →
  `theme.text.secondary`; Sudoku `LiveRouteFactory` → `Color.secondary`);
  Minesweeper's `LiveRouteFactory+Helpers.swift:36` passes none and
  inherits the changed default (`.secondary`), mirroring Sudoku.
- Design doc (Phase 2e, meetings/2026-09-11_1058-slot-model-design.md):
  records the PM ruling that the zero gap between creative.maxX and
  dismiss.minX stays — the 44pt target starts at the ad edge but the 16pt
  glyph is centred 14pt away, fully outside, on the app's own ground; a
  gap would push 375pt hosts back below a 44pt target.

Part of #1058 (PR #1062 phase 2e). Part of #1084.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… keep the bootstrapped instance (#1058 2f)

Phase 2f of #1058 (PR #1062), found by the #1078 final-head E2E run and
approved by the PM on #1078.

Symptom: Minesweeper `test_clearCacheCancelAndFailureToast_N19` is red at
`d25702c0` and green on `origin/main` `d89dba47` (base 3/3, head 0/4, one
job at a time on the same iPhone 17 Pro / iOS 26.5 simulator). idb tree
dumps every 2 s show the Settings screen identical at base and head except
that the `settings.storage.cacheReady` anchor never appears at head. No
crash, no error log lines.

Mechanism (the #909 shape, `GameConfig.reminderSettings`): both apps'
`.settings` `navigationDestination` builders mint `SettingsViewModel(...)`
inline, SwiftUI re-invokes that builder on any ancestor re-render, and
`SettingsView` held the model as a plain `@Bindable` property. A re-render
therefore replaced the instance whose one-shot `.task { bootstrap() }` had
already set `isCacheStateReady = true` with a fresh one (`false`); `.task`
does not re-fire for the same view identity. This PR adds exactly such an
ancestor re-render: `GameRoot` now reads `@Environment(\.scenePhase)` for
the banner repoll, so the launch-time `inactive -> active` change
re-renders it right after Settings mounts. Sudoku N19 was already red on
base for the same class of re-render (#1088).

Fix: `SettingsView` owns the model as `@State`
(`_viewModel = State(initialValue:)`), one shared place for both apps.
Keeping the first instance is correct because everything the builders
capture is a composition-time `let` — Sudoku: `generatorVersionLabel`
(constant), `appVersion` (Bundle read), `persistence`, `errorReporter`,
`toastController`; Minesweeper: `appVersion`, `persistence ?? Fake`,
`errorReporter ?? Noop`, `toastController` — so nothing a rebuild could pick
up ever changes. `$viewModel` was unused, so `@Bindable` drops cleanly.

Pin: `SettingsViewModelIdentityTests` (GameAppKit). An ancestor view mints
model "1.0.0-A" on its first body evaluation and "9.9.9-B" on every later
one, hosted in a headless `NSHostingView` inside an `NSWindow`; an
`@Observable` tick forces the ancestor re-render; the host's pixels before
and after must be identical (the Version row still renders "A"). A second
test renders a "B"-first host and asserts it differs from an "A" host, so
the compare cannot pass vacuously. No production hook: identity is observed
through what the model renders.

Green (this tree):
  GameAppKit: Test run with 92 tests in 20 suites passed (90 + 2).
Mutation (`@State` reverted to the plain `@Bindable` property), then
restored:
  Test "an ancestor re-render that mints a new model keeps rendering the
  first one" recorded an issue at SettingsViewModelIdentityTests.swift:166:9:
  Expectation failed: (after -> 5150246 bytes) == (before -> 5150246 bytes)
  Test run with 2 tests in 1 suite failed after 0.367 seconds with 1 issue.
  (the "B" render; the vacuity test still passed)
E2E, Minesweeper N19 with this change on the head tree: passed 2/2
(24.6 s, 23.4 s). Sudoku N19 stays as reported on #1088 (see the PR
evidence comment for the post-2f run).

Design doc: `meetings/2026-09-11_1058-slot-model-design.md` gains a Phase 2f
section.

Part of #1058 (PR #1062 phase 2f). Part of #1078.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@wei18

wei18 commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Phase 2f (#1078 final-head verification): Settings view-model identity — a5ebe93f

Range d25702c0..a5ebe93f, one commit: 3 files, +224/−2 (SettingsView.swift, new SettingsViewModelIdentityTests.swift, design-doc Phase 2f section). Approved by the PM on #1078 as @State in the shared SettingsView, not per-factory.

What the final-head run found

Running the whole E2E suite at d25702c0 (mise run test:ui all, iPhone 17 Pro / iOS 26.5, BF91A16F) turned Minesweeper test_clearCacheCancelAndFailureToast_N19 red. Base-vs-head, one job at a time on the same simulator:

Head Minesweeper N19 Notes
origin/main d89dba47 3/3 pass (21.1 s, 20.1 s, 25.1 s) idb tree dump at 17:3x shows settings.storage.cacheReady present
d25702c0 (PR head before 2f) 0/4 pass (in-suite, then solo ×3) tree dumps every 2 s: identical to base except the cacheReady anchor never appears; no crash, no app error lines
d25702c0 + 2f patch (throwaway tree) 2/2 pass (24.6 s, 23.4 s)
a5ebe93f (2f committed) 2/2 pass (in-suite during test:ui all, then solo 23.3 s)

Mechanism (the #909 shape, GameConfig.reminderSettings): both apps' .settings navigationDestination builders mint SettingsViewModel(...) inline; SwiftUI re-invokes that builder on any ancestor re-render; SettingsView held the model as a plain @Bindable property, so the instance whose one-shot .task { bootstrap() } had already set isCacheStateReady = true was replaced by a fresh one (false) and .task did not re-fire. This PR adds the ancestor re-render: GameRoot now reads @Environment(\.scenePhase) for the banner repoll, so the launch-time inactive → active change re-renders it right after Settings mounts. Sudoku's N19 is red on main already for the same class (#1088, filed today with N4 ×2 / N5 / N12).

Fix and pin

  • SettingsView owns the model as @State (_viewModel = State(initialValue:)). Correct because every value the builders capture is a composition-time let (Sudoku: generatorVersionLabel, appVersion, persistence, errorReporter, toastController; Minesweeper: appVersion, persistence, errorReporter, toastController), so the first instance is complete; $viewModel was unused, so @Bindable drops cleanly.
  • SettingsViewModelIdentityTests (GameAppKit, 2 tests): an ancestor view mints "1.0.0-A" on its first body evaluation and "9.9.9-B" on every later one, hosted in a headless NSHostingView in an NSWindow; an @Observable tick forces the ancestor re-render; pixels before/after must be identical (Version row still "A"). A "B"-first host must differ from an "A" host (no vacuous pass). No production hook.
  • Mutation (@State → plain @Bindable property), then restored: Expectation failed: (after → 5150246 bytes) == (before → 5150246 bytes) on the identity row; the vacuity row stayed green. Output is in the commit body.

Runs at a5ebe93f, one job at a time

Job Result
AppMonetizationKit 174 tests / 29 suites passed
GameAppKit 92 tests / 20 suites passed (90 + 2)
MinesweeperKit 413 tests / 70 suites passed
SettingsKit swift build passed
SudokuKit composition (--filter 'SudokuAppCompositionTests') 69 / 14 passed
SudokuKit today (2d filter string) 106 / 15 passed
SudokuKit board (2d filter string) 188 / 43 passed (#1087 did not reproduce this run; at d25702c0 it did once, isolated 7/7)
SudokuKit hubs (2d filter string) 69 / 10 passed
SudokuKit settings A (2d filter string) first attempt crashed in swiftpm-testing-helper (signal 11 after clearCache_deletesResumeCandidateAndSetsConfirmation passed, no test failure recorded — the known local helper segfault); retry 31 / 4 passed
SudokuKit settings B (2d filter string) 25 / 6 passed

E2E at a5ebe93f:

Gates

  • swiftlint --strict on the 2 changed Swift files: 0 violations; lefthook gitleaks / hygiene / swiftlint ✔ on the commit.
  • Remote head was d25702c0 immediately before the push; pushed HEAD:fix/1058-bannerslot-task-lifecycle, no force.
  • No production identifiers in the diff.

Part of #1058 (PR #1062 phase 2f). Part of #1078.

…op the no-op hub banner tests, de-sleep the primer negatives (#1058 2g)

Phase 2g of #1058 (PR #1062): the three findings of the PM's whole-PR code
review at a5ebe93 (1 MAJOR + 2 MINOR, none blocking), closed as one commit
on the PM's ruling (#1078).

MAJOR-1 — `HubSettingsBannerTests.swift` deleted (SudokuKit, 7 tests).
Since 2c the slot holds no provider, so every test built a `FakeAdProvider`
wired to nothing and asserted `refreshCallCount == 0`, which holds for any
production code, while the header still claimed to pin "gate allows ->
provider refresh is invoked". What each deleted test named is pinned here:

  dailyHub_gateDenies_slotNeverTouchesProvider,
  practiceHub_gateDenies_slotNeverTouchesProvider,
  settings_gateDenies_slotNeverTouchesProvider
    -> BoardViewBannerTests.running_butGateDenies_bannerSlotCollapsesToEmpty
       (rendered slot collapses on a denied gate) and
       BannerSessionModelFollowUpTests "A load that finds the gate closed
       collapses every slot, not just its own" (the provider is never
       asked once the gate says no).
  dailyHub_gateAllows_slotInitializes,
  practiceHub_gateAllows_slotInitializes,
  settings_gateAllows_slotInitializes
    -> BoardViewBannerTests.running_andGateAllows_bannerMountIsActive and
       runningBoard_rendersLoadedBanner (an open gate mounts and loads the
       slot through the session; height 50 running).
  allHubs_removeAdsPurchased_bannerSlotCollapsesToEmpty
    -> BannerEntitlementWiringTests (a successful purchase, a restore that
       returns the entitlement and a .purchased update all collapse the
       slot) plus the denied-gate rows above.

The three hub shells' `banner:` pass-through stays covered by their snapshot
baselines. SudokuKit "hubs" filter batch drops the name: 62 tests / 9 suites
(was 69 / 10).

MINOR-1 — `BannerSessionModel.runStart()` published `shouldShow = open` and
only then awaited `providerCanServe`; on a macOS cold launch with an open
gate that painted one 50pt spinner band before the `NoopAdProvider`
suppression collapsed it. Suppression is now resolved before the open gate
is published; the hide-generation capture stays before the first await, and
`sceneDidBecomeActive` already had this order. New
`BannerSessionModelSuppressionOrderTests` (AppMonetizationKit): an actor
provider holds its `bannerStatus` read on a latch, the test samples
`isVisible` while `runStart()` is suspended in that read, then releases it.

  Green: samples == [false, false]; shouldShow == true afterwards;
         refreshCallCount == 0.
  Mutation (old order restored in runStart, then reverted):
    Expectation failed: (samples -> [true, false]) == [false, false]
    (BannerSessionModelSuppressionOrderTests.swift:68) - the one frame.
  The closed-gate row ("publishes false without consulting the provider")
  passes under both.

MINOR-2 — `TodayTabHostTests.firstAdContextNeverPresentsWhenDetermined` and
`declinedPrimerIsNotReoffered` no longer sleep a fixed 200ms before their
negative assertion. Readiness is held on the fake's `markReady()` seam; a
registered slot's `refreshBanner()` call, which runs only after ready ->
ad context -> sessionReady, is the positive proof that the primer hook
already executed. For the repoll row the slot's loads are scripted to
throw, so the repoll's retry (second refresh call) proves it ran to its
load step before the "not re-offered" assertion.

Runs on this tree, one at a time:
  AppMonetizationKit: Test run with 176 tests in 30 suites passed (174 + 2;
    the race and ordering suites included).
  GameAppKit: Test run with 92 tests in 20 suites passed.
  SudokuKit hubs (new filter): Test run with 62 tests in 9 suites passed.
  0 __Snapshots__ changes. swiftlint --strict on the 3 changed Swift files:
  0 violations.
Full re-run at this commit (every package + E2E) is in the PR evidence
comment.

Design doc: `meetings/2026-09-11_1058-slot-model-design.md` gains a Phase 2g
section.

Part of #1058 (PR #1062 phase 2g). Part of #1078.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@wei18

wei18 commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

Phase 2g (#1078 whole-PR CR closures): ee33a60a

Range a5ebe93f..ee33a60a, one commit: 5 files, +174/−187. Closes the PM's whole-PR CR findings at a5ebe93f (1 MAJOR + 2 MINOR, none blocking) on the PM's ruling.

Finding What landed Pin / proof
MAJOR-1 HubSettingsBannerTests green no-op file deleted (7 tests). Since 2c the slot holds no provider; every test asserted refreshCallCount == 0 against a provider wired to nothing per-test coverage map in the commit body: denied-gate rows → BoardViewBannerTests.running_butGateDenies_bannerSlotCollapsesToEmpty + BannerSessionModelFollowUpTests "load that finds the gate closed collapses every slot"; allowed-gate rows → BoardViewBannerTests.running_andGateAllows_bannerMountIsActive / runningBoard_rendersLoadedBanner; Remove-Ads row → BannerEntitlementWiringTests. SudokuKit hubs batch: 62 / 9 (was 69 / 10)
MINOR-1 one visible frame before the macOS suppression check runStart() resolves providerCanServe before publishing shouldShow; hide-generation capture stays before the first await; sceneDidBecomeActive already had this order BannerSessionModelSuppressionOrderTests: an actor provider holds its bannerStatus read on a latch; the test samples isVisible while runStart() is suspended in it. Green [false, false]; mutation (old order restored, then reverted): Expectation failed: (samples → [true, false]) == [false, false] at :68 — the frame in question. Closed-gate row green under both
MINOR-2 fixed-sleep negatives TodayTabHostTests.firstAdContextNeverPresentsWhenDetermined / declinedPrimerIsNotReoffered: readiness held on FakeAdProvider(readinessHeld: true), released by markReady(); positive eventually on a registered slot's refreshBanner() (only reachable after ready → ad context → sessionReady); the repoll row scripts loads to throw so the repoll's retry is its positive signal both green; no Task.sleep left in the two tests

Runs at ee33a60a, one job at a time

Job Result
AppMonetizationKit 176 tests / 30 suites passed (174 + 2)
GameAppKit 92 tests / 20 suites passed
MinesweeperKit 413 tests / 70 suites passed
SettingsKit swift build passed
SudokuKit composition 69 / 14 passed
SudokuKit today 106 / 15 passed
SudokuKit board 188 / 43, 1 failure (2 issues): BoardLeaveOrPauseStateTests "live startOrResume() lands in the reachable Ready window" (:123 elapsedSeconds 2 == 0, :126 .pause == .leaveReady) — #1082 wall-clock flake; isolated --filter BoardLeaveOrPauseStateTests 7 / 1 passed; #1087 did not reproduce
SudokuKit hubs (filter minus HubSettingsBannerTests) 62 / 9 passed
SudokuKit settings A 31 / 4 passed (no helper crash this pass)
SudokuKit settings B 25 / 6 passed

E2E at ee33a60a (mise run test:ui all, iPhone 17 Pro / iOS 26.5):

Gates

  • 0 __Snapshots__ changes (checked after every batch).
  • swiftlint --strict on the 3 changed Swift files: 0 violations; lefthook gitleaks / hygiene / swiftlint ✔ on the commit.
  • Remote head was a5ebe93f immediately before the push; pushed HEAD:fix/1058-bannerslot-task-lifecycle, no force.
  • No production identifiers in the diff.

Part of #1058 (PR #1062 phase 2g). Part of #1078.

@wei18

wei18 commented Sep 14, 2026

Copy link
Copy Markdown
Owner Author

PM merge record (head ee33a60a). Gate satisfied:

  • Whole-PR code review (opus, every file in origin/main...HEAD, 111 files): verdict MERGE. Four runtime traces (iOS cold launch to first creative, macOS cold launch with zero provider calls, purchase → refreshGate → hideAll, foreground repoll with the hide-generation guard) found no path where a slot renders with a nil session, a handle leaks, a continuation hangs, or the gate is bypassed. nonisolated(unsafe) 27 → 27; one import GoogleMobileAds site; no drive-by edits. Its 1 MAJOR + 2 MINOR were closed by phase 2g.
  • Fresh-context acceptance (T6): ACCEPT, 11/11: phase SHAs, re-run test counts, six red-evidence links opened, device table vs test(monetization): #1058 simulator evidence E1–E10 for PR #1062 #1077, 15 snapshot files, known limits, CI caveat, closing keywords, survivors table line numbers, no production identifiers.
  • 2g re-check: clean. Suppression-order mutation red on the named test; race and ordering suites unaffected; the 7 deleted HubSettingsBannerTests are each covered by a real-render test; no Task.sleep remains in the de-sleeped negatives.

Known reds at head, all pre-existing and tracked: #1082 (board batch wall-clock flake), #1087 (Toast flake), #1088 (Sudoku E2E seam rows). Post-merge: #1074 is the next pre-submission blocker; #1080 continues #1024 on top of this.

@wei18
wei18 merged commit 6341999 into main Sep 14, 2026
14 checks passed
@wei18
wei18 deleted the fix/1058-bannerslot-task-lifecycle branch September 14, 2026 15:17
wei18 added a commit that referenced this pull request Sep 15, 2026
… model (#1080)

Merge origin/main (728ef19) into session/brisk-stork-isio. Resolution rules
from #1080:

- #1024's removal of the inline Today/Practice/Settings banner slots wins:
  every conflict hunk in MakeGameApp, TodayTabHost, both Live+TabRoots, both
  LiveRouteFactory(+Helpers) and both TodayTabViewTests takes the #1024 side;
  main's non-conflicting hunks in those files (the `BannerSlotView(
  isSuppressed:)` rewrite of the unused fallback helpers) are kept.
- The four `snapshotIPhoneLightBannerVisible` fixtures main re-added are
  dropped with the test that produced them (Today no longer hosts a slot).
- `TodayTabHostTests.swift` comes back from main: it pins the
  `makeBannerSession` ATT wiring, not TodayTabHost's retired slot.
- `BannerAccessoryView` is rewritten onto the session model: a plain
  `BannerSlotView(isSuppressed: false, …)` that reads `\.bannerSession` like
  every other slot — no provider / gate / primer parameters; C-33 lives on the
  session's `onAdContext` hook. `makeBottomAccessory()` loses its parameters
  and `BannerAccessoryViewTests` (which called the deleted init and a hook
  `makeBannerSession` already covers) is removed.
- `MarkerProvider` test fixture gains `awaitReady()` and the handle-returning
  `refreshBanner()` the #1062 protocol requires.
- No `MonetizationBootSignal` / `bootSignal` reintroduced (zero hits).
- No board file touched by hand; board slots auto-merged clean.

Verified: `swift test` AppMonetizationKit 180/180, GameAppKit 95/95.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
wei18 added a commit that referenced this pull request Sep 15, 2026
…inesweeper Today tab (#1080)

The main merge (68f840a) combined the wrong sides of one test.
`MinesweeperTodayTabViewTests.swift` came from #1024, where `TodayTabHost`
has no banner slot, so no `\.bannerSession` environment is written. The
view-structure `.txt` baselines came from main (#1062), whose version of the
test wraps the host in that extra environment modifier.

Result: all five `assertViewStructure` checks failed on line 1 (the root
type string) in `swift test --package-path Packages/MinesweeperKit`. Found
while running both apps' packages for #1080.

Evidence that this corrects a merge and does not re-record a behaviour
change:
- The failing assertions are `assertViewStructure` only; every `.image`
  snapshot passed.
- The five PNG baselines are the same blobs at 7b423da (#1024), 728ef19
  (main) and HEAD.
- The test's actual structure output matches the #1024 `.txt` baselines at
  7b423da byte-for-byte, and differs from the main-side baselines only on
  line 1.

So the five `.txt` files are restored from 7b423da.
`MinesweeperTodayTabViewTests` now passes. SudokuKit's `TodayTabViewTests`
already passed, since its test file and baselines agree.

part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
wei18 added a commit that referenced this pull request Sep 15, 2026
…R gate part-1 findings (#1080)

PM gate on PR #1095, part 1.

Dead fallback removal (both apps, mirror principle):
- Delete Sudoku `LiveRouteFactory.themedBanner()` and Minesweeper
  `LiveRouteFactory+Helpers.bannerSlot()`. The accessory path shipped in
  #1024 and was confirmed stable in #1079, so the tab-content-bottom
  fallback is obsolete. This also removes the resurrected pre-#1062 comment
  in the Minesweeper helpers file (B1).
- Drop the `banner:` parameter and `Banner` generic from
  `SudokuUI.PracticeHubView`, `MinesweeperUI.MinesweeperPracticeHubView`,
  `GameAppKit.SettingsView` and `SettingsUI.SettingsScreen`; the per-app
  `SettingsView` typealiases become non-generic.
- The Minesweeper helpers file now imports UIKit explicitly under
  `canImport(UIKit)`; `UIApplication` had only resolved through the removed
  SwiftUI import, which only the iOS app build exposed.

Tests:
- `BannerSlotCollapsedHeightTests`: drop the two rows for the deleted
  helpers (Sudoku `themedBanner`, Minesweeper `bannerSlot`); the Today and
  Board rows are unchanged.
- `BannerSlotDarkBandRegressionTests`: doc comment only, notes the removal.
- No test was deleted and no snapshot baseline changed.

Other findings:
- M1: `mise-tasks/new_game/scaffold` generates iOS 26.1, matching
  Project.swift.
- m1: comments no longer point at private memory files; they cite
  `meetings/2026-09-11_1058-slot-model-design.md` "Externally owned lease
  (#1080)" or CLAUDE.md.
- m2: design.md 2.4.1 now says only that the macOS `#else` never builds
  `BannerAccessoryView`; `AdProvider`, `AdGate` and `BannerSlotView` are
  still constructed on macOS.
- m3: `EnvironmentValues.bannerAccessoryLease` is internal and
  `MonetizationUI` is an internal import in that file.
- design.md 2.4 and the #1024 impl notes record the fallback removal.

Verification: swift test AppMonetizationKit 181, GameAppKit 96,
GameShellKit 124, MinesweeperKit 412 (all pass); SudokuKit
SudokuAppCompositionTests 69, SudokuUITests without settings suites 376,
audio/reminder/IAP settings 14, SettingsViewAppStoreRowsTests 4,
SettingsViewWindowSnapshotTests 2, SettingsViewTests 15 (all pass, each
settings suite run alone); swiftlint --strict 0 violations on 19 files;
scan:hygiene, scan:design_contracts, scan:admob pass; Sudoku and
Minesweeper iOS simulator builds succeed.

Part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
wei18 added a commit that referenced this pull request Sep 21, 2026
…GameRoot-owned lease on an iOS 26.1 floor (#1095)

* docs(meetings): impl-notes log for #1024 banner-accessory session

Running in-flight decision log per agent-impl-notes-log convention:
locked decisions from the dispatch, B-6 (#1029) gate evidence, scope
adjudications, and PM (sly-bunting) rulings incl. the static-modifier
suppression shape and ATT C-33 re-anchor conditions.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(shell): add generic tabViewBottomAccessory param to RootShellView

RootShellView gains a third generic `Accessory: View` param + a
`bottomAccessory` ViewBuilder closure, attached via
`.tabViewBottomAccessory` inside `#if os(iOS)` only (macOS has no such
API — design.md §2.4.1 option A). The modifier attaches
UNCONDITIONALLY; visibility is decided inside the accessory's own
content, never by conditionally attaching/detaching the modifier
(PM ruling — see meetings/2026-09-07_1024-banner-accessory.impl-notes.md).

An `Accessory == EmptyView` convenience init keeps every existing call
site (GameRoot, RootShellViewGenericityTests) compiling unchanged.

GameShellKit stays zero-dependency — the closure is fully opaque to
this module; GameAppKit supplies the real (monetization) content next.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(monetization): host the banner in tabViewBottomAccessory (#1024)

Add `BannerAccessoryView` (GameAppKit, iOS/iPadOS only): the same
`BannerSlotView` gate-then-provider flow, now wired as
`GameRoot`/`RootShellView`'s shared `tabViewBottomAccessory` content
instead of a per-screen inline slot. macOS gets `{ EmptyView() }`
(`makeBottomAccessory`, MakeGameApp+Helpers.swift) — no AdProvider/
AdGate/BannerSlotView type is even constructed there.

`TodayTabHost` drops its own banner slot and the adProvider/adGate/
attPrimer params that fed it — the accessory now covers Today,
Practice, and Settings (pushed onto a tab's stack, so it stays inside
the TabView) with ONE shared banner. The C-33 ATT primer anchor moves
with it: `bannerAccessoryFireOnAdContext` replaces the retired
`todayTabHostFireOnAdContext`, same ordering guarantee (unchanged
`BannerSlotView.resolveGateAndLoad`: onAdContext always precedes the
actual ad load).

TodayTabHostTests.swift (tested exactly this wiring) is replaced by
BannerAccessoryViewTests.swift on the new host; verified on the iOS
simulator (macOS `swift test` structurally excludes this iOS-only
suite, it never compiles into that build).

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* wip(sudoku): retire practice-hub inline banner closure (#1024 phase 3 start)

Checkpoint of interrupted subagent work: Sudoku practice call site no
longer passes banner:; shared accessory covers the tab. Remaining phase-3
sites (sudoku settings, minesweeper, TodayTabHost/ATT) follow.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(monetization): retire in-shell inline banner call sites (#1024)

Both apps stop passing a `banner:` closure at their Practice/Settings
composition sites (Sudoku Live+TabRoots.swift + LiveRouteFactory.swift;
Minesweeper mirrors) — the shared `tabViewBottomAccessory` now covers
the whole tab shell. The shells' `banner:` params stay (default to
`EmptyView()`) as design.md §2.4's documented tab-content-bottom
fallback; `SudokuAppComposition.themedBanner` / `LiveRouteFactory
.bannerSlot` (MS) stay as that fallback's ready-made implementation,
now with zero production callers, doc-noted why.

Drops the now-orphaned `adProvider`/`adGate` parameters from both
apps' `makeTabRoot` (only the retired Practice banner call used them)
and updates every test call site: RouteFactoryTests / LiveRouteFactoryTests
(makeTabRoot signature), TodayTabViewTests / MinesweeperTodayTabViewTests
/ ASCScreenshotEmitTests (TodayTabHost's simplified init — no more
adProvider/adGate/attPrimer). The retired per-suite banner-visible
coverage (TodayTabHost had its own banner slot pre-#1024) is deleted
along with its now-dead snapshot fixtures — that surface is
BannerAccessoryViewTests + the pre-existing BannerSlotView coverage now.

All other TodayTabView/MinesweeperTodayTabView snapshot baselines are
UNCHANGED and still pass byte-for-byte: every surviving baseline seeds
the ad gate closed, so the banner region already rendered EmptyView
before this move — removing the slot's own subtree produces identical
pixels and structure dumps (verified via swift test, not re-recorded).

Verified: SudokuKit filtered batch (32/32) + MinesweeperKit full suite
(408/408) green; swiftlint --strict clean.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* test(monetization): pin ATT-primer-before-ad-load order on the sim (#1024)

PM condition: prove the primer fires before any ad-context/ad-load
call, not just by reading source. `primerFiresBeforeAnyAdLoad` renders
the real `BannerAccessoryView` in a `UIHostingController` inside a key
`UIWindow` and records, into one shared actor log, the moment ATT's
`isNotDetermined()` check runs vs. the moment the reload coordinator's
`refreshBanner()` actually starts a load — asserting the log order
directly (no timing-race poll loop).

This only pumps on a real run-loop host: confirmed via `xcodebuild
test -destination 'platform=iOS Simulator,name=iPhone 17 Pro'
-only-testing:GameAppKitTests/BannerAccessoryViewTests` (4/4 pass).
`TodayTabHostTests`' documented headless-macOS-`NSWindow` harness
limitation (an actor-hop inside `.task` never resumes there) does not
apply to an iOS Simulator XCTest host, which boots a real
`UIApplication` run loop.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(monetization): mark design.md §2.4/§2.4.1 as-built, re-anchor ATT contract (#1024)

design.md §2.4/§2.4.1: U-10 (AdMob-in-accessory) and U-13 (macOS banner
exclusion) both resolve — accessory path shipped, option A shipped as
final, degradation fallback documented but unused. §3.6.1: C-33's ATT
anchor moves a second time, from the Today tab's own banner slot to
the ONE shared accessory banner slot.

screen-contracts.md: the HOME-retirement banner + the ATT-PRIMER
section both re-anchored to `BannerAccessoryView`, with an explicit
before/after reachability table (Today-gated → tab-agnostic) since the
accessory's tab-agnostic mount genuinely changes when the primer can
first fire, not just where the code lives.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(monetization): letterbox the accessory banner instead of black slivers (#1024)

B-6 bonus finding (#1029): the fixed-size 320×50 test creative doesn't
cover the tabViewBottomAccessory capsule's rounded ends when the SDK
stretches its own view to fill the accessory. `LiveAdMobBridge` now
sets the native `BannerView.backgroundColor` to `.clear` so
`BannerAccessoryView`'s themed SwiftUI background shows through the
gap instead of the SDK's opaque fill.

Updates the #1024 impl-notes log with final phase status.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(comments): update two stale TodayTabHost banner-slot comments (#1024 CR)

CR round-1 cosmetic findings (sonnet reviewer): MakeGameApp.swift and
GameConfig.swift doc comments still described TodayTabHost as carrying
the banner slot + C-33 ATT anchor; both moved to BannerAccessoryView /
tabViewBottomAccessory in this branch. Comment-only change.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* test(shell): render-prove RootShellView's bottomAccessory wiring (#1024)

PM ruling: the #1029 spike proved AdMob-in-tabViewBottomAccessory works
as an API; that isn't proof our own wiring (RootShellView's generic
bottomAccessory param -> .tabViewBottomAccessory { bottomAccessory() })
actually threads a caller's content through, and replacing coverage
removed elsewhere in #1024 is part of the change.

RootShellViewBottomAccessoryRenderTests (new, GameShellKit, #if
os(iOS)) renders the real shell with a sentinel accessory in a
UIHostingController/UIWindow and finds SwiftUI's private
"...BottomAccessory" container in the live hierarchy, asserting it has
real content. A second test with an EmptyView accessory proves the
container is genuinely empty in that case, ruling out "always has
stray children" as a false-positive explanation for the first test's
pass.

Accessibility-identifier lookup was tried first and is documented as a
dead end in the file: `.accessibilityIdentifier(_:)` on plain Text
does not surface through UIAccessibilityIdentification or
UIAccessibilityContainer's count/index methods when walked in-process
in a headless XCTest host.

Verified via `xcodebuild test -scheme GameShellKit -destination
'platform=iOS Simulator,name=iPhone 17 Pro'` — 2/2 new tests pass, full
suite 106/106 on iOS Sim, 116/116 unaffected on macOS (file is
`#if os(iOS)`-excluded there).

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(uitest): add -uitest-open-ad-gate DEBUG-only launch arg (#1024)

PM-approved: lets the tabViewBottomAccessory banner be sim-verified
showing a REAL rendered ad, not just an empty/gated slot. New
UITestAlwaysOpenAdGateStateStore (UITestFakeSeams.swift) reports an
unconditionally-open AdGateState (ancient firstLaunchAt, no purchase,
no dismissal, no clock-tamper baseline); resolveAdGateStore swaps it
in when the new arg is present and -uitest-fake-ad-gate-repoll is not.

Strictly additive: the new check is inserted BEFORE the existing
repoll guard, whose lines stay byte-identical (git diff proves it).
resolveAdProvider is completely untouched, so the real live AdProvider
(AdMob SDK, Google's public DEBUG test creative per LiveAdMobBridge)
still loads for real -- only the gate's read path is faked.

Release-unreachable: swift build -c release succeeds, and `strings`
over every compiled .o in the Release GameAppKit.build directory
returns zero hits for any "uitest-" string.

Part of #1024.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(monetization): raise the iOS floor to 26.1 and drive the banner accessory with isEnabled (#1079, #1080)

Owner decision #1079 option 1: instead of an empty 48pt accessory capsule
whenever the ad gate denies (signed out, Remove Ads, dismissed today), the
shell now uses `tabViewBottomAccessory(isEnabled:content:)`, which is
`@available(iOS 26.1, *)` in the iOS 26 SDK — so the iOS deployment floor
moves from 26.0 to 26.1. macOS stays 26.0 and still has zero
`tabViewBottomAccessory` hits (design.md §2.4.1 option A).

- Project.swift: all four app targets `iOS: "26.1"`.
- Every package `.iOS(.v26)` → `.iOS("26.1")` (synced versioning; the
  macOS-only ASCRegisterKit is untouched).
- RootShellView (GameShellKit, still zero-dependency): new
  `bottomAccessoryIsEnabled: Bool` on the designated init, applied as
  `.tabViewBottomAccessory(isEnabled:)` inside the unchanged `#if os(iOS)`
  attach point. The modifier is still attached unconditionally — `isEnabled`
  is the SDK's own visibility switch, not a conditional attach. The
  `Accessory == EmptyView` convenience init passes `false`.
- GameRoot: passes `bannerSession.isVisible`, read inside `shellContent`
  (evaluated from `body`) so `@Observable` tracking re-renders the shell.
- RootShellViewBottomAccessoryRenderTests: `isEnabled: false` with real
  sentinel content draws no accessory (iOS-only suite).
- Docs: design.md §2.4 as-built addendum, foundations.md floor lines,
  SUBMISSION-CHECKLIST minimum-OS note, both v2.6 review-information docs,
  impl-notes follow-through section.

Verified: swift test GameShellKit 124/124, GameAppKit 95/95 (macOS host);
swiftlint --strict 0 violations on the touched Swift files.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* test(monetization): pin the shared banner accessory and re-point stale ATT docs (#1080)

Replaces the deleted BannerAccessoryViewTests with a render-level pin
(PM condition on #1080; E2E-only pins do not count):

- BannerAccessoryPinTests (GameAppKitTests): (a) gate open — the real
  RootShellView + BannerAccessoryView over a started session renders a
  non-empty accessory container, the \.bannerSession injection reaches the
  slot (onMissingSession never fires) and exactly one slot registers;
  (b) gate denied — no container or a zero-height empty one, no slot state;
  (c) macOS — makeBottomAccessory() is EmptyView. (a)/(b) run on the iOS
  Simulator; (c) on the macOS host.
- makeBottomAccessory() returns `some View` instead of AnyView.
- RootShellViewBottomAccessoryRenderTests: the isEnabled:false case now also
  requires zero height, not just no subviews.
- screen-contracts ATT-PRIMER and three test headers stop naming the deleted
  BannerSlotView.resolveGateAndLoad / BannerAccessoryViewTests.

Verified: swift test GameAppKit 96/96, GameShellKit 124/124 (macOS);
xcodebuild iOS Simulator BannerAccessoryPinTests (a)(b) and
RootShellViewBottomAccessoryRenderTests 3/3 green; mutation `isEnabled: true`
turned both suites red and was restored; scan:design_contracts PASS;
swiftlint --strict 0 violations.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(monetization): own the banner accessory's slot lease in GameRoot so re-hosts stop re-requesting ads (#1080)

`tabViewBottomAccessory` re-hosts its SwiftUI content natively on sheet
dismissal, NavigationStack push/pop and some layout passes, without
re-evaluating `GameRoot.body`. The accessory's `BannerSlotView` kept its
`BannerSlotLease` in a `@StateObject`, so every re-host created a new lease.
The old lease's `isolated deinit` disposed the loaded ad and the new one sent
a fresh request. A simulator probe with request logging measured 8 accessory
ad requests on one scripted run (cold launch, ATT dismiss, push, reminder
sheet, pop, idle) on both iPhone and iPad, against 2 on main's
never-re-hosted inline slots. With this change the same script sends 1.

AppMonetizationKit, minimal public surface:
- `BannerSlotLease` is public with `public init()`. `id` and `attach(to:)`
  stay internal.
- `BannerSlotRegistration` attaches `external ?? own`. The self-owned
  `@StateObject` lease still exists but is never attached when an external
  lease is supplied, and a comment explains why it must stay.
- One additional `BannerSlotView(lease:…)` init. The existing init and
  `BannerSessionModel` keying are unchanged: one lease per placement.
- `BannerSlotBandLayout` moved to its own file with no behaviour change,
  `private` becoming `internal`, to keep BannerSlotView.swift under the
  400-line limit.
- `LiveAdMobBridge`'s representable gets only an invariant comment. The new
  host adopts the retained `BannerView` before the old host is dismantled, so
  a future `dismantleUIView` must never `removeFromSuperview` it.

GameAppKit:
- `GameRoot` owns `@State accessoryLease` for the scene's lifetime and
  injects it via the new `\.bannerAccessoryLease` environment entry.
- `BannerAccessoryView` uses the external lease. A missing injection calls
  `onMissingAccessoryLease` (assertionFailure) and renders nothing. There is
  no silent fallback.
- GameShellKit is unchanged and still has zero dependencies.

Tests, each with an executed mutation that turned red:
- T1 `BannerSlotExternalLeaseTests`: two sequential slots sharing one lease
  make 1 register and 1 refresh. Mutation: registration ignores the
  external lease.
- T2 `BannerAccessoryReHostTests` (iOS): push+pop on the real `GameRoot`
  keeps the same slot id and refresh count 1. The mutation (self-owned
  lease) goes red, which shows the harness really re-hosts.
- T4 `BannerAccessoryMissingLeaseTests`: a missing lease fires the hook.
- Round-2 `BannerAccessoryPinTests` (a)/(b)/(c)/(d1)/(d2) are also included
  here. The (a)/(b) cases now host the real `GameRoot`, so the
  `isVisible`→`isEnabled` flip is pinned through Observation.
- T2 lives in its own suite. The two pin disjoint behaviour: lease identity
  across a re-host versus capsule visibility. Folding T2 into the pin file
  would have pushed it past 400 lines.

Docs:
- #1058 design doc: "Externally owned lease (#1080)" section.
- design.md §2.4: as-built note.
- screen-contracts ATT-PRIMER: the trigger is corrected to
  `BannerSessionModel.start()` from `GameRoot.onAppear`.
- impl-notes: probe summary, the PM ruling on the residual repaint gap
  (tracked in #1094), and teardown classified as hygiene (single-scene app;
  no per-re-host lease accumulation).

Verified:
- `swift test`: AppMonetizationKit 181, GameAppKit 96, GameShellKit 124,
  all pass.
- iOS Simulator GameAppKitTests: 97 pass.
- `swiftlint --strict`: 0 violations.
- `scan:admob` and `scan:design_contracts`: PASS.
- Sudoku and Minesweeper iOS Simulator builds succeed.

part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(monetization): pin the accessory's no-fallback guarantee, not just the hook (#1080)

T4 previously asserted only that `onMissingAccessoryLease` fires when
`BannerAccessoryView` has no `\.bannerAccessoryLease`. A regression that
re-added a fallback to the self-owned `BannerSlotView` init next to that hook
call would have stayed green. That fallback would silently bring back the
per-re-host re-request this PR fixes. (PM request on #1080.)

The test now hosts `BannerAccessoryView` over a started, gate-open
`BannerSessionModel` backed by a fresh `FakeAdProvider`, with the session
injected and the lease left nil, and asserts all three:
- the hook fired;
- `session.slots` is empty (nothing registered or loaded);
- `refreshCallCount == 0`.

The suite is `.serialized` because it swaps a static.

Mutation executed on the iOS Simulator: rendering the self-owned
`BannerSlotView(isSuppressed:…)` in the nil branch turns it red.
`session.slots` holds a `.loaded` slot, and `refreshCallCount == 0` fails.
Restored and green again. Full GameAppKitTests iOS run: 97 tests pass.
`swiftlint --strict`: 0 violations.

part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(snapshots): restore the #1024 view-structure baselines for the Minesweeper Today tab (#1080)

The main merge (68f840a) combined the wrong sides of one test.
`MinesweeperTodayTabViewTests.swift` came from #1024, where `TodayTabHost`
has no banner slot, so no `\.bannerSession` environment is written. The
view-structure `.txt` baselines came from main (#1062), whose version of the
test wraps the host in that extra environment modifier.

Result: all five `assertViewStructure` checks failed on line 1 (the root
type string) in `swift test --package-path Packages/MinesweeperKit`. Found
while running both apps' packages for #1080.

Evidence that this corrects a merge and does not re-record a behaviour
change:
- The failing assertions are `assertViewStructure` only; every `.image`
  snapshot passed.
- The five PNG baselines are the same blobs at 7b423da (#1024), 728ef19
  (main) and HEAD.
- The test's actual structure output matches the #1024 `.txt` baselines at
  7b423da byte-for-byte, and differs from the main-side baselines only on
  line 1.

So the five `.txt` files are restored from 7b423da.
`MinesweeperTodayTabViewTests` now passes. SudokuKit's `TodayTabViewTests`
already passed, since its test file and baselines agree.

part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* refactor(monetization): delete the unused banner fallback and apply PR gate part-1 findings (#1080)

PM gate on PR #1095, part 1.

Dead fallback removal (both apps, mirror principle):
- Delete Sudoku `LiveRouteFactory.themedBanner()` and Minesweeper
  `LiveRouteFactory+Helpers.bannerSlot()`. The accessory path shipped in
  #1024 and was confirmed stable in #1079, so the tab-content-bottom
  fallback is obsolete. This also removes the resurrected pre-#1062 comment
  in the Minesweeper helpers file (B1).
- Drop the `banner:` parameter and `Banner` generic from
  `SudokuUI.PracticeHubView`, `MinesweeperUI.MinesweeperPracticeHubView`,
  `GameAppKit.SettingsView` and `SettingsUI.SettingsScreen`; the per-app
  `SettingsView` typealiases become non-generic.
- The Minesweeper helpers file now imports UIKit explicitly under
  `canImport(UIKit)`; `UIApplication` had only resolved through the removed
  SwiftUI import, which only the iOS app build exposed.

Tests:
- `BannerSlotCollapsedHeightTests`: drop the two rows for the deleted
  helpers (Sudoku `themedBanner`, Minesweeper `bannerSlot`); the Today and
  Board rows are unchanged.
- `BannerSlotDarkBandRegressionTests`: doc comment only, notes the removal.
- No test was deleted and no snapshot baseline changed.

Other findings:
- M1: `mise-tasks/new_game/scaffold` generates iOS 26.1, matching
  Project.swift.
- m1: comments no longer point at private memory files; they cite
  `meetings/2026-09-11_1058-slot-model-design.md` "Externally owned lease
  (#1080)" or CLAUDE.md.
- m2: design.md 2.4.1 now says only that the macOS `#else` never builds
  `BannerAccessoryView`; `AdProvider`, `AdGate` and `BannerSlotView` are
  still constructed on macOS.
- m3: `EnvironmentValues.bannerAccessoryLease` is internal and
  `MonetizationUI` is an internal import in that file.
- design.md 2.4 and the #1024 impl notes record the fallback removal.

Verification: swift test AppMonetizationKit 181, GameAppKit 96,
GameShellKit 124, MinesweeperKit 412 (all pass); SudokuKit
SudokuAppCompositionTests 69, SudokuUITests without settings suites 376,
audio/reminder/IAP settings 14, SettingsViewAppStoreRowsTests 4,
SettingsViewWindowSnapshotTests 2, SettingsViewTests 15 (all pass, each
settings suite run alone); swiftlint --strict 0 violations on 19 files;
scan:hygiene, scan:design_contracts, scan:admob pass; Sudoku and
Minesweeper iOS simulator builds succeed.

Part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* refactor(ui): drop the orphaned banner slot from the Practice and Settings shells (#1080)

PM gate on PR #1095, part 1 follow-up rulings.

- `PracticeHubShellView` (GameShellKit) and `SettingsShellView`
  (SettingsKit) lose their `banner:` parameter and `Banner` generic. The
  previous commit removed their only forwarders (both Practice hub views
  and `GameAppKit.SettingsView` / `SettingsScreen`), so nothing fed these
  slots. The single-child `VStack(spacing: 0)` wrapper that existed only to
  seam the content against the banner is gone too; the modifiers now sit on
  the `ScrollView` and the `Form` directly. GameShellKit stays
  zero-dependency.
- `BannerSlotCollapsedHeightTests`: delete the "TodayTabHost (Today tab,
  both apps)" row and its header bullet. `TodayTabHost` has constructed no
  `BannerSlotView` since #1024, so the row pinned a host that no longer
  exists. The table now has 4 cases.
- Both `Live+TabRoots.swift` Today-case comments no longer claim
  `TodayTabHost` carries its own slot and is the ATT anchor. They now say the
  shared `tabViewBottomAccessory` covers the tab, the accessory slot's
  registration is the ad context that triggers the ATT primer, and the
  Daily hub `banner:` param is dead and tracked in #1096.
- `DailyHubShellView`, `DailyHubView` and `MinesweeperDailyHubView` are
  untouched; they were dead before this PR and #1096 owns them.

No snapshot baseline changed and no test was deleted; the Practice hub and
Settings snapshot suites pass unchanged on both apps.

Verification: swift test AppMonetizationKit 181, GameAppKit 96,
GameShellKit 124, SettingsKit 51, MinesweeperKit 412 (all pass); SudokuKit
SudokuAppCompositionTests 69, SudokuUITests without settings suites 376,
audio/reminder/IAP settings 14, SettingsViewAppStoreRowsTests 4,
SettingsViewWindowSnapshotTests 2, SettingsViewTests 15 (all pass, each
settings suite run alone); swiftlint --strict 0 violations; scan:hygiene,
scan:design_contracts, scan:admob pass; Sudoku and Minesweeper iOS
simulator builds succeed.

Part of #1024

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
wei18 added a commit that referenced this pull request Sep 23, 2026
…rift, no code change) (#1104)

* test(snapshots): re-baseline 174 strict snapshots on macOS 27 (renderer drift, no code change)

The dev Mac went macOS 26.5.1 -> 27.0 (26A428) on 2026-09-16; Xcode 26.5
(17F42) / Swift 6.3.2 unchanged. Every strict `.image` baseline and every
`assertViewStructure` TXT that touched an NSClipView failed on a clean
`origin/main` 73f76b4 with no code change.

Enumerated first (no record mode): MinesweeperKit full + SudokuKit in the
#1062 batch filters (today / board / hubs, the SettingsView suites run one
at a time, settings-B) -> 174 failing baselines, all "does not match
reference": 130 PNG (37 MS + 93 SK) and 44 TXT (22 + 22). Suites that
passed (the tolerant board suites and 30 other baselines) are untouched.

Classification before recording:
- TXT: 43 x `NSClipView` -> `SwiftUI.HostingClipView`, 2 x `_FocusRingView`
  1pt y-shift; 0 unknown lines; line 1 (root type) identical in all 44.
- PNG: 105 files < 2 % pixels differing (text antialiasing, shift 0-2 px
  @2x). 25 outliers > 2 %: every text-stack card (completion cards, the
  DailyHub exhausted card) is exactly 4 px @2x (2pt) taller, centered, and
  the CTAs below shift +2 px; PracticeHub / AudioSettings / two tiny
  component images are sub-visible uniform shifts. Content, glyphs,
  colours and element sets are unchanged; no margin newly hits 0, no
  inter-element gap <= 0 (tightest, 6 px, is unchanged). PM ruling on
  #1097: environment drift, re-record all 174.

Recorded by deleting the 174 files and re-running the same suites in the
committed `.missing` mode (record mode never flipped in code). The 174
recorded files are byte-identical to the enumeration run's rendered
artifacts, and every suite passes twice in a row afterwards.

`SettingsViewWindowSnapshotTests` crashes the helper on macOS 27 (SIGSEGV,
no committed baseline) -> tracked in #1103, excluded here.

part of #1097
part of #1014

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* test(sudoku): retarget the #851 dark-band pin to the shipped board banner slot

Since #1024 / #1080 the hub banner is hosted in `tabViewBottomAccessory`,
so `BannerSlotDarkBandRegressionTests` was pinning a hand-reconstructed
pre-#1024 VStack (kept alive by #1096) that no longer ships.

The accessory host itself cannot be pixel-pinned on this harness:
`GameAppKit.BannerAccessoryView` and `RootShellView`'s
`.tabViewBottomAccessory` are both `#if os(iOS)`, and the macOS build that
`swift test` renders with `NSHostingView` ships `EmptyView()` there. The
board screen's slot (`BoardView+Layout.swift` `themedBanner`) is the
shipped composition that renders here and paints the same
`surface.background` token, so the pin moves to `BoardView` in dark mode
with a started session over a readiness-held provider (gate open, slot
reserved) — strict `.image`, unlike `BoardViewBannerTests`' tolerant
sibling of the same state, because a 12 %-alpha band is inside a 0.95
tolerance.

Mutant proof (macOS 27, this branch): with `themedBanner`'s
`backgroundColor` temporarily set back to the stale
`Color.secondary.opacity(0.12)`, the test fails "does not match
reference" — 5.3 % of pixels, a solid band over exactly the slot rect
(rows 1020–1119, x 32–753 @2x); with the token restored it passes twice.
The old DailyHub baseline is removed with the fixture it pinned.

part of #1097
part of #851

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* chore(store): regenerate the 147 ASC frames whose source baselines moved on macOS 27

`mise run store:screenshots build-ascspec` over the re-baselined
snapshots: 168 slots processed, 0 failures, spec check passed. 147 frames
change (every slot except the 3 Minesweeper 03-board slots, whose tolerant
board suites passed on macOS 27); the 21 Minesweeper 03-board frames come
back byte-identical, which doubles as the determinism check for the
generator on this host.

Old-vs-new per frame: mean 0.81 % of pixels differ, max 3.50 %
(minesweeper/iphone-6.9/ja/04-completion) — the same 2pt text-card growth
as the source baselines. The taller completion card does not collide with
the device bezel or the caption band; the callout below it shifts ~2 px
with the card.

The Sudoku 03-board frames stay #1054-affected (the pipeline cannot render
Liquid Glass, so the controls are surface-less). Regenerating them here
only carries the macOS 27 drift; this commit does not fix #1054.

part of #1097

Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

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

1 participant