Skip to content

fix(daily-hub): render trio immediately, fill completion async (#526) - #528

Merged
wei18 merged 2 commits into
mainfrom
worktree-agent-ae7574e15c3a5ee47
Jun 16, 2026
Merged

wei18 merged 2 commits into
mainfrom
worktree-agent-ae7574e15c3a5ee47

Conversation

@wei18

@wei18 wei18 commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Fixes #526 — Sudoku Daily Hub spun forever when iCloud is signed out.

Root cause

bootstrap() did async let completedCall = persistence.fetchCompletedDailyIds(...) then try await completedCall. With iCloud signed out the CloudKit completed-ids fetch hangs indefinitely (it never throws), so bootstrap stayed in .loading → permanent spinner, no cards.

Fix (two-phase, mirrors the intended MinesweeperDailyHub shape)

  1. Fetch the trio (pure-local) → state = .loaded(cards) immediately, all un-completed — the hub renders without gating on any account.
  2. fillCompletionOverlay runs after, best-effort; a hang/error degrades silently (cards stay un-completed).

Verification

swift test --package-path Packages/SudokuKit green (244 macOS / 279 iOS-runner). New tests: bootstrapReachesLoadedEvenWhenCompletedIdsFetchHangsForever (HangingPersistence — fails against old code) + the iCloud-signed-out throw degrade path. Leader will also sim-verify offline Daily Hub render post-merge.

Review (dual-model CR)

Sonnet: PASS (completion accuracy correct, hang test non-vacuous, tap-during-fill benign, MainActor-safe, CK lazy). Haiku: flagged the same MS mirror gap as a blocker. Leader adjudication: the Sudoku fix is sound and both reviewers PASS it; the MS DailyHub still uses the single-phase pattern, but it is latent (sim shows MS Daily Hub renders offline today) — tracked as a follow-up (bundled with #515, MS iCloud-gate family), including Sonnet's defensive guard case .loaded nit. Not a blocker for the actually-broken Sudoku surface.

🤖 Generated with Claude Code

wei18 and others added 2 commits June 16, 2026 13:13
When iCloud is signed out, the CloudKit completed-daily-ids fetch hangs
indefinitely instead of throwing — the previous `async let completedCall`
pattern blocked bootstrap() at `try await completedCall` forever, leaving the
Sudoku Daily Hub in .loading with a permanent spinner (no cards).

Two-phase fix, mirroring MinesweeperDailyHubViewModel:
1. Fetch the trio (pure-local) and immediately set state = .loaded(cards) with
   every card un-completed — the hub renders without gating on any account.
2. fillCompletionOverlay(trio:date:) runs afterwards; a hang or error there
   degrades silently (cards stay un-completed) instead of blocking the hub.

Tests: bootstrapReachesLoadedEvenWhenCompletedIdsFetchHangsForever (HangingPersistence
reproduces the CK hang) + the iCloud-signed-out throw degrade path. 244/244 SudokuKit pass.
Fixes #526.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ngth (#526)

DailyHubViewModelInteractionTests hit 422 lines (SwiftLint file_length 400).
Moved the two #526 offline regression tests + their HangingPersistence /
ThrowingCompletionPersistence fakes into DailyHubViewModelOfflineTests.swift
(own @suite). swiftlint --strict clean; SudokuKit 244/244 pass.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit 90478a6 into main Jun 16, 2026
4 checks passed
@wei18
wei18 deleted the worktree-agent-ae7574e15c3a5ee47 branch June 16, 2026 05:35
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.

Daily Hub spins forever when iCloud signed out (no local fallback) — same gate class as #512/#515

1 participant