test(timer): expose pause-over-midnight duration bug - #2137
Open
cpvalente wants to merge 2 commits into
Open
Conversation
Pause is tracked as pausedAt (TimeOfDay, ms since local midnight) and paused duration is derived via the naive `clock - pausedAt`. When a pause spans midnight the clock has wrapped to a small value while pausedAt is still large, so the subtraction goes negative and every paused-duration result is corrupted (runtimeState.start resume accumulation, and getExpectedFinish/getCurrent/getRuntimeOffset in timerUtils). Add two currently-failing tests that reproduce this: - runtimeState: full start/pause/resume cycle where the pause crosses midnight, asserting pausedDuration and elapsed exclude the pause. - timerUtils.getRuntimeOffset: over-midnight variant of the paused-offset case (the site carrying the "brakes when crossing midnight" TODO). Both fail today (report ~ -86,100,000 instead of the real 5-minute pause) and will pass once the pause math adopts the wrap-aware primitives (timeCore.elapsedTime / epoch-based tracking). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136N3FnyuUmLJbMNJiZd6YX
Make the midnight pause test's intent explicit: elapsed is active time since start and must not advance during a pause (even one crossing midnight). Add a frozen-elapsed assertion while paused and keep pausedDuration - the corrupted pause count - as the headline assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136N3FnyuUmLJbMNJiZd6YX
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
expose a bug for reporting paused time for events that are paused across midnight