Repository navigation
fix(api): return 404 when changing the role of a missing user - #699
Merged
Merged
Conversation
PATCH /users/{id} with a role on a deleted user passed sql.ErrNoRows to httperr, which maps it to 500. Return 404 user not found, like the non-role path does. The branch test that pinned the 500 now expects 404.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
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 |
CI Report - 91e30cerun 38640149328 - attempt 1 0 failed - 22 passed - 10 skipped - 48m17s elapsed Coverageno coverage/* commit statuses found on 91e30ce Changed
Slowest jobs
e2e buckets run
|
ValgulNecron
marked this pull request as ready for review
October 14, 2026 22:16
ValgulNecron
pushed a commit
that referenced
this pull request
Oct 14, 2026
With #699 merged, changing a deleted user's role returns 404 "user not found". The error path now changes the role in the Edit dialog and asserts the inline alert, as T040 specifies, instead of using the namespace-grant 404. Tick T040. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
ValgulNecron
pushed a commit
that referenced
this pull request
Oct 15, 2026
G-08 closes on live run 38649266488, where the users spec asserts the role-change 404 from #699. T044 is done: typecheck:e2e passes and the login count and duration are recorded. Summary recounted to 15/24 closed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
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.
Before:
PATCH /users/{id}with aroleon a user that no longer exists returned 500 "internal error". The role UPDATE touched 0 rows and the handler passedsql.ErrNoRowstohttperr.Write, which does not map it, so it fell through to 500.After: the same request returns 404 "user not found", matching what the endpoint already returns for a missing user on the non-role path.
How:
api/internal/handlers/users.gowriteshttp.Error(w, "user not found", http.StatusNotFound)whenRowsAffectedis 0. Test change (valgul signed off on the spec 013 card, 2026-10-14): the subtest inapi/internal/handlers/users_branches_test.gothat pinned the 500 is renamed to "role update on a missing user is 404 (RowsAffected path)" and now asserts 404. Found while writing the spec 013 T040 live spec; once this merges, T040's error path asserts this 404.🤖 Generated with Claude Code
Generated by Claude Code