Skip to content

fix(gui): guard quota reset date formatting - #2405

Draft
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/quota-reset-invalid-date
Draft

fix(gui): guard quota reset date formatting#2405
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/quota-reset-invalid-date

Conversation

@luvs01

@luvs01 luvs01 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Normalize quota reset epochs once and reject only values outside JavaScript Date's representable range before calling Intl.DateTimeFormat.
  • Share the guard between compact and stacked quota rows while preserving the existing seconds-versus-milliseconds heuristic and every representable timestamp.
  • Add a finite out-of-range regression so malformed remote or cached quota metadata cannot replace the Providers page with its error boundary.

Verification

  • Bun 1.4 quota-row regression: bun test --isolate tests/quota-bars-rows.test.ts — 13 passed, 0 failed, 41 assertions.
  • Bun 1.4 localization regression: bun test --isolate ./gui/tests/fr-localization.test.ts — 8 passed, 0 failed, 4,187 assertions.
  • bun run typecheck — passed.
  • GUI bun x tsc -b — passed.
  • Focused GUI oxlint src/components/QuotaBars.tsx — passed.
  • bun run privacy:scan — passed.
  • git diff --check — passed.
  • Independent exact-diff review — no actionable findings.
  • Exact head f0db6a981386104d41f865a438bb6eb332db30d7, based directly on dev at 46d41505cc702ce9248890202bb144f9ee2df6f7.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. This is an internal defensive formatting fix with no configuration or public API change.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. This touches display formatting only and introduces no credential or authorization behavior.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes

    • Improved quota reset date handling for invalid or out-of-range values.
    • Prevented improperly formatted reset dates from appearing in the interface.
  • Tests

    • Added coverage for safely handling extremely large date values.

@github-actions github-actions Bot added the bug Something isn't working label Aug 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a61c0a2b-1ad6-4b18-887d-7aae8516e646

📥 Commits

Reviewing files that changed from the base of the PR and between 46d4150 and f0db6a9.

📒 Files selected for processing (2)
  • gui/src/components/QuotaBars.tsx
  • tests/quota-bars-rows.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Quota reset formatting now shares epoch normalization and invalid-date validation. Future reset formatting returns an empty string for out-of-range timestamps. Tests cover Number.MAX_VALUE.

Changes

Quota reset validation

Layer / File(s) Summary
Validate and format reset dates
gui/src/components/QuotaBars.tsx, tests/quota-bars-rows.test.ts
resetDate validates finite epoch values, converts seconds to milliseconds, and rejects invalid JavaScript dates. formatResetAt and formatResetFuture use the shared result. Tests verify that Number.MAX_VALUE produces an empty string.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f0db6

This narrowly scoped change guards quota reset date formatting so malformed metadata cannot break the Providers page; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: lidge-jun

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the GUI fix for guarding quota reset date formatting.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • UI screenshot required.

What to do

  • Add a screenshot of the UI change to the PR description.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 22, 2026 18:08
@luvs01

luvs01 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

Screenshot waiver requested: this is a defensive invalid-data formatting guard, not a new visual state. The only observable change is that an out-of-range reset timestamp no longer replaces the Providers page with the existing error boundary; normal quota rendering is unchanged, so a screenshot with valid data would be identical. Could a maintainer apply the gui-screenshot-waived label?

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 48 / 80

설명: 이 PR은 제공자 페이지의 할당량 리셋 시각이 자바스크립트 Date 가 못 담는 숫자일 때, 페이지 전체가 에러 경계로 바뀌지 않게 한다. 지금 CURRENT dev HEAD 는 4f41a8e93 이다. 이번 시간에 origin/dev 는 46d4150 에서 한 커밋이 와서 여기까지 왔다. 착지는 2396 사용량 CLI 오늘 비용이다. package.json 은 2.27.0 이다. src/config.ts 는 3975줄이다. src/runtime 폴더는 지금 HEAD 에 없다. 지금 HEAD 의 gui/src/components/QuotaBars.tsx 352줄 formatResetAt 과 368줄 formatResetFuture 는 유한한 숫자인지만 본다. 초와 밀리초 구분은 그대로 10_000_000_000 기준이다. 그다음 new Date(ms) 를 만들고 Intl.DateTimeFormat 에 바로 넣는다. Number.MAX_VALUE 처럼 범위를 넘는 숫자는 Date 가 Invalid Date 가 되고, Intl 이 RangeError 를 던진다. 제공자 페이지가 그 오류로 통째로 죽는다. 이 PR 은 resetDate 한 곳에서 정규화하고, date.getTime 이 유한이 아니면 빈 글자를 돌려 준다. 두 표시 함수가 그걸 같이 쓴다. 테스트는 formatResetFuture(Number.MAX_VALUE) 가 빈 글자인 한 줄을 더 넣는다. 작성자 로컬은 quota-bars-rows 13개, fr-localization 8개, typecheck, GUI tsc, oxlint, privacy:scan 통과라고 적었다. 아직 드래프트다. 체크리스트 네 칸은 채워져 있다. bug 라벨만 있고 review-ready 는 없다. 작성자는 luvs01 이다. 베이스는 46d41505c 이다. 지금 HEAD 보다 2396 하나 뒤다. 겹치는 파일은 거의 없다. Closes 가 없다. 사용자 길이로는 잘못된 리셋 숫자 하나가 제공자 페이지를 죽이는 구멍이라서 48. 카탈로그 팁은 Ox Alpha x-preview-f-free + deepseek-v4-flash-vision-exp. Cursor 정적 카탈로그는 opus-4-8-fast / opus-5-fast. 2334 CursorCredentialRouter 는 여전히 src/providers/cursor-pool.ts 모듈+테스트만 있고 어댑터에 연결되지 않았다. 2332 H2 는 discovery 전용. 2320 overflow + 2342 는 이미 dev. 2188 사이드카는 이미 dev. 2382 데스크톱 앱 재시작은 이미 dev. 2292 는 아직 연다.

gui/src/components/QuotaBars.tsx 라인 352 - 지금 HEAD 의 formatResetAt 은 유한 숫자만 보고 Intl 에 바로 넣는다. Invalid Date 에서 RangeError
gui/src/components/QuotaBars.tsx 라인 368 - formatResetFuture 도 같다. PR 은 resetDate 한 곳으로 모은다
tests/quota-bars-rows.test.ts - Number.MAX_VALUE 가 빈 글자인지 한 줄을 더 넣는다. 초/밀리초 시험은 그대로다
PR 베이스 46d41505c - 지금 HEAD 4f41a8e93 보다 2396 하나 뒤다. 드래프트다. review-ready 라벨이 없다
GitHub CI - Cross-platform CI 는 드래프트라 안 떴을 수 있다. 작성자 로컬은 통과라고 적었다

메인테이너의 판단이 필요한 지점

  • 드래프트인데 체크리스트가 다 채워져 있다. 레디로 올릴지, 2396 위에 한 번 맞출지
  • compact 줄과 stacked 줄이 같은 가드를 쓰는지. PR 은 두 표시 함수만 고친다
  • 이 구멍을 이슈로 남길지. 본문에 Closes 가 없다

너의 추천
레디로 올리고 GitHub 시험이 초록이면 머지한다. 가드를 더 넓히지 말 것. 초/밀리초 구분은 그대로 둔다. 2396 과 파일이 안 겹치면 리베이스하지 말고 닫지도 않는다. 라벨은 그대로 둔다. 프리뷰 배포가 아니다.

이 댓글은 grok-bot이 작성했습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants