Skip to content

fix: DateTime overflow in pace calculation crashes UI rendering#407

Merged
rygel merged 1 commit intodevelopfrom
hotfix/datetime-overflow-pace-calc
Mar 21, 2026
Merged

fix: DateTime overflow in pace calculation crashes UI rendering#407
rygel merged 1 commit intodevelopfrom
hotfix/datetime-overflow-pace-calc

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Mar 21, 2026

Summary

HOTFIX — Customer reports completely blank UI. Logs show 56x per session:

System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
at UsageMath.CalculatePaceAdjustedColorPercent

Root cause: nextResetUtc - periodDuration underflows when stale provider data has a NextResetTime too close to DateTime.MinValue.

Fix: guard against DateTime underflow in both CalculatePaceAdjustedColorPercent and CalculateProjectedFinalPercent. Falls back to raw usedPercent.

Test plan

  • Build succeeds
  • CI tests pass

🤖 Generated with Claude Code

CalculatePaceAdjustedColorPercent crashes with ArgumentOutOfRangeException
when nextResetUtc is too close to DateTime.MinValue (stale provider data).
The subtraction `nextResetUtc - periodDuration` underflows.

Guard both CalculatePaceAdjustedColorPercent and CalculateProjectedFinalPercent
against DateTime underflow. Falls back to raw usedPercent when the date math
would overflow.

Customer reported: 56 render failures per session, completely blank UI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rygel rygel merged commit 1980bb8 into develop Mar 21, 2026
16 checks passed
@rygel rygel deleted the hotfix/datetime-overflow-pace-calc branch March 21, 2026 19:17
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.

2 participants