Skip to content

fix(sudoku): present completion view as in-board overlay on iOS (#610) - #611

Merged
wei18 merged 2 commits into
mainfrom
fix/610-sudoku-completion-overlay
Jun 24, 2026
Merged

wei18 merged 2 commits into
mainfrom
fix/610-sudoku-completion-overlay

Conversation

@wei18

@wei18 wei18 commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Fixes #610.

Problem

On iOS, solving a Sudoku puzzle showed no Completion view (Game Center still submitted). Found during #579 TestFlight device verification.

Root cause

After the board moved to a fullScreenCover modal (SDD-003 Epic 1), GameRoot mounts it with path == nil. Sudoku's only completion trigger was the legacy BoardView.pushCompletionIfNeeded() → path.append(.completion), a documented no-op when path == nil. Minesweeper already presents completion as an in-board overlay; Sudoku was never wired into that seam — a mirror-principle drift.

Fix (mirrors Minesweeper)

Verification

  • TDD: new BoardCompletionOverlayTests — RED (init lacked gameCenter) → GREEN. Asserts overlay VM present on .completed in the modal (path == nil) context; absent while .playing.
  • swift test --package-path Packages/SudokuKit — all suites pass, no snapshot baselines re-recorded.
  • swiftlint --strict — 0 violations across 5 changed files.
  • Pending: Leader idb sim-verify on iOS (overlay layout / safe-area) + a fresh TestFlight build for user re-verification.

🤖 Generated with Claude Code

wei18 and others added 2 commits June 24, 2026 16:52
Root cause: the board is presented as a fullScreenCover modal where
`path == nil`, so `pushCompletionIfNeeded()` → `path.append(.completion)`
was silently a no-op — the Completion screen never appeared after solving.

Fix: mirror MinesweeperBoardView's in-board overlay pattern (#292/#518).
Added `@State var completionViewModel: CompletionViewModel?` to BoardView.
An `.onChange(of: viewModel.status == .completed)` builds it once on the
playing→completed transition; an `.overlay {}` shows `completionSurface(_:)`
while it is non-nil. `gameChrome?.setHidingChrome` is keyed on overlay
presence (not status), matching MS CR #518-R2 so Close restores the chrome
without clearing terminal state.

The macOS push-navigation path (`pushCompletionIfNeeded` / `hasNavigatedToCompletion`
latch) is left untouched — it still fires correctly when `path != nil`.

Wiring preserved: `gameCenter` and `makeDailyReminderPrimer` are threaded
from `LiveRouteFactory` → `BoardLoaderView` → `BoardView` so the overlay's
CompletionViewModel gets the GC client (#381/#383 leaderboard routing intact)
and Daily solves still see the reminder primer (#287 Phase 2).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Blocker from CR: on macOS the board is presented inline inside a
NavigationStack (path != nil), so the new `.onChange` was building
`completionViewModel` AND `pushCompletionIfNeeded()` was appending
`.completion` to the path — both mechanisms fired at once.

Fix: add `shouldPresentCompletionOverlay: Bool { path == nil && viewModel.status == .completed }`
to `BoardView+Completion.swift` and guard the overlay-building branch
with it. iOS modal (path == nil) → overlay only. macOS inline board
(path != nil) → push only. Gate is on `path`, not `#if os(iOS)`, so
it tracks the real presentation contract.

Also make `path` internal (was private) so `BoardView+Completion.swift`
can read it for the predicate — same pattern as `gameCenter`.

Strengthened tests (all 5 pass):
- shouldPresentCompletionOverlay: true when completed + path==nil
- shouldPresentCompletionOverlay: false when playing + path==nil
- shouldPresentCompletionOverlay: false when completed + path!=nil (macOS regression lock)
- makeCompletionViewModel: correct puzzleId + non-nil leaderboardId for daily
- makeCompletionViewModel: nil leaderboardId for practice puzzle

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit 3fe3cc4 into main Jun 24, 2026
4 checks passed
@wei18
wei18 deleted the fix/610-sudoku-completion-overlay branch June 24, 2026 09:45
wei18 added a commit that referenced this pull request Jul 4, 2026
Spec-first navigation methodology: screen contracts (element inventory +
per-interaction presentation semantics + back/close landing + covering/
z-order + state variants) + forward/negative flow chains, code-anchored.
Synthesizes web research (wireflows, statecharts, HIG modality, model-based
test derivation) + this repo battle-scars (#2B/#197/#523/#611/#518/#674).
Worked example: docs/screen-contracts.md + docs/navigation-flows.md (#683).

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

fix(sudoku): completion view never shows on iOS — modal board left on dead path-push (mirror drift vs MS overlay)

1 participant