Skip to content

feat(build): Add --selective flag to snapshots command#3268

Merged
NicoHinderling merged 6 commits intomasterfrom
nico/build-snapshots-all-image-names
Apr 15, 2026
Merged

feat(build): Add --selective flag to snapshots command#3268
NicoHinderling merged 6 commits intomasterfrom
nico/build-snapshots-all-image-names

Conversation

@NicoHinderling
Copy link
Copy Markdown
Contributor

@NicoHinderling NicoHinderling commented Apr 14, 2026

Add --selective flag to sentry-cli build snapshots to indicate the upload
contains only a subset of images (e.g. due to sharding or selective test
execution).

The command validates that every uploaded image is listed in the provided
file, failing early if an unknown image is found.

Accept a file listing all expected preview names so that images not
present in the upload directory are reported as 'skipped' rather than
'removed'. Validates that every uploaded image appears in the provided
list.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against e73888e

NicoHinderling and others added 2 commits April 14, 2026 16:25
The --all-image-names file now accepts newline-delimited,
comma-separated, or a mix of both formats.

Co-Authored-By: Claude <noreply@anthropic.com>
Add doc comment to the manifest field, remove unnecessary type
annotation, and move validation before upload so unknown images
fail fast without waiting for the upload to complete.

Co-Authored-By: Claude <noreply@anthropic.com>
@NicoHinderling NicoHinderling marked this pull request as ready for review April 14, 2026 23:29
@NicoHinderling NicoHinderling requested review from a team and szokeasaurusrex as code owners April 14, 2026 23:29
--head-sha <head_sha>
The VCS commit sha to use for the upload. If not provided, the current commit sha will be
used.
--all-image-names <PATH>
Copy link
Copy Markdown
Member

@rbro112 rbro112 Apr 15, 2026

Choose a reason for hiding this comment

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

I'd elaborate on what a "missing" image is and what this list does to clarify this more. Maybe "Path to a file containing a list of preview names (...). Sentry will use this list to determine what images to diff. Any image in this list will be diffed against the base. Images not uploaded, but present in this list will be marked as 'skipped' rather than 'removed'."

--head-sha <head_sha>
The VCS commit sha to use for the upload. If not provided, the current commit sha will be
used.
--all-image-names <PATH>
Copy link
Copy Markdown
Member

@rbro112 rbro112 Apr 15, 2026

Choose a reason for hiding this comment

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

Also name suggestions: --all-snapshot-file-names or --all-image-file-names, or --diffable-image-file-names

Copy link
Copy Markdown
Contributor Author

@NicoHinderling NicoHinderling Apr 15, 2026

Choose a reason for hiding this comment

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

switched to all-image-file-names (in addition to adding the new "selective" flag)

…ll-image-file-names

Add --selective boolean flag to indicate the upload contains only a
subset of images. Without --all-image-file-names, removals and renames
cannot be detected on PRs. With --all-image-file-names, they are.

--all-image-file-names now requires --selective (enforced by clap).
Add manifest serialization tests for the new fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NicoHinderling NicoHinderling changed the title feat(build): Add --all-image-names flag to snapshots command feat(build): Add --selective flag and --all-image-file-names to snapshots command Apr 15, 2026
NicoHinderling and others added 2 commits April 15, 2026 12:47
Remove the --all-image-file-names flag entirely, keeping only --selective.
Simplifies the selective upload flow by dropping the image name list feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NicoHinderling NicoHinderling changed the title feat(build): Add --selective flag and --all-image-file-names to snapshots command feat(build): Add --selective flag to snapshots command Apr 15, 2026
@NicoHinderling NicoHinderling merged commit d783793 into master Apr 15, 2026
26 checks passed
@NicoHinderling NicoHinderling deleted the nico/build-snapshots-all-image-names branch April 15, 2026 20:37
NicoHinderling added a commit to getsentry/sentry that referenced this pull request Apr 16, 2026
…_image_file_names (#113006)

## Summary

Adds backend support for the new sentry-cli `--selective` flag
([sentry-cli PR
#3268](getsentry/sentry-cli#3268)).

- **`selective` boolean** added to upload API and manifest
- **`all_image_names` renamed to `all_image_file_names`** to match CLI
naming
- **Three categorization modes:**
- `selective` + `all_image_file_names`: can distinguish removed vs
skipped (like Happo/Chromatic)
- `selective` only: all missing base images treated as skipped, no
removals (like Argos `--subset`)
  - Full build: missing = removed (existing behavior)
- **Validation:** `all_image_file_names` requires `selective`,
`selective` requires `base_sha`
- **Baseline guard:** selective builds excluded from
`find_base_snapshot_artifact` via `is_selective` DB field and don't
trigger waiting-heads comparisons

## Test plan

- [x] Unit tests for 3-branch categorization logic (selective+names,
selective-only, full)
- [x] API validation tests (selective requires base_sha, names requires
selective, names rejects empty)
- [x] Selective build without names: all missing = skipped
- [x] Selective build with names: removed vs skipped distinguished
- [x] Fingerprinting excludes skipped images for auto-approval

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants