Skip to content

feat(gui): show reset credit expiration time - #613

Merged
Wibias merged 2 commits into
lidge-jun:devfrom
ACJF00:feat/reset-credit-expiration
Jul 29, 2026
Merged

feat(gui): show reset credit expiration time#613
Wibias merged 2 commits into
lidge-jun:devfrom
ACJF00:feat/reset-credit-expiration

Conversation

@ACJF00

@ACJF00 ACJF00 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Show the local expiration time for Codex reset credits.
  • Keep granted dates in the existing date-only format.
  • Add focused formatter tests.

Verification

  • bun run typecheck
  • bun run test
  • 5,022 tests passed

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were not needed for this UI-only change.
  • Security-sensitive changes were reviewed; no auth or secret-handling code changed.

Summary by CodeRabbit

  • Improvements

    • Credit expiration timestamps now display date and local time, respecting your locale settings.
    • Credit granted dates continue to use compact, date-only formatting, while urgent styling and countdown logic remain unchanged.
  • Bug Fixes

    • Invalid credit timestamps consistently show the same em dash fallback () for both date-only and date-time displays.
  • Tests

    • Added tests for date-only vs date-time formatting behavior and invalid-input fallback.

@github-actions github-actions Bot added the enhancement New feature or request label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

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: d83b13ae-0d40-458d-a8b7-e2805269b5fa

📥 Commits

Reviewing files that changed from the base of the PR and between e16c92e and cece556.

📒 Files selected for processing (5)
  • gui/src/components/codex-account-pool-helpers.tsx
  • gui/src/components/codex-account-pool-utils.ts
  • gui/src/components/codex-account-reset-modal.tsx
  • gui/src/intl-formatters.ts
  • gui/tests/intl-formatters.test.ts

📝 Walkthrough

Walkthrough

Adds cached locale-aware date and date-time formatting, exposes the new formatter through account-pool utilities, and passes locale data through credit displays and reset confirmation text. Existing invalid-date fallback, urgency styling, and day calculations remain unchanged.

Changes

Credit date formatting

Layer / File(s) Summary
Locale-aware formatter contracts
gui/src/intl-formatters.ts, gui/tests/intl-formatters.test.ts
Adds cached locale-specific date and date-time formatters, preserves the "—" fallback, and tests valid and invalid inputs.
Account-pool credit formatting
gui/src/components/codex-account-pool-utils.ts, gui/src/components/codex-account-pool-helpers.tsx
Propagates locale through formatter wrappers and renders localized grant dates and date-time expiration labels without changing urgency or day-count behavior.
Reset-modal locale wiring
gui/src/components/codex-account-reset-modal.tsx
Obtains locale from useI18n(), passes it to credit items, and applies it to the confirmation date.

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

Possibly related PRs

  • lidge-jun/opencodex#470: Modifies the same intl-formatters.ts date formatting and invalid-date fallback behavior.

Suggested reviewers: wibias, ingwannu, lidge-jun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: displaying reset credit expiration time in the GUI.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e16c92eb8d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gui/src/intl-formatters.ts Outdated
year: "numeric",
});

const CREDIT_DATE_TIME_FORMAT = new Intl.DateTimeFormat(undefined, {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Format the expiration time with the selected UI locale

When the user selects a dashboard language different from the browser language, this formatter still uses the browser default because it is constructed with undefined; for example, a German dashboard on an English browser embeds an English Jul 31, 2026, 02:34 PM timestamp in the German expiration text instead of the expected German date and 24-hour time. Pass the active I18nContext.locale through CodexCreditItem and cache or construct the formatter for that locale, as the quota reset formatters already do.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gui/tests/intl-formatters.test.ts`:
- Around line 5-14: Update the tests around formatCreditDate and
formatCreditDateTime to derive the expected localized hour/minute component from
the test ISO value using the appropriate locale-aware formatter. Assert that
formatCreditDate excludes this component and formatCreditDateTime includes it,
while retaining the existing placeholder check and avoiding the hardcoded
"12:34" value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8652c8e3-7108-4399-bbbb-8d138ba6bcc8

📥 Commits

Reviewing files that changed from the base of the PR and between 7710185 and e16c92e.

📒 Files selected for processing (4)
  • gui/src/components/codex-account-pool-helpers.tsx
  • gui/src/components/codex-account-pool-utils.ts
  • gui/src/intl-formatters.ts
  • gui/tests/intl-formatters.test.ts

Comment thread gui/tests/intl-formatters.test.ts
@Wibias

Wibias commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Maintainer review (bug + security)

Verdict: APPROVE (optional follow-ups below)

Security

No medium+ XSS / locale-injection / sensitive-data issues. Dates go through Intl and React text nodes; locale is the whitelisted app locale.

Bug review / open bot threads

Item Status
Codex P2: format with selected UI locale Fixed (formatCreditDate(Time)(..., locale) from useI18n)
Rabbit: assert localized time component Fixed (test derives hour/minute via Intl and asserts inclusion)

Non-blocking notes

  • App locale codes (en/zh/…) are passed straight to Intl; nearby quota UI maps via bcp47() (enen-GB, zhzh-CN). Worth aligning later for consistent calendar/time style.
  • {days}d left still uses Math.ceil day buckets, so same-day expiries can still show 1d left next to a tonight timestamp — pre-existing shape, slightly more noticeable now that time is shown.

Notes

  • Fork PR: limited checks on head SHA; change is small and self-contained.

@Wibias

Wibias commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Will get merged after interal code work lands on dev.

@Wibias
Wibias merged commit f492f7d into lidge-jun:dev Jul 29, 2026
11 checks passed
Wibias added a commit that referenced this pull request Jul 29, 2026
@Wibias

Wibias commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Transition workflow completed

  1. Merged into dev: f492f7d4 (feat(gui): show reset credit expiration time #613)
  2. Carried onto dev2-go: feat(gui): carry reset credit expiration onto dev2-go (#613) #664
  3. Go port: none — GUI-only change (decision recorded)

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants