Skip to content

perf(daily): parallelize best-time fetches and enable difficulty cards before phase-2 lands - #943

Merged
wei18 merged 2 commits into
mainfrom
perf/941-daily-hub-latency
Jul 22, 2026
Merged

wei18 merged 2 commits into
mainfrom
perf/941-daily-hub-latency

Conversation

@wei18

@wei18 wei18 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

What

Verification

  • New tests both apps: best-time concurrency order-independence (gated-continuation fakes), tap-during-pending appends board route then reconciles after landing.
  • SudokuKit Daily filter 89/89 green; MinesweeperKit full suite 370/370 green; swiftlint --strict clean; l10n untouched.
  • Dual code review (0 blockers/majors; 2 minor comment drifts fixed in follow-up commit).
  • Fresh-context acceptance: 5/5 PASS incl. fresh-sim spot-check on both apps — cards full-opacity and tappable within ~1s of hub entry, no dead taps, no Daily Hub spins forever when iCloud signed out (no local fallback) — same gate class as #512/#515 #526-style spinner.

Closes #941

🤖 Generated with Claude Code

wei18 and others added 2 commits July 22, 2026 23:45
…ase-2 lands

fetchBestTimes ran its 3 per-difficulty CK reads in a serial for-loop — the
last serial hop in the Daily hub's phase-2 lane (the week-window fetch and
this whole method already race via async let). Fan it out into a TaskGroup
in both apps so all reads are in flight at once; assembly stays
order-independent since results are keyed by Difficulty, not completion
order.

Also drops the #842/#878 tap-gate + dim/no-button visual: difficulty cards
are now optimistically tappable at full opacity from the first .loaded
render instead of waiting for phase-2 to land. Safe because correctness was
never this gate's job — BoardLoaderView / MinesweeperDailyOpenGuardView's
precheck unconditionally re-checks persistence on every daily open and
redirects to Completion if already done, regardless of this flag.

Co-Authored-By: Claude Fable 5 <[email protected]>
Review round-1 cosmetic fixes (cr findings): both comments still described
the pre-#941 phase2-pending tap gate / dim treatment.

Part of #941.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 22, 2026 16:15
@wei18
wei18 merged commit 29d685b into main Jul 22, 2026
5 checks passed
@wei18
wei18 deleted the perf/941-daily-hub-latency branch July 22, 2026 16:15
wei18 added a commit that referenced this pull request Jul 29, 2026
…ate (#973)

* test(sudoku): re-record stale dark-band regression baseline (#972)

`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]>

* test(composition): pin the macOS Settings monetization gate from #971

#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]>

* test(sudoku): drop the inert async from the gate test signature (#972)

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]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(daily): parallelize best-time fetches and enable difficulty cards before phase-2 overlay lands

1 participant