Skip to content

refactor: move static provider flags to ProviderDefinition#362

Merged
rygel merged 3 commits intodevelopfrom
refactor/provider-definition-flags
Mar 20, 2026
Merged

refactor: move static provider flags to ProviderDefinition#362
rygel merged 3 commits intodevelopfrom
refactor/provider-definition-flags

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Mar 20, 2026

Summary

  • Add IsStatusOnly, IsCurrencyUsage, DisplayAsFraction to ProviderDefinition as the authoritative source for static provider characteristics
  • MistralProvider: declare IsStatusOnly = true in StaticDefinition, remove per-instance assignment
  • DeepSeekProvider: declare IsCurrencyUsage = true in StaticDefinition, remove per-instance assignment
  • AntigravityProvider: declare DisplayAsFraction = true in StaticDefinition, remove unconditional summary.DisplayAsFraction = true assignment (conditional per-child assignment is unchanged)
  • ProviderUsageProcessingPipeline: OR definition flags into the normalized usage so declarations in ProviderDefinition are always honoured

Motivation

These flags were being set unconditionally on every ProviderUsage instance returned by the provider. They describe static provider characteristics, not runtime data — the same design smell as PeriodDuration on ProviderUsageDetail. Moving them to ProviderDefinition makes the contract explicit and eliminates the need for each provider to remember to set them.

Test plan

  • Build passes with zero errors
  • Mistral card still shows status-only presentation
  • DeepSeek card still shows currency display
  • Antigravity summary card still shows fraction display; per-child fraction behaviour unchanged

🤖 Generated with Claude Code

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>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ 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>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ 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>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ Within acceptable range


This is an automated performance check

@rygel rygel merged commit 156384a into develop Mar 20, 2026
19 checks passed
@rygel rygel deleted the refactor/provider-definition-flags branch March 20, 2026 09:53
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.

2 participants