fix(pace): surface overuse early and grade it against the limit - #48
Merged
Merged
Conversation
The pace math mirrors upstream ClaudeMeter, which had two flaws the Rust and TS layers inherited: - Only the lockout date escaped the 5%-elapsed grace; the pace ratio and projected-end stayed suppressed for the whole grace window, so a front-loaded burst showed no pace signal for up to ~8h into the week. - Overuse started at 1.2x and heavy overuse at 2.5x, so a burn projected to end between 100% and 120% still read green "sustainable". Port the fix proposed upstream in eddmann/ClaudeMeter#33 across both layers and the shared fixtures: - pace_ratio / expected_usage_percent and projected_end_percent now surface once utilization clears MIN_USAGE_FOR_PROJECTION, matching projected_limit_date; MIN_USAGE_FOR_PROJECTION lowered 5% -> 2%. - Rebase the bands on the limit: overuse >1.0x (was 1.2x), heavy >1.2x (was 2.5x). Regenerate the four affected tray-icon snapshots (1.8x overuse now renders red). - Colour the popover "hits limit" line by pace band instead of a fixed warning, so it matches the ratio. cargo test, clippy, vitest and tsc all pass.
mpecan
added a commit
that referenced
this pull request
Jul 26, 2026
Brings in the 0.1.3 release and #48's pace rework, which needed more than a textual resolution: it moved `RISK_THRESHOLD` 1.2 -> 1.0, `HEAVY_OVERUSE_THRESHOLD` 2.5 -> 1.2 and `MIN_USAGE_FOR_PROJECTION` 5.0 -> 2.0, and made the ratio and the projections surface before the elapsed grace once utilization clears the usage floor. The tray menu's new per-window detail lines are built on exactly those primitives, so the behaviour changed with them — a front-loaded burst now gets its `6.0× pace · 2% expected · hits limit ~12:45 PM` line five minutes into a window instead of waiting the grace out. That is the point of #48, and the menu is the whole Linux surface, so it is where the early warning lands. Suppression now needs *both* too little elapsed time and too little usage. - `spec.rs`: the conflicting pace tests moved to `spec/pace.rs` on this branch, so main's edits to them are ported there rather than kept here — including the purpose-built on-pace fixture (45% at 50% elapsed -> 0.9), which main added because the old one reads as overuse under the new bands. - `spec/pace.rs`: the grace test split in two, one per half of the new rule. - `detail_line`'s doc, CLAUDE.md and docs/linux.md no longer claim the line is suppressed "under the 5% elapsed grace". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GKDuhghEHL8a6Y7Zu4YSEa
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.
Ports the pace-signal fix from upstream ClaudeMeter (eddmann/ClaudeMeter#33) into both the Rust (
meter-core/meter-render/src-tauri) and TS (pacing/view-model) layers, which mirror upstream numerically.Problems
The pace math inherited two issues from the version it mirrors:
projected_limit_dateescaped the 5%-elapsed grace;pace_ratio/expected_usage_percentandprojected_end_percentstayed suppressed until 5% of the window had elapsed — up to ~8h into the 7-day window. A front-loaded burst showed a "hits limit" date but no ratio, badge, or band colour.1.2×(overuse) /2.5×(heavy), so a burn projected to end anywhere from 100–120% still read green "sustainable" — "on pace" while actually over the limit.Plus the popover "hits limit" line used a fixed warning colour regardless of severity.
Changes
pacing.rs/pacing.ts): both now surface as soon asutilizationclearsMIN_USAGE_FOR_PROJECTION, exactly likeprojected_limit_datealready did.MIN_USAGE_FOR_PROJECTIONlowered5% → 2%(~one work-hour).1.0×): overuse>1.0×(was1.2×), heavy overuse>1.2×(was2.5×). Underuse (<0.8×) unchanged.render.ts+styles.css): orange for overuse, red for heavy overuse, matching the ratio.Behaviour change / snapshots
The reband means moderate overuse (
~1.2–2.5×) tray icons now render red instead of orange. Four snapshot fixtures were regenerated viaUPDATE_SNAPSHOTS=1(pace_battery_overuse,pace_battery_overuse_2x,pace_dual_bar_overuse,pace_gauge_overuse— all1.8×cases). Underuse/heavy/mono snapshots are unchanged.Verification
cargo test(workspace) — all passcargo clippy --all-targets -- -D warnings— cleancargo fmt --check— cleannpx vitest run— 121 pass;npx tsc --noEmit— clean🤖 Generated with Claude Code