Skip to content

Improve theme surface token coverage#30

Merged
Jay1 merged 6 commits into
mainfrom
jcode/improve-theme-surface-depth
Jun 1, 2026
Merged

Improve theme surface token coverage#30
Jay1 merged 6 commits into
mainfrom
jcode/improve-theme-surface-depth

Conversation

@Jay1

@Jay1 Jay1 commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • add semantic app tokens for toolbar, chrome controls, metadata, control icons, and work rows
  • route existing header, git, branch, chat, and sidebar surfaces through theme tokens
  • document theme surface token ownership and clean the testing docs index

Verification

  • snip bun run --cwd apps/web test src/theme/theme.logic.test.ts
  • snip bun run fmt:check:local
  • snip bun run --cwd apps/web typecheck
  • snip bun run --cwd apps/web build
  • GIT_MASTER=1 snip git diff --check
  • Playwright browser QA: dark Catppuccin computed tokens present, .sidebar-icon-button consumes tokenized colors, console errors 0

Summary by CodeRabbit

  • Style

    • Updated UI styling across chat, branch, git, and sidebar components to use new consistent design tokens for improved visual coherence.
    • Introduced enhanced theme surface tokens (toolbar, chrome controls, metadata, work rows) for standardized appearance.
  • Documentation

    • Added theme surface token rules documentation defining token ownership and component usage guidelines.
  • Tests

    • Expanded theme logic test coverage for chrome control and metadata token validation.

@coderabbitai

coderabbitai Bot commented May 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Jay1, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 45 minutes and 49 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 482c98ba-a198-4e2f-824c-3d1be3fb6bb9

📥 Commits

Reviewing files that changed from the base of the PR and between fa1534e and 009cf9d.

📒 Files selected for processing (1)
  • apps/web/src/components/chat/MessagesTimeline.test.tsx
📝 Walkthrough

Walkthrough

This PR introduces a new design token system for the web app by defining CSS variables (--app-chrome-control-, --app-metadata-, --app-control-icon-, --app-work-row-) in the root stylesheet, generating them across theme profiles, validating the generation with tests, and applying them across UI components to replace hardcoded Tailwind classes and older color tokens.

Changes

Theme Surface Token System and Component Migration

Layer / File(s) Summary
Design token definitions in CSS
apps/web/src/index.css
New :root CSS variables are defined for toolbar surfaces, chrome controls, metadata text, control icons, and work-row styling. The .sidebar-icon-button helper is updated to use --app-control-icon-* tokens with fallbacks.
Theme token generation for Catppuccin and profiles
apps/web/src/theme/theme.logic.ts
Chrome control, metadata, control-icon, toolbar surface, and work-row CSS variables are generated in both the Catppuccin-specific depth builder and the general profile depth builder, deriving values from resolved theme tokens and computed ink-based RGBA.
Theme token generation tests and validation
apps/web/src/theme/theme.logic.test.ts
The REQUIRED_APP_DEPTH_TOKENS list is extended with new token names; a new test validates chrome control variable derivation; Catppuccin Mocha assertions are expanded with expected values for all new token families.
Component styling — environment, chat, git, and sidebar controls
apps/web/src/components/BranchToolbar.tsx, apps/web/src/components/ChatView.tsx, apps/web/src/components/GitActionsControl.tsx, apps/web/src/components/Sidebar.tsx, apps/web/src/components/chat/ChatHeader.tsx, apps/web/src/components/chat/MessageActionButton.tsx
Environment picker, runtime controls, composer skeletons, chat headers, message buttons, git action controls, and sidebar buttons are updated to use the new --app-* token variables instead of hardcoded Tailwind classes and older color tokens. Disabled states and hover behaviors are preserved via the new token system.
Component styling — chat transcript and work entry display
apps/web/src/components/chat/MessagesTimeline.tsx
Chat transcript UI including checkpoint changed-files cards, assistant metadata, working indicators, and work-entry rows (edited files, subagent cards, thread buttons, counters, metadata emphasis) are updated to use --app-work-row-*, --app-metadata-*, and --app-chrome-control-* token variables.
Token rules and architecture documentation
docs/architecture/theme-surface-tokens.md, docs/architecture/README.md, docs/testing/README.md
New documentation establishes theme surface token rules defining token families, ownership, component usage guidelines, and accessibility guardrails. The architecture scenario matrix is updated to include theme token changes, and an obsolete appearance-regressions reference is removed from the testing docs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Jay1/jcode#6: Both PRs extend the theme token system in apps/web/src/theme/theme.logic.ts and add CSS variables to apps/web/src/index.css for app-specific UI tokens used by component styling.
  • Jay1/jcode#21: Both PRs refactor component styling to use shared --app-* theme tokens and extend the REQUIRED_APP_DEPTH_TOKENS validation set, following a similar pattern of centralizing token definitions and consuming them across the component tree.

Suggested labels

vouch:trusted, size:XL

Poem

🐰 Tokens twine through threads so bright,
Chrome and metadata in sight,
Themes now dance in CSS arrays,
Components sing in modern ways,
Design systems bloom with care,
Beauty tokens everywhere!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Improve theme surface token coverage' accurately and directly describes the main objective of adding semantic app tokens and routing existing surfaces through theme tokens.
Description check ✅ Passed The PR description covers the key aspects (Summary, verification steps) but lacks Why/motivation section and is not fully aligned with the template structure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jcode/improve-theme-surface-depth

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels May 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/index.css`:
- Around line 61-66: The CSS uses the background shorthand which breaks
transition-colors and triggers Stylelint; update the .sidebar-icon-button rule
and its hover variant (the selector .sidebar-icon-button) to use
background-color instead of background (both the base declaration currently
using var(--app-control-icon-bg, transparent) and the hover declaration using
var(--app-control-icon-hover-bg, ...)); keep the rest of the declaration order
(leave `@apply` and transition-colors intact) so the hover color change can be
animated and Stylelint warnings are resolved.

In `@docs/architecture/README.md`:
- Around line 18-25: Update the metadata table's "Last reviewed" field in
docs/architecture/README.md to a current date to reflect the added architecture
navigation; locate the "Last reviewed" metadata entry (the header metadata block
containing "Last reviewed") and change its value to today's review date so the
document's metadata remains accurate after edits to the table (also apply the
same update if there's a duplicate "Last reviewed" entry noted at line 32).

In `@docs/architecture/theme-surface-tokens.md`:
- Around line 34-37: The docs incorrectly state that chrome-control tokens are
derived only in buildProfileAppDepthVariables; update the source note in
theme-surface-tokens.md so it also documents that these tokens are emitted from
the Catppuccin branch in buildAppDepthVariables (in addition to
buildProfileAppDepthVariables), and reference the specific token family names
(`--app-chrome-control-*`) and the functions buildAppDepthVariables and
buildProfileAppDepthVariables so readers can trace generation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ffee8e80-e4e1-4e21-b392-997ed2415e9d

📥 Commits

Reviewing files that changed from the base of the PR and between 68ee224 and fa1534e.

📒 Files selected for processing (13)
  • apps/web/src/components/BranchToolbar.tsx
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/GitActionsControl.tsx
  • apps/web/src/components/Sidebar.tsx
  • apps/web/src/components/chat/ChatHeader.tsx
  • apps/web/src/components/chat/MessageActionButton.tsx
  • apps/web/src/components/chat/MessagesTimeline.tsx
  • apps/web/src/index.css
  • apps/web/src/theme/theme.logic.test.ts
  • apps/web/src/theme/theme.logic.ts
  • docs/architecture/README.md
  • docs/architecture/theme-surface-tokens.md
  • docs/testing/README.md
💤 Files with no reviewable changes (1)
  • docs/testing/README.md

Comment thread apps/web/src/index.css
Comment on lines +61 to +66
@apply items-center justify-center rounded-sm p-0.5 text-[var(--app-control-icon-fg,var(--muted-foreground))] transition-colors hover:text-[var(--app-control-icon-hover-fg,var(--foreground))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--app-state-focus,var(--ring))];
background: var(--app-control-icon-bg, transparent);
}

.sidebar-icon-button:hover {
background: var(--color-background-button-secondary-hover);
background: var(--app-control-icon-hover-bg, var(--color-background-button-secondary-hover));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use background-color here instead of background.

transition-colors will stop animating this hover change when the rule switches the background shorthand, and Stylelint is already flagging Line 62 for the declaration placement.

💡 Suggested fix
 .sidebar-icon-button {
   `@apply` items-center justify-center rounded-sm p-0.5 text-[var(--app-control-icon-fg,var(--muted-foreground))] transition-colors hover:text-[var(--app-control-icon-hover-fg,var(--foreground))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--app-state-focus,var(--ring))];
-  background: var(--app-control-icon-bg, transparent);
+
+  background-color: var(--app-control-icon-bg, transparent);
 }
 
 .sidebar-icon-button:hover {
-  background: var(--app-control-icon-hover-bg, var(--color-background-button-secondary-hover));
+  background-color: var(--app-control-icon-hover-bg, var(--color-background-button-secondary-hover));
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@apply items-center justify-center rounded-sm p-0.5 text-[var(--app-control-icon-fg,var(--muted-foreground))] transition-colors hover:text-[var(--app-control-icon-hover-fg,var(--foreground))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--app-state-focus,var(--ring))];
background: var(--app-control-icon-bg, transparent);
}
.sidebar-icon-button:hover {
background: var(--color-background-button-secondary-hover);
background: var(--app-control-icon-hover-bg, var(--color-background-button-secondary-hover));
`@apply` items-center justify-center rounded-sm p-0.5 text-[var(--app-control-icon-fg,var(--muted-foreground))] transition-colors hover:text-[var(--app-control-icon-hover-fg,var(--foreground))] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--app-state-focus,var(--ring))];
background-color: var(--app-control-icon-bg, transparent);
}
.sidebar-icon-button:hover {
background-color: var(--app-control-icon-hover-bg, var(--color-background-button-secondary-hover));
}
🧰 Tools
🪛 Stylelint (17.12.0)

[error] 62-62: Expected empty line before declaration (declaration-empty-line-before)

(declaration-empty-line-before)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/index.css` around lines 61 - 66, The CSS uses the background
shorthand which breaks transition-colors and triggers Stylelint; update the
.sidebar-icon-button rule and its hover variant (the selector
.sidebar-icon-button) to use background-color instead of background (both the
base declaration currently using var(--app-control-icon-bg, transparent) and the
hover declaration using var(--app-control-icon-hover-bg, ...)); keep the rest of
the declaration order (leave `@apply` and transition-colors intact) so the hover
color change can be animated and Stylelint warnings are resolved.

Comment on lines +18 to +25
| If you are doing this | Start here | Then check |
| ----------------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| Getting oriented | [System Overview](system-overview.md) | [`../../AGENTS.md`](../../AGENTS.md) |
| Checking workspace boundaries | [Runtime Boundaries](runtime-boundaries.md) | [System Overview](system-overview.md) |
| Changing providers | [Provider Runtime Architecture](provider-runtime.md) | [`../../apps/server/AGENTS.md`](../../apps/server/AGENTS.md) |
| Changing server boundaries | [Server Architecture Migration Inventory](../server-architecture-migration.md) | [Testing Strategy](../testing/strategy.md) |
| Changing theme surface tokens | [Theme Surface Token Rules](theme-surface-tokens.md) | [Appearance Regression Testing](../testing/appearance-regressions.md) |
| Recording a durable decision | [ADR Index](../adr/README.md) | [Repo Governance](../governance/repo-governance.md) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the metadata table's review date.

This adds new architecture navigation, so the Last reviewed field above should move forward with the edit as well. As per coding guidelines, "Keep metadata tables current when adding or substantially changing a document".

Also applies to: 32-32

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/architecture/README.md` around lines 18 - 25, Update the metadata
table's "Last reviewed" field in docs/architecture/README.md to a current date
to reflect the added architecture navigation; locate the "Last reviewed"
metadata entry (the header metadata block containing "Last reviewed") and change
its value to today's review date so the document's metadata remains accurate
after edits to the table (also apply the same update if there's a duplicate
"Last reviewed" entry noted at line 32).

Comment on lines +34 to +37
| Family | Tokens | Use for | Source evidence |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| App surfaces | `--app-surface-canvas`, `--app-surface-sidebar`, `--app-surface-topbar`, `--app-surface-panel`, `--app-surface-card`, `--app-surface-card-header`, `--app-surface-composer`, `--app-surface-toolbar`, `--app-surface-toolbar-hover`, `--app-surface-toolbar-active`, `--app-surface-toolbar-border` | App shell depth, panels, cards, composer surfaces, and compact toolbar chrome | Derived in `apps/web/src/theme/theme.logic.ts`; required by `REQUIRED_APP_DEPTH_TOKENS` in `apps/web/src/theme/theme.logic.test.ts`; used by toolbar and git action classes. |
| Chrome controls | `--app-chrome-control-bg`, `--app-chrome-control-border`, `--app-chrome-control-fg`, `--app-chrome-control-hover-bg`, `--app-chrome-control-hover-fg`, `--app-chrome-control-active-bg` | Compact controls embedded in app chrome where background, border, foreground, hover, and active states need to move together | Derived in `buildProfileAppDepthVariables`; tested in the Catppuccin token expectations. |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Broaden the source note for chrome-control tokens.

These tokens are also emitted from the Catppuccin branch in buildAppDepthVariables, so documenting them as derived only in buildProfileAppDepthVariables is inaccurate. As per coding guidelines, "Keep docs source-grounded; do not invent commands, scripts, environment variables, or runtime behavior".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/architecture/theme-surface-tokens.md` around lines 34 - 37, The docs
incorrectly state that chrome-control tokens are derived only in
buildProfileAppDepthVariables; update the source note in theme-surface-tokens.md
so it also documents that these tokens are emitted from the Catppuccin branch in
buildAppDepthVariables (in addition to buildProfileAppDepthVariables), and
reference the specific token family names (`--app-chrome-control-*`) and the
functions buildAppDepthVariables and buildProfileAppDepthVariables so readers
can trace generation.

@Jay1 Jay1 merged commit 9ef7e83 into main Jun 1, 2026
8 checks passed
@Jay1 Jay1 deleted the jcode/improve-theme-surface-depth branch June 3, 2026 00:33
@coderabbitai coderabbitai Bot mentioned this pull request Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant