Ignore undeclared query parameters on the legacy economy routes - #3833
Merged
Conversation
The typed economy query parser introduced in #3827 inherited the v2 contracts' rejection of every undeclared field, so the release gate's live suite, which appends a staging_probe correlation id to every economy request, received HTTP 400 from the staging candidate for 5cdf95a and production was not promoted. Before #3827 these GET routes accepted any query string. Ignore undeclared parameters on EconomyQuery only. Declared parameters keep their validation, repeated scalars are still rejected, and the spm selection object stays strict; an omitted or misspelled spm inherits the certified default measurement either way. The route test that pinned the rejection now pins the tolerance for both a misspelled selection and the probe parameter. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The changelog fragment ended in a literal backslash-n; write a real newline. The api-routes skill and the base class docstring said every undeclared query parameter is rejected, which is now false for the legacy economy GET family alone, so both name the exception and a guard test asserts that no other StrictQueryParameters subclass ignores undeclared parameters. The canonical SPM document says which repeated keys return 400: declared ones. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3833 +/- ##
===========================================
+ Coverage 48.63% 88.04% +39.40%
===========================================
Files 164 179 +15
Lines 9736 10854 +1118
Branches 1668 1917 +249
===========================================
+ Hits 4735 9556 +4821
+ Misses 4612 772 -3840
- Partials 389 526 +137 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Why
The staging deploy for
5cdf95a1(the version bump after #3827) failedRun Cloud Run staging integration tests:test_live_utah_macro_reformand the three budget-window cache tests got HTTP 400 from the candidate. Reproduced against the candidate URL:#3827 routed the legacy economy GET routes through the typed
AnnualEconomyQuery/BudgetWindowEconomyQuerymodels, which inheritextra="forbid"from the v2 query contracts. The live suite appends astaging_probecorrelation id to every economy request, and before #3827 these routes accepted any query string.What
EconomyQuerysetsextra="ignore". Declared parameters keep their validation, repeated scalars are still rejected, and thespmselection object stays strict. An omitted or misspelledspminherits the certified default measurement either way, so tolerance selects nothing new.spmmand forstaging_probe, on both the annual and budget-window routes.docs/canonical-spm.mdstates the behavior; changelog fragment added.Verification
uv run --frozen --extra dev python -m pytest tests/unit/routes/test_economy_spm_query.py tests/unit/test_query_parameters.py tests/unit/test_openapi_spm.py: 96 passed.ruff format --check .: clean.mypy: no issues.🤖 Generated with Claude Code