Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/sentry/seer/code_review/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

from pydantic import BaseModel, Field

from sentry.seer.models import SeerRepoDefinition

# =============================================================================
# Code Review Models (ported from Seer)
# =============================================================================
Expand Down Expand Up @@ -118,17 +116,6 @@ class SeerCodeReviewRepoForPrClosed(SeerCodeReviewRepoDefinition):
# =============================================================================


class SeerCodeReviewBaseRequest(BaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import after removing its only consumer

Low Severity

The SeerRepoDefinition import from sentry.seer.models is now unused. It was previously consumed by the removed SeerCodeReviewBaseRequest class (which used it as the type for repo and more_readable_repos). After this PR removes that class, the only remaining reference is inside a comment string on line 79. This is dead code left behind by the model cleanup.

Fix in Cursor Fix in Web

repo: SeerRepoDefinition
pr_id: int
more_readable_repos: list[SeerRepoDefinition] = Field(default_factory=list)


class SeerCodeReviewRequest(SeerCodeReviewBaseRequest):
bug_prediction_specific_information: BugPredictionSpecificInformation
config: SeerCodeReviewConfig | None = None


class SeerCodeReviewRequestForPrReview(BaseModel):
"""Request model for PR review with optional organization_id and integration_id."""

Expand All @@ -150,12 +137,6 @@ class SeerCodeReviewRequestForPrClosed(BaseModel):
config: SeerCodeReviewConfig | None = None


class SeerCodeReviewTaskRequest(BaseModel):
data: SeerCodeReviewRequest
external_owner_id: str
request_type: SeerCodeReviewRequestType


class SeerCodeReviewTaskRequestForPrReview(BaseModel):
"""Task request wrapper for PR review."""

Expand Down
11 changes: 7 additions & 4 deletions src/sentry/seer/code_review/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def transform_webhook_to_codegen_request(
target_commit_sha: str,
) -> dict[str, Any] | None:
"""
Transform a GitHub webhook payload into SeerCodeReviewRequest format for Seer.
Transform a GitHub webhook payload into a code review request format for Seer.

Args:
github_event: The GitHub webhook event type
Expand All @@ -216,7 +216,8 @@ def transform_webhook_to_codegen_request(
target_commit_sha: The target commit SHA for PR review (head of the PR at the time of webhook event)

Returns:
Dictionary in SeerCodeReviewRequest format with request_type, data, and external_owner_id,
Dictionary with request_type, data, and external_owner_id that matches either
SeerCodeReviewTaskRequestForPrReview or SeerCodeReviewTaskRequestForPrClosed format,
or None if the event is not PR-related (e.g., issue_comment on regular issues)
"""
payload = None
Expand Down Expand Up @@ -268,7 +269,9 @@ def transform_issue_comment_to_codegen_request(
target_commit_sha: str,
) -> dict[str, Any] | None:
"""
Transform an issue comment on a PR into a CodecovTaskRequest for Seer.
Transform an issue comment on a PR into a code review request for Seer.

Returns a dictionary matching SeerCodeReviewTaskRequestForPrReview format.
"""
payload = _common_codegen_request_payload(
SeerCodeReviewRequestType.PR_REVIEW, # An issue comment on a PR is a PR review request
Expand Down Expand Up @@ -333,7 +336,7 @@ def transform_pull_request_to_codegen_request(

def _build_repo_definition(repo: Repository, target_commit_sha: str) -> dict[str, Any]:
"""
Build the repository definition for the CodecovTaskRequest.
Build the repository definition for code review requests.
"""
# Extract owner and repo name from full repository name (format: "owner/repo")
repo_name_sections = repo.name.split("/")
Expand Down
Loading