Skip to content

Comments

fix: fix balance subrow issue to show /granted always#780

Open
charlietlamb wants to merge 3 commits intomainfrom
charlie/balance-subrows-fix
Open

fix: fix balance subrow issue to show /granted always#780
charlietlamb wants to merge 3 commits intomainfrom
charlie/balance-subrows-fix

Conversation

@charlietlamb
Copy link
Contributor

@charlietlamb charlietlamb commented Feb 20, 2026


Summary by cubic

Fixes balance sub-rows so “/granted” always shows the full granted amount, and fixes sub-row expand/collapse by using stable row IDs.

  • Bug Fixes
    • CustomerBalanceTableColumns: allowance = entitlement × quantity + prepaid (cusEntToPrepaidQuantity) + adjustments; prefer entity-level adjustment, fallback to entitlement-level.
    • CustomerBalanceTable: use feature-based row IDs for parent rows and stable IDs for sub-rows to open/close correctly and retain expanded state.

Written for commit cd77f45. Summary will update on new commits.

Greptile Summary

Fixed balance calculation in customer balance table sub-rows to properly display granted allowances by including adjustments and prepaid quantities.

Key Changes

  • Bug fixes: Updated getIndividualEntValues function to include adjustment and cusEntToPrepaidQuantity in allowance calculation, ensuring sub-rows display /granted values consistently with parent rows
  • Bug fixes: Added import for cusEntToPrepaidQuantity utility function from @autumn/shared

The change aligns the sub-row allowance calculation with the parent row logic used in useFeatureUsageBalance hook, which calls cusEntsToGrantedBalance (includes adjustments) and adds prepaid quantities. This ensures that manual adjustments and prepaid purchases are properly reflected in the balance display for individual entitlements.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a targeted bug fix that aligns sub-row allowance calculation with the established parent row logic. The implementation correctly mirrors the pattern used in useFeatureUsageBalance hook and cusEntsToGrantedBalance function. No logical errors, syntax issues, or security concerns identified.
  • No files require special attention

Important Files Changed

Filename Overview
vite/src/views/customers2/components/table/customer-balance/CustomerBalanceTableColumns.tsx Updated allowance calculation in sub-rows to include adjustments and prepaid quantities, matching parent row calculation logic

Last reviewed commit: f0248b9

@vercel
Copy link

vercel bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
autumn-vite Ready Ready Preview, Comment Feb 20, 2026 0:04am

Request Review

@use-tusk
Copy link

use-tusk bot commented Feb 20, 2026

⚠️ Additional setup required (cd77f45) View output ↗

Tip

New to Tusk? Learn more here.
Follow the setup instructions so Tusk can start generating tests.


View check history

Commit Status Output Created (UTC)
f0248b9 ⚠️ Additional setup required Output Feb 20, 2026 11:26AM
092ea5e ⚠️ Additional setup required Output Feb 20, 2026 11:50AM
cd77f45 ⚠️ Additional setup required Output Feb 20, 2026 12:03PM

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Confidence score: 3/5

  • The allowance calculation in vite/src/views/customers2/components/table/customer-balance/CustomerBalanceTableColumns.tsx always uses ent.adjustment, so sub-rows with an entityId may display incorrect per-entity adjustments.
  • Given the mid-severity logic issue (5/10) in a customer balance view, there’s some risk of user-facing calculation inaccuracies even if the change is localized.
  • Pay close attention to vite/src/views/customers2/components/table/customer-balance/CustomerBalanceTableColumns.tsx - ensure sub-row adjustments use the entity-specific value when entityId is present.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="vite/src/views/customers2/components/table/customer-balance/CustomerBalanceTableColumns.tsx">

<violation number="1" location="vite/src/views/customers2/components/table/customer-balance/CustomerBalanceTableColumns.tsx:70">
P2: Use entity-specific adjustments for sub-rows; the current allowance calculation always uses `ent.adjustment`, which ignores per-entity adjustments when `entityId` is provided.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@charlietlamb
Copy link
Contributor Author

@cubic-dev-ai review

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Feb 20, 2026

@cubic-dev-ai review

@charlietlamb I have started the AI code review. It will take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@charlietlamb
Copy link
Contributor Author

@cubic-dev-ai review

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Feb 20, 2026

@cubic-dev-ai review

@charlietlamb I have started the AI code review. It will take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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.

1 participant