Skip to content

refactor(ui): drop the dead [data-trow] chat rules - #2231

Merged
Astro-Han merged 1 commit into
mainfrom
refactor/chat-css-drop-dead-trow-rules
Aug 5, 2026
Merged

refactor(ui): drop the dead [data-trow] chat rules#2231
Astro-Han merged 1 commit into
mainfrom
refactor/chat-css-drop-dead-trow-rules

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

chat-message.css still carried four rules keyed on [data-trow]: the hover arm inside @media (hover: hover), and the .astryx-collapsible-trigger type/box rule plus its two chevron-sizing rules. Nothing renders that attribute any more.

The attribute went away in 6745aa1 ("render every tool row through Astryx"), which retired the bespoke trow renderer — data-trow="group" / data-trow="row" were emitted by packages/ui/src/tool-activity.tsx and are deleted in that diff — and moved permission / sandbox / interrupted rows onto Astryx ChatToolCalls. Confirmations: no data-trow anywhere in packages/*/src or apps/desktop/src outside this stylesheet, and grep -o data-trow apps/desktop/dist-renderer/assets/*.js is empty, so the shipped bundle has no element these selectors could match.

The block's long comment split three ways rather than going wholesale:

  • Dead with the rules. "Product trow (permission / sandbox / interrupted): Collapsible defaults large" describes a renderer that no longer exists.
  • Live, and about the rules above. Product CSS in the components layer beats Astryx's StyleX atoms on layer order alone, which is why this file declares no !important. That is a fact about the surviving reasoning/tool-call icon boxes, so it moves onto them — minus its count of "all eight" flags, since some of those lived on the rules deleted here and the number no longer resolves to anything a reader can check. The mechanism it was evidence for still holds.
  • Dropped. The --maka-line-body note. That token's only use in this file is the supporting-leading rebind one rule earlier, which its own comment already explains; the rules the note sat above declare nothing but width and height, so it had no force where it stood.

--maka-line-body, --radius-element and --maka-text-label all keep live consumers elsewhere in the file, so nothing became a dead token.

One follow-on: check-dead-css.mjs keeps astryx-collapsible-trigger in DYNAMIC_STYLE_HOOKS with a comment pointing at chat-message.css. After this change its only consumer is styles/settings/permission.css, so the comment is retargeted; the allowlist entry itself is still needed.

Why check:stale did not flag this — and what actually should have

check:stale is scripts/check-stale-dist.mjs. It compares src mtimes against dist mtimes per workspace to force a rebuild before tests. It never reads CSS and has no opinion about selectors, so it was never going to catch this — no gap there.

The tool that is meant to catch dead CSS is scripts/check-dead-css.mjs (wired into check:release, not check:stale). It also misses these rules, and that is the real find. Its class scan matches /\.(-?[_a-zA-Z][_a-zA-Z0-9-]*)/ — class selectors only — and its token scan looks at --custom-properties. An attribute selector such as [data-trow] is in neither vocabulary, so a rule can be keyed entirely on a data-* hook that no component renders and the script still reports "no dead classes or tokens found ✓", exactly as it does before and after this PR.

The two classes in these selectors did not help either: maka-turn and astryx-collapsible-trigger are both live elsewhere (astryx-collapsible-trigger is in the DYNAMIC_STYLE_HOOKS allowlist precisely because it is rendered at runtime), so even a per-rule liveness check that reasoned over class names alone would have called this rule live. Detecting it requires scanning the data-* attribute hooks a stylesheet keys on and checking each against source — a real extension to the script rather than a config tweak, and one that needs its own baseline because the renderer keys plenty of live rules on data-* ([data-sender], [data-maka-contract] in this file alone).

Not doing that extension here: it would land a new detector plus its own baseline alongside an unrelated cleanup. Flagging it so the gap is on the record.

Verification

Rebased onto main after #2228 landed; the two changes touch adjacent but disjoint rules in this stylesheet and merged without conflict.

  • npm run format / npm run format:check / npm run lint — clean (Biome, no fixes applied).
  • node scripts/check-dead-css.mjsno dead classes or tokens found ✓ (unchanged, and per above, unchanged for the wrong reason).
  • node --test scripts/check-dead-css.test.mjs — 13/13 pass.
  • CSS contract tests under apps/desktop/src/main/__tests__/: node --test "dist/main/**/*contract*.test.js" "dist/main/**/css-test-helpers.test.js" — 145/145 pass, 35 suites. This covers every test that parses this stylesheet through css-test-helpers / contract-css-helpers, including chat-reasoning-wrap-contract and fix(ui): draw the reasoning chevron from the Astryx icon registry #2228's chat-disclosure-chevron-contract (the latter asserts the reasoning and tool-call rows declare a 10x10 chevron svg and wrapper, which the deleted trow rules never contributed to).
  • tsc -p tsconfig.main.json reports pre-existing errors in runtime-host / oauth / voice tests. They reproduce identically on a clean main checkout and are unrelated to this change.
  • No live-app screenshot: the deleted rules cannot match any rendered element, so there is no before/after to show. The bundle grep above is the evidence that rendering is untouched.

@Astro-Han
Astro-Han force-pushed the refactor/chat-css-drop-dead-trow-rules branch 2 times, most recently from d98ea82 to 0cf4247 Compare August 5, 2026 11:28
`data-trow` stopped being rendered in 6745aa1 ("render every tool row
through Astryx"), which retired the bespoke trow renderer and moved
permission / sandbox / interrupted rows onto ChatToolCalls. The four
rules keyed on the attribute in chat-message.css outlived it: the hover
arm and the trigger's type, box and chevron sizing. Nothing sets the
attribute in source, and the built renderer bundle contains no
`data-trow`, so none of them can match.

The block's comment split three ways rather than going wholesale. Its
opening line is dead with the rules. Its cascade note is live and is
about the surviving icon boxes above — product CSS in `components`
outranks Astryx's StyleX atoms on layer order, so this file needs no
!important — so it moves onto them, minus a count of flags that no
longer resolves to anything a reader can check. Its --maka-line-body
note is dropped: the token's only use here is the supporting-leading
rebind one rule earlier, which its own comment already explains, and
the rules the note sat above declare nothing but width and height.

check-dead-css's DYNAMIC_STYLE_HOOKS kept `astryx-collapsible-trigger`
for chat-message.css; its live consumer is now settings/permission.css.
@Astro-Han
Astro-Han force-pushed the refactor/chat-css-drop-dead-trow-rules branch from 0cf4247 to fc42f42 Compare August 5, 2026 11:31
@Astro-Han
Astro-Han marked this pull request as ready for review August 5, 2026 11:40
@Astro-Han
Astro-Han merged commit 3c0cb0a into main Aug 5, 2026
12 checks passed
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