Skip to content

Add solo snapshot status checks#110167

Merged
rbro112 merged 3 commits intomasterfrom
ryan/add_solo_snapshot_status_checks
Mar 9, 2026
Merged

Add solo snapshot status checks#110167
rbro112 merged 3 commits intomasterfrom
ryan/add_solo_snapshot_status_checks

Conversation

@rbro112
Copy link
Copy Markdown
Member

@rbro112 rbro112 commented Mar 6, 2026

Adds solo snapshot status checks. Three cases:

First upload (success - no base to be found)
Screenshot 2026-03-06 at 12 02 28 PM

Uploaded and no base provided (success - main branch is the use case here)
Screenshot 2026-03-06 at 10 49 16 AM

Uploaded and base provided but not found (error)
Screenshot 2026-03-06 at 2 23 39 PM

@rbro112 rbro112 requested a review from a team as a code owner March 6, 2026 22:27
Copy link
Copy Markdown
Member Author

rbro112 commented Mar 6, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

Backend Test Failures

Failures on b90ff76 in this run:

tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py::SnapshotProcessingStateFormattingTest::test_comparison_in_pending_state_shows_comparinglog
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py:136: in test_comparison_in_pending_state_shows_comparing
    assert "Comparing" in summary
E   AssertionError: assert 'Comparing' in '| Name | Added | Removed | Modified | Renamed | Unchanged | Status |\n| :--- | :---: | :---: | :---: | :---: | :---: ...tserver/organizations/concise-redbird/preprod/snapshots/13)<br>`com.example.head` | - | - | - | - | - | ⏳ Processing |'
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py::SnapshotMixedStateFormattingTest::test_mixed_success_and_processinglog
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py:491: in test_mixed_success_and_processing
    assert "Comparing" in summary
E   AssertionError: assert 'Comparing' in '| Name | Added | Removed | Modified | Renamed | Unchanged | Status |\n| :--- | :---: | :---: | :---: | :---: | :---: ...//testserver/organizations/pet-boa/preprod/snapshots/65)<br>`com.example.pending` | - | - | - | - | - | ⏳ Processing |'
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py::SnapshotFirstUploadFormattingTest::test_first_upload_summary_table_formatlog
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py:743: in test_first_upload_summary_table_format
    assert summary == expected
E   AssertionError: assert '| Name | Sna... main branch.' == '| Name | Sna... main branch.'
E     
E     Skipping 162 identical leading characters in diff, use -v to show
E       loaded |
E       
E     - > This looks like your first snapshot upload. Snapshot diffs will appear when we have a base upload to compare against. Make sure to upload snapshots from your main branch.
E     ? --
E     + This looks like your first snapshot upload. Snapshot diffs will appear when we have a base upload to compare against. Make sure to upload snapshots from your main branch.
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py::SnapshotMissingBaseFormattingTest::test_missing_base_summary_table_formatlog
tests/sentry/preprod/vcs/status_checks/snapshots/test_templates.py:810: in test_missing_base_summary_table_format
    assert summary == expected
E   AssertionError: assert '| Name | Sna... main branch.' == '| Name | Sna... main branch.'
E     
E     Skipping 166 identical leading characters in diff, use -v to show
E       loaded |
E       
E     - > No base snapshots found to compare against. Make sure snapshots are uploaded from your main branch.
E     ? --
E     + No base snapshots found to compare against. Make sure snapshots are uploaded from your main branch.

all_artifacts,
snapshot_metrics_map,
)
else:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

https://github.com/EmergeTools/hackernews/runs/66045496060

can't we have valid solo success cases that aren't the first upload? like on main branch?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call, adding the proper support here will require checking the presence of a base_sha but no matching build. Will implement this as a follow up - EME-921

For now, we'll return SUCCESS to match existing Emerge behavior

Comment on lines +172 to +178
# TODO(EME-921) Add logic to fail if there's any base_sha set but no base artifact
status = StatusCheckStatus.SUCCESS
title, subtitle, summary = format_missing_base_snapshot_status_check_messages(
all_artifacts,
snapshot_metrics_map,
)
else:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The query for has_previous_snapshots incorrectly handles NULL values in commit_comparison_id, as .exclude() will not filter them out, leading to an incorrect is_first_upload determination.
Severity: MEDIUM

Suggested Fix

Modify the query to explicitly handle NULL values. Chain a second .exclude() call, such as .exclude(preprod_artifact__commit_comparison_id__isnull=True), to ensure records with a null commit_comparison_id are also filtered from the result set.

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/vcs/status_checks/snapshots/tasks.py#L172-L178

Potential issue: The query to determine if previous snapshots exist uses
`.exclude(preprod_artifact__commit_comparison_id=commit_comparison.id)` to filter out
the current commit. However, the `commit_comparison` foreign key on the
`PreprodArtifact` model is nullable. The `.exclude()` filter will not match records
where `commit_comparison_id` is `NULL`. This causes the query to incorrectly include
older snapshots that have a null `commit_comparison_id`, leading the system to wrongly
conclude that `is_first_upload` is `False`. As a result, users may see an incorrect
status message, such as "No base snapshots found," instead of the correct "This looks
like your first snapshot upload" message.

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

else:
# TODO(EME-921) Add logic to fail if there's any base_sha set but no base artifact
status = StatusCheckStatus.SUCCESS
title, subtitle, summary = format_missing_base_snapshot_status_check_messages(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure if you want this to the message for the success case but I'll assume that will be addressed as part of EME-921

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I'll take that on as part of 921 (added a note), but I think having the message still show missing base for now is fine.

@rbro112 rbro112 merged commit 4feb45c into master Mar 9, 2026
55 checks passed
@rbro112 rbro112 deleted the ryan/add_solo_snapshot_status_checks branch March 9, 2026 18:26
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants