fix(sdk): route $ref-backed color-set CTRs through diff_multimode - #1434
Merged
Conversation
diff_multimode's routing gate in diff_values only compared a Figma variable mode-by-mode when record_concept_id could read conceptId/setUuid off the resolved record. For a $ref-backed color-set CTR (e.g. action-bar-border-color, popover-border-color, card-selection-background-color), that link exists only in packages/design-data/relationships/*.json as setUuid, and never survives onto a resolved TokenRecord: resolve_relationship_ref follows the CTR's $ref straight to the underlying palette color token (no setUuid), and reindex_relationship_tokens only synthesizes a setUuid-carrying record for inline-value CTRs, explicitly skipping $ref-backed ones. So these genuinely per-mode-divergent tokens fell through to the single-value collapse path and were misreported skipped-uncovered. The gate now also accepts a legacy_key with a CTR/relationship record at all (graph.has_relationship_record), independent of what conceptId/setUuid ends up on the resolved record — diff_multimode's own per-mode resolution already handles this shape correctly via resolve_relationship_ref_in_context, so widening the gate is the whole fix. Closes spectrum-design-data-2god. Reported by Nate Baldwin, #Design Data and Figma Vars Comparison (C0BUQU7JDA7). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 0f0590a The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🎨 Token Changes ReportTokens Changed (0)Original Branch: This comment was automatically generated by the token diff tool. 🤖 |
Contributor
🧩 Component Schema Changes ReportNo component schema changes detected.This comment was automatically generated by the component schema diff tool. 🤖 |
Contributor
Run report for 0f0590aaTotal time: 2m 30s | Comparison time: 4m 25s | Estimated savings: 1m 54s (43.2% faster)
Changed files |
Leftover artifact from tool authoring that would have leaked into generated changelog/release notes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
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.
Description
figma diff'sdiff_multimoderouting gate only compared a Figma variablemode-by-mode when the resolved design-data record carried
conceptIdorsetUuiddirectly on its own JSON. For a$ref-backed color-set CTR —action-bar-border-color,popover-border-color,card-selection-background-color— that link exists only on theRelationshipRecordinpackages/design-data/relationships/*.json, andnever survives onto the resolved
TokenRecord:resolve_relationship_reffollows the CTR's$refstraight to theunderlying palette color token (no
setUuid), andreindex_relationship_tokensonly synthesizes asetUuid-carrying recordfor inline-value CTRs — explicitly skipping
$ref-backed ones. So thesegenuinely per-mode-divergent tokens (e.g. action-bar border is
transparent-white-25in light,gray-400in dark) fell through to thesingle-value collapse path and were misreported
skipped-uncovered.The gate now also accepts a
legacy_keywith a CTR/relationship record atall (
graph.has_relationship_record), independent of whatconceptId/setUuidends up on the resolved record —diff_multimode's own per-mode resolution already handles this shapecorrectly via
resolve_relationship_ref_in_context, so widening the gateis the whole fix.
Related Issue
Closes bead
spectrum-design-data-2god. Reported by Nate Baldwin in#Design Data and Figma Vars Comparison (Slack thread ts 1788882886.952429).
Motivation and Context
figma diffwas silently under-reporting real Figma/design-datadivergence for color-set component tokens, hiding genuine mismatches
behind an incorrect "skipped, not mode-set-backed" reason.
How Has This Been Tested?
ref_backed_ctr_color_set_routes_through_diff_multimodereproduces the real
action-bar-border-colorshape end-to-end(
$ref-backed CTR siblings, noconceptIdanywhere) and asserts aMultiModeMismatchwith correct per-modeMatch/ValueMismatchclassification. Confirmed it fails pre-fix (falls to
skipped-uncovered) and passes post-fix.moon run sdk:test— 1418 tests pass, no regressions.moon run sdk:lint— clippy clean.base-padding-horizontal-{large,extra-large,2x-large}(a related report) shared this root cause: they don't — their
design-data records already carry
conceptIddirectly, a differentshape. No fix needed there.
Screenshots (if appropriate):
N/A
Types of changes
Checklist:
🤖 Generated with Claude Code