Conversation
WalkthroughRemoved the Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Connector as UserConnector
Note over Caller,Connector: New flow (post-change)
Caller->>Connector: Delete(user)
Note right of Connector: No Delete implementation exists\n(no external Slack interaction)
Connector-->>Caller: (no deletion capability exposed)
sequenceDiagram
autonumber
actor Caller
participant Connector as UserConnector
participant Slack as Slack API
Note over Caller,Slack: Prior flow (removed)
Caller->>Connector: Delete(user)
Connector->>Slack: Lookup user / Remove (enterprise client)
Slack-->>Connector: Success / Rate limit / Error
alt success
Connector-->>Caller: nil
else rate limited
Connector-->>Caller: Retryable/RateLimit error
else errors
Connector-->>Caller: Specific error
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
pkg/connector/user.go(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test-member
pkg/connector/user.go
Outdated
| // Delete user can't be done via the Slack API. | ||
| func (o *userResourceType) Delete(ctx context.Context, resourceId *v2.ResourceId) (annotations.Annotations, error) { | ||
| if o.enterpriseClient == nil { | ||
| return nil, fmt.Errorf("baton-slack: enterprise client required for user deletion") | ||
| } | ||
|
|
||
| userID := resourceId.Resource | ||
| outputAnnotations := annotations.New() | ||
|
|
||
| user, ratelimitData, err := o.enterpriseClient.GetUserInfo(ctx, userID) | ||
| outputAnnotations.WithRateLimiting(ratelimitData) | ||
| if err != nil { | ||
| return outputAnnotations, fmt.Errorf("baton-slack: failed to get user info: %w", err) | ||
| } | ||
|
|
||
| ratelimitData, err = o.enterpriseClient.RemoveUser(ctx, user.Profile.Team, userID) | ||
| outputAnnotations.WithRateLimiting(ratelimitData) | ||
| if err != nil { | ||
| if err.Error() == enterprise.SlackErrUserAlreadyDeleted { | ||
| return outputAnnotations, nil | ||
| } | ||
| return outputAnnotations, fmt.Errorf("baton-slack: failed to delete user %s: %w", userID, err) | ||
| } | ||
|
|
||
| return outputAnnotations, nil | ||
| return nil, fmt.Errorf("baton-slack: delete user not supported") | ||
| } |
There was a problem hiding this comment.
Return the standardized “not implemented” error.
The rest of the connector surface uses the shared connectorbuilder.ErrNotImplemented (or wraps it) to signal unsupported operations. Returning a plain fmt.Errorf here deviates from that contract, so the SDK will treat this as an opaque failure instead of a capability verdict. Please swap the error for the canonical sentinel (and wrap with context/fmt.Errorf if you need a message).
🤖 Prompt for AI Agents
In pkg/connector/user.go around lines 304 to 307, the Delete implementation
returns a plain fmt.Errorf which deviates from the connector contract; replace
the returned error with the shared sentinel connectorbuilder.ErrNotImplemented
(or wrap it with fmt.Errorf to add context, e.g. fmt.Errorf("delete user: %w",
connectorbuilder.ErrNotImplemented)) so the SDK recognizes this as an
unsupported operation rather than an opaque failure.
Summary by CodeRabbit
Breaking Changes
User Impact