Repository navigation
feat(minesweeper): record practice personal bests via seed-derived puzzle id - #779
Merged
Merged
Conversation
…zzle id The #699 personal-record store shipped with 6 mode/difficulty slots but a mode == .daily write gate, leaving the 3 practice slots unused — a deliberate launch scope (owner decision 2026-07-06) because the practice SavedGame recordName is a singleton (practice-{difficulty}) and would collapse every practice win into one dedup entry. The per-game unique id now derives from the board's existing generation seed instead of a new persisted field: every new-practice callsite already mints UInt64.random once per game, and the seed round-trips through MinesweeperSessionSnapshot / MinesweeperSession.restore verbatim (it reproduces the mine layout), so a resumed practice win dedups as the same game with zero new snapshot fields, no schema-version bump, and no legacy-decode fallback. Id format mirrors Sudoku's PuzzleIdentity.practice(salt:): practice-{crockfordBase32(seed)}-{difficulty}, via a new MinesweeperPracticeIdentity + a byte-identical private copy of the Crockford encoder (SudokuPersistence's is internal; shared test vectors pin the two implementations against drift). submitDailyTimeIfWon() is renamed submitWinIfWon(): the didSubmitWin latch now arms on any win (practice previously early-returned before latching), Game Center submission stays strictly daily-only (#329, permanent), and the personal-record puzzleId branches by mode (daily: board recordName as before; practice: the seed-derived id). Tests: practice wins record with the expected id format; two distinct practice games count separately; resume keeps the id (dedup as one game); GC never fires for practice; daily path unchanged; Crockford vector pins (0, 1, 31, 32, 42, 12345, UInt64.max) shared with Sudoku. Verification: MinesweeperKit full suite 240 tests / 40 suites pass (was 218/36); MinesweeperCoreKit 91 tests pass; SudokuKit builds clean (no Sudoku source touched); swiftlint --strict 0 violations on all changed files. Closes #705 Co-Authored-By: Claude Fable 5 <[email protected]>
wei18
enabled auto-merge (squash)
July 11, 2026 11:51
wei18
added a commit
that referenced
this pull request
Jul 11, 2026
…722) (#782) Timeline log for the five-issue wave: cross-app coordinate a11y l10n (#755/PR #776), Sudoku state-suffix l10n (#771/PR #777), the #716 premise refutation + pencil-notes snapshot regression lock (PR #778), MS practice personal bests via seed-derived ids (#705/PR #779), and Sudoku digit-first input (#722/PR #781). Records the three pre-push review catches, the seed-reuse design decision, and process notes (haiku numeric spot-checks, reviewer send-report instruction, filtered-batch verification). Co-authored-by: Claude Fable 5 <[email protected]>
9 tasks
wei18
added a commit
that referenced
this pull request
Jul 14, 2026
…ntry) (#820) Implements docs/v2/stats-screen-proposal.md as amended by the owner's 2026-07-14 adjudication comments on the issue (which are binding and supersede the older body/proposal text where they conflict): - Entry point: Home ONLY — a secondary-weight HomeSecondaryEntryLink row below the four mode cards (new optional secondaryLink slot on the shared HomeScreen scaffold; GameConfig.statsRoute drives it). The Settings disclosure row is DROPPED from scope per adjudication 4 — SettingsScreen is untouched. - Layout: Daily and Practice as two stacked sections (adjudication 1, no segmented control). - NO streak number anywhere (adjudication 2 — #774 adds it later). - NO MS win-rate tile (adjudication 3 — no loss counter exists). - Per-app screens (SudokuUI StatsView/StatsViewModel + MinesweeperUI MinesweeperStatsView/MinesweeperStatsViewModel; proposal §7 scope note — no shared cross-app Stats component), reading ONLY existing PersonalRecord fields: completedCount, bestTimeSeconds (nilable), totalTimeSeconds → average computed as total/count. Zero schema changes. - MS Daily AND Practice sections ship with real data (#705 closed via #779 — practice PBs write for both). Screen behavior: - Pushed route per app (AppRoute.stats + LiveRouteFactory mapping; MS's destination split into LiveRouteFactory+Stats.swift for the 400-line file_length ceiling). Compact: 1-column tiles; iPad/Mac regular: 3-column reflow + the boards' 960pt clamp-and-center; .accessibility3+: grid AND per-tile stat columns stack vertically (LeaderboardView's policy), no truncation. - VoiceOver: each tile is one combined element with an explicit localized label ("Easy, 14 completed, best time 3 minutes 12 seconds, ..."). - Fetch: renders empty tiles instantly, fills as async CK reads land; offline / iCloud-signed-out degrades to zeroes via errorReporter funnel (daily-hub graceful-degrade posture). No monetization surface. - Telemetry: new TelemetryEvent.statsViewed fired once per screen mount. - L10n: 8 new keys in both catalogs (7 locales), +3 MS-only (Completed / Daily / Practice were missing from the MS catalog); l10n fixture regenerated; scan:l10n passes. Deviation (documented): the proposal's conditional status.success accent on a "just-set personal best" tile is omitted — PersonalRecord carries no "best changed at last update" signal, so the screen cannot know "just-set" (the dispatch's stated fallback). Tests: VM unit tests both apps (average computation, nil-best / zero-count tiles, fetch-failure degrade, one-shot telemetry, nil-store MS path); strict-image snapshot baselines for the new screen (iPhone light, AX3, iPad, Mac × both apps) recorded once and eyeballed; Home baselines re-recorded for the new entry (both apps) and eyeballed. SudokuKit verified in filtered batches (full-suite segfault is the known local issue, reproduced on unmodified main); MinesweeperKit --no-parallel 276/276; GameAppKit 35/35; GameShellKit 28/28; TelemetryKit 32/32. swiftlint --strict clean on changed files. CR round-1 fix: per-case route-factory sentinel tests added for `.stats` (statsRouteReturnsStatsView in SudokuKit RouteFactoryTests; factoryReturnsViewForStatsRoute in MS LiveRouteFactoryTests). Rebased over #744 (53c3daa): kept both sides in MS LiveRouteFactory/Live (their share/review/invite-friends params + this branch's stats route); removed an orphaned doc-comment line #744 left at the file tail and compressed the `.stats` case to hold the 400-line file_length ceiling. Closes #773 Co-authored-by: Claude Fable 5 <[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.
What
Widens the #699 MS personal-record write path from daily-only to daily + practice (owner decision 2026-07-06), filling the 3 unused practice slots. The practice dedup puzzleId derives from the board's existing generation seed —
practice-{crockfordBase32(seed)}-{difficulty}, mirroring Sudoku'sPuzzleIdentity.practice(salt:)— because the practice SavedGame recordName stays a deliberate singleton.Key design point: the seed is already minted once per new practice game (
UInt64.randomat both production callsites) and already round-trips save→resume verbatim (it reproduces the mine layout), so this needs zero new snapshot fields, no schema-version bump, and no legacy-decode fallback — a resumed practice win dedups as the same game for free.submitDailyTimeIfWon()→submitWinIfWon(): latch arms on any win; GC submission stays strictly daily-only (fix(minesweeper): gate GC leaderboard submit to daily mode (mirror Sudoku) #329, permanent); personal-record puzzleId branches by modeMinesweeperPracticeIdentity+ byte-identical private Crockford encoder copy (Sudoku's isinternal); 7 shared test vectors pin the two implementations against drift.replayDailyBoardroute comment now explicitly documents whypersonalRecordStorestays nil there (CR finding)Verification
Closes #705
🤖 Generated with Claude Code