fix(shell): honor [tokens] chip_height instead of a hardcoded table (v0.7.11) #19

Closed
Breadway wants to merge 0 commits from fix/eco-17-chip-height-token into main
Owner

Summary

Fixes ECO-17 ("Text clipping in breadbar on custom themes").

Reported against a custom theme ("Strata") setting font_family = "Space Grotesk, JetBrains Mono, sans-serif", font_size_base = 13, font_weight = 500, chip_height = 30, modules.workspaces.style = "dots". Screenshots showed descenders (y, g) on the media-title and a [[bar.widget]] uptime chip clipped flush against the chip's bottom edge.

Root cause

chip_height_px — the min-height baked into .media-widget, .stat-pair, and Trail/Pill .workspace-btn in assets/shell/base.css — came from a hardcoded per-WorkspaceStyle table (style::chip_height: Trail 26, Pill/Dots 22), completely independent of tokens.chip_height. The token was parsed, stored, exposed via an accessor, and documented, but never actually reached the CSS it's supposed to control.

Every builtin theme happened to set chip_height to the exact same number that table already returns for its style — which is how this went unnoticed for so long — except loaf, which explicitly asks for 24 (chip_height = 24 in its own theme.toml) and silently got 22 instead, inherited from glass-workbench's style = "pill" via extends. That's concrete proof this was dead even in a shipped, reviewed builtin, not just a hypothetical.

Strata's chip_height = 30 was meant to give its 17px custom-font media label enough room; instead it got the "dots" style's 22px regardless, and the label's descenders clipped.

Fix

resolve_tokens (manifest.rs) now takes the resolved workspace style and falls back to the per-style number only when a theme doesn't set chip_height at all; an explicit value is used as-is, no matter the style. style::subst_pairs just reads t.chip_height directly now — the fallback is baked into the token once at resolution time, matching this module's own "fully resolved, no further branching downstream" design.

Also removed breadbar::theme::approved_chip_height (companion breadbar change) — it existed specifically to bypass the token because of this exact staleness (see its own doc comment), so it's redundant now that tokens().chip_height() is always the correct, effective value.

Test plan

  • cargo build --release -p bread-theme
  • cargo test --release -p bread-theme — 111 passing (2 new: an explicit chip_height reaches .media-widget/.stat-pair CSS and beats the style fallback; an omitted one still gets the per-style number, not the stale 32 default)
  • Golden CSS snapshot: only loaf.css drifted (22px → 24px, exactly the one builtin where the token and the hardcoded table actually disagreed) — every other builtin is byte-identical. Re-blessed with BLESS_GOLDEN=1.
  • cargo clippy --release -p bread-theme — clean

Version bump to 0.7.11 + CHANGELOG + a docs/shell-themes.md correction (the token's documented default, 32, was also stale — now shows the real per-style fallback).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WtbAi2H268yYaoUb5YoPN9

## Summary Fixes ECO-17 ("Text clipping in breadbar on custom themes"). Reported against a custom theme ("Strata") setting `font_family = "Space Grotesk, JetBrains Mono, sans-serif"`, `font_size_base = 13`, `font_weight = 500`, `chip_height = 30`, `modules.workspaces.style = "dots"`. Screenshots showed descenders (`y`, `g`) on the media-title and a `[[bar.widget]]` uptime chip clipped flush against the chip's bottom edge. ## Root cause `chip_height_px` — the `min-height` baked into `.media-widget`, `.stat-pair`, and Trail/Pill `.workspace-btn` in `assets/shell/base.css` — came from a hardcoded per-`WorkspaceStyle` table (`style::chip_height`: Trail 26, Pill/Dots 22), **completely independent of `tokens.chip_height`**. The token was parsed, stored, exposed via an accessor, and documented, but never actually reached the CSS it's supposed to control. Every builtin theme happened to set `chip_height` to the exact same number that table already returns for its style — which is how this went unnoticed for so long — **except `loaf`**, which explicitly asks for `24` (`chip_height = 24` in its own `theme.toml`) and silently got `22` instead, inherited from `glass-workbench`'s `style = "pill"` via `extends`. That's concrete proof this was dead even in a shipped, reviewed builtin, not just a hypothetical. Strata's `chip_height = 30` was meant to give its 17px custom-font media label enough room; instead it got the "dots" style's 22px regardless, and the label's descenders clipped. ## Fix `resolve_tokens` (manifest.rs) now takes the resolved workspace style and falls back to the per-style number **only when a theme doesn't set `chip_height` at all**; an explicit value is used as-is, no matter the style. `style::subst_pairs` just reads `t.chip_height` directly now — the fallback is baked into the token once at resolution time, matching this module's own "fully resolved, no further branching downstream" design. Also removed `breadbar::theme::approved_chip_height` (companion breadbar change) — it existed specifically to bypass the token because of this exact staleness (see its own doc comment), so it's redundant now that `tokens().chip_height()` is always the correct, effective value. ## Test plan - [x] `cargo build --release -p bread-theme` - [x] `cargo test --release -p bread-theme` — 111 passing (2 new: an explicit `chip_height` reaches `.media-widget`/`.stat-pair` CSS and beats the style fallback; an omitted one still gets the per-style number, not the stale `32` default) - [x] Golden CSS snapshot: only `loaf.css` drifted (22px → 24px, exactly the one builtin where the token and the hardcoded table actually disagreed) — every other builtin is byte-identical. Re-blessed with `BLESS_GOLDEN=1`. - [x] `cargo clippy --release -p bread-theme` — clean Version bump to 0.7.11 + CHANGELOG + a `docs/shell-themes.md` correction (the token's documented default, `32`, was also stale — now shows the real per-style fallback). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WtbAi2H268yYaoUb5YoPN9
chip_height_px (the min-height baked into .media-widget, .stat-pair,
and Trail/Pill .workspace-btn) came from a hardcoded per-WorkspaceStyle
table, completely independent of tokens.chip_height. Every builtin
theme happened to set chip_height to the same number that table
already returns for its style — except loaf, which asks for 24 and
silently got 22 (inherited style=pill via extends) — proof the token
was dead even for a shipped theme, not just a hypothetical.

A custom theme with a font/size/weight combo that needs a taller chip
than its style's demo number had no way to ask for one, so descender
glyphs clipped against the too-short box (reported against a
font_size_base=13/font_weight=500/chip_height=30 "dots"-style theme,
which was silently getting 22px instead of the 30 it asked for).

resolve_tokens now falls back to the per-style number only when a
theme omits chip_height; an explicit value is used as-is. loaf's
golden CSS snapshot moves from 22px to 24px accordingly (BLESS_GOLDEN);
every other builtin is byte-identical, since their tokens already
matched what the hardcoded table produced.

Version bump to 0.7.11 + CHANGELOG entry + docs/shell-themes.md
correction (the token's documented default, 32, was also stale).

Fixes ECO-17.
Breadway closed this pull request 2026-09-05 10:27:13 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/bread-ecosystem!19
No description provided.