fix: Type error in UserQuotaSnapshot (PR #507 CI fix)#513
Closed
github-actions[bot] wants to merge 1 commit intofix/daily-quota-timezone-consistencyfrom
Closed
fix: Type error in UserQuotaSnapshot (PR #507 CI fix)#513github-actions[bot] wants to merge 1 commit intofix/daily-quota-timezone-consistencyfrom
github-actions[bot] wants to merge 1 commit intofix/daily-quota-timezone-consistencyfrom
Conversation
… type Fixed: - Changed rpm.limit from 'number' to 'number | null' (quotas can be unlimited) - Changed dailyCost.limit from 'number' to 'number | null' - Changed dailyCost.resetAt from 'Date | undefined' to 'Date' (always present) Type mismatch was exposed by timezone consistency fixes in ce9b616. The getUserLimitUsage() function returns user.rpm and user.dailyQuota which can be null. CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20667174342
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
TypeScript compilation failed on
fix/daily-quota-timezone-consistencybranch:Root Cause
The timezone consistency fixes in commit ce9b616 correctly changed
getUserLimitUsage()to returnlimit: number | null, but theUserQuotaSnapshotinterface was not updated to match. User quotas CAN be null (meaning unlimited).Fixes Applied
types.ts:4rpm.limit: number→number | nulltypes.ts:5dailyCost.limit: number→number | nulltypes.ts:5resetAt?: Date→resetAt: DateVerification
bun run buildsucceedsChanges
export interface UserQuotaSnapshot { - rpm: { current: number; limit: number; window: "per_minute" }; - dailyCost: { current: number; limit: number; resetAt?: Date }; + rpm: { current: number; limit: number | null; window: "per_minute" }; + dailyCost: { current: number; limit: number | null; resetAt: Date }; }Auto-generated by Claude AI
Greptile Summary
This CI auto-fix resolves a TypeScript compilation error by aligning the
UserQuotaSnapshotinterface with the actual return type ofgetUserLimitUsage().Changes made:
rpm.limit: number→number | null(quotas can be unlimited)dailyCost.limit: number→number | null(quotas can be unlimited)resetAt?: Date→resetAt: Date(always present at runtime, returned bygetDailyResetTime())Root cause: PR #507 correctly updated
getUserLimitUsage()to return nullable limits (matching the database schema whererpmLimitanddailyLimitUsdare nullable integers/numerics), but the consuming interface was not updated.Verification:
users.rpm_limitandusers.daily_limit_usdare nullablegetDailyResetTime()always returns a non-nullDateobjectusers-quota-client.tsxanduser-quota-list-item.tsxalready handles null limits correctly with null-checks (e.g.,limit !== null && limit > 0)Confidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant UI as Users Quota Page participant Action as getUserLimitUsage() participant DB as Database participant Redis as Redis Cache participant Type as UserQuotaSnapshot UI->>Action: Request user quota (userId) Action->>DB: findUserById(userId) DB-->>Action: User { rpmLimit: int | null, dailyLimitUsd: numeric | null } Action->>Redis: Get RPM current (dynamic window) Redis-->>Action: 0 (cannot get exact value) Action->>DB: sumUserCostToday(userId) DB-->>Action: dailyCost: number Action->>Action: getDailyResetTime() Action-->>UI: { rpm: { limit: number | null }, dailyCost: { limit: number | null, resetAt: Date } } UI->>Type: Type check UserQuotaSnapshot Note over Type: ✅ BEFORE: limit: number (mismatch)<br/>✅ AFTER: limit: number | null (matches)<br/>✅ resetAt: Date (always present)