Return 400 instead of 404 for a malformed date query parameter (fixes #159) #562
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 289 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #562"
general
weight: 0.35
tonygermano
Return 400 instead of 404 for a malformed date query parameter (fixes #159)
Problem
GET /api/channels/{channelId}/messages(and the other message endpoints) takestartDate/endDateas@QueryParam Calendar, converted byCalendarParamConverterProvider. On a malformed date,fromStringthrowsProcessingException, which Jersey surfaces as 404 Not Found:404 is misleading for a bad parameter value — the caller should get a 400 that says
what was wrong.
Fix
Throw
BadRequestException(400) from the converter, with a message naming the value andthe expected format:
JAX-RS honors a
WebApplicationExceptionthrown from aParamConverter(and noExceptionMappers are registered that would override it), so the response status is 400.Valid dates are unaffected.
Tests
CalendarParamConverterProviderTest:nullreturnsnullfromStringthentoString)BadRequestExceptionwith status 400./gradlew :server:test --tests "CalendarParamConverterProviderTest"→ 3 tests, 0 failures.Note on verification
The project has no Jersey HTTP test harness, so this is verified at the converter level —
the same approach as the existing
MetaDataSearchParamConverterProviderTest. TheHTTP-level 400 follows from JAX-RS
WebApplicationExceptionhandling as described above.Release Note
The message API returns 400 instead of 404 for a malformed date
A
startDateorendDatequery parameter that isn't in the formatyyyy-MM-dd'T'HH:mm:ss.SSSZnow gets a 400 Bad Request instead of a 404 Not Found. This applies to every message endpoint that takes these parameters, such asGET /api/channels/{channelId}/messages. The response message names the value that was rejected and shows the expected format, for example1985-10-26T09:00:00.000-0700. Valid dates work as before. (#159, #562)If a script treated the 404 from a bad date as "channel not found", update it to check for 400 as well.