fix(design-data): stop dropping structure field from legacy token keys - #1517
Merged
Merged
Conversation
`packages/design-data/fields/structure.json` set `excludeFromLegacyKey: true` on the (mistaken) assumption structure's value was always already embedded in `property`. An audit of the corpus found 138/138 tokens with both `structure` and a pinned `legacyKey` include the structure word in that key — the flag only silently broke the handful of tokens with no pin to mask it: banner/list gap and padding tokens in layout.tokens.json. - packages/design-data/fields/structure.json: remove excludeFromLegacyKey. - sdk/core/src/naming.rs: update stale doc comments; rewrite the test that asserted the old (buggy) exclusion behavior to assert the corrected one. - sdk/core/src/registry_data.rs: regenerated via `moon run sdk:codegen`. - tools/token-mapping-analyzer/src/field-catalog.js: update doc comment (no logic change — this JS mirror reads the field JSON live). - packages/design-data/tokens/layout.tokens.json: add five deprecated companion tokens pinning the old generic keys (gap-horizontal, gap-vertical, padding-horizontal, padding-vertical, gap-regular) with a `lifecycle.replacedBy` pointing at each corrected token, so existing consumers of the broken names get a `renamed` pointer instead of a removal. - packages/tokens/src/*.json: regenerated via `moon run design-data:legacy-output`. Confirmed via diff: exactly the five keys correct themselves (banner-gap-horizontal, banner-gap-vertical, banner-padding-horizontal, banner-padding-vertical, list-gap-regular), the five old keys become deprecated aliases, and six dependent files' `renamed` pointers update to the corrected names. Validated: `moon run sdk:test` (1511 passed), `moon run tokens:test` (27 passed), `moon run design-data:roundtrip-verify` (OK), `moon run design-data:validate` (0 errors, pre-existing warnings only), `node tools/changeset-linter/src/cli.js check --fail-on-warnings` (5 valid). Closes spectrum-design-data-mra7. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🦋 Changeset detectedLatest commit: f0220d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 (32)Original Branch: Renamed (5)
Newly Deprecated (5)
Updated (22)Updated Properties (22)
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 f0220d00Total time: 2m 48s | Comparison time: 7m 34s | Estimated savings: 4m 46s (63.0% faster)
Expanded report
Changed files |
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
Fixes the
structurefield being silently dropped from generated legacy token keys. Five banner/list gap and padding tokens inpackages/tokens/src/layout.jsonwere missing their structure prefix (gap-horizontalinstead ofbanner-gap-horizontal, etc.), while every other structure-scoped token in the corpus correctly includes it.packages/design-data/fields/structure.json: removeexcludeFromLegacyKey: true, set on the (mistaken) assumptionstructure's value was always already embedded inproperty. An audit found 138/138 tokens carrying bothstructureand a pinnedlegacyKeyinclude the structure word in that key — the exclusion only silently broke the five tokens with no pin to mask it.sdk/core/src/naming.rs: update stale doc comments; rewrite the test that asserted the old (buggy) exclusion behavior to assert the corrected one.sdk/core/src/registry_data.rs: regenerated viamoon run sdk:codegen.tools/token-mapping-analyzer/src/field-catalog.js: doc comment only — this JS mirror reads the field JSON live, so no logic change was needed.packages/design-data/tokens/layout.tokens.json: add five deprecated companion tokens pinning the old generic keys (gap-horizontal,gap-vertical,padding-horizontal,padding-vertical,gap-regular), each with alifecycle.replacedBypointing at its corrected replacement, so existing consumers of the broken names get arenamedpointer instead of the key disappearing.packages/tokens/src/*.json: regenerated viamoon run design-data:legacy-output. Confirmed via diff that exactly the five keys correct themselves, the five old keys become deprecated aliases, and six dependent files'renamedpointers update to the corrected names.Related Issue
Tracked as bead
spectrum-design-data-mra7(this repo uses beads for task tracking rather than GitHub issues for internal bugs). Reported by Helen Le / Nate Baldwin in the team's Slack thread aboutbanner-padding/gap-*tokens missing from the Spectrum 2 Figma specs.Motivation and Context
The Spectrum 2 Figma specs expect
banner-padding-horizontal-compact-style names (structure-prefixed) for every banner/list token, but five tokens never got that prefix because of this bug — they were born wrong in the first design-data-generated release (@adobe/spectrum-tokens@15.0.0) and never shipped correctly. This surfaced as "why are these tokens missing" when in fact they existed under the wrong name.How Has This Been Tested?
moon run sdk:codegen— regeneratedregistry_data.rs; diff is exactly the one expected field flag flip.cargo test --package design-data-core naming::— 54 unit + 7 integration tests passed.moon run sdk:test— full SDK suite: 1511 passed, 2 skipped.moon run design-data:legacy-output— regeneratedpackages/tokens/src/*.json; diff confirmed to be exactly the five renamed keys, five new deprecated aliases, and six dependent files'renamedpointers updating to the corrected names.moon run design-data:roundtrip-verify— "Roundtrip OK".moon run design-data:validate— exit 0, 0 errors (pre-existing warnings only, unrelated to this change).moon run tokens:test— 27 passed, includingcheckUniqueTokenNames(no duplicate names introduced).moon run token-naming-audit:test— 17 passed.node tools/changeset-linter/src/cli.js check --fail-on-warnings— 5 valid changesets, 0 warnings/errors.deprecated/deprecated_comment/renamed) for all five new companion tokens — this path was previously unexercised in the corpus (zero cascade tokens usedlifecycle.replacedBybefore this change).Screenshots (if appropriate):
N/A — data/naming change only.
Types of changes
Checklist: