GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(quota): report unlimited A6API keys by banipest · Pull Request #1171 · lidge-jun/opencodex Conversation
|
|
✅ Deterministic PR hygiene checks passed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
⏳ DRAFT
What to do
Review readiness checklist
2/4 boxes ticked. This PR stays in draft until every box above is ticked. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe quota model now supports structured USD credits. A6API parsing reports metered usage, unlimited status, expiration timestamps, and custom quota windows. Tests cover metered and unlimited accounts. ChangesA6API credit quota reporting
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
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 `@tests/provider-quota.test.ts`:
- Around line 300-327: Update the test around fetchProviderQuotaReports to use a
valid nonzero expires_at timestamp in the mocked unlimited-quota response, then
assert that the returned creditsUsd object includes the same expiresAt value
alongside its existing fields. Keep the test focused on propagating expiry for
unlimited accounts.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1f1dc15e-b69d-4902-9f2a-c5377732ec6c
src/providers/quota.tstests/provider-quota.test.ts
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| test("A6API unlimited keys remain visible even when all finite credit totals are zero", async () => { | ||
| globalThis.fetch = (async (input: RequestInfo | URL) => new Response(JSON.stringify( | ||
| String(input).includes("subscription") | ||
| ? { data: { hard_limit_usd: 100_000_000 } } | ||
| : { data: { | ||
| total_granted: 0, | ||
| total_used: 0, | ||
| total_available: 0, | ||
| unlimited_quota: true, | ||
| expires_at: 0, | ||
| } }, | ||
| ), { status: 200 })) as typeof fetch; | ||
|
|
||
| const result = await fetchProviderQuotaReports(a6apiOnlyConfig(), true); | ||
|
|
||
| expect(result.reports).toHaveLength(1); | ||
| expect(result.reports[0]?.quota.creditsUsd).toEqual({ | ||
| used: 0, | ||
| limit: 0, | ||
| remaining: 0, | ||
| percent: 0, | ||
| unlimited: true, | ||
| }); | ||
| expect(result.reports[0]?.quota.customWindows).toEqual([{ | ||
| label: "Unlimited API credits", | ||
| percent: 0, | ||
| }]); | ||
| }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Test expiry propagation for unlimited accounts.
Line 309 sets expires_at to 0. The test cannot detect a regression that drops expiresAt from the unlimited creditsUsd branch.
Set a valid timestamp and assert expiresAt in the expected quota object.
- expires_at: 0, + expires_at: "2027-01-01T00:00:00Z", ... percent: 0, unlimited: true, + expiresAt: Date.parse("2027-01-01T00:00:00Z"),
As per path instructions, a src/ behavior change must have a focused regression test under tests/.
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test("A6API unlimited keys remain visible even when all finite credit totals are zero", async () => { | |
| globalThis.fetch = (async (input: RequestInfo | URL) => new Response(JSON.stringify( | |
| String(input).includes("subscription") | |
| ? { data: { hard_limit_usd: 100_000_000 } } | |
| : { data: { | |
| total_granted: 0, | |
| total_used: 0, | |
| total_available: 0, | |
| unlimited_quota: true, | |
| expires_at: 0, | |
| } }, | |
| ), { status: 200 })) as typeof fetch; | |
| const result = await fetchProviderQuotaReports(a6apiOnlyConfig(), true); | |
| expect(result.reports).toHaveLength(1); | |
| expect(result.reports[0]?.quota.creditsUsd).toEqual({ | |
| used: 0, | |
| limit: 0, | |
| remaining: 0, | |
| percent: 0, | |
| unlimited: true, | |
| }); | |
| expect(result.reports[0]?.quota.customWindows).toEqual([{ | |
| label: "Unlimited API credits", | |
| percent: 0, | |
| }]); | |
| }); | |
| test("A6API unlimited keys remain visible even when all finite credit totals are zero", async () => { | |
| globalThis.fetch = (async (input: RequestInfo | URL) => new Response(JSON.stringify( | |
| String(input).includes("subscription") | |
| ? { data: { hard_limit_usd: 100_000_000 } } | |
| : { data: { | |
| total_granted: 0, | |
| total_used: 0, | |
| total_available: 0, | |
| unlimited_quota: true, | |
| expires_at: "2027-01-01T00:00:00Z", | |
| } }, | |
| ), { status: 200 })) as typeof fetch; | |
| const result = await fetchProviderQuotaReports(a6apiOnlyConfig(), true); | |
| expect(result.reports).toHaveLength(1); | |
| expect(result.reports[0]?.quota.creditsUsd).toEqual({ | |
| used: 0, | |
| limit: 0, | |
| remaining: 0, | |
| percent: 0, | |
| unlimited: true, | |
| expiresAt: Date.parse("2027-01-01T00:00:00Z"), | |
| }); | |
| expect(result.reports[0]?.quota.customWindows).toEqual([{ | |
| label: "Unlimited API credits", | |
| percent: 0, | |
| }]); | |
| }); |
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@tests/provider-quota.test.ts` around lines 300 - 327, Update the test around
fetchProviderQuotaReports to use a valid nonzero expires_at timestamp in the
mocked unlimited-quota response, then assert that the returned creditsUsd object
includes the same expiresAt value alongside its existing fields. Keep the test
focused on propagating expiry for unlimited accounts.
Source: Path instructions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e646862 to
d2f4991
Compare
Co-Authored-By: Codex <[email protected]>
d2f4991 to
162be68
Compare
|
Closing in favor of #1208, which adopts this change as-is. This PR needed no changes. It was independently re-audited against current Why it sat: 524 workflow runs were queued awaiting maintainer approval, 39 on open-PR branches including this one. The readiness gate verifies the Two observations recorded in #1208, neither blocking: Thanks for catching this — a working key showing as dead is exactly the kind of bug that erodes trust in the dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Adopted from PR #1171 by @byongshintv, rebuilt on the current stack. Original closed in favor of this commit. An unlimited A6API key reports zero finite credit totals. Finite-total validation then treated that as a terminal failure and returned before the key could be represented at all, so a perfectly working key looked dead in the dashboard. The unlimited branch now runs ahead of that validation and emits the generic `customWindows` row the GUI and CLI already consume, preserving expiry. It accepts `true`, `1`, and `"true"` for the upstream flag. Two known limitations, stated rather than discovered later: `creditsUsd` and its expiry are not yet surfaced by the GUI — visibility comes from `customWindows` — and neither changes existing behavior for finite keys. Confirmed to fail with the unlimited branch disabled.
…-jun#1171) Adopted from PR lidge-jun#1171 by @byongshintv, rebuilt on the current stack. Original closed in favor of this commit. An unlimited A6API key reports zero finite credit totals. Finite-total validation then treated that as a terminal failure and returned before the key could be represented at all, so a perfectly working key looked dead in the dashboard. The unlimited branch now runs ahead of that validation and emits the generic `customWindows` row the GUI and CLI already consume, preserving expiry. It accepts `true`, `1`, and `"true"` for the upstream flag. Two known limitations, stated rather than discovered later: `creditsUsd` and its expiry are not yet surfaced by the GUI — visibility comes from `customWindows` — and neither changes existing behavior for finite keys. Confirmed to fail with the unlimited branch disabled.
…-jun#1171) Adopted from PR lidge-jun#1171 by @byongshintv, rebuilt on the current stack. Original closed in favor of this commit. An unlimited A6API key reports zero finite credit totals. Finite-total validation then treated that as a terminal failure and returned before the key could be represented at all, so a perfectly working key looked dead in the dashboard. The unlimited branch now runs ahead of that validation and emits the generic `customWindows` row the GUI and CLI already consume, preserving expiry. It accepts `true`, `1`, and `"true"` for the upstream flag. Two known limitations, stated rather than discovered later: `creditsUsd` and its expiry are not yet surfaced by the GUI — visibility comes from `customWindows` — and neither changes existing behavior for finite keys. Confirmed to fail with the unlimited branch disabled.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.