refactor: move static provider flags to ProviderDefinition#362
Merged
refactor: move static provider flags to ProviderDefinition#362
Conversation
IsStatusOnly (Mistral), IsCurrencyUsage (DeepSeek), and DisplayAsFraction (Antigravity summary) were unconditional per-instance assignments on ProviderUsage. These are static provider characteristics, not runtime data. - Add IsStatusOnly, IsCurrencyUsage, DisplayAsFraction to ProviderDefinition - Declare each flag in the respective StaticDefinition - Remove the redundant per-instance assignments from each provider - ProviderUsageProcessingPipeline ORs definition values into the normalized flags, so any provider that declares a flag in its definition always has it honoured regardless of what the provider's usage object returns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Build Performance Report⏱️ Build Time: 12 minutes 📊 Comparison with main branch:
✅ Within acceptable range This is an automated performance check |
…tion in all providers Four improvements across all provider implementations: 1. ProviderBase.CreateUnavailableUsage: removed planType and isQuotaBased parameters — the method now reads both from this.Definition. Providers like Mistral and DeepSeek were silently getting wrong values (PlanType.Coding, isQuotaBased=true) in all error/unavailable paths because no caller ever passed these named args explicitly. 2. ClaudeCodeProvider: fixed PlanType.Coding bug on the OAuth success path — the definition declares PlanType.Usage; this was the only diverging path. 3. ProviderName hardcoded string literals replaced with this.Definition.DisplayName in ClaudeCodeProvider (7), DeepSeekProvider (1), GitHubCopilotProvider (2), SyntheticProvider (1), XiaomiProvider (3). 4. PlanType and IsQuotaBased in all success-path new ProviderUsage blocks replaced with this.Definition.PlanType / this.Definition.IsQuotaBased across 15 provider files. Exception: ClaudeCodeProvider's API-key billing paths intentionally return IsQuotaBased=false (runtime variation, not static). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Build Performance Report⏱️ Build Time: 12 minutes 📊 Comparison with main branch:
✅ Within acceptable range This is an automated performance check |
- ClaudeCodeProviderTests: update expected PlanType from Coding to Usage — the test was asserting the old bug; the definition correctly declares PlanType.Usage for the OAuth success path - GeminiProvider: two error-path ProviderUsage blocks were missing PlanType and IsQuotaBased. The per-account exception path now sets both from the definition; the no-accounts fallback uses CreateUnavailableUsage directly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Build Performance Report⏱️ Build Time: 12 minutes 📊 Comparison with main branch:
✅ Within acceptable range This is an automated performance check |
This was referenced Mar 20, 2026
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 free
to 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.
Summary
IsStatusOnly,IsCurrencyUsage,DisplayAsFractiontoProviderDefinitionas the authoritative source for static provider characteristicsMistralProvider: declareIsStatusOnly = trueinStaticDefinition, remove per-instance assignmentDeepSeekProvider: declareIsCurrencyUsage = trueinStaticDefinition, remove per-instance assignmentAntigravityProvider: declareDisplayAsFraction = trueinStaticDefinition, remove unconditionalsummary.DisplayAsFraction = trueassignment (conditional per-child assignment is unchanged)ProviderUsageProcessingPipeline: OR definition flags into the normalized usage so declarations inProviderDefinitionare always honouredMotivation
These flags were being set unconditionally on every
ProviderUsageinstance returned by the provider. They describe static provider characteristics, not runtime data — the same design smell asPeriodDurationonProviderUsageDetail. Moving them toProviderDefinitionmakes the contract explicit and eliminates the need for each provider to remember to set them.Test plan
🤖 Generated with Claude Code