fix(preprod): Add organization_slug to snapshot log statements#112499
Merged
NicoHinderling merged 2 commits intomasterfrom Apr 8, 2026
Merged
fix(preprod): Add organization_slug to snapshot log statements#112499NicoHinderling merged 2 commits intomasterfrom
NicoHinderling merged 2 commits intomasterfrom
Conversation
Adds organization_slug to key preprod snapshot log statements for easier filtering by organization in logging dashboards.
mtopo27
approved these changes
Apr 8, 2026
Contributor
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.
Reviewed by Cursor Bugbot for commit a12d0f8. Configure here.
| extra={ | ||
| "head_artifact_id": head_artifact_id, | ||
| "base_artifact_id": base_artifact_id, | ||
| "organization_slug": head_artifact.project.organization.slug, |
Contributor
There was a problem hiding this comment.
Bug: Accessing head_artifact in the generic exception handler can cause a NameError if it was never assigned, masking the original error.
Severity: MEDIUM
Suggested Fix
Initialize head_artifact to None before the try block. In the exception handler, conditionally access head_artifact.project.organization.slug only if head_artifact is not None to prevent the NameError.
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/preprod/snapshots/tasks.py#L742
Potential issue: In the outer `except BaseException:` block, the code accesses
`head_artifact` to log the organization slug. However, if an exception other than
`PreprodArtifact.DoesNotExist` (such as a `DatabaseError` or `TimeoutError`) occurs when
initially fetching `head_artifact`, the variable will not be defined. This will cause a
`NameError` inside the exception handler, which masks the original, more informative
exception and prevents proper error logging and debugging.
Did we get this right? 👍 / 👎 to inform future reviews.
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
## Summary - Adds `organization_slug` to 4 preprod snapshot log statements for easier filtering by organization in logging dashboards - Replaces `organization_id` with `organization_slug` in the snapshot creation log - Adds `organization_slug` to auto-approve, comparison complete, and comparison failed logs doing this for our sentry dashboard usage
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.

Summary
organization_slugto 4 preprod snapshot log statements for easier filtering by organization in logging dashboardsorganization_idwithorganization_slugin the snapshot creation logorganization_slugto auto-approve, comparison complete, and comparison failed logsdoing this for our sentry dashboard usage