Auto-fix CI failures for PR #507 #512
Closed
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: PR Build Check
Root Cause
The
UserQuotaSnapshotinterface had type definitions that didn't match the actual data returned bygetUserLimitUsage():rpm.limit: numberanddailyCost.limit: numberrpm.limit: number | nullanddailyCost.limit: number | nullThis mismatch occurred because the interface was created before the user-level daily quota feature was fully implemented with timezone support.
Fixes Applied
src/app/[locale]/dashboard/quotas/users/_components/types.tsrpm.limit: numbertorpm.limit: number | nullsrc/app/[locale]/dashboard/quotas/users/_components/types.tsdailyCost.limit: numbertodailyCost.limit: number | nullWhy This Fix is Safe
getUserLimitUsageinsrc/actions/users.ts:1233-1237explicitly returns nullable limitsVerification
✅ TypeScript Check:
bun run typecheckpasses✅ Lint Check:
bun run lintpasses✅ No logic changes: Only type definitions updated
Original Error
Auto-generated by Claude AI - CI Auto-Fixer
Greptile Summary
This PR fixes a TypeScript type error by updating
UserQuotaSnapshotinterface to allow nullable limits (number | null) for bothrpm.limitanddailyCost.limitfields. The change aligns the interface definition with the actual data structure returned bygetUserLimitUsage()insrc/actions/users.ts:1235-1236, which explicitly returns nullable limits to support unlimited quotas (where limit is intentionally null).Key changes:
rpm.limitfromnumbertonumber | nulldailyCost.limitfromnumbertonumber | nullImpact:
The UI components already handle null limits correctly through conditional checks and the
QuotaProgresscomponent's null guard on line 13.Confidence Score: 5/5
getUserLimitUsage()(src/actions/users.ts:1235-1236), and all consuming UI code already handles nullable limits through proper null checks and guard clauses. CI checks pass (typecheck and lint), and the change is scoped to exactly 2 type annotations in a single interface.Important Files Changed
getUserLimitUsage()Sequence Diagram
sequenceDiagram participant Page as UsersQuotaPage participant Action as getUserLimitUsage() participant DB as Database participant UI as UserQuotaListItem Page->>Action: getUserLimitUsage(userId) Action->>DB: Query user quota data DB-->>Action: Return { rpm: {limit: null}, dailyCost: {limit: null} } Action-->>Page: ActionResult with nullable limits Note over Page: Type now correctly accepts<br/>number | null for limits Page->>UI: Pass UserQuotaWithUsage UI->>UI: Display quota with null checks Note over UI: Existing code handles nulls<br/>via conditionals & QuotaProgress