Skip to content

fix: expand 3-digit hex custom properties before token-name inversion - #102

Merged
3x-haust merged 1 commit into
mainfrom
fix/token-hex-normalize
Jul 22, 2026
Merged

3x-haust merged 1 commit into
mainfrom
fix/token-hex-normalize

Conversation

@3x-haust

Copy link
Copy Markdown
Owner

Problem

Vite/esbuild minifies a repeating 6-digit CSS custom property (--paper: #ffffff) down to its 3-digit shorthand (#fff) in a production build. The IR token->name inversion in core/ir/dom.ts compared that raw custom-property value against a consumer's computed background-color, which always resolves to the full 6-digit form via toHex. So a minified design token read as a false mismatch and silently lost its token name — a real bug in the design checker, not a page defect.

Fix

Expand a 3-digit hex shorthand to its canonical 6-digit form before the value->name comparison. Ten lines; no behavior change for any already-6-digit or rgb() value.

Tests (positive + negative, per repo convention)

New test/token-hex.test.ts renders a real fixture through the browser IR path:

  • Positive: a minified --surface: #fff resolves to #FFFFFF and a consumer keeps token: 'surface' (fails without the fix).
  • Control: an already-6-digit --brand: #1f9d55 is unaffected.
  • Negative: a hand-typed #fefefe literal stays token: null — no fabricated attribution.

Validation

npm run typecheck clean · token-hex 2/2 · ir + blueprint 49/49 · npm run build clean · git diff --check clean.

Branched from main; no release.

Vite/esbuild minifies a repeating 6-digit CSS custom property (#ffffff) to 3-digit (#fff) in production; the IR token->name inversion compared it against a consumer's 6-digit computed background, dropping the token name. Expand shorthand before comparing. Adds a browser IR test with positive/control/negative cases.

typecheck clean; token-hex 2/2; ir+blueprint 49/49; build clean; diff --check clean.
@3x-haust
3x-haust merged commit b07e8bf into main Jul 22, 2026
@3x-haust
3x-haust deleted the fix/token-hex-normalize branch July 23, 2026 12:03
@3x-haust 3x-haust mentioned this pull request Jul 23, 2026
3x-haust added a commit that referenced this pull request Jul 23, 2026
Bump all five manifests (package.json, .claude-plugin/plugin.json + marketplace.json, .codex-plugin/plugin.json, .agents/plugins/marketplace.json) 0.18.0 -> 0.19.0 and resync package-lock.json via scripts/bump.ts. Pushing the plugin.json version change to main triggers the Release workflow, which tags v0.19.0 and cuts the GitHub release with the merged-PR changelog.

This release ships this session's harness-quality work merged since v0.18.0 (#102-#117): token-hex normalization; marketing register/ambition, colour+material carrier, and free-license photography floors; frame-before-build gate; Awwwards/FWA scout and showpiece load-scene ambition; section-granular reference composition and the per-section-fidelity transfer boundary; the staged showpiece scroll-scene evidence protocol (contract, browser capture, final-evidence enforcement, composer permission); macro-layout sketch divergence; the SLOP-COLORLESS machine check; and genuinely-divergent visual-direction enumeration. Full suite 1566 pass / 0 fail / 1 skip; build + typecheck clean.
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.

1 participant