Skip to content

refactor(desktop): remove dead shell CSS recipes and close check-dead-css blind spots - #2070

Merged
Astro-Han merged 3 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:fix/check-dead-css-blind-spots
Aug 4, 2026
Merged

refactor(desktop): remove dead shell CSS recipes and close check-dead-css blind spots#2070
Astro-Han merged 3 commits into
apache:mainfrom
UncertaintyDeterminesYou4ndMe:fix/check-dead-css-blind-spots

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

Summary

Implements #1980 end to end: fixes the three check-dead-css blind spots, then deletes everything the fixed scanner reveals — the audit's 13 dead rules were still present on main (the gate printed "no dead classes or tokens found ✓" over them the whole time).

Scanner fixes (scripts/check-dead-css.mjs)

  1. Class scan now includes maka-tokens.css — previously it was scanned for tokens only, so .maka-composer-toolbar and .maka-shimmer were invisible outright.
  2. Exact class-name matching — the substring check let maka-shell-astryx keep .maka-shell alive, maka-chat-message-* keep .maka-chat alive, etc. Consumers now match with hyphen-aware boundaries (\b alone treats - as a boundary, so plain word-boundary matching would not have fixed the collision).
  3. Sheet-internal token reads are attributed, not blanket-seeded — a var() read in a class rule counts only when the rule's classes have consumers; a read inside another token's value counts only once that token is live (fixpoint over derivation edges). This is what let the dead shell rules keep --w-rail/--w-sidebar alive.

The script also gains an isMain guard and exports its pure pieces for the new scripts/check-dead-css.test.mjs (fixtures cover both acceptance scenarios: prefix-collision and token-read-only-by-dead-rules). Wired into test:scripts.

Deletions (all zero-consumer under the fixed scanner, re-verified individually)

  • maka-tokens.css: .maka-shell, .maka-shell-rail-right, the .maka-sidebar header/section/row/button family, .maka-titlebar (+strong), .maka-chat, .maka-composer-toolbar, .maka-shimmer + its @keyframes (folded into functional-motion.stories.tsx, its only consumer), and --w-rail/--w-sidebar. .maka-main, .maka-turn, .maka-code stay — they are live.
  • Two prefix-collision finds the original audit missed: .maka-plan-card (plan-reminders.css; its "consumer" was maka-plan-card-menu) and .maka-skill-tab (theme-glass.css; its "consumer" was maka-skill-tabs-bar).
  • --ease-in-out-strong lost its last consumer with .maka-shimmer, but it is the named movement curve of the motion governance vocabulary (out-strong = feedback, in-out-strong = movement), so it joins RESERVED_SCALE_TOKENS with that rationale instead of being deleted.

Theme build (scripts/build-astryx-theme.mjs)

@astryxdesign/cli 0.2.0 stopped emitting maka.variants.d.ts but its maka.d.ts still opens with a /// <reference> to it (masked by skipLibCheck). Post-processing now strips the dangling line; maka.d.ts regenerated (css/js byte-identical), astryx:theme --check current. Covered by scripts/build-astryx-theme.test.mjs.

Closes #1980.

Verification

  • check-dead-css reports the 13 rules + 3 tokens before the deletions, and is clean at baseline 0/0 after; --check passes.
  • npm run astryx:theme -- --check: artifacts current.
  • npm run typecheck: clean across all workspaces.
  • Script tests 19/19 (including the two new files); check-story-annotations clean.
  • e2e/main/preload grepped for the deleted class names as locators: none.

Note: dev-app-runtime.test.mjs › ignores an unreadable or wrong-schema environment file fails on my machine both with and without this change (it picks up the developer's real local env file — a pre-existing test-isolation issue, unrelated).

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve. Two scanner issues to address before merge:

  1. Comma-group selector liveness (check-dead-css.mjs:282). .a, .b { ... var(--t) } with only .b live drops the rule wholesale because of .every, so --t is misattributed as dead. No comma-group class rule exists in the token sheet today, but the fix is small: split each selector, run .every per branch, combine with .some.
  2. The class scan misses packages/ui/src/styles.css (check-dead-css.mjs:323), which is imported into the product CSS. It currently holds four classes with no consumers: .maka-daily-review-append/copy/quick-run/save (the daily-review panel was simplified in July). The three listed blind spots are closed; this one is not. Add the file to the scan and delete the four, or document why the component-library stylesheet is exempt.
    Also on record, non-blocking: the fixpoint tests lack self-reference, cycle, and diamond cases; the reservation comment for --ease-in-out-strong and the motion-governance comment in maka-tokens.css disagree about the shimmer curve.

UncertaintyDeterminesYou4ndMe added a commit to UncertaintyDeterminesYou4ndMe/maka-agent that referenced this pull request Aug 4, 2026
… tests

Review round on apache#2070:

- A comma group applies when ANY branch matches, so rule liveness now
  splits the selector and asks .every per branch, .some across branches
  — one live branch keeps the group's token reads, all-dead branches do
  not.
- packages/ui/src/styles.css joins the class scan (it is imported into
  the product CSS); its four consumer-less daily-review button classes
  are deleted, and the runtime-composed maka-markdown-code-{default,
  compact} density variants the scan then surfaced join
  DYNAMIC_STYLE_HOOKS with the composing call sites named.
- Fixpoint tests gain self-reference, cycle, and diamond cases, plus
  the comma-group case.
- The --ease-in-out-strong reservation comment no longer claims the
  shimmer sweep uses --ease-linear (the live text shimmer animates with
  bare `linear`); it now matches the motion governance comment.
@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor Author

All addressed in b0cfb7f, including the non-blocking notes:

  1. Comma-group liveness — rule liveness now splits the selector on commas: .every(isClassLive) per branch, .some across branches. Covered by a new test (a comma group with one live branch keeps its token reads, both directions).
  2. packages/ui/src/styles.css joins the class scan — and the four dead daily-review button classes are deleted. The wider scan also surfaced .maka-markdown-code-default/-compact, which are runtime-composed (maka-markdown-code-${props.density} in markdown-body.tsx / mermaid-diagram.tsx), so they join DYNAMIC_STYLE_HOOKS with the call sites named. Scoped to the one hand-written sheet rather than all of packages/ui/src — the only other stylesheets that could appear there are generated ones; the exemption rationale is in the UI_STYLE_FILE comment.
  3. Fixpoint tests — added self-reference (no loop, no self-revival), cycle (terminates; lives or dies as one unit), and diamond (all paths to the shared base) cases.
  4. Comment disagreement — the reservation comment claimed the shimmer sweep uses --ease-linear; the live text shimmer actually animates with bare linear, so the claim is dropped and the comment now restates only what the motion governance comment says (out-strong = feedback, in-out-strong = movement).

check-dead-css --check clean at 0/0, script tests 13/13, biome clean.

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor Author

The test_headless / test failures on the latest run are inherited from main, not from this PR: #2081 moved workspace-instructions.ts out of apps/desktop/src/main, and the AHE snapshot source ref in packages/headless/src/ahe-target-protocol.ts still points at the old path — main's own last two CI runs (f39210128, 5daa6d191) are red on the same cli.test.js subtest. Fix: #2094 (one-line repoint, verified 11/11 locally).

Everything this PR owns is green on the same run: typecheck (biome/knip), storybook, e2e, test_workspaces, test_runtime_host.

@Astro-Han

Copy link
Copy Markdown
Contributor

Rebase to the latest main would fix it.

…-css blind spots

The scanner had three blind spots that made `--check` report a clean
sheet while ~13 dead legacy shell recipes sat in maka-tokens.css:

- maka-tokens.css was scanned for tokens only, so its class rules were
  invisible to the class sweep. It now joins the scan.
- The consumer check was a substring match, so `maka-shell-astryx` kept
  `.maka-shell` alive and `maka-chat-message-*` kept `.maka-chat` alive.
  Consumers now require an exact class-name match (hyphen-aware
  boundaries).
- Token reads inside the token sheet unconditionally seeded the live
  set, so `--w-rail`/`--w-sidebar` were kept alive by the very dead
  rules that read them. Sheet-internal reads now only count when they
  can fire: reads in class rules whose classes have consumers, and
  token-to-token derivations resolved as a fixpoint from external
  reads.

With the scanner fixed, delete what it now sees, all verified
zero-consumer: the .maka-shell/.maka-sidebar/.maka-titlebar/.maka-chat/
.maka-composer-toolbar recipe family, .maka-shimmer plus its keyframes
(folded into functional-motion.stories.tsx, its only consumer),
--w-rail/--w-sidebar, and two prefix-collision finds the original audit
missed: .maka-plan-card (plan-reminders.css) and .maka-skill-tab
(theme-glass.css). --ease-in-out-strong joins RESERVED_SCALE_TOKENS as
the named movement curve of the easing vocabulary rather than being
deleted with its last consumer.

While in the theme pipeline: @astryxdesign/cli 0.2.0 stopped emitting
maka.variants.d.ts but its maka.d.ts still opens with a reference to
it; the build now strips the dangling line instead of leaning on
skipLibCheck (maka.d.ts regenerated).

New scripts/check-dead-css.test.mjs and build-astryx-theme.test.mjs
cover the prefix-collision and token-read-only-by-dead-rules fixtures
from the issue's acceptance criteria, wired into test:scripts.

Closes apache#1980.

Verification: check-dead-css --check clean at baseline 0/0 with the
stricter matching; astryx:theme --check current; typecheck clean;
script tests 19/19.
… tests

Review round on apache#2070:

- A comma group applies when ANY branch matches, so rule liveness now
  splits the selector and asks .every per branch, .some across branches
  — one live branch keeps the group's token reads, all-dead branches do
  not.
- packages/ui/src/styles.css joins the class scan (it is imported into
  the product CSS); its four consumer-less daily-review button classes
  are deleted, and the runtime-composed maka-markdown-code-{default,
  compact} density variants the scan then surfaced join
  DYNAMIC_STYLE_HOOKS with the composing call sites named.
- Fixpoint tests gain self-reference, cycle, and diamond cases, plus
  the comma-group case.
- The --ease-in-out-strong reservation comment no longer claims the
  shimmer sweep uses --ease-linear (the live text shimmer animates with
  bare `linear`); it now matches the motion governance comment.
@Astro-Han
Astro-Han merged commit 10fae47 into apache:main Aug 4, 2026
11 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.

refactor(desktop): remove dead shell CSS recipes and close check-dead-css blind spots

2 participants