Skip to content

fix(sdk): route $ref-backed color-set CTRs through diff_multimode - #1434

Merged
GarthDB merged 2 commits into
mainfrom
fix/figma-diff-ref-backed-color-set
Sep 9, 2026
Merged

fix(sdk): route $ref-backed color-set CTRs through diff_multimode#1434
GarthDB merged 2 commits into
mainfrom
fix/figma-diff-ref-backed-color-set

Conversation

@GarthDB

@GarthDB GarthDB commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

figma diff's diff_multimode routing gate only compared a Figma variable
mode-by-mode when the resolved design-data record carried conceptId or
setUuid directly 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 the
RelationshipRecord in packages/design-data/relationships/*.json, and
never survives onto the 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 (e.g. action-bar border is
transparent-white-25 in light, gray-400 in dark) 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.

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 diff was silently under-reporting real Figma/design-data
divergence for color-set component tokens, hiding genuine mismatches
behind an incorrect "skipped, not mode-set-backed" reason.

How Has This Been Tested?

  • New unit test ref_backed_ctr_color_set_routes_through_diff_multimode
    reproduces the real action-bar-border-color shape end-to-end
    ($ref-backed CTR siblings, no conceptId anywhere) and asserts a
    MultiModeMismatch with correct per-mode Match/ValueMismatch
    classification. 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.
  • Checked whether base-padding-horizontal-{large,extra-large,2x-large}
    (a related report) shared this root cause: they don't — their
    design-data records already carry conceptId directly, a different
    shape. No fix needed there.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

🤖 Generated with Claude Code

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-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0f0590a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@adobe/design-data-wasm Minor
@adobe/design-data-tui Minor
s2-tokens-viewer Patch
@adobe/design-data-agent-mcp Patch
@adobe/design-data-mcp Patch
@adobe/design-data Patch
@adobe/token-naming-audit Patch

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

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🎨 Token Changes Report

Tokens Changed (0)

Original Branch: main


This comment was automatically generated by the token diff tool. 🤖

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🧩 Component Schema Changes Report

No component schema changes detected.

This comment was automatically generated by the component schema diff tool. 🤖

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Run report for 0f0590aa

Total time: 2m 30s | Comparison time: 4m 25s | Estimated savings: 1m 54s (43.2% faster)

Action Time Status Info
⬛️ SetupProto(0.57.4) 0.1ms Skipped
🟩 SyncWorkspace 10.5ms Passed
🟩 SyncProject(sdk) 0.7ms Passed
⬛️ SetupToolchain(node:20.17.0) 14.4ms Skipped
⬛️ SetupToolchain(pnpm:10.17.1) 2.3ms Skipped
⬛️ SetupToolchain(javascript) 0ms Skipped
⬛️ SetupEnvironment(javascript, sdk) 0.4ms Skipped
⬛️ SetupToolchain(rust:1.88.0) 374.2ms Skipped
🟩 SetupEnvironment(rust, sdk) 205.1ms Passed
⬛️ InstallDependencies(rust, sdk) 3.6ms Skipped
🟩 RunTask(sdk:fmt-check) 1.6s Passed
🟩 InstallDependencies(javascript, sdk) 4.2s Passed
🟩 RunTask(sdk:codegen-check) 106.2ms Passed
🟩 RunTask(sdk:lint) 48.5s Passed
🟩 RunTask(sdk:test-doc) 1m 50s Passed
🟩 RunTask(sdk:test) 2m 26s Passed SLOW
Changed files
.changeset/figma-diff-ref-backed-color-set.md
sdk/core/src/figma/import.rs

Leftover artifact from tool authoring that would have leaked into
generated changelog/release notes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@GarthDB
GarthDB merged commit 47db5e9 into main Sep 9, 2026
9 checks passed
@GarthDB
GarthDB deleted the fix/figma-diff-ref-backed-color-set branch September 9, 2026 21:55
@GarthDB GarthDB mentioned this pull request Sep 9, 2026
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.

1 participant