Skip to content

feat(billing): surface capacity equivalences on the nav compute gauge#4350

Merged
PierreBrisorgueil merged 2 commits into
masterfrom
feat/billing-equivalences-nav-gauge
Jun 18, 2026
Merged

feat(billing): surface capacity equivalences on the nav compute gauge#4350
PierreBrisorgueil merged 2 commits into
masterfrom
feat/billing-equivalences-nav-gauge

Conversation

@PierreBrisorgueil

@PierreBrisorgueil PierreBrisorgueil commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What

Surface the configured billing.equivalences on the sidenav compute gauge.

When serverConfig.billing.equivalences is set, the nav compute-gauge tooltip now shows a human-readable remaining-capacity estimate ("~N easy / ~M heavy operations remaining"), wiring the previously-orphaned BillingEquivalencesChipsComponent (0 imports before this).

How

  • Contract: 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), with totalRemaining = max(0, (meterQuota + extrasRemaining) − meterUsed).
  • The unit-cost framing handles per-period and one-shot grants with no special branch (this dissolves the one-shot/no-renewal edge case).
  • Only consumption-scaled kinds easy/hard render; entries with a non-positive/non-finite unitCost, a non-string label, or any other kind are dropped (guards division-by-zero / Infinity).
  • Config-driven → no-op when equivalences is absent. No meter / quota / billing-mechanism change. BillingEquivalencesChipsComponent is 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

  • New Features
    • Enhanced compute usage visualization with a color-coded ring gauge
    • Added capacity breakdown chips showing easy/heavy operations remaining
    • Visual warning pulse effect when compute usage is low
    • Richer compute usage tooltips with detailed metrics
    • Motion effects respect accessibility preferences (reduced-motion support)

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
Copilot AI review requested due to automatic review settings June 18, 2026 14:33
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PierreBrisorgueil, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 962840fc-517a-477e-9afd-ce39d2efb151

📥 Commits

Reviewing files that changed from the base of the PR and between 61eb442 and 3f71ad3.

📒 Files selected for processing (2)
  • src/modules/billing/components/billing.navComputeGauge.component.vue
  • src/modules/billing/tests/billing.navComputeGauge.component.unit.tests.js

Walkthrough

BillingNavComputeGaugeComponent is updated to derive equivalenceChips from serverConfig.billing.equivalences and render them via BillingEquivalencesChipsComponent inside the hover tooltip. A new isLow computed value drives a pulsing ring animation for near-exhaustion states, with prefers-reduced-motion gating. Unit tests and README documentation are added.

Changes

Billing nav gauge equivalence chips

Layer / File(s) Summary
Computed properties and template wiring
src/modules/billing/components/billing.navComputeGauge.component.vue
Adds isLow, totalRemaining, equivalencesConfig, and equivalenceChips computed properties. Replaces the bare v-progress-circular with an isLow-driven ring container, renders BillingEquivalencesChipsComponent in the tooltip when chips are non-empty, and registers the import.
Ring mount and pulse CSS animations
src/modules/billing/components/billing.navComputeGauge.component.vue
Adds scoped .nav-gauge-ring-enter and .nav-gauge-ring-alert classes with nav-gauge-in and nav-gauge-pulse keyframes, both gated by prefers-reduced-motion: no-preference.
Unit tests and README documentation
src/modules/billing/tests/billing.navComputeGauge.component.unit.tests.js, src/modules/billing/README.md
Adds #4349 equivalenceChips derivation tests (count calculation, flooring, invalid unitCost/kind/label filtering, one-shot grant, exhausted quota), a tooltip render test for teleported chip DOM, ring motion/threshold tests, and README documentation for both components.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

Feat, billing

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: surfacing billing equivalences on the nav compute gauge.
Description check ✅ Passed The description covers the what, how, visibility improvements, and tests. While it doesn't strictly follow the template format with all explicit sections, the content is comprehensive and clear.
Linked Issues check ✅ Passed The code changes fully address issue #4349: deriving equivalence-based capacity estimates, wiring the component to display them, and keeping the feature config-driven with no billing logic changes [#4349].
Out of Scope Changes check ✅ Passed All changes are scoped to surfacing equivalences on the nav gauge and improving ring UX. No out-of-scope modifications to billing mechanisms, meters, or unrelated areas.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/billing-equivalences-nav-gauge

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.56%. Comparing base (9f9cd96) to head (3f71ad3).
⚠️ Report is 4 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BillingEquivalencesChipsComponent into the nav compute gauge tooltip and derive equivalenceChips from serverConfig.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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e7d9c1d and 61eb442.

📒 Files selected for processing (3)
  • src/modules/billing/README.md
  • src/modules/billing/components/billing.navComputeGauge.component.vue
  • src/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.
@PierreBrisorgueil PierreBrisorgueil merged commit dfeef01 into master Jun 18, 2026
7 checks passed
@PierreBrisorgueil PierreBrisorgueil deleted the feat/billing-equivalences-nav-gauge branch June 18, 2026 14:59
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.

✨ Surface billing equivalences on the nav compute gauge

2 participants