Repository navigation
test(sudoku): re-record dark-band baseline + pin macos monetization gate - #973
Merged
Merged
Conversation
`postFix_themedBackground_dailyHubDarkMode_bannerOpen_noBand` has been red on main since #943 changed the three difficulty cards' subtitle from a shimmer/skeleton placeholder to the resolved `Best —` empty state; nobody re-recorded the baseline. Verified deterministic (not the timing-sensitive flake a #971 reviewer suspected): the pixel diff bbox (64,304 → 721,662) matches #943's change exactly and is nowhere near the banner slot. Eyeballed the re-recorded PNG and the banner-boundary crop: no dark band or seam, confirming #851 has not regressed — this is a stale-baseline fix, not a determinism rework. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#971 fixed a Guideline 2.1 exposure — macOS offered "Remove Ads" where no ads exist — by nil-ing the LOCAL `settingsMonetizationController` inside each app's `Live.swift` `makeRouteFactory` on non-iOS platforms. Both code reviewers and the acceptance agent on that PR flagged that nothing pins the behaviour: the composition-level `bag.monetizationController` DI handle stays non-nil on macOS (only the value fed into `LiveRouteFactory`'s Settings route is gated), so the existing `liveAdProviderIsLiveOnIOSNoopOnMac` pattern doesn't reach it, and a future refactor could silently reintroduce the exposure. No tracking issue exists for this — it surfaced purely from review. Added `liveCompositionGatesSettingsMonetizationControllerByPlatform` to both `SudokuAppCompositionTests` and `MinesweeperAppCompositionTests` (mirror principle), reaching through the real `.live()` composition to `routeFactory.view(for: .settings)` and asserting on the rendered `SettingsView`'s `monetizationController` field via `String(reflecting:)` — this exercises the actual `#if os(iOS)` gate in `Live.swift`, not a copy of it, so deleting the gate flips the assertion. Verified by temporarily un-gating Sudoku's `Live.swift` (passing the controller unconditionally): the new test failed with `monetizationController: Optional(...)`; restored the gate and the test passes again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
CR round 1: SudokuAppComposition.live() is synchronous, so the test never awaited anything — and the Minesweeper mirror test was already sync. Now symmetric. Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #972
Two small, related test-hygiene fixes. Base = main @ a0bb3c2 (includes #971).
Task 1 (#972) — re-record the stale dark-band baseline
postFix_themedBackground_dailyHubDarkMode_bannerOpen_noBandhas been red onmain since #943 changed the three difficulty cards' subtitle from a
shimmer/skeleton placeholder to the resolved
Best —empty state, and nobodyre-recorded the baseline. Per the issue's own diagnosis (confirmed
independently here): deterministic staleness, not a timing flake — the pixel
diff bbox is
(64,304)→(721,662), matching #943's change exactly, nowherenear the banner slot.
Eyeball verification (the whole point of this test, #851): cropped +
2x-upscaled the banner-boundary region of the re-recorded PNG — solid,
uniform dark background, no lighter band/seam. Row-mean grayscale across the
entire banner region stays flat at ~(17,18,20) with only a ~2-3 unit bump
where the loading-spinner glyph pixels sit — noise, not a seam. #851 has not
regressed.
Diff-confinement verification: programmatic pixel-diff between the old
and new committed baselines confirms the changed region is exactly bbox
(64,304)→(721,662)— the three difficulty-card subtitle rows — nothingelse moved.
Task 2 (no tracking issue — flagged by #971's two code reviewers + its
acceptance agent) — pin the macOS monetization gate with a test
#971 fixed a real Guideline 2.1 exposure (macOS offered "Remove Ads" where no
ads exist) by nil-ing a LOCAL (
settingsMonetizationController) inside eachapp's
Live.swiftmakeRouteFactory, on macOS only. Nothing pinned thatbehaviour, so a future refactor could silently reintroduce it. The subtlety:
bag.monetizationController(the composition-level DI handle) stays non-nilon macOS — only the value fed into the Settings route is gated — so the
existing
liveAdProviderIsLiveOnIOSNoopOnMac-style test doesn't reach it.Chosen seam: reach through the real
.live()composition torouteFactory.view(for: .settings)and assert on the renderedSettingsViewstruct's
monetizationControllerfield viaString(reflecting:). Thisexercises the actual production
#if os(iOS)gate inLive.swift— not aduplicate of it — added to both
SudokuAppCompositionTestsandMinesweeperAppCompositionTests(mirror principle). Rejected alternatives:exposing a standalone "resolved value" accessor would be one more
indirection between the test and the real gate for no benefit; asserting on
the Purchases-affordance's rendered text is l10n-fragile compared to
Mirror-inspecting the stored property directly.
swift testalways buildsfor the macOS host regardless of the package's iOS support (documented
repo gotcha), so the
#elsebranch is what a local run actually pins; the#if os(iOS)branch mirrors the same defensive shape already used byliveAdProviderIsLiveOnIOSNoopOnMac.Negative proof (acceptance evidence) — temporarily reverted the gate in
Sudoku's
Live.swift:Restored the gate (
git diffagainst main confirmed byte-identical) andre-ran:
Verification
swift test --package-path Packages/SudokuKit --filter "SettingsView|CompositionTests"— 82/82 passed.swift test --package-path Packages/SudokuKit --filter BannerSlotDarkBandRegressionTests— 1/1 passed.swift test --package-path Packages/SudokuKit --no-parallel(full suite, avoiding the documentedlocal parallel-execution segfault flake) — 444/444 passed.
swift test --package-path Packages/MinesweeperKit(full suite) — 372/372 passed.mise run lint:swift_stricton both changed test files — 0 issues.git status --porcelainshows exactly one modified snapshot baseline (TaskTest plan
🤖 Generated with Claude Code