fix(waterdata): raise RequestTooLarge for an unchunkable over-budget request (not a silent 414)#309
Draft
thodson-usgs wants to merge 1 commit into
Draft
Conversation
…request ChunkPlan's "no chunkable axes" branch returned immediately without sizing the request, deliberately leaving an over-budget URL for the server to reject. So a single large CQL-text `filter` with one big `IN (...)` clause (no top-level `OR`, hence no chunk axis) was shipped verbatim and failed with an opaque HTTP 414 — and not even RequestTooLarge. (The equivalent monitoring_location_id=[...] chunks fine.) Size-check the no-axes path: if the single request fits, pass through as before; if it's over budget there's nothing to split, so raise RequestTooLarge with actionable guidance instead of shipping it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
ChunkPlan's "no chunkable axes" branch returned immediately without sizing the request — its comment even said "if that produces an over-budget URL, the server (or httpx itself) rejects." So a single large CQL-textfilterwith one bigIN (...)clause — which has no top-levelOR, hence yields no chunk axis — was shipped verbatim and failed with an opaque HTTP 414, not even aRequestTooLarge:Fix
Size-check the no-axes path: if the single request fits the byte limit, pass through exactly as before (the common hot path); if it's over budget there's nothing to split, so raise
RequestTooLargewith actionable guidance (narrow the query / simplify the filter / split manually) instead of shipping it.Verification
The chunking suite passes (the old test that asserted "pass an over-budget request through (the server may 414)" is updated to expect
RequestTooLarge, plus a fits→passthrough case).ruffclean.🤖 Generated with Claude Code