Skip to content

Handle duplicate token conflicts gracefully#184

Merged
JLG-WOCFR-DEV merged 1 commit intomainfrom
codex/add-duplicate-token-handling-and-validation
Oct 1, 2025
Merged

Handle duplicate token conflicts gracefully#184
JLG-WOCFR-DEV merged 1 commit intomainfrom
codex/add-duplicate-token-handling-and-validation

Conversation

@JLG-WOCFR-DEV
Copy link
Owner

Summary

  • surface duplicate design token conflicts during normalization instead of overwriting entries and include the conflicting inputs in the response
  • ensure the tokens UI blocks duplicate submissions, highlights the offending fields, and announces the error through toast/ARIA messaging
  • extend the Playwright tokens spec with duplicate-handling coverage and an API scenario that expects the REST endpoint to report detailed conflicts

Testing

  • npx playwright test tests/ui/tokens.spec.js (fails: Docker-based wp-env is unavailable in this environment)

https://chatgpt.com/codex/tasks/task_e_68dd41f3b84c832ebabf3cb50d349af9

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 438 to 442
'group' => 'Legacy',
];

if (array_key_exists($name, $tokensByName)) {
unset($tokensByName[$name]);
}

$tokensByName[$name] = $token;
$tokensByName[] = $token;
}

Choose a reason for hiding this comment

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

P1 Badge Preserve last CSS definition when importing duplicate tokens

convertCssToRegistry used to index declarations by name so the last occurrence replaced earlier ones, mirroring CSS’s cascade. After the change the code simply appends tokens and relies on normalizeRegistry() to deduplicate, which keeps the first encountered value. If the CSS source contains duplicate custom properties, importing the registry now yields the stale initial value, so a round‑trip through the admin UI will overwrite the effective CSS value with an older one and duplicates still aren’t surfaced. The import needs to retain last‑wins behaviour or explicitly pick the final conflicting token as canonical.

Useful? React with 👍 / 👎.

@JLG-WOCFR-DEV JLG-WOCFR-DEV merged commit dd9ed09 into main Oct 1, 2025
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant