chore(theme): fail token build on unresolved tokenRef#807
Draft
robsongajunior wants to merge 1 commit into
Draft
chore(theme): fail token build on unresolved tokenRef#807robsongajunior wants to merge 1 commit into
robsongajunior wants to merge 1 commit into
Conversation
robsongajunior
marked this pull request as draft
July 27, 2026 00:17
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.
Summary
Closes the engineering-audit finding:
compile-primitives.js/compile-theme.jssilently fall through on an unresolvedtokenRef— a typo'd token either shipped as a rawpath.to.tokenstring in the CSS (primitives) or silently vanished from the output (theme), with no build warning.assertResolvedRefs(context, unresolved)inrefs.js: throws one aggregated error listing every miss as--var → ref.path.compile-primitives.js,compile-theme.js, andresolve.js(same silent class: raw-ref fallback; the audit had only named two).build-tokens.mjsdrops its private re-implementation of the primitives flatten in favor of the guardedcompilePrimitivesVars().prepack(publish), and any import of these modules fail loudly on a bad ref — a typo can never ship.Verification
build:tokensgreen anddist/v4output byte-identical to the pre-change baseline (the guard is a pure no-op on valid data);build:dts(publish-path vue-tsc emit) green.--var → refin the message (e.g.[theme] 2 unresolved tokenRef(s) in semantic theme tokens: [light] --primary → brand.primary.primary-999 …), each reverted.Notes — the guard immediately found real rot
semantic/colors.jscarries 4 pre-existing dangling refs:--background-backdrop → primitives.alpha.neutral.25and--background-primary-mask → primitives.alpha.brand.primary.65(light + dark) —alphahas noneutral/brandshades. They live in the deadcss-vars.js/resolve.jspath: zero callers in the monorepo, not in theme's exports map, and the shipped CSS gets those variables from the healthy compile-theme path — production is unaffected. This PR deliberately does not guess data fixes:createCssVars()now throws with that exact list if anyone revives the API. Follow-up decision: point the refs at realalphashades (needs design input) or delete the unreferencedcss-vars.js/resolve.jspair.choretype → no release (dist output unchanged; the guard matters at build time).