fix: keep Windsurf quota visible when extra usage balance is missing#346
fix: keep Windsurf quota visible when extra usage balance is missing#346prayzey wants to merge 2 commits intorobinebers:mainfrom
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
There was a problem hiding this comment.
Pull request overview
Makes the Windsurf plugin’s quota parsing resilient to missing/invalid overageBalanceMicros so daily/weekly quota bars remain visible instead of showing the “quota unavailable” error.
Changes:
- Treat
overageBalanceMicrosas optional (missing/invalid no longer fails the whole quota render). - Conditionally include the “Extra usage balance” line only when the value parses to a valid dollar amount.
- Add/adjust regression tests for missing/invalid extra usage balance scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/windsurf/plugin.js | Loosens quota contract requirements and conditionally renders extra usage balance without failing daily/weekly lines. |
| plugins/windsurf/plugin.test.js | Adds coverage for omitted/invalid extra usage balance and updates the expected behavior accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function formatDollarsFromMicros(value) { | ||
| var micros = readFiniteNumber(value) | ||
| if (micros === null) return null | ||
| if (!Number.isFinite(micros)) return null |
There was a problem hiding this comment.
readFiniteNumber() already guarantees the returned value is finite (or null), so the extra Number.isFinite(micros) check is redundant and can confuse future readers. Consider removing it, or adding a short comment explaining why the double-check is intentional (e.g., defensive against patched/inconsistent Number.isFinite).
| if (!Number.isFinite(micros)) return null |
davidarny
left a comment
There was a problem hiding this comment.
No chance to test it, but LGTM!
Closes
Closes #345
What was going wrong
For some Windsurf accounts, OpenUsage was showing:
Windsurf quota data unavailable. Try again later.even though Windsurf was still returning usable quota data.
The daily quota, weekly quota, and reset times were present, but the extra usage balance field could be missing or invalid. When that happened, OpenUsage treated the whole response like an error and showed the red error state instead of the quota bars.
What this change does
This PR makes the Windsurf parser more forgiving.
Now OpenUsage will:
This means the app keeps showing the useful quota information instead of failing completely.
Why this matters
Right now, one missing field can make Windsurf look completely broken, even when the main usage data is still available.
With this change, OpenUsage keeps working for Windsurf users even when that extra field is missing.
Before
After
Testing
Added regression tests for:
Summary by cubic
Keeps Windsurf quota visible when the extra usage balance is missing or invalid, preventing the red “quota unavailable” error and showing daily/weekly bars as long as they’re available.
overageBalanceMicrosas fatal; render daily and weekly quota when present.Written for commit bbbb6cc. Summary will update on new commits.