feat(hud): cost velocity indicator (Wave 2-B)#1483
Closed
JeremyDev87 wants to merge 2 commits into
Closed
Conversation
Shows session spend rate next to absolute cost so users can see whether they're on a slow planning pass or a hot refactor burn: $1.23↗$0.08/m Trend glyphs: - 🔥 rate >= $0.20/min (hot burn) - ↗ $0.01 <= rate < $0.20/min (normal/rising) - → 0 < rate < $0.01/min (steady, very low) - 💤 rate <= 0 (idle) Stateless implementation: rate = cost_usd / (duration_ms / 60k). Uses Claude Code stdin.cost.total_cost_usd and total_duration_ms directly, with hud_state.sessionStartTimestamp fallback for the elapsed-time component. Deliberately does NOT touch hud_state.py schema (costHistory was deferred per Wave 0 review). New lib/hud_velocity.py: - TREND_IDLE_MAX=0.01, TREND_HOT_MIN=0.20 constants - compute_spend_rate(cost_usd, duration_ms) -> float - trend_glyph(rate) -> str - format_velocity_segment(stdin_data, hud_state) -> str - format_cost_with_velocity(cost_usd, stdin, hud_state, *, is_exact) - _duration_ms_from_state helper for stdin fallback 33 new tests cover: - compute_spend_rate: zero/negative/non-numeric/numeric-string, known rates ($1/min, $0.50/30s, $6/10min) - trend_glyph: all 4 tiers + boundary values + non-numeric - format_velocity_segment: empty, missing cost, missing duration, zero rate, normal hot, rising tier, state fallback, no state - format_cost_with_velocity: exact/estimate prefix, no-velocity fallback, non-numeric cost, two decimals - Constant ordering 162/162 pass. Part of #1464 (Wave 0 statusbar refactor)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2a89a12 to
1237087
Compare
7b89e0b to
11c38dd
Compare
Combined Wave 0 polish items from the #1465/#1485 review cycle: 1. Narrow `except Exception` to `except ImportError` in the 3 lib fallback import blocks (qual-1465 HIGH-1). Real logic bugs (SyntaxError, NameError, AttributeError) inside lib modules now surface immediately instead of being silently swallowed by a catch-all. 2. Drop inline stub functions for format_rate_limits and _get_fresh_version (qual-1465 HIGH-2). Eliminates the signature drift between canonical lib definitions and in-file fallback stubs observed on the integrator branch (Wave 1-A plugin_json_file kwarg drift). The outer main() try/except still catches any runtime failure and emits the minimal safe output via the BUDDY_FACE constant. 3. Hoist hud_velocity and hud_cache_savings imports to module top as _format_velocity_segment and _format_cache_savings (perf-1485 H1). Eliminates ~0.47us sys.modules lookup per render. Integrator branch only - no-op on refactor/wave branches where the inline imports don't exist yet. 4. Bump next to 16.2.3 for GHSA-q4gf-8mx6-v5v3 (landing-security-check). Aligns eslint-config-next and updates setup.test.ts assertion. Refs: qual-1465 HIGH-1/2, perf-1485 H1, GHSA-q4gf-8mx6-v5v3
1237087 to
30a1d71
Compare
Owner
Author
Superseded by #1485This PR was part of a stacked PR structure ( All of this PR's commits have been consolidated into #1485 (now with
EVAL review results from this PR (all reviewers, iter1 converged → Critical=0, High=0) already applied in #1485. Closing as superseded. Use #1485 with GitHub's Rebase and merge button to land all 12 commits linearly on master. |
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.
Closes the velocity issue. Stacked on #1465. 33 new tests. 162/162 pass. Stateless — no hud_state schema changes.