Skip to content

Fix phantom CSS var() refs across the shell renderer + close the check gap#151

Merged
th3-br41n merged 1 commit into
mainfrom
fix/shell-phantom-css-tokens
Jul 12, 2026
Merged

Fix phantom CSS var() refs across the shell renderer + close the check gap#151
th3-br41n merged 1 commit into
mainfrom
fix/shell-phantom-css-tokens

Conversation

@th3-br41n

Copy link
Copy Markdown
Contributor

What

The shell renderer CSS was excluded from tools/check-css-tokens.mjs (CSS_SCOPES only covered apps / sdk / editor). So a var(--x) naming a token that doesn't exist fell back silently:

  • wrong font where a fallback existed (font-family: var(--font-mono, monospace) → the UI font, not code — the exact bug behind the Identity fingerprint looking off), and
  • no background at all for the no-fallback cases (background: var(--color-surface-2) → the declaration is invalid → transparent). Several settings/marketplace/feedback panels were rendering with missing surfaces.

Fix

Mapped 46 references (24 distinct phantom names) across packages/shell/src/renderer/**/*.css to real tokens (packages/tokens), verified against the actual palette rather than guessing:

Phantom Real
--font-mono, --font-family-mono, --font-family-sans --text-family-code / --text-family-ui
--color-surface{,-1,-2,-3,-sunken,-muted,-subtle,-secondary,-tertiary} --color-surface-{default,raised,overlay}
--color-surface-hover --color-interactive-hover
--color-text-danger, --color-text-on-accent, --color-on-accent --color-state-error / --color-text-inverse
--color-state-*-subtle, --color-state-warn-bg, --color-state-highlight color-mix(… var(--color-state-*) N%, transparent) (existing shell pattern)
--focus-ring 2px solid var(--color-focus-ring)
--shadow-overlay --shadow-xl
--line-height-relaxed --text-line-height-relaxed
--space-1-5 --space-2
--z-windowControlsOverlay --z-window-controls-overlay (casing)

Dead phantom fallbacks (--color-background-secondary, --color-selection-subtle) dropped.

Regression guard

Added packages/shell/src/renderer to CSS_SCOPES — the check now covers the shell renderer, so a phantom there fails CI instead of shipping. bun tools/check-css-tokens.mjs → ✓ every var() resolves.

🤖 Generated with Claude Code

…rd against regression

The shell renderer CSS was deliberately excluded from `check-css-tokens.mjs`
(`CSS_SCOPES` covered apps/sdk/editor only), so `var(--x)` names that don't
resolve to any real theme token fell back silently — the wrong font, or (for
the no-fallback cases like `background: var(--color-surface-2)`) no background
at all. This is the same class of bug as the Identity fingerprint's phantom
`--font-mono` (it rendered in the UI font, not code).

Swept every `packages/shell/src/renderer/**/*.css` reference to a real token:
- `--font-mono` / `--font-family-mono` / `--font-family-sans` → `--text-family-code` / `--text-family-ui`
- `--color-surface{,-1,-2,-3,-sunken,-muted,-subtle,-secondary,-tertiary}` → real `--color-surface-{default,raised,overlay}`
- `--color-surface-hover` → `--color-interactive-hover`
- `--color-text-danger` / `--color-text-on-accent` / `--color-on-accent` → `--color-state-error` / `--color-text-inverse`
- subtle state backgrounds (`--color-state-*-subtle`, `--color-state-warn-bg`, `--color-state-highlight`) → `color-mix(... var(--color-state-*) N%, transparent)` (existing shell pattern)
- `--focus-ring` → `2px solid var(--color-focus-ring)`; `--shadow-overlay` → `--shadow-xl`
- `--line-height-relaxed` → `--text-line-height-relaxed`; `--space-1-5` → `--space-2`
- `--z-windowControlsOverlay` → `--z-window-controls-overlay` (casing)
- dropped dead phantom fallbacks (`--color-background-secondary`, `--color-selection-subtle`)

Then added `packages/shell/src/renderer` to `CSS_SCOPES` so the check now covers
the shell renderer too — a phantom there can't silently ship again.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@th3-br41n th3-br41n merged commit 588aca4 into main Jul 12, 2026
2 of 3 checks passed
@th3-br41n th3-br41n deleted the fix/shell-phantom-css-tokens branch July 12, 2026 20:31
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