diff --git a/docs/cli/snapshots.mdx b/docs/cli/snapshots.mdx index 4e100b8f2285b..78dccc34ac75a 100644 --- a/docs/cli/snapshots.mdx +++ b/docs/cli/snapshots.mdx @@ -58,7 +58,23 @@ If you only upload a subset of your snapshots per CI run — for example, becaus sentry-cli snapshots upload ./snapshots --app-id web-frontend --selective ``` -When an upload is marked as selective, Sentry only diffs the snapshots you uploaded. Any snapshot that exists in the base build but was not included in the upload is treated as unchanged rather than removed. Removals and renames cannot be detected when using `--selective`, because Sentry cannot distinguish a deliberately deleted snapshot from one that was not part of the subset. +When an upload is marked as selective, Sentry only diffs the snapshots you uploaded. Any snapshot that exists in the base build but was not included in the upload is treated as unchanged rather than removed. Removals and renames cannot be detected when using `--selective` alone, because Sentry cannot distinguish a deliberately deleted snapshot from one that was not part of the subset. + +### Detecting Removals and Renames + +Pass the full list of image names in your suite to enable removal and rename detection. Both flags implicitly enable `--selective`. + +```bash +# comma-separated inline +sentry-cli snapshots upload ./snapshots \ + --app-id web-frontend \ + --all-image-file-names "homepage.png,settings/profile.png,settings/billing.png" + +# or a file with one name per line +sentry-cli snapshots upload ./snapshots \ + --app-id web-frontend \ + --all-image-file-names-file all-snapshot-names.txt +``` ## Diff Threshold @@ -84,6 +100,8 @@ sentry-cli snapshots upload [OPTIONS] --app-id | `-o`, `--org ` | Sentry organization slug. Can also be set via `SENTRY_ORG`. | | `-p`, `--project ` | Sentry project slug. Can also be set via `SENTRY_PROJECT`. | | `--selective` | Mark the upload as a subset. Use when uploading only a portion of your snapshots (for example, affected tests only). | +| `--all-image-file-names ` | Comma-separated list of all image names (including subdirectory paths) in the full test suite. Used with selective uploads to detect removals and renames. Implicitly enables `--selective`. Mutually exclusive with `--all-image-file-names-file`. | +| `--all-image-file-names-file ` | Path to a file listing all image names (including subdirectory paths), one per line. Used with selective uploads to detect removals and renames. Implicitly enables `--selective`. Mutually exclusive with `--all-image-file-names`. | | `--diff-threshold ` | Float between `0.0` and `1.0`. Sentry only reports images as changed if the percentage of changed pixels exceeds this value. | | `--head-sha ` | Commit SHA for the upload. Auto-detected in CI. | | `--base-sha ` | Base commit SHA for comparison (PR only). Auto-detected from merge-base. | diff --git a/docs/product/snapshots/uploading-snapshots/index.mdx b/docs/product/snapshots/uploading-snapshots/index.mdx index 354db37eafdac..58b68da0c5cd1 100644 --- a/docs/product/snapshots/uploading-snapshots/index.mdx +++ b/docs/product/snapshots/uploading-snapshots/index.mdx @@ -93,7 +93,26 @@ When an upload is marked as selective, Sentry only diffs the snapshots you uploa Because Sentry cannot distinguish a deliberately deleted snapshot from one that was not part of the subset, removals and renames cannot be detected when - using `--selective`. + using `--selective` alone. Use `--all-image-file-names` or + `--all-image-file-names-file` to enable removal and rename detection. +### Detecting Removals and Renames + +Pass the full list of image names in your suite to enable removal and rename detection. Both flags implicitly enable `--selective`. + +```bash +# comma-separated inline +sentry-cli snapshots upload ./snapshots \ + --app-id web-frontend \ + --all-image-file-names "homepage.png,settings/profile.png,settings/billing.png" + +# or a file with one name per line +sentry-cli snapshots upload ./snapshots \ + --app-id web-frontend \ + --all-image-file-names-file all-snapshot-names.txt +``` + +The CLI validates that every uploaded image appears in the provided list. + For the full `sentry-cli snapshots upload` flag reference, see [Snapshots (CLI)](/cli/snapshots/).