Skip to content

docs(snapshots): Document SnapshotPreviews selective testing#18277

Open
cameroncooke wants to merge 1 commit into
masterfrom
cameroncooke/EME-1182-selective_snapshots
Open

docs(snapshots): Document SnapshotPreviews selective testing#18277
cameroncooke wants to merge 1 commit into
masterfrom
cameroncooke/EME-1182-selective_snapshots

Conversation

@cameroncooke
Copy link
Copy Markdown
Contributor

@cameroncooke cameroncooke commented Jun 5, 2026

Add an Apple Snapshots guide for using SnapshotPreviews with Sentry selective testing.

What Changed

This adds a dedicated selective testing page under the Apple Snapshots docs and links to it from the Apple Snapshots setup guide.

The new page explains how to:

  • organize SnapshotPreviews into selectable SnapshotTest groups;
  • generate image-name manifests for the groups that participate in selective testing;
  • merge those manifests into one complete tracked image-name file;
  • render only the group selected for the current CI run;
  • upload the rendered subset with --all-image-file-names-file.

Why This Exists

Selective Sentry uploads need to distinguish images that were skipped in the current run from images that were removed from the snapshot suite. SnapshotPreviews provides the image-name manifest; Sentry uses that manifest to treat listed-but-missing images as skipped rather than removed.

Workflow Constraints

The page documents the constraints users need to account for:

  • name generation and image rendering are separate, mutually exclusive SnapshotPreviews modes;
  • manifest generation must run once per participating SnapshotTest group;
  • CI is responsible for merging the per-group manifest files before upload;
  • inclusion filters define selectable groups;
  • exclusion filters remove snapshots from the tracked set entirely.

Examples

The examples use placeholder project, scheme, and test class names so readers can adapt the workflow to their own app. The page links to the SnapshotPreviews MultiModuleDemo workflow as a complete reference implementation.

Refs EME-1182

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 5, 2026

EME-1182

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sentry-docs Ready Ready Preview, Comment Jun 5, 2026 6:03pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
develop-docs Ignored Ignored Preview Jun 5, 2026 6:03pm

Request Review

Document an advanced SnapshotPreviews workflow that renders only selected
preview groups in CI while keeping Sentry aware of the full tracked image
set. The guide separates name generation from image rendering so skipped
snapshots are distinguished from removed ones on selective uploads.

Link to the new page from the snapshots index and clarify how
SnapshotPreviews emits logical, unprefixed image names.
@cameroncooke cameroncooke force-pushed the cameroncooke/EME-1182-selective_snapshots branch from 260fb88 to 92cefab Compare June 5, 2026 17:52
@cameroncooke cameroncooke marked this pull request as ready for review June 5, 2026 17:57
@cameroncooke cameroncooke changed the title docs(preprod): Selective Snapshots for Apple platforms docs(snapshots): Document SnapshotPreviews selective testing Jun 5, 2026
Selective testing is an advanced SnapshotPreviews workflow for large suites. Use it when rendering every preview on every pull request is too expensive, but you still want Sentry to tell apart:

- snapshots rendered in this run;
- snapshots skipped because their group wasn't selected;
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.

nit: remove the semi colons on these two lines


<Include name="feature-available-for-user-group-early-adopter" />

Selective testing is an advanced SnapshotPreviews workflow for large suites. Use it when rendering every preview on every pull request is too expensive, but you still want Sentry to tell apart:
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.

nit: I'd put the word "subset" or something somewhere in these two sentences. Just make it dumb obvious that only a subset of the snapshots are being generated

- snapshots skipped because their group wasn't selected;
- snapshots intentionally removed from the tracked set.

The idea is to separate **name generation** from **image rendering**. First, write the complete list of image names for the full tracked suite. Then render only the groups selected for this CI run and upload those images with the complete image-name file.
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.

Important point to make: You can totally use selective testing just by uploading a subset of images without the list of image names.

We just won't be able to flag any removals or renames. Including the --all-image-file-names field is an optional add-on to get visibility of the removals and renames.

I think the current wording presents the image file names as a requirement

["ModuleB", "ModuleC"]
}
}
```
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.

nice!!


## Step 1: Upload a complete baseline build

On your base branch, render and upload the full snapshot suite. This is a normal, complete upload. Do not pass an image-name file on the baseline upload.
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.

Do not pass an image-name file on the baseline upload.

I feel like this is another example of why we should make it clear near the top that the image name generation stuff is optional ONLY for the selective testing case.

If so, I feel like it might be implicit here that it shouldn't be included for full (non selective) uploads 🤔

idk, curious your thoughts


```bash
TEST_RUNNER_SNAPSHOTS_EXPORT_DIR="/private/tmp/base_snapshots/iphone" \
xcodebuild test \
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.

should this also be xcodebuild build-for-testing?

/private/tmp/snapshotpreviews_root/DerivedData/Build/Products/<generated>.xctestrun
```

## Step 3: Generate image names for every selectable group
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.

again, would flag this as an optional section/step

also perhaps this step could be after the selected snapshot generation step?


## Step 5: Upload the selective build

Upload the rendered image directory with the complete image-name file. Passing `--all-image-file-names-file` tells Sentry this is a selective upload, so listed images that were not uploaded are treated as skipped rather than removed.
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.

Passing --all-image-file-names-file tells Sentry this is a selective upload

--selective tells sentry it's a selective build, but i then made it so that including --all-image-file-names-file implicitly implies that it's selective so that you can just do that rather than --selective --all-image-file-names-file

might be worth making sure this is clear here 🤷

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.

nit:

"so listed images that were not uploaded are treated as skipped rather than removed."

->

"so listed images that were not uploaded are correctly identified as skipped rather than removed."

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.

2 participants