fix: validate UUID in user Enable and Disable RPCs#1439
Merged
whoAbhishekSah merged 1 commit intomainfrom Mar 5, 2026
Merged
Conversation
The Enable and Disable methods in the user service were passing the user ID directly to the repository without validating it is a valid UUID. This caused invalid IDs to reach PostgreSQL and return confusing "not found" errors instead of proper "invalid ID" errors. Add UUID validation using utils.IsValidUUID() at the start of both methods, consistent with how GetByID and Update already validate. The handlers already map ErrInvalidID to CodeInvalidArgument, so callers now correctly receive a 400 Bad Request for invalid UUIDs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughUUID validation was added to the Enable and Disable methods in the user service to reject invalid IDs early. Corresponding test suites with multiple scenarios—valid UUIDs, invalid/empty IDs, and not-found users—were added to cover both methods. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 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 |
Pull Request Test Coverage Report for Build 22707974817Details
💛 - Coveralls |
rohilsurana
approved these changes
Mar 5, 2026
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.
Summary
user.Service.Enable()anduser.Service.Disable()before calling the repository, returningErrInvalidIDfor invalid UUIDsGetByIDandUpdatemethods in the same serviceTest plan
TestService_DisableandTestService_Enable(8 new test cases)TestConnectHandler_DisableUserandTestConnectHandler_EnableUsercore/usertest suite passesinvalid_argument:🤖 Generated with Claude Code