Skip to content

fix(design-data): route opacity tokens to Color theme, not Platform scale, in figma exporter/diff - #1435

Merged
GarthDB merged 1 commit into
mainfrom
fix/figma-opacity-collection-routing
Sep 9, 2026
Merged

fix(design-data): route opacity tokens to Color theme, not Platform scale, in figma exporter/diff#1435
GarthDB merged 1 commit into
mainfrom
fix/figma-opacity-collection-routing

Conversation

@GarthDB

@GarthDB GarthDB commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

Opacity tokens are typed FLOAT but were classified TokenKind::Scale in the
Figma variables exporter's alias pre-pass and flat dispatch, so they were
emitted into .Platform scale (platformScale/*) instead of .Color theme
(colorTheme/*) — the collection the hand-built "S2 - Web" library actually
uses for them. This made ~62 opacity tokens show up as missing/figma-only
in design-data figma diff even though generated equivalents existed under
the wrong name.

  • Route opacity to .Color theme in both the alias-target pre-pass and the
    flat-token dispatch branch (mapping.rs)
  • process_color_set_token now infers FLOAT/COLOR from any sets member
    instead of only the first, fixing a latent (currently harmless)
    misclassification risk
  • diff_values now falls back to resolve_alias_target when invert_name
    returns None (bare, slash-less Figma names), recovering all 35
    S2.Color-theme opacity variables, which are VARIABLE_ALIASes into
    .Color theme with no / in their own name (import.rs)

Related Issue

Closes spectrum-design-data-11k.18 (DNA-1953).

Motivation and Context

Flagged by Nate Baldwin on the Design Data / Figma Vars comparison Canvas —
opacity tokens were reported as missing from the generated Figma variables,
blocking parity verification against the manual S2 Web library.

How Has This Been Tested?

  • Added unit tests for the new collection routing, the any-member color-set
    type inference, and the bare-name alias fallback
  • moon run sdk:test — 1417/1417 passed, no regressions
  • design-data figma diff --snapshot core/tests/fixtures/figma/s2-web-variables.baseline.json:
    all 27 .Color theme + 35 S2.Color-theme previously-flagged opacity
    entries now resolve out of figma-only
  • Confirmed (out of scope, unfixed) that ~20 remaining figma-only opacity
    tokens belong to legacy component files (card.json, menu.json,
    table.json, etc.) entirely absent from the resolved token graph — a
    pre-existing legacy-source-discovery gap unrelated to Figma routing, not a
    corpus migration this task covers

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

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 added tests to cover my changes.
  • All new and existing tests passed.

🤖 Generated with Claude Code

…cale, in figma exporter/diff

Opacity tokens are typed FLOAT but were classified TokenKind::Scale in the
mapping.rs alias pre-pass and flat dispatch, so they were emitted into
.Platform scale (platformScale/*) instead of .Color theme (colorTheme/*) —
the collection the hand-built S2 - Web library actually uses for them. This
made ~62 opacity tokens show up as missing/figma-only in `design-data figma
diff` even though generated equivalents existed under the wrong name.

- Route opacity to .Color theme in both the alias-target pre-pass and the
  flat-token dispatch branch (mapping.rs)
- process_color_set_token now infers FLOAT/COLOR from any sets member
  instead of only the first, fixing a latent (currently harmless)
  misclassification risk
- diff_values now falls back to resolve_alias_target when invert_name
  returns None (bare, slash-less Figma names), recovering all 35
  S2.Color-theme opacity variables, which are VARIABLE_ALIASes into
  .Color theme with no "/" in their own name (import.rs)
- Add unit tests for the new collection routing, the any-member color-set
  type inference, and the bare-name alias fallback

Closes spectrum-design-data-11k.18 (DNA-1953).

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: 8895939

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

This PR includes changesets to release 10 packages
Name Type
@adobe/spectrum-design-data Minor
@adobe/spectrum-component-api-schemas Patch
@adobe/design-system-registry Patch
@adobe/design-data-agent-mcp Patch
@adobe/design-data-mcp Patch
markdown-generator Patch
@adobe/token-corpus-migrate Patch
@adobe/token-naming-audit Patch
component-options-editor Patch
@adobe/spectrum-design-data-mcp 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 8895939e

Total time: 2m 23s | Comparison time: 4m 13s | Estimated savings: 1m 50s (43.5% faster)

Action Time Status Info
⬛️ SetupProto(0.57.4) 0ms Skipped
🟩 SyncWorkspace 10ms Passed
🟩 SyncProject(sdk) 0.5ms Passed
⬛️ SetupToolchain(node:20.17.0) 13.1ms Skipped
⬛️ SetupToolchain(pnpm:10.17.1) 2.2ms Skipped
⬛️ SetupToolchain(javascript) 0ms Skipped
⬛️ SetupEnvironment(javascript, sdk) 0.5ms Skipped
⬛️ SetupToolchain(rust:1.88.0) 211.1ms Skipped
🟩 SetupEnvironment(rust, sdk) 233.8ms Passed
⬛️ InstallDependencies(rust, sdk) 8.2ms Skipped
🟩 RunTask(sdk:fmt-check) 1.7s Passed
🟩 InstallDependencies(javascript, sdk) 4.8s Passed
🟩 RunTask(sdk:codegen-check) 104.9ms Passed
🟩 RunTask(sdk:lint) 47s Passed
🟩 RunTask(sdk:test-doc) 1m 45s Passed
🟩 RunTask(sdk:test) 2m 18s Passed SLOW
Changed files
.changeset/figma-opacity-collection-routing.md
sdk/core/src/figma/import.rs
sdk/core/src/figma/mapping.rs

@GarthDB
GarthDB merged commit 905bc1d into main Sep 9, 2026
10 checks passed
@GarthDB
GarthDB deleted the fix/figma-opacity-collection-routing branch September 9, 2026 22:14
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