-
Notifications
You must be signed in to change notification settings - Fork 0
Cleanup and fixing comments #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdded compile-time ResourceSyncerV2 assertions to multiple builders, removed the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (5)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/connector/privilege.go (1)
52-59: Typo: stray backtick in display name format string.Line 58 has a backtick (`) instead of what appears should be no special character or possibly a closing parenthesis.
🔎 Proposed fix
- entitlement.WithDisplayName(fmt.Sprintf("%s have %s`", collaboratorResourceType.DisplayName, resource.DisplayName)), + entitlement.WithDisplayName(fmt.Sprintf("%s have %s", collaboratorResourceType.DisplayName, resource.DisplayName)),
🧹 Nitpick comments (1)
pkg/connector/privilege.go (1)
70-75: Remove unusedcachefield fromprivilegeBuilder.The
cachefield is initialized in the constructor but never used in any of theprivilegeBuildermethods (List,Entitlements,Grants). Other builders in the codebase that use cache (e.g.,collaboratorBuilder,roleBuilder) actively reference their cache fields, making this instance clearly unused dead code.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
pkg/connector/collaborator.go(2 hunks)pkg/connector/connector.go(1 hunks)pkg/connector/folder.go(5 hunks)pkg/connector/privilege.go(5 hunks)pkg/connector/project.go(3 hunks)pkg/connector/role.go(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
pkg/connector/privilege.go (1)
pkg/connector/client/client.go (1)
WorkatoClient(28-33)
🔇 Additional comments (9)
pkg/connector/collaborator.go (1)
8-8: LGTM!The compile-time interface conformance assertion is a good practice. It ensures
collaboratorBuilderimplementsResourceSyncerV2at compile time, catching any interface drift early.Also applies to: 23-24
pkg/connector/connector.go (1)
31-31: LGTM!The constructor call correctly aligns with the updated
newPrivilegeBuildersignature that now only requires the client parameter.pkg/connector/folder.go (2)
11-11: LGTM!The compile-time interface conformance assertion ensures
folderBuilderimplementsResourceSyncerV2at compile time.Also applies to: 25-26
97-98: LGTM!The updated comments now accurately describe folder-focused semantics for
EntitlementsandGrantsmethods.Also applies to: 111-112
pkg/connector/role.go (1)
41-42: LGTM!The updated comments accurately describe role-focused semantics for
List,Entitlements, andGrantsmethods.Also applies to: 88-89, 101-101
pkg/connector/project.go (2)
6-6: LGTM!The compile-time interface conformance assertion ensures
projectBuilderimplementsResourceSyncerV2at compile time.Also applies to: 14-15
24-24: LGTM!The updated comments accurately describe project-focused semantics.
Also applies to: 54-54
pkg/connector/privilege.go (2)
7-7: LGTM!The compile-time interface conformance assertion ensures
privilegeBuilderimplementsResourceSyncerV2at compile time.Also applies to: 21-22
32-33: LGTM!The updated comments accurately describe privilege-focused semantics.
Also applies to: 65-66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/connector/folder.go (1)
101-101: Minor typo:assigmentOptionsshould beassignmentOptions.Missing 'n' in "assignment".
🔎 Proposed fix
- assigmentOptions := []entitlement.EntitlementOption{ + assignmentOptions := []entitlement.EntitlementOption{ entitlement.WithGrantableTo(collaboratorResourceType), entitlement.WithDescription(fmt.Sprintf("%s can access %s", collaboratorResourceType.DisplayName, resource.DisplayName)), entitlement.WithDisplayName(fmt.Sprintf("%s access %s", collaboratorResourceType.DisplayName, resource.DisplayName)), } - rv = append(rv, entitlement.NewPermissionEntitlement(resource, collaboratorAccessEntitlement, assigmentOptions...)) + rv = append(rv, entitlement.NewPermissionEntitlement(resource, collaboratorAccessEntitlement, assignmentOptions...))
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
pkg/connector/folder.go(5 hunks)pkg/connector/project.go(3 hunks)
🔇 Additional comments (5)
pkg/connector/project.go (2)
14-15: Good addition of compile-time interface conformance check.This is a best practice that ensures
projectBuilderimplementsResourceSyncerV2at compile time, catching any missing methods early.
49-57: Comments and implementations look good.The previous typo ("an an") has been fixed, and the comments now accurately describe that projects are not assignable/grantable.
pkg/connector/folder.go (3)
25-26: Good addition of compile-time interface conformance check.This ensures
folderBuilderimplementsResourceSyncerV2at compile time.
37-95: List implementation looks correct.The double period typo from the previous review has been fixed. The function correctly handles:
nilparent (early return)- Project parent type (fetches project folders)
- Folder parent type (fetches subfolders)
- Unknown parent types (logs warning and returns gracefully)
111-173: Grants implementation looks well-structured.The pagination logic using the bag pattern is clean, and the conditional role sync based on
disableCustomRolesSyncis appropriate. The grant annotations withGrantExpandableare correctly set up for entitlement expansion. ThegetRoleByFolderfunction is properly defined in the same package and accessible.
JavierCarnelli-ConductorOne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just out of curiosity, why are you including var _ connectorbuilder.ResourceSyncerV2 = (*resourceBuilder)(nil) to the resources?
What use does it have?
https://github.com/uber-go/guide/blob/master/style.md#verify-interface-compliance |
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.