Skip to content
Merged
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
9 changes: 7 additions & 2 deletions src/sentry/seer/explorer/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def get_replay_metadata(

Returns:
A dict containing the metadata for the replay, or None if it's not found.
The return type is ReplayDetailsResponse.
The return type should conform to ReplayDetailsResponse (may have extra fields).
"""
try:
organization = Organization.objects.get(id=organization_id)
Expand Down Expand Up @@ -567,4 +567,9 @@ def get_replay_metadata(
)
return None

return resp.data["data"]
# Add project_slug field.
result = resp.data["data"]
project = Project.objects.get(id=result["project_id"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Broken Contract: Unhandled Project Not Found

The Project.objects.get(id=result["project_id"]) call lacks exception handling for Project.DoesNotExist. If the replay metadata contains a project_id for a deleted or inaccessible project, the function will crash with an unhandled exception instead of returning None as documented. This breaks the function's contract and differs from the error handling pattern used consistently elsewhere in the same file.

Fix in Cursor Fix in Web

result["project_slug"] = project.slug

return result
Loading