feat: implement CheckCurrentUserPATTitle RPC by AmanGIT07 · Pull Request #1469 · raystack/frontier
Warning
Rate limit exceeded
@AmanGIT07 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 35 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.
We recommend that you space out your commits to avoid hitting the rate limit.
🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 577f7c09-40fa-412e-b783-9630d51e02ac
📒 Files selected for processing (1)
pkg/server/connect_interceptors/authorization.go
📝 Walkthrough
Walkthrough
Adds a CheckCurrentUserPATTitle API and related IsTitleAvailable plumbing across service, repository, mocks, handler, proto/connect, validation, tests, and authorization skip-list; also updates a Makefile commit hash.
Changes
| Cohort / File(s) | Summary |
|---|---|
Build Configuration Makefile |
Updated PROTON_COMMIT hash used by the proto target. |
Core PAT Layer core/userpat/userpat.go, core/userpat/service.go, core/userpat/service_test.go, core/userpat/mocks/repository.go |
Added IsTitleAvailable to Repository interface, implemented Service.IsTitleAvailable with enabled-flag guard, added unit tests, and extended mocks with expectation helpers. |
Internal API / Connect internal/api/v1beta1connect/interfaces.go, internal/api/v1beta1connect/mocks/user_pat_service.go, internal/api/v1beta1connect/user_pat.go, internal/api/v1beta1connect/user_pat_test.go |
Added CheckCurrentUserPATTitle handler, connect interface and mock method; handler validates principal/request, calls service, logs and maps errors to Connect codes, and has tests for auth/validation/service error paths. |
Database Layer internal/store/postgres/userpat_repository.go |
Implemented IsTitleAvailable using a NOT EXISTS subquery with case-insensitive title match and deleted-row filtering; wraps SQL generation and exec errors. |
Authorization Configuration pkg/server/connect_interceptors/authorization.go |
Added PAT procedures (GetCurrentUserPAT, DeleteCurrentUserPAT, CheckCurrentUserPATTitle, ListRolesForPAT) to the skip-authorization map. |
Protobuf Validation & Connect Stubs proto/v1beta1/frontier.pb.validate.go, proto/v1beta1/frontierv1beta1connect/frontier.connect.go |
Generated validators for new/updated PAT request/response messages (Validate/ValidateAll, ValidationError/MultiError types) and added three FrontierService RPCs: UpdateCurrentUserPAT, RegenerateCurrentUserPAT, CheckCurrentUserPATTitle with client/handler wiring and unimplemented stubs. |
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
- feat: CreateCurrentUserPAT RPC implementation #1401: Adds and modifies PAT domain code and API surface; overlaps with repository, service, handlers, and proto changes in this PR.
- feat: implement DeleteCurrentUserPAT RPC #1460: Related PAT subsystem changes (additional PAT endpoints and repository/service updates) that complement this PR's title-availability feature.
Suggested reviewers
- whoAbhishekSah
- rohilsurana
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 @coderabbitai help to get the list of available commands and usage tips.