fix: update UserQuotaSnapshot type to allow null limits #511
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.
CI Auto-Fix
Original PR: #507
Failed CI Run: Non-Main Branch CI/CD
Problem
The TypeScript build failed with a type mismatch error at
src/app/[locale]/dashboard/quotas/users/page.tsx:75:The issue was that:
getUserLimitUsageaction returnslimit: number | null(src/actions/users.ts:1235-1236)UserQuotaSnapshottype expectedlimit: number(non-nullable)This mismatch was introduced by PR #507's changes to support unlimited quotas (represented as
nulllimits).Fixes Applied
rpm.limitanddailyCost.limittonumber | nullChanged:
Verification
✅ Type definition now matches the actual return type from
getUserLimitUsage✅ No logic changes - only type definition sync
✅ Safe minimal fix
Notes
This is a safe type synchronization fix. PR #507 explicitly changed quota handling to support
nulllimits (representing unlimited quotas), but theUserQuotaSnapshottype definition wasn't updated accordingly. This PR completes that change by updating the type to match the runtime behavior.Auto-generated by Claude AI
Greptile Summary
This PR fixes a TypeScript type mismatch by updating
UserQuotaSnapshotto allownulllimits, matching the return type fromgetUserLimitUsagewhich represents unlimited quotas asnullvalues.Key Changes:
rpm.limitanddailyCost.limitfromnumbertonumber | nullinUserQuotaSnapshotinterfaceCritical Issues Found:
user-quota-list-item.tsxdon't handlenulllimits properly when renderingnull(unlimited), line 153 displays "null" as text and line 176 callsformatCurrency(null)which returns "$0.00" - both are misleading to usersnullvaluesImpact:
The type fix is correct and necessary, but the UI will display incorrect information for users with unlimited quotas until the display logic is fixed.
Confidence Score: 2/5
Important Files Changed
nulllimits for unlimited quotas - matches getUserLimitUsage return typeSequence Diagram
sequenceDiagram participant Page as users/page.tsx participant Action as getUserLimitUsage participant Type as UserQuotaSnapshot participant UI as user-quota-list-item.tsx Page->>Action: getUserLimitUsage(userId) Note over Action: Returns limit as number | null<br/>(null = unlimited quota) Action-->>Page: {rpm: {limit: number | null}, dailyCost: {limit: number | null}} Page->>Type: Assign to UserQuotaSnapshot Note over Type: Before fix: limit: number<br/>After fix: limit: number | null Page->>UI: Pass quota data Note over UI: Bug: Displays null as "null"<br/>or formats as "$0.00"<br/>Should show "Unlimited"