Skip to content

fix(minesweeper): give the pre-first-tap board an exit - #693

Merged
wei18 merged 2 commits into
mainfrom
fix/681-ms-ready-state-exit
Jul 5, 2026
Merged

wei18 merged 2 commits into
mainfrom
fix/681-ms-ready-state-exit

Conversation

@wei18

@wei18 wei18 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Fixes #681 (P1 user trap): MS defers mine placement to the first reveal, so the board mounts in .idle — where the pause toggle (gated .playing || isPaused) never rendered, edge-swipe is intentionally disabled (#660), and the ONLY escape was force-quitting. Fat-fingering Expert 16×30 stranded the user.

Fix: widen the toggle gate to include .idle; tapping there mounts the SAME PauseOverlayView via a view-local showIdleLeaveOverlay flag (MinesweeperSession.pause()/resume() deliberately guard .playing/.paused, so routing through the session would silently no-op — the idle-aware branch is required). Resume-from-idle just clears the flag (no session call, no illegal transition — pinned by the new resumeBeforeFirstActionIsNoop test); Leave dismisses. CR round 2: the .idle button now shows ✕ + the existing leave.game.leave key (label/behavior parity; zero new strings, 7 locales verified, scan:l10n green). Sudoku immune — BoardLoaderView.startOrResume() enters .playing at mount (cited, SudokuKit untouched).

Verification: MinesweeperKit 174/174 + MinesweeperCoreKit 87/87; 3 BeginnerCovered baselines re-recorded (eyeballed; dark-harness text-invisible quirk confirmed PRE-existing by extracting the old baseline). Leader sim walkthrough: Ready board shows the exit control → tap → 'Leave Game?' overlay (a11y tree = 5 elements, live-confirming #691's .isModal on the new path) → Leave → lands on the Practice hub. Dual CR APPROVE ×2 (sonnet verified dual-trigger exclusivity, idle-teardown writes nothing per the #675 guard, clock can't start from idle). Spec rows updated (#681-tagged).

🤖 Generated with Claude Code

wei18 and others added 2 commits July 5, 2026 21:41
The MS board's pause toggle was gated to `.playing || isPaused`, but MS
defers session start to the first reveal (first-click-safe mine
placement), so a just-mounted board sits in `.idle` with NO exit — no
back button, no pause control, and edge-swipe-back is a no-op (#660).
Fat-fingering the wrong difficulty (e.g. Expert 16x30) stranded the
player with force-quit as the only escape. Sudoku is immune:
`BoardLoaderView.startOrResume()` drives its session to `.playing` at
mount, so its board never renders in `.idle` (no SudokuKit change).

Fix: widen the toggle gate to also render in `.idle`. Tapping it there
sets a view-local `showIdleLeaveOverlay` flag that mounts the SAME
`PauseOverlayView` (leave-confirm semantics, existing `leave.game.*`
strings, no new chrome) WITHOUT calling `viewModel.pause()` — the
session actor deliberately no-ops pause on `.idle` (no clock to
freeze), so an idle-aware view branch is required, not optional.
Resume from the idle overlay just clears the flag (no session call);
Leave dismisses as before. Play -> pause -> resume is untouched.

Also:
- Add `resumeBeforeFirstActionIsNoop` VM test backing the design
  decision that `resume()` is a safe no-op on an `.idle` session.
- Re-record the 3 intentionally-affected covered-board baselines
  (iPhone light/dark + iPad light) — the Ready-state status bar now
  carries the pause button.
- Update `docs/screen-contracts.md` (MS-BOARD idle row + #681 delta
  note; PAUSE-OVERLAY entry/Resume rows) and `docs/navigation-flows.md`
  (dated #681 delta under the unified pause menu section).

Verified: MinesweeperKit 174/174 green (--no-parallel),
MinesweeperCoreKit 87/87 green, swiftlint --strict clean on changed
files. Sim walkthrough skipped per coordinator (watchdog stall);
covered by re-recorded baselines + VM tests.

Co-Authored-By: Claude Fable 5 <[email protected]>
CR follow-up: the `.idle` exit control still showed the pause glyph /
"Pause" a11y label while its tap opened the Leave confirmation — a
label/behavior mismatch (VoiceOver announced "Pause"). Add a third
label branch for `.idle`: glyph `xmark`, visible Label text (regular
width) and `.accessibilityLabel` both reuse the pause overlay's own
`leave.game.leave` key (verified present in the MS app catalog with all
7 locales; `mise run scan:l10n` green incl. the #594 dotted-key gate —
no new string). `.playing` / `.paused` branches are byte-identical.

Re-recorded the same 3 covered-board baselines: iPhone light + iPad
light now show ✕ instead of ⏸ in the Ready state (iPad rail renders
the raw key text — a harness artifact: the snapshot host bundle has no
app catalog, so LocalizedStringKey falls back to the literal; at
runtime Bundle.main is the MS app and resolves "Leave", the exact
mechanism PauseOverlayView's own keys use). Dark iPhone: status-bar
text remains invisible in this harness (pre-existing quirk).

Also noted the ✕/Leave label on the MS-BOARD idle contract row in
docs/screen-contracts.md.

Verified: MinesweeperKit 174/174 green (--no-parallel), scan:l10n
green, swiftlint --strict clean.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 enabled auto-merge (squash) July 5, 2026 14:04
@wei18
wei18 merged commit 07e7777 into main Jul 5, 2026
4 checks passed
@wei18
wei18 deleted the fix/681-ms-ready-state-exit branch July 5, 2026 14:04
wei18 added a commit that referenced this pull request Jul 5, 2026
…ain (#695)

Session log: 4-screenshot bug wave (#673-#677), three-lane dual-app
UIUX/spec audit, navigation-flows + screen-contracts spec (#683), the
screen-contract-spec skill (#684), the contract-driven static pass, the
4-PR fix train (#690-#693), two evidence-based environmental downgrades,
and the gated open items (#685/#468/B1-B4/#694).

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(minesweeper): board 'Ready' state (pre-first-tap) has no exit — trap on wrong-difficulty pick

1 participant