feat(billing): surface capacity equivalences on the nav compute gauge#4350
Conversation
Wire the (previously orphaned) BillingEquivalencesChipsComponent into the nav compute-gauge tooltip. When serverConfig.billing.equivalences is set, derive a human-readable remaining-capacity estimate per entry: count = floor(totalRemaining / unitCost), totalRemaining = max(0, (meterQuota + extrasRemaining) - meterUsed). Only consumption-scaled kinds (easy/hard) with a finite positive unitCost render; the unit-cost framing handles per-period and one-shot grants with no special branch. Config-driven, no-op when absent. Also adds a mount fade/scale-in and a low-remaining (>= 80%) pulse to the ring to make the gauge more noticeable; both respect prefers-reduced-motion. Tests (15 new) cover the derivation, filtering, one-shot grant, exhaustion and ring motion. Documents the equivalences contract in the module README. Closes #4349
|
Warning Review limit reached
More reviews will be available in 46 minutes and 50 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough
ChangesBilling nav gauge equivalence chips
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4350 +/- ##
=======================================
Coverage 99.56% 99.56%
=======================================
Files 35 35
Lines 1390 1390
Branches 435 435
=======================================
Hits 1384 1384
Misses 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR enhances the billing sidenav compute gauge by surfacing configured serverConfig.billing.equivalences as human-readable remaining-capacity chips in the tooltip, and adds motion polish to the progress ring (mount fade/scale + low-remaining pulse with reduced-motion gating).
Changes:
- Wire
BillingEquivalencesChipsComponentinto the nav compute gauge tooltip and deriveequivalenceChipsfromserverConfig.billing.equivalences. - Add ring mount/pulse animations gated by
prefers-reduced-motion. - Add unit tests for equivalence derivation/rendering and ring-motion behavior; document the equivalences contract in the billing module README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/modules/billing/components/billing.navComputeGauge.component.vue | Adds equivalence chips to the tooltip, introduces totalRemaining/equivalenceChips derivation, and applies ring animation classes/styles. |
| src/modules/billing/tests/billing.navComputeGauge.component.unit.tests.js | Adds coverage for equivalence filtering/derivation, tooltip DOM render, and ring motion behaviors. |
| src/modules/billing/README.md | Documents the nav gauge behavior and the billing.equivalences contract/derivation rules. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/modules/billing/tests/billing.navComputeGauge.component.unit.tests.js`:
- Around line 604-607: In the Object.defineProperty call for the visualViewport
mock in the test file, there are two duplicate value descriptor keys defined in
the property descriptor object. Remove one of the duplicate value keys from the
descriptor, keeping only the single value entry that contains the complete mock
object with width, height, offsetTop, offsetLeft, addEventListener, and
removeEventListener properties. This will ensure the descriptor is not brittle
and will pass linting checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6011604c-92a1-44f4-a2da-89b537a98d31
📒 Files selected for processing (3)
src/modules/billing/README.mdsrc/modules/billing/components/billing.navComputeGauge.component.vuesrc/modules/billing/tests/billing.navComputeGauge.component.unit.tests.js
- Header comment now quotes the exact rendered chip text (integer counts, no '~'). - Open-tooltip test captures + restores the original visualViewport descriptor instead of clobbering/deleting it, so it never disturbs a real/global one and Vuetify overlay teardown stays safe.
What
Surface the configured
billing.equivalenceson the sidenav compute gauge.When
serverConfig.billing.equivalencesis set, the nav compute-gauge tooltip now shows a human-readable remaining-capacity estimate ("~N easy / ~M heavy operations remaining"), wiring the previously-orphanedBillingEquivalencesChipsComponent(0 imports before this).How
billing.equivalences = [{ kind:'easy'|'hard', unitCost:number>0, label:string }] | null— read from server config (opaque passthrough; downstream defines the values).count = floor(totalRemaining / unitCost), withtotalRemaining = max(0, (meterQuota + extrasRemaining) − meterUsed).easy/hardrender; entries with a non-positive/non-finiteunitCost, a non-stringlabel, or any other kind are dropped (guards division-by-zero / Infinity).equivalencesis absent. No meter / quota / billing-mechanism change.BillingEquivalencesChipsComponentis wired in unchanged.Visibility polish
The progress ring now fades/scales in on mount and pulses near exhaustion (≥ 80%), both gated on
prefers-reduced-motion: no-preference.Tests
+18 nav-gauge tests (derivation, filtering, one-shot grant, exhaustion, ring motion, plus a real-component open-tooltip DOM render). Full billing suite green (631 tests). Contract documented in the module README.
Closes #4349
Summary by CodeRabbit