feat(snapshots): Restructure sidecar JSON to match ingestion schema#1162
Merged
runningcode merged 2 commits intomainfrom Apr 24, 2026
Merged
feat(snapshots): Restructure sidecar JSON to match ingestion schema#1162runningcode merged 2 commits intomainfrom
runningcode merged 2 commits intomainfrom
Conversation
Contributor
|
rbro112
reviewed
Apr 23, 2026
| if (info.showBackground) metadata["show_background"] = true | ||
|
|
||
| when (info.uiMode and UI_MODE_NIGHT_MASK) { | ||
| UI_MODE_NIGHT_YES -> metadata["color_mode"] = "dark" |
Member
There was a problem hiding this comment.
Make sure to pass this through as uiMode in context
rbro112
approved these changes
Apr 23, 2026
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 6acdeab. Configure here.
Bucket appearance inputs (locale, device, font_scale, api_level, width_dp, height_dp, show_system_ui, show_background, preview_name) under `tags`; move preview identity (class_name, method_name, image_file_name) under `context`; replace the `night_mode` boolean with a `color_mode` enum that is emitted only when `uiMode` explicitly sets `UI_MODE_NIGHT_YES` or `UI_MODE_NIGHT_NO`. The serializer is extended with a small recursive `renderJson` helper so the template can emit nested objects without pulling in a JSON library. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Relocate the uiMode → light/dark mapping from the top-level metadata field `color_mode` into the `tags` map, keyed as `ui_mode`. This aligns the field with the other appearance inputs (locale, device, font_scale, etc.) and matches the ingestion schema's expectation that preview configuration travels as tags rather than first-class metadata. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6acdeab to
67d6904
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Aligns the per-snapshot sidecar JSON with the ingestion JSON Schema by organizing fields into the defined buckets:
display_name,group,diff_thresholdtags(appearance / render inputs):preview_name,locale,device,font_scale,api_level,width_dp,height_dp,show_system_ui,show_background,ui_modecontext(preview identity / location):image_file_name,class_name,method_nameNotable behavior changes:
night_modeboolean is gone. Dark/light state is now emitted as aui_modetag, only when the@Preview(uiMode = …)bits explicitly setUI_MODE_NIGHT_YES→"dark"orUI_MODE_NIGHT_NO→"light". The commonUI_MODE_NIGHT_UNDEFINEDcase (the default for unannotated previews) yields noui_modetag.preview_name(the@Preview(name = …)label) moves from top level intotags.tagsis omitted when empty;contextis always present.Implementation notes:
GenerateSnapshotTestsTask.kt), so the change lives in that template.renderJson(value, indentLevel)that handlesString,Number,Boolean, andMap<*,*>— no new dependencies.Example output:
{ "display_name": "FooPreview", "group": "main", "tags": { "preview_name": "Dark", "locale": "en", "font_scale": 1.5, "ui_mode": "dark" }, "context": { "image_file_name": "com.example.FooPreview", "class_name": "com.example.Foo", "method_name": "FooPreview" } }#skip-changelog