From 9f50aca4bc1a325013499526b3ed55562bff0cd3 Mon Sep 17 00:00:00 2001 From: Avinash Dwarapu Date: Wed, 29 Jul 2026 14:44:51 +0200 Subject: [PATCH 1/3] chore: Migrate font tokens to use stable hashes --- build-tools/utils/token-versions.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-tools/utils/token-versions.js b/build-tools/utils/token-versions.js index 955cba72a6..28600b9577 100644 --- a/build-tools/utils/token-versions.js +++ b/build-tools/utils/token-versions.js @@ -4,8 +4,13 @@ const DEFAULT_TOKEN_VERSION = 'v3-1'; // Groups map a token-name pattern (matched against the token's CSS variable name) to a version. -// Tokens matching no group stay version-less and keep the legacy value-based hashes. -const versionGroups = [{ pattern: /^border-/, version: DEFAULT_TOKEN_VERSION }]; +// Tokens matching no group stay version-less and keep the legacy value-based hashes. Tokens are +// being migrated in batches (one batch per line), and eventually all tokens will be migrated to +// the new format. +const versionGroups = [ + { pattern: /^border-/, version: DEFAULT_TOKEN_VERSION }, + { pattern: /^(font|letter-spacing|line-height)-/, version: DEFAULT_TOKEN_VERSION }, +]; // Builds the token -> version allowlist from the full token -> cssName map. function getTokenVersions(variablesMap, groups = versionGroups) { From 7a5e27757254e17c75d3d69d96aa0e87df7dd5e2 Mon Sep 17 00:00:00 2001 From: Avinash Dwarapu Date: Wed, 29 Jul 2026 14:57:07 +0200 Subject: [PATCH 2/3] Fix tests. --- build-tools/utils/__tests__/token-versions.test.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build-tools/utils/__tests__/token-versions.test.js b/build-tools/utils/__tests__/token-versions.test.js index 48e8c41f0b..2fa974e1e4 100644 --- a/build-tools/utils/__tests__/token-versions.test.js +++ b/build-tools/utils/__tests__/token-versions.test.js @@ -7,27 +7,37 @@ const { getTokenVersions } = require('../token-versions'); const variablesMap = { borderRadiusButton: 'border-radius-button', borderWidthField: 'border-width-field', + colorChartsPurple300: 'color-charts-purple-300', colorBorderButtonNormalDefault: 'color-border-button-normal-default', + colorBackgroundPopover: 'color-background-popover', + colorTextControlDisabled: 'color-text-control-disabled', colorTextAccent: 'color-text-accent', spaceScaledM: 'space-scaled-m', + sizeIconMedium: 'size-icon-m', fontFamilyBase: 'font-family-base', + shadowModal: 'shadow-modal', }; test('versions border tokens matched by the default groups and leaves others (incl. border colors) version-less', () => { expect(getTokenVersions(variablesMap)).toEqual({ borderRadiusButton: 'v3-1', borderWidthField: 'v3-1', + fontFamilyBase: 'v3-1', }); }); test('assigns the version of the first matching group', () => { const groups = [ { pattern: /^color-border-/, version: 'v3-2' }, + { pattern: /^color-text-/, version: 'v3-2' }, { pattern: /^color-/, version: 'v3-1' }, ]; expect(getTokenVersions(variablesMap, groups)).toEqual({ + colorBackgroundPopover: 'v3-1', colorBorderButtonNormalDefault: 'v3-2', - colorTextAccent: 'v3-1', + colorChartsPurple300: 'v3-1', + colorTextAccent: 'v3-2', + colorTextControlDisabled: 'v3-2', }); }); @@ -37,6 +47,6 @@ test('a catch-all group versions every token', () => { }); test('returns an empty map when no group matches', () => { - const groups = [{ pattern: /^color-background-/, version: 'v3-1' }]; + const groups = [{ pattern: /^motion-duration-/, version: 'v3-1' }]; expect(getTokenVersions(variablesMap, groups)).toEqual({}); }); From 44e316371b2710f6884fb604bc339a54049d4055 Mon Sep 17 00:00:00 2001 From: Avinash Dwarapu Date: Wed, 29 Jul 2026 15:18:35 +0200 Subject: [PATCH 3/3] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build-tools/utils/__tests__/token-versions.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/utils/__tests__/token-versions.test.js b/build-tools/utils/__tests__/token-versions.test.js index 2fa974e1e4..aa0e07825c 100644 --- a/build-tools/utils/__tests__/token-versions.test.js +++ b/build-tools/utils/__tests__/token-versions.test.js @@ -18,7 +18,7 @@ const variablesMap = { shadowModal: 'shadow-modal', }; -test('versions border tokens matched by the default groups and leaves others (incl. border colors) version-less', () => { +test('versions border + typography tokens matched by the default groups and leaves others (incl. border colors) version-less', () => { expect(getTokenVersions(variablesMap)).toEqual({ borderRadiusButton: 'v3-1', borderWidthField: 'v3-1',