Repository navigation
fix(overview): report a refused range instead of showing zeros - #339
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
MAX_METRICS_WINDOW_MS.dayinseamless-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.window, not while a request is pending or has failed.src/lib/queryRetry.tsand no longer retries 400 or 422 (401 was already excluded).enabled.Type of Change
How to Test
?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.npm testcovers both cases, an API 400, and the pending state inOverview.test.tsx, plusqueryRetry.test.tsandtimeRange.test.ts.Checklist
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
RangeFilterand 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.