Communicate SourceCodeManager's capabilities through RPC#111303
Conversation
Backend Test FailuresFailures on
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test expectations contradict removesuffix("Protocol") in code
- Updated
test_get_capabilitiesto expect protocol names without theProtocolsuffix, matching the implemented and documentedget_capabilitiesbehavior used byget_capabilities_v1.
- Updated
Or push these changes by commenting:
@cursor push a21f8561c9
Preview (a21f8561c9)
diff --git a/tests/sentry/scm/unit/test_scm_actions.py b/tests/sentry/scm/unit/test_scm_actions.py
--- a/tests/sentry/scm/unit/test_scm_actions.py
+++ b/tests/sentry/scm/unit/test_scm_actions.py
@@ -779,53 +779,53 @@
def test_get_capabilities():
assert list(get_capabilities(SourceCodeManager(BaseTestProvider()))) == [
- "CompareCommitsProtocol",
- "CreateBranchProtocol",
- "CreateCheckRunProtocol",
- "CreateGitBlobProtocol",
- "CreateGitCommitProtocol",
- "CreateGitTreeProtocol",
- "CreateIssueCommentProtocol",
- "CreateIssueCommentReactionProtocol",
- "CreateIssueReactionProtocol",
- "CreatePullRequestCommentProtocol",
- "CreatePullRequestCommentReactionProtocol",
- "CreatePullRequestDraftProtocol",
- "CreatePullRequestProtocol",
- "CreatePullRequestReactionProtocol",
- "CreateReviewCommentFileProtocol",
- "CreateReviewCommentReplyProtocol",
- "CreateReviewProtocol",
- "DeleteIssueCommentProtocol",
- "DeleteIssueCommentReactionProtocol",
- "DeleteIssueReactionProtocol",
- "DeletePullRequestCommentProtocol",
- "DeletePullRequestCommentReactionProtocol",
- "DeletePullRequestReactionProtocol",
- "GetBranchProtocol",
- "GetCheckRunProtocol",
- "GetCommitProtocol",
- "GetCommitsByPathProtocol",
- "GetCommitsProtocol",
- "GetFileContentProtocol",
- "GetGitCommitProtocol",
- "GetIssueCommentReactionsProtocol",
- "GetIssueCommentsProtocol",
- "GetIssueReactionsProtocol",
- "GetPullRequestCommentReactionsProtocol",
- "GetPullRequestCommentsProtocol",
- "GetPullRequestCommitsProtocol",
- "GetPullRequestDiffProtocol",
- "GetPullRequestFilesProtocol",
- "GetPullRequestProtocol",
- "GetPullRequestReactionsProtocol",
- "GetPullRequestsProtocol",
- "GetTreeProtocol",
- "MinimizeCommentProtocol",
- "RequestReviewProtocol",
- "UpdateBranchProtocol",
- "UpdateCheckRunProtocol",
- "UpdatePullRequestProtocol",
+ "CompareCommits",
+ "CreateBranch",
+ "CreateCheckRun",
+ "CreateGitBlob",
+ "CreateGitCommit",
+ "CreateGitTree",
+ "CreateIssueComment",
+ "CreateIssueCommentReaction",
+ "CreateIssueReaction",
+ "CreatePullRequestComment",
+ "CreatePullRequestCommentReaction",
+ "CreatePullRequestDraft",
+ "CreatePullRequest",
+ "CreatePullRequestReaction",
+ "CreateReviewCommentFile",
+ "CreateReviewCommentReply",
+ "CreateReview",
+ "DeleteIssueComment",
+ "DeleteIssueCommentReaction",
+ "DeleteIssueReaction",
+ "DeletePullRequestComment",
+ "DeletePullRequestCommentReaction",
+ "DeletePullRequestReaction",
+ "GetBranch",
+ "GetCheckRun",
+ "GetCommit",
+ "GetCommitsByPath",
+ "GetCommits",
+ "GetFileContent",
+ "GetGitCommit",
+ "GetIssueCommentReactions",
+ "GetIssueComments",
+ "GetIssueReactions",
+ "GetPullRequestCommentReactions",
+ "GetPullRequestComments",
+ "GetPullRequestCommits",
+ "GetPullRequestDiff",
+ "GetPullRequestFiles",
+ "GetPullRequest",
+ "GetPullRequestReactions",
+ "GetPullRequests",
+ "GetTree",
+ "MinimizeComment",
+ "RequestReview",
+ "UpdateBranch",
+ "UpdateCheckRun",
+ "UpdatePullRequest",
]
class IncapableProvider:This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
| """ | ||
| for protocol in ALL_PROTOCOLS: | ||
| if isinstance(scm, protocol): | ||
| yield protocol.__name__.removesuffix("Protocol") |
There was a problem hiding this comment.
We should keep the type names the same to simplify usage patterns across the platform's interfaces.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| """Get the names of the protocols implemented by the given SourceCodeManager.""" | ||
| for protocol in ALL_PROTOCOLS: | ||
| if isinstance(scm, protocol): | ||
| yield protocol.__name__ |
There was a problem hiding this comment.
New function missing from module's __all__ export list
Low Severity
The newly added get_capabilities function is not included in the __all__ tuple at the bottom of actions.py. Every other public function in this module is listed in __all__, making this an inconsistency. While explicit imports in rpc.py and tests work fine, anyone using wildcard imports from this module would not get get_capabilities.
| # If a method of SourceCodeManager accepts only JSON-serializable arguments, by names, and | ||
| # returns a JSON-serializable type, then it can be listed here directly. | ||
| # Else, an adapter function must be used. | ||
| "get_capabilities_v1": lambda scm: sorted(get_capabilities(scm)), |
There was a problem hiding this comment.
Curious about this sort call. I assume its a QOL change for the RPC. Could the same be said for local Sentry usage? Do we even want to expose this for local Sentry usage (i.e. should get_capabilities be inlined in the RPC only)?
I have no opinions. We can merge as is.



This exposes the capabilities of a given provider through the SCM RPC. It's used in https://github.com/getsentry/seer/pull/5393.