ref(seer): Type 10 issue/event/agent/PR seer RPC responses#117876
Open
azulus wants to merge 1 commit into
Open
ref(seer): Type 10 issue/event/agent/PR seer RPC responses#117876azulus wants to merge 1 commit into
azulus wants to merge 1 commit into
Conversation
Replaces the `dict[str, Any]` return annotations on the following seer RPC
methods with explicit Pydantic models so the seer-side SDK consumer sees
declared field shapes:
- `get_issue_details` → `IssueDetailsResponse | None`
- `get_event_details` → `EventDetailsResponse | None`
- `get_issue_and_event_details_v2` → `IssueAndEventDetailsResponse | None`
(single model whose issue-side fields use `exclude_unset` so they're
absent from the wire when `include_issue=False` or the group lookup
failed — matches the pre-typed conditional spread)
- `get_transactions_for_project` → `TransactionsForProjectResponse`
- `get_trace_for_transaction` → `TraceData | EmptyResponse`
- `get_profiles_for_trace` → `TraceProfiles | EmptyResponse`
- `get_issues_for_transaction` → `TransactionIssues | EmptyResponse`
(the four project-scoped RPC wrappers above already built the response
by calling `.dict()` on existing Pydantic models — just return them
directly and use `EmptyResponse` for the `{}` not-found case)
- `bulk_get_project_preferences` → `BulkProjectPreferencesResponse`
(bare `{project_id_str: pref_dict}` map via `__root__` passthrough)
- `record_pr_attribution` → `PrAttributionResponse`
- `update_pr_metrics` → `UpdatePrMetricsSuccessResponse | UpdatePrMetricsErrorResponse`
(discriminated by `success: Literal[True|False]`)
Wire-identical across all paths. The response models that need to be
read like dicts by seer or existing test sites carry a small `_DictProxyMixin`
(`__getitem__`/`__contains__`/`.get`) so the typed return doesn't force
a rewrite of every consumer in the same change.
Comment on lines
+516
to
+517
| def dict(self, **kwargs: Any) -> Any: | ||
| return dict(self.__root__) |
Contributor
There was a problem hiding this comment.
Bug: The dict() method on BulkProjectPreferencesResponse ignores all keyword arguments, which is inconsistent with other Pydantic models in the codebase and violates the expected API contract.
Severity: LOW
Suggested Fix
Modify the dict method in BulkProjectPreferencesResponse to forward keyword arguments to the parent class's method. Change return dict(self.__root__) to return super().dict(**kwargs) to ensure consistent behavior with other Pydantic models.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/sentry/seer/sentry_data_models.py#L516-L517
Potential issue: The `dict()` method override for the `BulkProjectPreferencesResponse`
Pydantic model does not pass through any keyword arguments (`**kwargs`) to the
underlying implementation. Instead, it returns `dict(self.__root__)`, discarding
arguments like `exclude_unset`. This is inconsistent with other response models in the
same file that correctly forward these arguments to `super().dict(**kwargs)`. While
current usage doesn't pass any arguments, this creates a maintenance risk. Future
refactoring or Pydantic version upgrades could introduce calls that rely on these
arguments, leading to silent failures and unexpected serialization behavior.
Did we get this right? 👍 / 👎 to inform future reviews.
gricha
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the
dict[str, Any]return annotations on the following seer RPC methods with explicit Pydantic models so the seer-side SDK consumer sees declared field shapes:get_issue_details→IssueDetailsResponse | Noneget_event_details→EventDetailsResponse | Noneget_issue_and_event_details_v2→IssueAndEventDetailsResponse | None— single model whose issue-side fields useexclude_unsetso they're absent from the wire wheninclude_issue=Falseor the group lookup failed (matches the pre-typed conditional spread)get_transactions_for_project→TransactionsForProjectResponseget_trace_for_transaction→TraceData | EmptyResponseget_profiles_for_trace→TraceProfiles | EmptyResponseget_issues_for_transaction→TransactionIssues | EmptyResponse— the four project-scoped RPC wrappers above already built the response by calling.dict()on existing Pydantic models, so they just return the model directly now and useEmptyResponsefor the{}not-found casebulk_get_project_preferences→BulkProjectPreferencesResponse— bare{project_id_str: pref_dict}map via__root__passthroughrecord_pr_attribution→PrAttributionResponseupdate_pr_metrics→UpdatePrMetricsSuccessResponse | UpdatePrMetricsErrorResponsediscriminated bysuccess: Literal[True|False]Wire-identical across all paths. The response models that need to be read like dicts by seer or existing test sites carry a small
_DictProxyMixin(__getitem__/__contains__/.get) so the typed return doesn't force a rewrite of every consumer in the same change.