Skip to content

Treat missing Grok usage percent as empty window - #30

Merged
TopiCsarno merged 1 commit into
TopiCsarno:mainfrom
mushonnip:fix-grok
Sep 13, 2026
Merged

TopiCsarno merged 1 commit into
TopiCsarno:mainfrom
mushonnip:fix-grok

Conversation

@mushonnip

Copy link
Copy Markdown
Contributor

Grok was treating a 0% weekly window as missing usage. After a weekly reset the billing API omits creditUsagePercent (and sometimes GrokBuild usagePercent) because 0 is the default. YapCap mapped that to GrokError::NoUsageData, so the account showed Error plus Grok response had no usage windows while the last snapshot still rendered as 0.0% used / Reset.

Fix: if config is present, a missing, null, or zero percent is a valid Weekly 0% window. NoUsageData is only returned when config itself is absent.

Billing omits zero-valued usage scalars after a reset, so only a
missing config preserves the prior snapshot. Document Grok fetch,
mapping, and errors in spec §3.10.
@TopiCsarno
TopiCsarno merged commit 43f2c8a into TopiCsarno:main Sep 13, 2026
1 check passed
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