fix(api): enforce squad number immutability on PUT#531
fix(api): enforce squad number immutability on PUT#531nanotaboada wants to merge 1 commit intomasterfrom
Conversation
Add a mismatch guard in put_async: if squad_number in the request body does not match the path parameter, return HTTP 400 Bad Request. The path parameter is the authoritative source of identity on PUT. Document the single-model design decision in PlayerRequestModel: one model intentionally covers both POST and PUT, with per-operation differences handled at the route layer. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR implements squad number immutability enforcement on the PUT endpoint. When a client submits a PUT request with a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Possibly related PRs
📋 Issue PlannerLet us write the prompt for your AI agent so you can ship faster (with fewer bugs). View plan for ticket: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #531 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 111 113 +2
=========================================
+ Hits 111 113 +2
🚀 New features to boost your workflow:
|



Summary
put_async: ifsquad_numberin the request bodydoes not match the path parameter, return HTTP 400 Bad Request
PlayerRequestModelmoduledocstring, explaining why one model covers both POST and PUT
test_request_put_player_squadnumber_mismatch_response_status_bad_requestTest plan
PUT /players/squadnumber/23with bodysquadNumber: 999→ 400 Bad RequestPUT /players/squadnumber/23with bodysquadNumber: 23→ 204 No ContentPUT /players/squadnumber/999(unknown) with matching body → 404 Not FoundPUT /players/squadnumber/23with empty body → 422 Unprocessable EntityCloses #529
🤖 Generated with Claude Code
This change is
Summary by CodeRabbit