Skip to content

feat(snapshots): Add image-name manifest mode#267

Merged
cameroncooke merged 3 commits into
mainfrom
cameroncooke/EME-1182-selective_snapshots
Jun 8, 2026
Merged

feat(snapshots): Add image-name manifest mode#267
cameroncooke merged 3 commits into
mainfrom
cameroncooke/EME-1182-selective_snapshots

Conversation

@cameroncooke

@cameroncooke cameroncooke commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Add an image-name manifest mode for Sentry selective testing.

What Changed

When TEST_RUNNER_SNAPSHOTS_ALL_IMAGE_NAMES_FILE is set, SnapshotTest discovers previews using the existing include/exclude filters, writes a sorted and de-duplicated list of logical .png image names, and returns without rendering previews.

Why This Exists

Sentry selective uploads need a complete list of the snapshot images that are still part of the tracked suite. During a selective run, only some images may be uploaded. The manifest tells Sentry which missing images were intentionally skipped by the selective run, instead of treating them as removed from the suite.

How It Is Used

A CI workflow first runs SnapshotPreviews in manifest mode for each SnapshotTest group that participates in selective testing, then merges those files into one complete manifest. The workflow then renders only the selected group for the current run and uploads those rendered images with the merged manifest.

Operational Constraints

Manifest generation currently emits names for the selected SnapshotTest class in a single invocation. Workflows that split previews across multiple participating test classes must run manifest generation once for each class and merge the resulting files in CI before upload. SnapshotPreviews does not aggregate multiple test classes into one manifest internally.

Filter Semantics

The manifest uses the same discovery filters as rendering. Inclusion filters define which snapshots belong to a selectable group. Exclusion filters remove snapshots from the tracked set, so excluded names are not written to the manifest.

Mutually Exclusive Modes

TEST_RUNNER_SNAPSHOTS_EXPORT_DIR renders PNG/JSON sidecars. TEST_RUNNER_SNAPSHOTS_ALL_IMAGE_NAMES_FILE writes image names only. These modes are mutually exclusive and are intended to run as separate CI steps.

Device-Aware Names

The generated image-name list applies the same preview-device filtering as rendering, using the current simulator device name or model identifier so the manifest matches the images a run would produce.

Example

Screenshot 2026-06-05 at 12 39 16

Refs EME-1182

@linear-code

linear-code Bot commented Jun 5, 2026

Copy link
Copy Markdown

EME-1182

@cameroncooke cameroncooke marked this pull request as draft June 5, 2026 14:06
cameroncooke and others added 2 commits June 5, 2026 18:14
…ploads

Support selective SnapshotPreviews runs by emitting the complete set of
logical image names before rendering. When
SNAPSHOT_PREVIEWS_ALL_IMAGE_NAMES_FILE is set, discoverPreviews writes
the sorted, de-duplicated image names to that file and returns without
rendering, so the name-generation phase produces no image or sidecar
output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a reference table for the supported test-runner environment variables
and clarify that the export and all-image-names modes are mutually
exclusive. Rename the all-image-names env key to SNAPSHOTS_ALL_IMAGE_NAMES_FILE
so it matches the SNAPSHOTS_ naming used by the other variables.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cameroncooke cameroncooke force-pushed the cameroncooke/EME-1182-selective_snapshots branch from 0948810 to b08538d Compare June 5, 2026 17:24
@cameroncooke cameroncooke marked this pull request as ready for review June 5, 2026 17:33
@cameroncooke cameroncooke changed the title feat(preprod): Selective Snapshots for Apple platforms feat(snapshots): Add all image names manifest mode Jun 5, 2026
@cameroncooke cameroncooke changed the title feat(snapshots): Add all image names manifest mode feat(snapshots): Add image-name manifest mode Jun 5, 2026
previewIndex: previewIndex
) else {
continue
}

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, im assuming this exactly matches the image_file_name value generated for a given snapshot 👏

Move filename sanitization out of SnapshotCIExportCoordinator into a
shared FileNameUtils helper so the export coordinator and the selective
upload image-name list build filenames through a single code path.
Previously each call site sanitized a base name and appended the
extension separately, which risked the generated image names drifting
from the files actually written on disk.

Replace SnapshotContext.baseFileName with a concrete imageFileName and
derive the JSON sidecar name from it, ensuring the PNG and its sidecar
always share the same base. Update tests to cover FileNameUtils directly
and to reference the new file name properties.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cameroncooke cameroncooke merged commit f0fbf24 into main Jun 8, 2026
19 checks passed
@cameroncooke cameroncooke deleted the cameroncooke/EME-1182-selective_snapshots branch June 8, 2026 13:08
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