Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR introduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~35 minutes Possibly related PRs
Suggested reviewers
📝 Coding Plan
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/api/v1beta1connect/user_pat_test.go (1)
924-1060: Add a test for request validation failure (CodeInvalidArgument).Current cases cover auth/service outcomes well, but not the
request.Msg.Validate()failure path. A dedicated case would lock in that mapping and ensureIsTitleAvailableis not called on invalid input.Suggested test case addition
+{ + name: "should return invalid argument when request validation fails", + setup: func(ps *mocks.UserPATService, as *mocks.AuthnService) { + as.EXPECT().GetPrincipal(mock.Anything).Return(authenticate.Principal{ + ID: testUserID, + Type: schema.UserPrincipal, + User: &user.User{ID: testUserID}, + }, nil) + }, + request: connect.NewRequest(&frontierv1beta1.CheckCurrentUserPATTitleRequest{ + OrgId: "", + Title: "", + }), + wantErr: connect.NewError(connect.CodeInvalidArgument, ErrBadRequest), +},
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1413893b-8722-42aa-975f-f7c091b01a6b
⛔ Files ignored due to path filters (1)
proto/v1beta1/frontier.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (13)
Makefilecore/userpat/mocks/repository.gocore/userpat/service.gocore/userpat/service_test.gocore/userpat/userpat.gointernal/api/v1beta1connect/interfaces.gointernal/api/v1beta1connect/mocks/user_pat_service.gointernal/api/v1beta1connect/user_pat.gointernal/api/v1beta1connect/user_pat_test.gointernal/store/postgres/userpat_repository.gopkg/server/connect_interceptors/authorization.goproto/v1beta1/frontier.pb.validate.goproto/v1beta1/frontierv1beta1connect/frontier.connect.go
Pull Request Test Coverage Report for Build 23341279702Details
💛 - Coveralls |
Description:
Summary
CheckCurrentUserPATTitleRPC to check if a PAT title is available for the current user in a given orgLOWER()in PostgresChanges
CheckCurrentUserPATTitleRPC, request (org_id, title), response (available: bool)IsTitleAvailable—NOT EXISTSquery matching the partial unique index (user_id, org_id, title WHERE deleted_at IS NULL)IsTitleAvailable— disabled check + delegates to repocore/userpatto.mockery.yamlManual test verification