fix(usage): apply round-3 review findings to OpenRouter credits - #183
Merged
Conversation
- a failed read no longer presents the previous balance as current: the settings rows say Unavailable and the meter dims the number with a "Couldn't load the latest balance" line - key saves and resets run strictly in click order instead of racing in separate single-flight lanes - cache TTLs treat a backwards wall-clock jump as expiry - the popover no longer refreshes the empty-query sentinel while the feature is toggled off - tests now pin the single-flight gate under real concurrency and prove the timed-out read releases it
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 freeto 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.
Follow-up to #182. A parallel round-3 review (gpt-5.6-sol read-only + Opus code-reviewer) surfaced six issues in the merged feature; this applies all of them.
Both reviewers independently found the biggest one: the credits query keeps its previous success when a refresh fails, so a disconnected environment kept showing its last balance as current. The settings rows now check the transport error first and say "Unavailable", and the meter dims the number and adds "Couldn't load the latest balance" instead of presenting yesterday's figure.
The rest: key saves and resets from Settings → Extras are chained so they run in click order (the payload-keyed single-flight lanes had made a reset able to race a still-running save and lose); cache TTL checks treat a backwards wall-clock jump as expiry instead of pinning an entry fresh; the popover no longer refreshes the shared empty-query sentinel while the feature is off; and two test gaps are closed — the single-flight gate is now exercised by genuinely concurrent readers, and the hung-body timeout test proves the gate is released afterwards.
vp checkandvp run typecheckpass; 12 focused server tests plus the meter and client-runtime suites are green.Implemented by Claude Fable 5 in Claude Code from review findings by gpt-5.6-sol and Claude Opus.