Skip to content

Conversation

@rbro112
Copy link
Member

@rbro112 rbro112 commented Jan 20, 2026

In prep for finally wiping the deprecated mobile-app specific cols from PreprodArtifact, this removes one final read I caught.

Copy link
Member Author

rbro112 commented Jan 20, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 20, 2026
@rbro112 rbro112 changed the title Remove final read of deprecated columns chore(preprod): Remove final read of deprecated columns Jan 20, 2026
Comment on lines +135 to +137
Q(mobile_app_info__app_name__icontains=search_term)
| Q(app_id__icontains=search_term)
| Q(build_version__icontains=search_term)
| Q(mobile_app_info__build_version__icontains=search_term)
Copy link

Choose a reason for hiding this comment

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

Bug: The search query's use of mobile_app_info__... creates an INNER JOIN, hiding artifacts that lack a PreprodArtifactMobileAppInfo record from search results.
Severity: HIGH

Suggested Fix

To fix this, the query should use an outer join. This can be achieved by either restructuring the query or by using a subquery with Exists() to check for the related fields without filtering out the parent records. Alternatively, ensure that every PreprodArtifact has a PreprodArtifactMobileAppInfo record, even if its fields are empty.

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/api/endpoints/builds.py#L135-L137

Potential issue: The new search query uses lookups across the `mobile_app_info`
relationship, such as `Q(mobile_app_info__app_name__icontains=search_term)`. This forces
the Django ORM to perform an `INNER JOIN`. However, the backfill migration and factory
logic only create `PreprodArtifactMobileAppInfo` records for artifacts that already have
mobile app data. As a result, any `PreprodArtifact` without a corresponding
`mobile_app_info` record will be excluded from search results, even if other search
criteria (like `app_id`) should match. This will cause existing artifacts to disappear
from search.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is fine/what we'd intend

@rbro112 rbro112 merged commit 29a779a into master Jan 20, 2026
69 checks passed
@rbro112 rbro112 deleted the ryan/remove_final_read_of_deprecated_columns branch January 20, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants