fix: reject structured weather query parameters #25

Merged
graham merged 1 commit from fix/w8-weather-query-params into main 2026-09-15 16:34:02 -05:00
Owner

Fixes W8 from bugs.md.

Adds terminal clauses to validate_required_float/2 and validate_optional_integer/3 so array/map query values (?lat[]=1, ?limit[a]=1) return the documented 400 instead of raising CaseClauseError into a 500 and an ErrorTracker row. Three regression tests cover array/map lat and array limit.

Verification: focused weather controller tests passed (20), full suite passed (2238), mix credo --strict, and commit hooks including Dialyzer passed.

Fixes W8 from bugs.md. Adds terminal clauses to `validate_required_float/2` and `validate_optional_integer/3` so array/map query values (`?lat[]=1`, `?limit[a]=1`) return the documented 400 instead of raising `CaseClauseError` into a 500 and an ErrorTracker row. Three regression tests cover array/map lat and array limit. Verification: focused weather controller tests passed (20), full suite passed (2238), `mix credo --strict`, and commit hooks including Dialyzer passed.
fix: reject structured weather query parameters
All checks were successful
Elixir CI / Dialyzer (pull_request) Successful in 40s
Elixir CI / Build and test (pull_request) Successful in 1m40s
Elixir CI / Build and Push Docker Image (pull_request) Has been skipped
skippy-bot/review Skippy review: clean — no open findings
b2ad7b87e6
First-time contributor

No findings. The two terminal clauses now cover every shape Plug can decode into these keys — lists (from lat[]=, lat[]=a&lat[]=b, or a repeated plain key) and maps (from lat[a]=) — and both fall through to the same {:error, :bad_request, msg} tuple the action fallback already renders as 400, so the CaseClauseError → 500 path is closed for lat/lon/radius/hours/limit alike (lon, radius and hours have no test but share the same clauses).

The three regression tests drive real nested params through Plug's query encoder rather than a synthetic map, so they would genuinely fail if either clause regressed.

No findings. The two terminal clauses now cover every shape Plug can decode into these keys — lists (from `lat[]=`, `lat[]=a&lat[]=b`, or a repeated plain key) and maps (from `lat[a]=`) — and both fall through to the same `{:error, :bad_request, msg}` tuple the action fallback already renders as 400, so the `CaseClauseError` → 500 path is closed for `lat`/`lon`/`radius`/`hours`/`limit` alike (`lon`, `radius` and `hours` have no test but share the same clauses). The three regression tests drive real nested params through Plug's query encoder rather than a synthetic map, so they would genuinely fail if either clause regressed. <!-- skippy-pr-review -->
graham merged commit 4c4bd4bb2b into main 2026-09-15 16:34:02 -05:00
graham deleted branch fix/w8-weather-query-params 2026-09-15 16:34:02 -05:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
graham/aprs.me!25
No description provided.