Skip to content

fix: detect $extensions changes in sync diff so modifier edits are no…#3900

Open
akshay-gupta7 wants to merge 4 commits into
mainfrom
akshay/fix-github-opacity-sync
Open

fix: detect $extensions changes in sync diff so modifier edits are no…#3900
akshay-gupta7 wants to merge 4 commits into
mainfrom
akshay/fix-github-opacity-sync

Conversation

@akshay-gupta7

@akshay-gupta7 akshay-gupta7 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

… longer silently dropped

Why does this PR exist?

Closes #0000

Editing an opacity modifier on a token updated the value correctly in the plugin but was never detected by the sync diff, so the change tab showed nothing and the commit could never be made.

What does this pull request do?

  • findDifferentState now compares $extensions alongside value and description when detecting token updates
  • oldValue is only populated when .value itself changed — not on $extensions-only diffs — to avoid misleading value diffs in the UI
  • Adds tests covering modifier changed, modifier added, modifier removed, identical modifier (no false positive), and oldValue is absent on extension-only updates

Testing this change

  1. Open the plugin and select a color token with an opacity modifier
  2. Change the modifier value (e.g. 0.50.35) and save
  3. Open the sync diff tab — the token should now appear as a pending change

Additional Notes (if any)

The same fix covers all $extensions changes (lighten, darken, mix modifiers), not just opacity — opacity was the only one customers reported because it is the most commonly used.

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1d18b2e

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

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin 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 Jun 17, 2026

Copy link
Copy Markdown
Contributor

⤵️ 📦 ✨ The artifact was successfully created! Want to test it? Download it here 👀 🎁

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Commit SHA:b0f985a039faf2c7c3ed7b401cbc973fff795776

Test coverage results 🧪

Code coverage diff between base branch:main and head branch: akshay/fix-github-opacity-sync 
Status File % Stmts % Branch % Funcs % Lines
🟢 total 59.65 (0.01) 51.3 (0.01) 57.98 (0) 60.14 (0.01)
🟢 packages/tokens-studio-for-figma/src/utils/findDifferentState.ts 89.58 (0.7) 77.27 (5.05) 84.61 (0) 92.85 (0.35)

@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance findings — 0 findings across reviewed files.

Categories checked: ROPA · Subprocessor · Access Control · AI Provider Routing · Secrets/Credentials · Policy Gap

Assessment: Adds $extensions comparison in token diff detection (findDifferentState.ts). Pure logic change — no new data flows, no external calls, no personal data involved.

ℹ️ This check is informational.
🛡️ Hyma Compliance Check · automated

@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance-relevant changes detected

2 file(s) scanned · 0 findings

Changes extend findDifferentState to include $extensions in token diff comparison, plus test coverage. No personal data, new external dependencies, AI calls, or access control changes.

ℹ️ This check is informational.
🛡️ Hyma Compliance Check · automated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the token sync-diff logic so changes in a token’s $extensions (notably modifier edits) are detected and included in the computed changed state, preventing modifier-only changes from being skipped during sync.

Changes:

  • Treat $extensions differences as token updates in findDifferentState.
  • Expand Jest coverage for updated values, removals, and $extensions modifier add/remove/change scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/tokens-studio-for-figma/src/utils/findDifferentState.ts Extends update detection to include $extensions diffs during token comparisons.
packages/tokens-studio-for-figma/src/utils/findDifferentState.test.ts Adds test cases for value updates, removals, and modifier-only $extensions changes.
Comments suppressed due to low confidence (1)

packages/tokens-studio-for-figma/src/utils/findDifferentState.ts:30

  • When an update is triggered solely by a $extensions change (with the token value unchanged), this code still sets oldValue, which makes the UI treat it as a value diff and can display an “old” and “new” value that are actually identical. Consider only setting oldValue when the value itself changed, while still marking the token as UPDATE when $extensions changed.
        if (!isEqual(oldValue.value, token.value) || !isEqual(oldValue.$extensions, token.$extensions)) {
          const updatedToken: ImportToken = { ...token };
          updatedToken.oldValue = oldValue.value;
          updatedToken.importType = 'UPDATE';
          updatedTokens.push(updatedToken);

@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance-relevant changes detected

Files changed in this PR were reviewed against the compliance taxonomy (ROPA, Subprocessor, Access Control, AI Provider Routing, Secrets/Credentials, Policy Gap). No findings were identified.

🛡️ Hyma Compliance Check · automated

@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance-relevant changes detected

1 file(s) scanned · 0 findings

ℹ️ This check is informational.
🛡️ Hyma Compliance Check · automated

@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance-relevant changes detected

Files scanned · 0 findings

No new external calls, personal data processing changes, or authentication/authorization modifications detected. No compliance action required.

ℹ️ This check is informational.
🛡️ Hyma Compliance Check · automated

@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance-relevant changes detected

2 file(s) scanned · 0 findings

ℹ️ This check is informational.
🛡️ Hyma Compliance Check · automated

1 similar comment
@anathaniel-TS

Copy link
Copy Markdown

🛡️ Hyma Compliance Check

No compliance-relevant changes detected

2 file(s) scanned · 0 findings

ℹ️ This check is informational.
🛡️ Hyma Compliance Check · automated

@akshay-gupta7 akshay-gupta7 self-assigned this Jul 2, 2026
@akshay-gupta7 akshay-gupta7 marked this pull request as ready for review July 2, 2026 20:49
@akshay-gupta7 akshay-gupta7 requested a review from six7 July 2, 2026 20:50
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.

3 participants