Skip to content

fix: Weekly Fable widget forces every usage widget into an error state#7

Open
BenIsLegit wants to merge 1 commit into
pcvelz:mainfrom
BenIsLegit:fix/fable-usage-poisoning
Open

fix: Weekly Fable widget forces every usage widget into an error state#7
BenIsLegit wants to merge 1 commit into
pcvelz:mainfrom
BenIsLegit:fix/fable-usage-poisoning

Conversation

@BenIsLegit

Copy link
Copy Markdown

Adding the Weekly Fable widget breaks every usage widget for anyone who hasn't used Fable.

weeklyFableUsage was a hard fetch requirement, but the API only returns a Fable limits entry once you've actually used Fable. On accounts that haven't, the field is always absent, so hasRequiredUsageFields() rejects every fresh and stale cache and turns good data into an error. Every usage widget then renders that error ([No credentials], [Timeout], whatever fits).

Two changes: weeklyFableUsage no longer gates cache validity or the stale fallback, and a successful response whose limits array just lacks a Fable entry parses as 0 instead of undefined, so the widget shows 0.0% rather than quietly vanishing for light users.

Regression tests cover both shapes (no limits key, and limits present without Fable).

The weekly-fable-usage widget registered weeklyFableUsage as a hard fetch requirement, but the usage API only returns a per-model limits entry once that model has been used. For accounts without Fable usage the field is permanently absent, so hasRequiredUsageFields() rejected every fresh and stale cache, converting valid data into a persistent error state across all usage widgets on machines where the API token is unavailable.

Two changes: weeklyFableUsage is now an optional field that never gates cache validity or stale-data fallback, and a successful response whose limits array simply lacks a Fable entry is parsed as 0% instead of undefined, so the widget renders 0.0% rather than silently disappearing for light users. Regression tests cover both shapes (no limits key, and limits without a Fable entry).
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