Skip to content

feat(minesweeper): wire saved-game resume — save hooks, .resumeBoard loader, fetchResume (#455 step 4) - #465

Merged
wei18 merged 4 commits into
mainfrom
feat/455-ms-resume-wire
Jun 11, 2026
Merged

wei18 merged 4 commits into
mainfrom
feat/455-ms-resume-wire

Conversation

@wei18

@wei18 wei18 commented Jun 10, 2026

Copy link
Copy Markdown
Owner

The last mile of #455 — the MS Home resume pill lights up.

Flow

start board → play → background/pause/dismiss → persistCurrentState() → relaunch → fetchResume (Live+Resume.swift) → ResumeCandidate → pill → tap → .resumeBoard → MinesweeperBoardLoaderView → loadInProgress + MinesweeperSession.restore → exact board, paused, elapsed frozen.

Pieces

  • PersistenceKit: public PrivateCKGatewayFactory (LivePrivateCKGateway stays internal). Lazy by contract — eager CKContainer.default() raised an uncatchable ObjC CKException in the entitlement-less test runner (the MS shape tests construct .live()); the deferring proxy mirrors LivePersistence's own per-op gateway.
  • Store: stale-daily filter (Sudoku design: resume-game behavior when daily puzzle has rolled to a new day #228 class) + .gameSaved/.gameSaveFailed funnel.
  • VM: persistCurrentState() — pause / terminal reveal (completed → clears pill) / scenePhase background / onDisappear. Idle never saves; failures funnel.
  • AppRoute.resumeBoard + MinesweeperBoardLoaderView (mirrors Sudoku's BoardLoaderView): honest failed-state + Retry for missing / newer-schema / corrupt records.
  • recordName fixed at creation: daily == MinesweeperDaily.puzzleId (today); practice = singleton slot per difficulty.

Tests

MS 141 (+5) · PersistenceKit 58 · SudokuKit 220 · MSCore 87 — green; no snapshot PNGs.

Follow-ups: one new L10n key ("Couldn't load saved game.") for the next translation pass; on-device verification (start→background→relaunch→resume) after merge. Refs #455.

🤖 Generated with Claude Code

wei18 and others added 2 commits June 10, 2026 22:32
…loader, fetchResume (#455 step 4)

Lights the MS Home resume pill end-to-end:

- PersistenceKit: public PrivateCKGatewayFactory (LivePrivateCKGateway stays internal). LAZY by contract — defers CKContainer.default() to first op; the app-shape tests construct .live() in a runner with no CloudKit entitlement, where eager resolution raises an uncatchable ObjC CKException (found by the test run, fixed via a deferring proxy actor — mirrors LivePersistence's own per-op gateway).
- Store: stale-daily filter in latestInProgress (daily-<day> recordName vs today UTC; Sudoku #228 class) + .gameSaved/.gameSaveFailed telemetry funnel (mirrors Sudoku's store)
- VM: optional store/recordName seam + persistCurrentState() — save points: pause, terminal reveal (upsert → wireStatus completed clears the pill), scenePhase .background + onDisappear (BoardView). Idle boards never save; failures funnel, never interrupt gameplay
- AppRoute.resumeBoard(recordName:mode:) + MinesweeperBoardLoaderView (mirrors Sudoku's BoardLoaderView): loadInProgress → MinesweeperSession.restore → board mounts paused (elapsed frozen); missing/newer-schema/corrupt records land in an honest failed state + Retry
- recordName fixed at board creation (daily == MinesweeperDaily.puzzleId for today; practice singleton slot) via a UI-layer GameMode helper
- Composition: savedGameStore over the factory; fetchResume (Live+Resume.swift — Live.swift is at the file_length budget) maps summary → ResumeCandidate; route factory threads store into boards + mounts the loader

Tests: MS 141 (was 136; +4 persist-hooks +1 stale-daily), PersistenceKit 58, SudokuKit 220, MSCore 87 — green; no snapshot PNG changes.

Follow-up: 'Couldn't load saved game.' needs the next L10n pass (Retry already in the MS catalog); resume-pill title strings keep the pre-#460 literal-interpolation behavior.

Co-Authored-By: Claude Fable 5 <[email protected]>
The step-4 wiring (+store build, +2 args) tipped Live.swift to 404; strict CI treats the 400-line file_length warning as an error. Condensed 4 comment blocks — no factual loss; Live+Resume.swift already carries the resume rationale.

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18 wei18 mentioned this pull request Jun 11, 2026
wei18 and others added 2 commits June 11, 2026 09:50
… doc sweeps, contract tests

Code Reviewer (APPROVE-WITH-NITS):
- Retry rebuilt the VM without errorReporter/store/recordName → save hooks silently died post-Retry (same class as the #330 soundPlayer omission). Seams now internal-readable on the VM and re-threaded in onRetry — a retried board keeps saving to its original slot.
- doc sweeps: RootViewModel header (resume is ON via Live+Resume.swift), store header (constructed + conflict policy decided + schema deployed), VM scope line, filter >= wording
- +2 tests: save-failure funnels (FakePrivateCKGateway.alwaysOnSave + FakeErrorReporter; gameplay state intact) and the GameModeRaw == GameMode.rawValue string contract

Deferred (CR nit, narrow + self-healing): daily .board recordName derives 'today' at view-build while the seed was baked at hub render — a hub left open across UTC midnight can file yesterday's board under today's slot. Airtight fix = carry the day in the route; noted for a future route-payload change.

MinesweeperKit 143 (was 141).

Co-Authored-By: Claude Fable 5 <[email protected]>
@wei18
wei18 merged commit 2425b92 into main Jun 11, 2026
4 checks passed
@wei18
wei18 deleted the feat/455-ms-resume-wire branch June 11, 2026 01:55
wei18 added a commit that referenced this pull request Jun 11, 2026
…o CLAUDE.md (#466) (#467)

* chore: #466 hygiene — wire AchievementID SSOT, README 16 packages, spec as-built, zh-Hant naming

- AchievementEvaluator now consumes the AchievementID enum (the SSOT it documented but never honored — 8 raw literals replaced); GameCenterIdentifiers header re-scoped honestly (GameCenterClient = structural; ASCRegister = deliberate runtime-reconciled copy, CLI must not depend on the cores)
- README.md + README.zh-Hant.md architecture trees 14 → 16 (add DeterminismKit, GameAppKit)
- resume-seam spec: MS section re-tagged as-built (#463/#465 landed same day; .resumeBoard supersedes the .board prediction)
- skills index zh: file-count 6→'5 files + meetings/' (en fixed in #461; zh missed) + renamed README.zh-TW.md → README.zh-Hant.md to match repo-root convention

Tests: GameCenterKit suite pending in CI; SudokuCoreKit 131, ASCRegisterKit 153 green locally.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: add repo-root CLAUDE.md — distilled agent operating guide

Operating knowledge distilled from the spec-first build sessions: the mirror principle (apps differ only in gameplay + resources, down to source), architecture layering in one map (zero-dep shell vs GameAppKit composition layer), the Leader/Developer/CR workflow contract (incl. subagent write-probe + model selection), build/verify discipline (absolute --package-path, stale-SourceKit rule, snapshot/determinism stops, unentitled-runner CloudKit laziness), user-owned hard gates (tf:upload, Console-only CK prod promote, secrets), and the conventions that bite (--no-gpg-sign, lowercase PR subject, strict-lint ceilings, .task arm64, worktree bleed). Pointer-first: deeper truth stays in skills / foundations / memory.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
@github-actions github-actions Bot mentioned this pull request Jun 13, 2026
@github-actions github-actions Bot mentioned this pull request Jun 23, 2026
wei18 added a commit that referenced this pull request Jun 24, 2026
)

Upkeep #592 staleness sweep (Leader-verified against code):
- SDD-004 RFC: status RFC_FINAL->IMPL_APPROVED (M1-M4 built, M5 parked #501); mark M3/M4 DONE; resolve bundle-id checklist contradiction
- MS flow prototype: re-tag resume pill SHIPPED (#455 via #463/#465); best-time row corrected to OMITTED-BY-DESIGN (not 'not yet built' - MS stores no completed-game elapsed)
- README + README.zh-Hant: add Game2048CoreKit/Game2048Kit to package tree
- docs/README: add superpowers/specs to doc map
- GameViewModel: stale 626->648 line count in file_length rationale

Screenshots (#236) + .task footgun (#607) routed separately; README 3rd-game prose disclosure left to user.

Co-authored-by: Claude Opus 4.8 <[email protected]>
@github-actions github-actions Bot mentioned this pull request Jul 10, 2026
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.

1 participant