Skip to content

fix(rate-limit): fixes footer display and tracks GraphQL cost#80

Merged
wgordon17 merged 7 commits into
gordon-code:mainfrom
wgordon17:worktree-fix+rate-limit-footer
Apr 23, 2026
Merged

fix(rate-limit): fixes footer display and tracks GraphQL cost#80
wgordon17 merged 7 commits into
gordon-code:mainfrom
wgordon17:worktree-fix+rate-limit-footer

Conversation

@wgordon17
Copy link
Copy Markdown
Member

Summary

  • Fixes rate limit footer disappearing when rate-limited by routing signals correctly and seeding from GET /rate_limit
  • Tracks actual GraphQL query point cost in API Usage table instead of counting each call as 1

Closes #79

- Gate updateRateLimitFromHeaders on !isGraphql to prevent GraphQL
  response headers from contaminating _coreRateLimit signal
- Add GraphQL-aware signal updates to hook.wrap error path: routes
  GraphQL errors to _setGraphqlRateLimit, REST errors to
  updateRateLimitFromHeaders, wrapped in try/catch to never mask errors
- Make fetchRateLimitDetails() update both signals on all return paths
  (cache-hit and fresh-fetch)
- Add tests for signal routing, error path updates, and
  fetchRateLimitDetails signal feedback
- Call fetchRateLimitDetails() after setIsRefreshing(true) to seed
  both rate limit signals with authoritative GET /rate_limit data
- Add github module mock to poll tests for fetchRateLimitDetails
- Add flushPromises helper for multi-await microtask flushing
- runForkPRFallback: extract rateLimit from err.data before partialData
- fetchPREnrichment: extract rateLimit at start of catch block
- fetchHotPRStatus: extract from s.reason.data in rejection loop
- Add tests for all three error-path extractions
- Three-tier CSS class: text-error at remaining===0, text-warning
  at <10%, normal otherwise
- Add DashboardPage.test.tsx with tests for all three styling states
- NaN-guard parseInt(remaining) in error-path signal update
- Remove redundant signal updates from fetchRateLimitDetails cache
  hit path (signals already set on fresh fetch)
- Add explanatory comment to flushPromises test helper
- Adds cost field to all 7 GraphQL rateLimit query fragments
- Extracts rateLimit.cost from GraphQL response body in hook.wrap
- Extracts cost from error response body on GraphQL failures
- Passes graphqlCost via ApiRequestInfo to api-usage tracking
- Renames Settings UI labels from Calls/counts to Usage
- Add tests for graphqlCost extraction in hook.wrap callbacks
- Restore cache-hit signal updates in fetchRateLimitDetails
- Extract rateLimitCssClass utility from inline ternary
- Run fetchRateLimitDetails concurrently (void, not await)
- Add error-path graphqlCost and call-count tests
- Add fetchRateLimitDetails signal update + cache-hit tests
- Fix section comment numbering cascade in SettingsPage
- Add clientOverride param to fetchRateLimitDetails for testability
@wgordon17 wgordon17 marked this pull request as ready for review April 23, 2026 20:36
@wgordon17 wgordon17 merged commit 91dcf41 into gordon-code:main Apr 23, 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.

Footer rate limit display disappears when rate-limited

1 participant