Skip to content

CI: enforce Figma codeSyntax coverage on shipped tokens #5326

Description

@eddiman

What

Add a CI check that fails when a token shipped as a CSS custom property is missing its Figma Code syntax value, or carries one that no longer matches what the export actually emits.

Why

We've just stamped $extensions["com.figma"].codeSyntax.Web onto 1185 tokens so Figma Dev Mode shows the real custom property (var(--eds-background-canvas)) instead of the variable name (background/canvas), giving developers something they can copy directly. That data pass is a point-in-time snapshot. Two things rot it, both silently:

1. New tokens ship blank. Every token added after the pass has no code syntax, and nothing flags it. This is not hypothetical — equinor/design-system#5284 added 36 new CSS variables in a single release (--eds-text-interactive-{info,success}-*, --eds-icon-interactive-{info,success}-*, --eds-icon-accent, plus --eds-dark-*-6/12). Had the pass run the day before, all 36 would be in Figma today with an empty field. At that rate the coverage decays within weeks, and the failure is invisible: the field just isn't there.

2. Stale values are worse than missing ones. The names are derived from the saved platform export EDS-CSS (id 39d37416-632b-4f04-b49b-cfaec63e3baa, naming.prefix: "eds"), which lives server-side in the Studio UI. Anyone changing the prefix or naming there leaves 1185 confidently-wrong strings pointing at properties that no longer exist. A developer copying one gets a value that silently does nothing. That is strictly worse than never having done this — a blank field makes people look it up; a wrong one doesn't.

Neither failure mode surfaces in review. review/changes doesn't even count extensions-only writes, so there's no signal from the normal token diff either.

What the check should do

Run against the generated packages/eds-tokens/src/tokens/ outputs on every tokens release PR:

  1. Derive the expected variable name for every token in src/tokens/raw/. The transform is currently '--eds-' + name.replace(/\./g, '-').toLowerCase(), verified exact against the shipped bundle: 923 CSS vars, 923 matched, 0 orphans.
  2. Re-prove the transform rather than trusting it — every shipped variable in src/tokens/css/variables.css must have exactly one owning token. An orphan means the export config changed and the derived names are no longer trustworthy; fail loudly at that point rather than emitting wrong values.
  3. Fail if any token that maps to a shipped variable is missing codeSyntax.Web, or has one that differs from the derived name.
  4. Skip the algorithm-input sets, which correctly export nothing: foundation/anchor, foundation/gaussian, input/palette, input/scale (85 tokens).
  5. Report a hand-authored value that disagrees with the derived name as a distinct outcome, not a generic failure — that's a deliberate override and needs a human decision, not an automatic rewrite.

The logic already exists in verify-only form and can be lifted more or less as-is; it currently reads the two sides and asserts the mapping in both directions.

Notes

  • The data pass itself is applied to Tokens Studio branch code-syntax (52f4edda-496f-457e-b0f1-28c2de24991a) and is awaiting human merge — this guard should ideally land alongside that merge rather than after it.
  • Related: the token redefinition epic equinor/design-system#4740 and the pipeline rebuild equinor/design-system#5108.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions