fix: show day form at exactly 24h in reset countdowns#2343
fix: show day form at exactly 24h in reset countdowns#2343OfficialAbhinavSingh wants to merge 1 commit into
Conversation
Windsurf (web + cached), Zed, and JetBrains each format their reset countdown with if hours > 24, so a reset exactly 24h out fell through to the hours branch and rendered '24h 0m' / 'Cycle ends in 24h 0m' - the '1d 0h' day form was unreachable. Change to hours >= 24 in all four, matching UsageFormatter.resetCountdownDescription. Inject now (default Date()) so the formatters are unit-testable, mirroring the canonical formatter's signature.
|
Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 12:52 PM ET / 16:52 UTC. Summary Reproducibility: yes. from source: with Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the shared 24-hour rollover behavior, add or mirror focused tests under Do we have a high-confidence way to reproduce the issue? Yes, from source: with Is this the best way to solve the issue? Yes, changing the outlying conditions to Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3b4d9a85cbec. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
Four providers format their reset countdown with a private copy of the same helper, each using
if hours > 24:WindsurfGetPlanStatusResponse.formatResetDescription(WindsurfWebFetcher.swift)WindsurfCachedPlanInfo.formatResetDescription(WindsurfStatusProbe.swift)ZedUsageSnapshot.formatResetDescription(ZedStatusProbe.swift)JetBrainsStatusSnapshot.formatResetDescription(JetBrainsStatusProbe.swift)Because the day branch is gated on
hours > 24, a reset exactly 24h out (hours == 24) falls through to the hours branch and renders "Resets in 24h 0m" / "Cycle ends in 24h 0m". The"1d 0h"day form is unreachable; the smallest day output is "1d 1h" (at 25h).The app's canonical formatter,
UsageFormatter.resetCountdownDescription, rolls over correctly at 24h (days = totalMinutes / (24*60)). These four provider copies are the outliers.Fix
hours > 24→hours >= 24in all four copies. At 24h →"1d 0h"; 25h →"1d 1h"(unchanged); 23h →"23h 0m"(unchanged). The[24h, 25h)band now uses the day form (dropping minutes, exactly as[25h, ∞)already did).Each
formatResetDescriptionalso gains an injectablenow: Date = Date()parameter (replacing an internallet now = Date()), matchingUsageFormatter.resetCountdownDescription(from:now:)so the pure formatting is unit-testable. All existing callers pass onlydateand are unaffected.Test
TestsLinux/ResetCountdownDayRolloverLinuxTests.swift— for each of the four formatters: 24h → day form; plus Windsurf 25h →"1d 1h"and 23h →"23h 0m"(no regression).Proof (real run)
Runs on CI in the
build-linux-cli"Swift Test (Linux only)" step. Local red→green inswift:6.3.3:Before the fix (
> 24) — the 24h cases render the hours form:After the fix (
>= 24) — all pass:Build clean,
swiftlint --strict0 violations,swiftformat --lintclean.Small and self-contained — happy to adjust or close if not wanted.