Repository navigation
feat(daily): filter stale dailies + mark late-completion (#228 e+b) - #230
Merged
Merged
Conversation
User-confirmed direction for issue #228: option E + B hybrid. E — Resume pill filter ---------------------- `SavedGameStore.latestInProgress()` now drops in-progress daily saves whose embedded UTC day is strictly earlier than today. Practice saves are untouched (they never expire). Stale records themselves are NOT deleted in this PR — just filtered out of the resume candidate set so they no longer mask newer non-stale saves. Implementation: - Inline `extractDailyDay(from:)` helper duplicated from `GameCenterClient/SubmitGuards` rather than re-exported across the package boundary (foundations.md §2 forbids the upward arrow). - Uses the same `UTCDay.string(from:)` helper SubmitGuards uses, so the two cross-day comparisons stay consistent. - `SavedGameStore` already had injectable `clock` (used by save flow); the filter reuses it without ABI change. B — Late-completion affordance ------------------------------ `GameViewModel.isLateCompletion` computes `true` iff this is a daily puzzle whose embedded UTC day is earlier than `clock()`. `BoardView`'s header renders a small `clock.badge.exclamationmark` icon next to the difficulty label with accessibility text "Late completion — won't score on leaderboard". No banner / modal — subtle marker only. Injectable `clock: @sendable () -> Date` added to both `GameViewModel` inits (live + snapshot) with `{ Date() }` default — fully source-compat for existing call sites. Behavior preserved ------------------ - Today's daily renders identically (no marker, no filter exclusion). - Practice saves render and resume identically. - `markCompleted` still runs locally for stale dailies (no submission to Game Center — that's SubmitGuards' job, unchanged). Filed as a follow-up note: cleanup of stale records + whether to skip the local completion flip are separate concerns. Tests ----- - `Packages/PersistenceKit/Tests/PersistenceTests/LatestInProgressFilterTests.swift` (5 tests): today's daily eligible, yesterday's daily filtered, stale daily doesn't mask fresh practice, practice never expires, newest non-stale wins over stale + older fresh. - `Packages/SudokuKit/Tests/SudokuUITests/GameViewModelLateCompletionTests.swift` (4 tests): yesterday's daily is late, today's daily is not, future- dated daily is not, practice is never late. Verified -------- - swift test --filter LatestInProgressFilterTests → 5/5 - swift test --filter GameViewModelLateCompletionTests → 4/4 - swift build --package-path Packages/SudokuKit → green - tuist build Sudoku --platform iOS → green Sr Dev diagnosed + spec'd the diff; Leader applied verbatim plus tests. Closes #228. Co-Authored-By: Claude Opus 4.7 <[email protected]>
…name) Strict swiftlint flagged `vm` (under the 3-char minimum). Same class of CR-after-CI fix as #221 — pre-existing rule applied to new code. Co-Authored-By: Claude Opus 4.7 <[email protected]>
4 of 5 tasks
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.
Summary
Closes #228 with user-confirmed direction option E + B.
Files (5, +272/-3)
Behavior preserved
Verification
Authorship
Senior Developer subagent fully diagnosed + spec'd the diff but was blocked from applying by tool permissions (same as #229). Leader applied the spec verbatim plus the test fixtures.
🤖 Generated with Claude Code