Skip to content

fix(overview): report a refused range instead of showing zeros - #339

Merged
Bccorb merged 1 commit into
mainfrom
fix/overview-rejected-range
Nov 3, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/overview-rejected-range

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

On the RoxTarget production console, an all-time custom range (?range=custom&from=2025-01-01T00:00&to=2026-11-03T23:59) drew a 400 from every metrics endpoint, because the API caps a window at 366 days. Overview retried each request, then rendered every figure as 0 under copy saying the API takes no date range, which was false. This reports the refused range as an error instead.


Changes

  • Overview checks the span before sending it. A range over 366 days (mirrors MAX_METRICS_WINDOW_MS.day in seamless-auth-api/src/schemas/internal.query.ts) sends no requests and says how long the range is and what the limit is. The picker stays in place and no figures are shown.
  • A 400 from any Overview query is shown as "The API rejected this range" instead of zeros or the full-page error, so the range can still be fixed.
  • The fixed 24 hour copy appears only when the API answers without a window, not while a request is pending or has failed.
  • The query retry rule moves to src/lib/queryRetry.ts and no longer retries 400 or 422 (401 was already excluded).
  • The five metrics hooks take an optional enabled.
  • Patch changeset.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

How to Test

  1. Open Overview with ?range=custom&from=2025-01-01T00:00&to=2026-11-03T23:59. Expect the "too long" message naming 366 days, no figures, and no requests to the metrics endpoints.
  2. Change the start to 2026-08-01. Expect figures to load normally.
  3. npm test covers both cases, an API 400, and the pending state in Overview.test.tsx, plus queryRetry.test.ts and timeRange.test.ts.

Checklist

  • Code builds successfully
  • Tests pass
  • Linting passes
  • No console errors
  • Updated documentation (if needed)

Notes

Not yet checked against a live API in a browser. The API caps hourly buckets at 31 days, but Overview switches to daily buckets above 48 hours, so only the 366 day cap applies here. The Security page shares RangeFilter and likely has the same unchecked cap; it now fails fast thanks to the retry change, but a pre-send check there is a separate fix.

A custom range over the API's 366 day maximum drew a 400 from every metrics
endpoint. The page retried each one, then rendered the figures as zeros under
copy saying the API takes no date range.

Overview now checks the span before sending it and names the limit. A 400 from
any of its queries is shown as a rejected range, with the picker kept in place.
The fixed 24 hour copy is shown only for a response without a window. Queries
no longer retry 400 or 422 responses.
@Bccorb
Bccorb merged commit 89389ee into main Nov 3, 2026
1 of 4 checks 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.

1 participant