feat(preprod): Add structured tags to snapshot test metadata#116307
Conversation
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.58% |
Move all custom metadata (theme, variant, size, state, etc.) from flat top-level keys into a structured `tags: Record<string, string>` field across all 14 snapshot test files. Add an `area` tag to distinguish core design system primitives from product-side snapshot UI.
The state tag duplicates information already captured by the snapshot test name and is not needed for area-level filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1917daa to
d0f12ba
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d0f12ba. Configure here.
| </Wrapper> | ||
| ), | ||
| diffMode => ({theme: themeName, state: diffMode}) | ||
| _diffMode => ({tags: {theme: themeName, area: 'snapshots'}}) |
There was a problem hiding this comment.
Dynamic diffMode value dropped from .each() tags
Low Severity
The diffMode parameter in the .each() metadata callback is renamed to _diffMode (marking it unused) and excluded from tags. All three iterations ('split', 'wipe', 'onion') now produce identical tags {theme, area}, making them indistinguishable when filtering. Every core component .each() callback consistently includes its varying parameter in tags (e.g., variant, size, checked), so omitting diffMode here appears to be an oversight during the migration from the flat state: diffMode field.
Reviewed by Cursor Bugbot for commit d0f12ba. Configure here.
…etadata Parse the theme (light/dark) from Jest's describe ancestry in parseSnapshotDetails, removing the need to manually pass it in every snapshot test. Explicit metadata.tags.theme still takes precedence. Replace the unsafe ...metadata spread in takeSnapshot with explicit field assignment so display_name and group overrides are intentional rather than side effects of object spreading. Add SnapshotArea union type to constrain area tags to known values, making it a compile error to use an unregistered area. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>


Move all custom metadata (theme, variant, size, state, etc.) from flat top-level keys into a structured
tags: Record<string, string>field across all 14 snapshot test files. This makes snapshot properties filterable and queryable on the product side without relying onextra = "allow"passthrough fields.Framework type changes
SnapshotTestMetadatareplaces the previousRecord<string, string>parameter onit.snapshot()andit.snapshot.each(). The new type restricts metadata to three keys:group,display_name, andtags. TheSnapshotImageMetadataoutput interface gains a matchingtagsfield. No backend changes needed —ImageMetadatainmanifest.pyalready hastags: dict[str, str] | Nonewith coercion.Per-file tag mapping
Every snapshot test now passes an explicit
tagsobject containing the relevant axes for that component —themeis universal,size/variant/statevary by file. Anareatag distinguishes core design system primitives (core) from product-side snapshot UI (snapshots). Three files (checkbox, radio, switch) that previously had no metadata now gain tags for the first time.