Skip to content

Ignore undeclared query parameters on the legacy economy routes - #3833

Merged
MaxGhenis merged 2 commits into
masterfrom
max/economy-query-ignore-unknown-20260911
Sep 11, 2026
Merged

Ignore undeclared query parameters on the legacy economy routes#3833
MaxGhenis merged 2 commits into
masterfrom
max/economy-query-ignore-unknown-20260911

Conversation

@MaxGhenis

Copy link
Copy Markdown
Collaborator

Why

The staging deploy for 5cdf95a1 (the version bump after #3827) failed Run Cloud Run staging integration tests: test_live_utah_macro_reform and the three budget-window cache tests got HTTP 400 from the candidate. Reproduced against the candidate URL:

{"status": "error", "message": "staging_probe: Extra inputs are not permitted", "result": null}

#3827 routed the legacy economy GET routes through the typed AnnualEconomyQuery / BudgetWindowEconomyQuery models, which inherit extra="forbid" from the v2 query contracts. The live suite appends a staging_probe correlation id to every economy request, and before #3827 these routes accepted any query string.

What

  • EconomyQuery sets extra="ignore". 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, so tolerance selects nothing new.
  • The route test that pinned the rejection now pins the tolerance for a misspelled spmm and for staging_probe, on both the annual and budget-window routes.
  • docs/canonical-spm.md states 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

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

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.04%. Comparing base (5cdf95a) to head (19b456f).
⚠️ Report is 3 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaxGhenis
MaxGhenis merged commit 7a0e589 into master Sep 11, 2026
14 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