Skip to content

Conversation

@github-actions
Copy link

@github-actions github-actions bot commented Jan 2, 2026

CI Auto-Fix

Original PR: #507
Failed CI Run: PR Build Check

Root Cause

The UserQuotaSnapshot interface had type definitions that didn't match the actual data returned by getUserLimitUsage():

  • Interface expected: rpm.limit: number and dailyCost.limit: number
  • Actual data: rpm.limit: number | null and dailyCost.limit: number | null

This mismatch occurred because the interface was created before the user-level daily quota feature was fully implemented with timezone support.

Fixes Applied

File Line Fix Type
src/app/[locale]/dashboard/quotas/users/_components/types.ts 4 Changed rpm.limit: number to rpm.limit: number | null TypeScript type correction
src/app/[locale]/dashboard/quotas/users/_components/types.ts 5 Changed dailyCost.limit: number to dailyCost.limit: number | null TypeScript type correction

Why This Fix is Safe

  1. No behavior change: Only corrects type definitions to match actual data
  2. Aligns with source: getUserLimitUsage in src/actions/users.ts:1233-1237 explicitly returns nullable limits
  3. Consistent with feature: User quotas can be unlimited (null limit), which is intentional design
  4. Minimal scope: Only 2 type annotations changed

Verification

TypeScript Check: bun run typecheck passes
Lint Check: bun run lint passes
No logic changes: Only type definitions updated

Original Error

src/app/[locale]/dashboard/quotas/users/page.tsx:75:3
Type error: Type '{ rpm: { current: number; limit: number | null; ... }; 
dailyCost: { current: number; limit: number | null; resetAt: Date; }; }' 
is not assignable to type 'UserQuotaSnapshot'.
  The types of 'rpm.limit' are incompatible between these types.
    Type 'number | null' is not assignable to type 'number'.
      Type 'null' is not assignable to type 'number'.

Auto-generated by Claude AI - CI Auto-Fixer

Greptile Summary

This PR fixes a TypeScript type error by updating UserQuotaSnapshot interface to allow nullable limits (number | null) for both rpm.limit and dailyCost.limit fields. The change aligns the interface definition with the actual data structure returned by getUserLimitUsage() in src/actions/users.ts:1235-1236, which explicitly returns nullable limits to support unlimited quotas (where limit is intentionally null).

Key changes:

Impact:
The UI components already handle null limits correctly through conditional checks and the QuotaProgress component's null guard on line 13.

Confidence Score: 5/5

  • This PR is safe to merge with zero risk
  • This is a minimal, type-only fix that corrects a type mismatch without changing any runtime behavior. The change is backed by the actual data structure in 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.
  • No files require special attention

Important Files Changed

Filename Overview
src/app/[locale]/dashboard/quotas/users/_components/types.ts Type correction to allow nullable limits, aligns with actual data from 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
Loading

Fixed:
- Updated rpm.limit from 'number' to 'number | null'
- Updated dailyCost.limit from 'number' to 'number | null'

This fixes TypeScript compilation error where getUserLimitUsage()
returns nullable limits but UserQuotaSnapshot expected non-null.

TypeScript Error:
src/app/[locale]/dashboard/quotas/users/page.tsx:75:3
Type mismatch in quota.rpm.limit and quota.dailyCost.limit

Verification:
- bun run typecheck: PASS
- bun run lint: PASS

CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20667182871
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants