Repository navigation
fix(workout): snap timers to wall clock on mobile screen wake - #116
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Rest timers and the elapsed timer used tick-accumulation (decrement/increment per interval) which pauses when the mobile screen times out, leaving displays stale and rest expiry firing late. - Rust rest timer: replace remaining-- with started_at.elapsed() computation; adjust() shifts started_at instead of mutating a counter - JS browser rest timer: add startedAt to RestTimer, add recalcRestTimer() which snaps to wall-clock reality and fires onExpired if rest ended while screen was off - Elapsed interval: compute from startedAt timestamps instead of prev+1 so it self-corrects on the next tick after wake - Foreground detector: wire createForegroundDetector in log page to immediately snap both timers the moment the screen turns back on
Dead fixture function and its type import left over in active-workout-store.test.ts caused tsc to error and the Vercel deploy to fail.
Fix-Now:
- P23-001: recalcRestTimer expiry now stops Rust timer + cleans listeners (Tauri)
- P23-002/003: _onRestExpired wrapped in try/catch/finally in recalcRestTimer and
tickRest -- cleanup always runs even if callback throws
- P23-004: bare catch {} in log.$workoutId.tsx replaced with logged catch (err)
- P23-005: store.recalcRestTimer() wrapped in its own try/catch in foreground callback
- P23-006: tickRest now uses wall-clock computation (total - elapsed) not remaining - 1
- P23-007: Rust adjust tests use tolerance assertions to avoid 1s CI timing race
- P23-010: onBackground no-op callback has explanatory comment
- P23-011: Rust adjust() unwrap_or_else fallback has saturation semantics comment
- P23-012: recalcRestTimer interface comment documents both running and expiry paths
- P23-013: adjustRest comment clarifies Rust vs JS saturation mechanism difference
Tests:
- recalcRestTimer: expired path, running path, no-op, exact boundary, throwing callback
- tickRest: updated existing tests for wall-clock; throwing-callback resilience
- adjustRest: startedAt shift verified via follow-up recalcRestTimer call
Review: Context/Reviews/0023-pr116-timer-timeout-2026-04-22.md
P23-012 comment was missing the running-path description (corrects remaining to wall-clock value). Updated interface comment to document both paths. Marked P23 and P22 reviews as verified.
rghamilton3
force-pushed
the
fix/timer-timeout
branch
from
April 23, 2026 02:52
3e24eb3 to
1a614a9
Compare
5 tasks
This branch had an error being deployed
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
createForegroundDetectorinto the log page so both timers update instantly when the screen turns back on, not just on the next scheduled tick.Test plan
onExpiredimmediately and dismiss the rest bannerbun run testpasses (2496 tests)cargo test --libpasses (85 tests)