fix(schema-compiler): Throw UserError for unknown granularity so API returns 400 instead of 500#11288
Merged
ovr merged 1 commit intoJul 20, 2026
Conversation
…returns 400 instead of 500 An unknown granularity in a time dimension (e.g. granularity: "all") is a client input error, but it was thrown as a plain Error, which the API gateway reports as HTTP 500 Internal Server Error. Throw UserError instead so the REST API returns 400 like other invalid-query errors. Co-authored-by: Claude Code <noreply@anthropic.com> Ai-assisted: true
Member
|
/bot-review |
Contributor
|
Claude finished @ovr's task in 49s —— View job Code ReviewVerdict: LGTM — small, correct, well-scoped fix. No blocking issues. Full reviewSummarySwapping the plain Correctness
Tests
Nice-to-haves (optional, not blocking)
Security / performance
|
Member
|
Thank you @BrianSigafoos-SQ for your contribution! |
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.
Check List
Description of Changes Made
Querying a time dimension with an unknown granularity (for example
granularity: "all", which some older clients send) throws a plainErrorfromGranularity's constructor. The API gateway only classifiesUserErroras a client error, so the REST API responds with500 Internal Server Errorfor what is really invalid client input:This change throws
UserErrorinstead, so/v1/loadreturns400for unknown granularities, consistent with other invalid-query errors (unknown members, malformed filters, etc.).Added a unit test in
base-query.test.tscovering the unknown-granularity case; ran the fullCustom granularitiessuite (35 tests) and the schema-compiler linter (0 errors).