fix(levels): address whole-branch review findings - #24
Merged
Conversation
Post-merge whole-branch review of the Levels feature (#13) surfaced one Important test-race plus a cluster of Minors. This is the agreed fix batch: - tests: await _resetDbForTests() then deleteDatabase in the 4 new Levels test files (was an un-awaited race the helper's own docstring warns against; now matches useDaily.test.ts) - speed: surface the best Ao5 time — consolidate useSpeedBestTier into useSpeedBest({ tier, bestMs, record }), which reads back the previously dead-stored speedBestAo5 and shows "best 4.21s 🥈" on the Levels screen - levels: the level test now plays a correctness chime/haptic (playFeedback, honoring soundEnabled) like QuickDrill/GuidedSolve — it was silent - levels: compute the correct weekday once and reuse it for the feedback and the picker reveal (was recomputed each render) - test: the DNF speed test now asserts no best tier/time was persisted - levels: document the type-mandated `?? 0` in tierForAo5 (unreachable row) - daily: fix stale comments left by the correct-only streak rewire Gates green: typecheck, lint (--max-warnings 0), 286 tests, build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Post-merge whole-branch review of the Levels feature (#13, all 4 slices on
main) ran 67 agents (7 finders → dual-lens verify → gap sweep). Verdict: no Critical, 1 Important, 25 Minor. This PR fixes the batch you approved, plus surfacing the previously dead-stored best Ao5 time.🟠 Important
useLevelTest,useSpeedChallenge,useUnlockedLevel,LevelsScreen). They called_resetDbForTests()+deleteDatabase()without awaiting — the exact race the helper's docstring warns about, and the asymmetry withuseDaily.test.ts(which was migrated). Now both are awaited.🟡 Surface best Ao5 (your call: "surface it")
speedBestAo5was written to IndexedDB forever but never read — only the tier badge was shown. ConsolidateduseSpeedBestTier→useSpeedBest({ tier, bestMs, record }), which reads back both keys (monotonic: max tier, min time) and showsSpeed challenge · best 4.21s 🥈 →on the Levels screen.onDonenow carries the earned time so a just-finished run reflects immediately (no read-back race).🟡 Minor fixes
playFeedback(correct, { sound })(chime/haptic) likeQuickDrill/GuidedSolve— it graded silently before.speedBestTiernorspeedBestAo5was persisted on a DNF.tierForAo5: documented the type-mandated, unreachable?? 0.useDailycomments: corrected the stale frozen-day / "credited" wording left by the correct-only streak rewire (no logic change).Deliberately not changed (noted in review)
recordPracticeDaybackward-clock edge &accuracyByDimensionguard — pre-existing / every caller pre-filters.Verification
--max-warnings 0✓ · 286 tests ✓ · build ✓🤖 Generated with Claude Code