Repository navigation
Replace hardcoded status colors and phantom CSS variables with design tokens (closes #2592) - #2669
Conversation
… tokens (closes #2592) diagnostic-panel.svelte and invitations-inbox.svelte bypassed the app.css semantic token system in two ways: hardcoded status hex literals, and references to a parallel CSS-variable vocabulary (--surface-1, --color-border, --text-primary, …) that is defined nowhere in the repo and so always resolved to its hardcoded fallback. The second problem was the more serious one. invitations-inbox.svelte is a user-facing modal whose fallbacks were all light-mode values, so it rendered as a white panel with dark text in dark mode regardless of theme — a real theming bug masked by token-shaped syntax that did nothing. Map status colors to --success/--destructive/--warning/--primary and chrome to --card/--foreground/--muted-foreground/--border, using hsl(var(--token)): the tokens are HSL triplets, so the rgb(var(--token) / alpha) form is wrong here. Ring/tint alpha follows the existing noderef.css:386 precedent. Contrast-check every mapping in both themes rather than matching by hue. Three pairings that looked correct fail WCAG AA: - State tags on --*-light: those tokens flip lightness between themes (pale in light, dark in dark), so no single foreground works — 2.22:1 and 3.41:1 in dark. Use a 0.15 tint of the solid token instead (12.7-17.7:1 both themes). - .status.success/.status.error badges: --success-foreground and --destructive-foreground are white in BOTH themes, landing at 2.55-2.83:1 on the solid mid-tone fills. Tint the background and use the state color as text. - .init-error-banner: white passes in light (4.57:1) but fails in dark (2.86:1) and the inverse foreground fails in light. Tinted for the same reason. diagnostic-panel.svelte stays a fixed dark console in both themes — it is a monospace developer tool, and mapping its surfaces to --background/--foreground would turn it white in light mode. Its surface greys remain explicit literals with the dead var() wrappers removed so the intent is honest, and a comment records why. Its status colors are tokenized and verified legible (4.17-7.68:1) against that surface. Known residual: .ok text is 2.83:1 in light mode. Neither --success nor --success-light is dark enough for body text on a white card; this is a gap in the token set rather than a mapping error, and warrants a separate issue. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The tree listed packages/design-system/, which does not exist, and omitted five packages that do: nodespace-types, proto, daemon, cli, and skill. dev-tools was described as "Development utilities" when it is specifically a Bun dev-proxy. Descriptions are taken from each package's own manifest (Cargo.toml `description` for the Rust crates, package.json for skill and dev-tools), and package order now follows the Cargo workspace members list. Also point at where the design system actually lives — packages/desktop-app/src/lib/design/ plus app.css for the color tokens — since that is what the missing design-system entry was gesturing at, and add the assets/ directory. Verified: every packages/ path referenced anywhere in CLAUDE.md now resolves. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Pragmatic Code Review — PR #2669Review Type: Initial review (no prior reviews/comments on the PR) SummaryThe core intent of #2592 is achieved and the change is a genuine improvement: the real theming bug in However, this PR fails a mandatory quality gate. Verified locally on the rebased branch: Requirements Check (against the current, repurposed #2592)
Findings🔴 Critical🔴-1 — This is the blocker. The mechanism is subtle and worth stating precisely, because it is not the "pre-existing 217-violation backlog" story:
This PR rewrote that declaration to bare Principle: a change must leave the mandatory gates green. The ratchet exists precisely so that the backlog can only shrink; unwrapping a grandfathered violation into an equivalent-but-differently-spelled one makes the count appear to grow, which is exactly what the ratchet is designed to catch. Recommended fix — define real dark-console tokens. The issue explicitly offers this as the sanctioned alternative ("Either keep its surface palette as explicit literals … or define real dark-console tokens for it"), and it is the only option that satisfies both AC-2 (no misleading wrappers) and AC-6 (gate passes) without touching the baseline by hand. Add to /* Developer console surface — deliberately dark in BOTH themes. */
--console-background: 0 0% 12%; /* #1e1e1e */
--console-surface: 0 0% 15%; /* #252525 */
--console-surface-hover: 0 0% 20%; /* #333 */
--console-border: 0 0% 27%; /* #444 */
--console-foreground: 0 0% 88%; /* #e0e0e0 */
--console-foreground-muted: 0 0% 53%;/* #888 */then replace the 21 literals with Do not resolve this by re-recording the baseline with the new literal spellings; 🟡 Important🟡-1 — Modal box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);This trips two rules: the raw-literal rule and I want to be clear about why I'm raising this above a nit despite AC-5 saying scrim/shadow values "may remain". AC-5 was written about color tokenization — it grants that .modal {
background: hsl(var(--card));
color: hsl(var(--card-foreground));
border-radius: 8px;
padding: 24px;
width: min(460px, calc(100vw - 48px));
/* no box-shadow — the scrim provides the separation (DESIGN.md) */
}Principle: a design system is only load-bearing if its semantic rules are enforced where the code is being touched. Leaving a known spec violation in a block you just rewrote converts it from "legacy debt" into "reviewed and accepted". (The two 🟡-2 — Stale PR-description claim: "No Stylelint check yet — that lands with #2589" This was true when written and is now false — #2663 landed the config, the rules test, the baseline ratchet, and wired 🟡-3 — Comment overstates the case against
The conclusion is right and the mapping is right — I verified the tint numbers and they are excellent (see ✅ below). But the stated reason is imprecise: Principle: comments earn their keep by explaining why; a why that doesn't survive checking is worse than no comment, because the next reader will act on it. 🟢 Suggestions🟢-1 — Nit: the diagnostic-panel badge comment cites a number that isn't the one that matters
The "white in both themes" claim is correct ( 🟢-2 — Nit:
The badge is 10px-ish uppercase in a developer-only tool, so I would not block on it. But if you want the whole set above 3:1, bumping the badge tint from 🟢-3 — Nit: Going from a solid 🟢-4 — Testing: no new test warranted, and that's the right call Worth stating explicitly since the review brief asks: these are CSS-only changes with no behavioral surface, and the existing rules test covers the config, not individual files. The correct regression mechanism for "this file has no raw literals" is the baseline ratchet, not a bespoke test — which is exactly why 🔴-1 matters. Fixing 🔴-1 by driving the baseline down is the test. 🟢-5 — Verified against the actual tree: all ten Nit on atomicity: this is an unrelated docs fix bundled into a CSS PR, which cuts against the single-cohesive-purpose principle. It's two lines of obvious truth and I would not ask for it to be split — flagging only so the habit doesn't scale to larger bundles. ✅ What's verified correctI re-derived every contrast claim from the
Two smaller things worth noting as correct-but-unremarked: Recommendation🔧 REQUEST CHANGESThis is a net-positive change and I want to be explicit that the substance is good: the dark-mode modal bug is genuinely fixed, the token mappings are semantically correct rather than hue-matched, and the contrast reasoning — unusually — survives independent verification. Under Pragmatic Quality I would happily approve it on design merits alone. What blocks it is narrow and mechanical: 🔴-1, a mandatory gate ( I'd pair that with 🟡-1 (delete the modal Re-review needed after 🔴-1 and 🟡-1. Automated pragmatic-code-review · verified against the rebased branch at |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: REQUEST CHANGES (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Blocker (🔴): #2663 landed the design-token ratchet while this PR was in flight, wiring `quality:design-tokens` into quality:check/quality:fix. The gate failed with 21 net-new violations in diagnostic-panel.svelte. The mechanism is subtle: design-tokens-baseline.json keys entries on file/rule/text, and `text` embeds the literal verbatim. The baseline held `var(--color-text-muted, #888)`. Unwrapping that dead var() to a bare #888 — correct in itself, since --color-text-muted is defined nowhere — produced a different key, so the gate read the result as net-new drift. Fix the cause rather than the symptom: define six theme-invariant --console-* tokens in app.css and swap all 21 literals. HSL values round-trip to the exact original hex, so the console is pixel-identical. The panel keeps its deliberate dark-in-both-themes appearance while satisfying the token rule, and the rationale moves to app.css where the tokens are defined. This drives the baseline DOWN from 251 to 194 (-57): diagnostic-panel goes from 33 entries to 0. The baseline is re-recorded because violations were *fixed*, which the ratchet requires — not to absorb new ones, which it forbids. Important (🟡): remove `box-shadow` from .modal in invitations-inbox.svelte. DESIGN.md reserves elevation shadows for floating surfaces; modal panels get none, since the backdrop provides separation. This PR rewrote the .modal block two lines above and should have caught it. Comment corrections (🟡/🟢): the --*-light rationale said those tokens "flip" lightness, which is imprecise — the real disqualifier is that they have no paired --*-light-foreground token. The badge comment's "~2.5-2.8:1" also omitted that white-on---destructive clears AA in light at 4.57:1; the binding constraint is the 2.86:1 dark case. Both now state the measured figures, including .status.error sitting at 2.88:1 in light. Not addressed: the rgba(0,0,0,0.5) overlay scrim (1 remaining baseline entry). It is the identical value used by all four other modals, and no overlay token exists. Inventing a one-off here would break that consistency; it belongs to the modals remediation issue. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
049854a to
ab4a5f8
Compare
Address-Review SummaryCommit ✅ 🔴 Blocker — design-token gate (AC-6)The review was correct, and my brief to it was wrong: I had claimed Stylelint was "only a devDependency, not wired into CI." It is wired — Root cause is the keying subtlety the review identified: the baseline keys on Fix: six theme-invariant Result: baseline 251 → 194 (−57). On re-recording: the gate flipped from "21 new" to "57 no longer occur" — opposite conditions. Re-recording to absorb new violations is what ✅ 🟡 Modal shadowRemoved ✅ 🟡/🟢 Comment accuracy — both corrections were right
Also verified the ⏭️ Not addressed — overlay scrim
Verification
Also corrected the PR description, which claimed "No Stylelint check yet." Re-Review DecisionRE-REVIEW NEEDED — new tokens added to a shared file ( |
Pragmatic Code Review — Re-Review (PR #2669)Review Type: Re-Review — scoped to Previous Review Summary
Counts: 3 addressed / 0 unaddressed / 1 justified deferral / 0 new issues. Verification of the Blocker FixThe highest-risk element of this commit was the baseline re-record (251 → 194). I verified it independently rather than taking the commit message at its word. Baseline integrity — confirmed legitimate ratchet shrinkage. I diffed the two baselines as multisets keyed on Zero entries added or altered. The raw diff corroborates this — the baseline hunk is 286 deleted lines and one added line (the closing bracket). This is structurally incapable of absorbing an unfixed violation. Gate + full quality run pass: HSL round-trip — all six exact. For achromatic HSL,
Token scoping — correct. Architecturally this is the stronger of the two options the issue offered ("keep literals honestly, or define real dark-console tokens"). It resolves the blocker by eliminating the literals rather than by re-recording around them, and it relocates the rationale to where the values are defined ( Verification of the Comment CorrectionsI recomputed every contrast figure from the raw HSL triplets in
These comments now explain why with falsifiable numbers rather than hand-waving — which is what a comment is for. FindingsCritical IssuesNone. Suggested ImprovementsNone blocking. Nitpicks
On the Deferred Scrim — Deferral Is Sound, Not a Cop-OutI checked this rather than accepting the rationale. Three reasons the deferral is right:
Deferring here keeps the change atomic and leaves the remaining entry visible in the baseline as a tracked debt rather than a silenced one. That is the correct call. Requirements Check — Issue #2592 Acceptance Criteria
All seven criteria met. Recommendation: ✅ APPROVEThis commit does exactly what the previous review asked, and — importantly — it fixed the cause rather than the symptom. The tempting shortcut here was to re-record the baseline to make 21 violations disappear, which the gate's own README forbids. The author instead diagnosed why the key changed (unwrapping a dead Every factual claim in the commit message verified under independent checking: the HSL round-trips are exact, the baseline gained zero entries, the contrast figures are right (including the non-obvious choice of the correct compositing parent), and the DESIGN.md citations are accurate ( No new issues introduced. The single remaining nit is optional. Ship it. Automated pragmatic-code-review · Findings verified by independent recomputation of contrast ratios, HSL round-trips, and multiset baseline diffing. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Re-review nit (🟢, explicitly non-blocking): the comment enumerated five contrast ratios to justify one decision, and "white-on---destructive" read badly as a triple hyphen. Keep what stays useful at the call site — why a solid fill is not an option, and the one accepted sub-AA-large case — and drop the rejected-alternative figures, which are working notes rather than a standing constraint. They remain in the commit history and PR discussion if anyone needs to re-derive the decision. Comment-only; no behavioral change. Retained figures re-verified: solid fill is 2.55:1/2.86:1 in dark, and the tint clears 3:1 everywhere except .status.error at 2.88:1 in light (3.92/4.29/3.97 for the rest). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…#2712) The @media print block in noderef.css hardcoded #000/#999. Swapping them for the live --foreground/--muted-foreground tokens (as the issue's proposed solution suggested) would have been wrong: theme.ts leaves the .dark class on <html> through printing since nothing resets it, so a theme-tracking token resolves to its near-white .dark value there, printing invisible ink on the always-white printed page. Add --print-foreground/--print-muted-foreground to app.css, defined once under :root and deliberately not redefined under .dark, pinning the light-mode --foreground/--muted-foreground values for print regardless of the active app theme. Mirrors the existing --console-* precedent (diagnostic-panel.svelte) for the same reason: a surface that must not track the live theme gets its own theme-invariant tokens. Re-recorded design-tokens-baseline.json: 137 -> 134, the three raw-hex print-block entries this removes. diagnostic-panel.svelte's own hardcoded dark IDE palette (the issue's other target) was already reworked onto --console-* tokens and its fixed-dark-console design decision already documented, in #2669/#2678 — verified via grep (zero hex/rgba literals remain) and a live browser check (see PR description) rather than assumed. Co-authored-by: Claude Sonnet 5 <[email protected]>
Closes #2592.
Scope note
This issue originally targeted
pro-sync-pill.svelte,enable-sync-pill.svelteandpro-teaser-pill.svelte. All three were deleted in #2627 along with their four test files, so that scope no longer existed. The issue was repurposed (title + body rewritten, with a comment recording why) onto the two surviving components carrying the same defect:diagnostic-panel.svelteandinvitations-inbox.svelte.What was wrong
Two distinct problems in both files:
1. Hardcoded status colors bypassing the
app.csssemantic token system — success/error/pending/primary states written as raw hex.2. References to CSS variables that do not exist. Both files referenced a parallel vocabulary (
--surface-1,--color-border,--text-primary,--color-bg-secondary, …) that is defined nowhere in the repo, so every one resolved to its hardcoded fallback, permanently.The second was the more serious one.
invitations-inbox.svelteis a user-facing modal whose fallbacks were all light-mode values (--surface-1, #ffffff,--text-primary, #1f2937), so it rendered as a white panel with dark text in dark mode regardless of theme — a real theming bug masked by token-shaped syntax that did nothing.Approach
Map by semantic meaning to
--success/--destructive/--warning/--primaryand chrome to--card/--foreground/--muted-foreground/--border, usinghsl(var(--token)).Note for the sibling audit issues (#2590, #2591): the original issue text prescribed
rgb(var(--token) / alpha). That is wrong for this codebase — the tokens are HSL triplets, so the correct form ishsl(var(--token)), per the existing precedent atnoderef.css:386. Those issues inherit the same incorrect prescription.Contrast verification
Every mapping was contrast-checked in both themes via WCAG 2.1 relative luminance rather than matched by hue. Three pairings that looked correct fail AA:
--*-light--*-lightflips lightness between themes, so no fixed foreground works. Use a0.15tint of the solid token → 12.7–17.7:1 both themes.status.*badges (white on solid fill)--success-foreground/--destructive-foregroundare white in both themes. Tint background, use state color as text.init-error-bannerdiagnostic-panel.svelte's tokenized status colors verified against its dark console surface: 4.17–7.68:1.diagnostic-panel.sveltestays a dark consoleIt is a fixed-position monospace developer tool, deliberately dark in both themes. Mapping its surfaces to
--background/--foregroundwould turn it white in light mode and destroy the console affordance. Its surface greys remain explicit literals with the deadvar()wrappers removed so the intent is honest, and an in-file comment records why. Only its status colors are tokenized.Known residual
.oktext ininvitations-inbox.svelteis 2.83:1 in light mode. Neither--success(2.83) nor--success-light(1.52) is dark enough for body text on a white card — every available token alternative scored worse. This is a gap in the token set, not a mapping error, and is filed as #2668 along with the white-*-foregroundproblem.Also included
CLAUDE.md's repo-structure tree was inaccurate: it listedpackages/design-system/(does not exist) and omitted five packages that do (nodespace-types,proto,daemon,cli,skill). Descriptions taken from each package's own manifest; order follows the Cargo workspace members list. Verified everypackages/path referenced anywhere in CLAUDE.md now resolves.Testing
All four suites green, each verified individually:
test:coverage— 242 files / 4995 tests (matches baseline exactly)test:scripts— 424 pass, 0 failtest:skill— 5 files / 91 testsrust:test— 184 passed, 0 failedquality:fix— clean (2500 files, 0 errors, 0 warnings)Design-token gate: #2663 landed the Stylelint ratchet (
quality:design-tokens, wired intoquality:check/quality:fix) while this PR was in flight — an earlier revision of this description incorrectly said no such check existed yet. It now passes, and the baseline drops from 251 to 194 (diagnostic-panel.svelte: 33 entries to 0). The one remaining entry for these files is thergba(0, 0, 0, 0.5)overlay scrim, which is the identical value used by all four other modals and has no token; it belongs to #2591.🤖 Generated with Claude Code