Skip to content

Make OpenRouter color-bar preview use the standard resolver path#855

Open
willytop8 wants to merge 1 commit intosteipete:mainfrom
willytop8:wr/openrouter-color-bar-preview
Open

Make OpenRouter color-bar preview use the standard resolver path#855
willytop8 wants to merge 1 commit intosteipete:mainfrom
willytop8:wr/openrouter-color-bar-preview

Conversation

@willytop8
Copy link
Copy Markdown
Contributor

The color-bar preview was reading usedPercent directly instead of going through IconRemainingResolver.resolvedPercents. Key-quota state (no limit configured, key data unavailable) had no effect — the preview always showed a non-nil percent even when the live icon renders no color bar.

Routes the preview through the same resolver the live icon uses:

  • No key limit → nil primary, no color bar
  • Key data unavailable → nil primary, no color bar
  • Key limit set → key-usage percent drives the bar as expected

Adds tests for all three cases, each asserting both the resolved percent and the menu-bar display text.

swift test --filter StatusItemControllerMenuTests

Previously the color-bar preview for OpenRouter read usedPercent directly
instead of going through IconRemainingResolver, which meant key-quota state
had no effect on the preview color. This change routes the preview through
the same resolvedPercents(_:style:showUsed:) call that the live icon uses.

- When no key limit is configured (noLimitConfigured) or key data is
  unavailable, resolvedPercents returns nil for primary, matching the live
  icon behavior and leaving the color bar unrendered
- When a key limit is set, the key-usage percent drives the preview as expected
- Adds tests covering the unavailable, no-limit, and key-quota cases, each
  verifying both the resolved percent and the menu-bar display text

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@willytop8 willytop8 force-pushed the wr/openrouter-color-bar-preview branch from 3d42a90 to be7d96a Compare May 7, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant