Skip to content

fix(theme): remove bare prop and state classes - #6121

Merged
cixzhang merged 1 commit into
mainfrom
fix/remove-bare-theme-classes
Sep 9, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/remove-bare-theme-classes

Conversation

@cixzhang

@cixzhang cixzhang commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace legacy prop/state value classes with stable component target classes plus reflected data-* attributes
  • add a normal astryx upgrade --apply migration frozen to the complete public v0.5.4 runtime contract: 186 targets, 988 finite tokens, four unbounded value domains, legacy aliases, and same-element primitive composition
  • preserve every old qualified match with specificity-equivalent :is(.old-class, [data-*], …) unions while leaving unknown/custom and unqualified classes unchanged
  • document prebuilt-theme rebuild requirements and every changed public theme helper; add package-boundary and generated-theme regression coverage

Test plan

  • pnpm build
  • pnpm check:repo
  • pnpm -F @astryxdesign/cli typecheck:strict
  • pnpm install --frozen-lockfile
  • focused Core, CLI codemod, current-main adaptation/Banner, and probe-theme suites
  • exact read-only transform run against eight representative real-world .css fixtures: 0 failures, 22 attribute arms added, consumer-owned classes/comments preserved, all outputs idempotent
  • nested functional pseudos and @scope selector preludes covered
  • generated CSS scan across maintained themes: no .astryx-<target>.<value> selectors
  • exact-head required CI: full, pr-a11y, and pr-visual

Risk / rollback

  • Risk: consumer CSS that directly targeted removed value classes needs migration.
  • Mitigation: the codemod operates only on parsed CSS selector nodes. It never rewrites declarations, comments, JavaScript/TypeScript strings, unqualified classes, or custom/unknown qualified classes. Each known value retains its original class arm for consumer className matches and adds every v0.6 data-attribute arm that could have produced the v0.5.4 class.
  • Rollback: revert this PR to restore the legacy classes while retaining the documented migration path.

@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 9, 2026 10:15am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 7, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 7, 2026
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
@cixzhang
cixzhang force-pushed the fix/remove-bare-theme-classes branch from af27da0 to c0ee31a Compare September 7, 2026 16:49
@cixzhang
cixzhang force-pushed the fix/remove-bare-theme-classes branch from c0ee31a to 7a0f66c Compare September 7, 2026 17:04
@cixzhang
cixzhang marked this pull request as ready for review September 7, 2026 17:15

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: request changes

The release currently removes bare .astryx-*.<value> selectors without giving 0.5.4 consumers a working migration. astryx upgrade selects no codemod from 0.5.4, and the older optional transform only recognizes .xds-*, so apps using the documented compatibility classes remain unchanged and silently lose themed styling; prebuilt custom themes also need to be regenerated.

Please add a current-version migration for safely rewritable Astryx selectors, concrete instructions for ambiguous selectors and prebuilt CSS, and name the changed return behavior of the exported themeProps, parseStyleKey, and theme CSS generators.

[Reviewed by Robohands]

github-actions Bot added a commit that referenced this pull request Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

AspectRatio (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 89 -
Complexity N/A Low (3) -
AvatarGroup (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 269 -
Complexity N/A High (19) -
Badge (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 189 -
Complexity N/A Low (4) -
Banner (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 428 -
Complexity N/A Very High (44) -
Button (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 517 -
Complexity N/A Very High (66) -
Calendar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1476 -
Complexity N/A Very High (138) -
Card (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 188 -
Complexity N/A Medium (10) -
Chat (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 5596 -
Complexity N/A Very High (456) -
CheckboxList (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 334 -
Complexity N/A Very High (61) -
Code (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 81 -
Complexity N/A Low (2) -
DateInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 3296 -
Complexity N/A Very High (356) -
DateRangeInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 539 -
Complexity N/A Very High (66) -
DateTimeInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 3388 -
Complexity N/A Very High (532) -
Divider (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 152 -
Complexity N/A Medium (12) -
FieldStatus (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 141 -
Complexity N/A Low (5) -
FormLayout (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 93 -
Complexity N/A Low (3) -
Heading (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 174 -
Complexity N/A High (26) -
Item (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 408 -
Complexity N/A Very High (59) -
Link (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 479 -
Complexity N/A Very High (37) -
List (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 282 -
Complexity N/A High (23) -
Markdown (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 3262 -
Complexity N/A Very High (205) -
MultiSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1656 -
Complexity N/A Very High (235) -
NumberInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1069 -
Complexity N/A Very High (151) -
Outline (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 673 -
Complexity N/A High (28) -
RadioList (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 433 -
Complexity N/A Very High (45) -
Section (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 230 -
Complexity N/A Very High (42) -
Selector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1993 -
Complexity N/A Very High (222) -
Spinner (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 291 -
Complexity N/A High (25) -
Stepper (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1603 -
Complexity N/A Very High (189) -
Switch (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 489 -
Complexity N/A Very High (46) -
Text (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 521 -
Complexity N/A High (24) -
TextArea (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 434 -
Complexity N/A Very High (65) -
TextInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 331 -
Complexity N/A Very High (55) -
TimeInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 526 -
Complexity N/A Very High (91) -
Token (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 454 -
Complexity N/A High (22) -
Tokenizer (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 776 -
Complexity N/A Very High (106) -
Toolbar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 269 -
Complexity N/A High (17) -
TreeList (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 805 -
Complexity N/A Very High (86) -
ListInput (@astryxdesign/lab) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1697 -
Complexity N/A Very High (267) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB
@astryxdesign/lab N/A 3.5KB 1.5KB

Accessibility Audit

Status: 8 accessibility violation(s) found — 1 critical, 7 serious.

CheckboxList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/17 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/20 stories · Learn more
    • WCAG: 4.1.2 (Level A)
Heading - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RadioList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/13 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Stepper - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/30 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Text - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/23 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Tokenizer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

Status: Skipped — Broad stable scope is deferred to the daily release gate. It covers 380 trusted baseline shots instead of recapturing them for this PR. View the report


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: request changes

0.5.4 consumers still do not have a complete path through this break. The new Changeset documents manual selector edits, but astryx upgrade still has no current transform for safely identifiable .astryx-<target>.<value> selectors. It also does not tell custom-theme owners to rebuild precompiled CSS or tell callers that the exported themeProps, parseStyleKey, and theme generators now return different values.

Please add the current-version migration, document regeneration for prebuilt themes, and name those exported behavior changes. Also update the five remaining AvatarGroup assertions; test-ui is red because they still expect the removed size classes.

[Reviewed by Robohands]

@cixzhang
cixzhang force-pushed the fix/remove-bare-theme-classes branch from 60dde05 to 0d8731a Compare September 8, 2026 02:06
github-actions Bot added a commit that referenced this pull request Sep 8, 2026
github-actions Bot added a commit that referenced this pull request Sep 9, 2026

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: request changes

Builders upgrading from 0.5.4 can still lose custom styling silently because the codemod leaves known released selectors unchanged when the Astryx target is only one branch of a functional selector. :is(.astryx-button, .other).primary returns unchanged with no TODO, so a primary Button stops matching after bare classes disappear; .astryx-button:nth-child(2n of .primary) does too. The current tests accept the first case unchanged.

Please either preserve each known branch’s match without broadening unrelated branches, or leave an actionable TODO for every known selector the transform cannot safely rewrite.

[Reviewed by Robohands]

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: request changes

Builders upgrading from 0.5.4 can still lose or unexpectedly gain custom styling because nested known selectors remain unchanged with no TODO. :is(.astryx-button, .other):not(.primary), :is(...):where(.primary), and .astryx-button:nth-child(2n of :is(.primary)) all diverge in Chromium after bare classes disappear.

Please preserve known target/value matches through these nesting boundaries without broadening unrelated branches, or leave an actionable TODO, and add fixtures for each boundary.

[Reviewed by Robohands]

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: request changes

Builders upgrading from 0.5.4 can still lose custom styling silently because the codemod leaves some standard nested selectors unchanged with no TODO. :not(:not(.astryx-button)).primary and :nth-child(2n of .astryx-button).primary both match primary Buttons before the class removal, but the exact-head transform returns them unchanged; Chromium then goes from 2→0 and 1→0 matches after v0.6 data attributes replace .primary.

Please either migrate these known target/value relationships without broadening unrelated elements, or leave an actionable TODO whenever the transform cannot prove a safe rewrite.

[Reviewed by Robohands]

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: request changes

Thanks, the two selectors from the last review now preserve their match sets. Native CSS nesting still has the same silent migration hole: .astryx-button { &.primary { … } } is valid CSS, but the exact-head codemod returns it unchanged with no TODO. Chromium matches three primary Buttons before the class removal and zero afterward. The transform walks each rule independently, so &.primary never inherits its parent target.

Please either migrate known target/value relationships expressed through nesting &, or leave an actionable TODO whenever parent selector context is required.

[Reviewed by Robohands]

@cixzhang
cixzhang force-pushed the fix/remove-bare-theme-classes branch from fe02233 to 451ba29 Compare September 9, 2026 10:11
@cixzhang
cixzhang force-pushed the fix/remove-bare-theme-classes branch from 451ba29 to 553ae4c Compare September 9, 2026 10:12
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
github-actions Bot added a commit that referenced this pull request Sep 9, 2026

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Semantic verdict: approve

This exact head now gives v0.5.4 users a complete, behavior-preserving migration for the bare selector-class removal.

  • The frozen runtime inventory covers 186 targets, 988 finite tokens, same-element primitive composition, legacy aliases, and every unbounded v0.5.4 domain.
  • The CSS parser preserves consumer class matches while adding exact data-attribute arms, including nested functional selectors, of filters, @scope, and native CSS nesting without changing specificity.
  • Prebuilt-theme regeneration and all six exported helper behavior changes are documented and regression-tested.

Exact-head full CI, accessibility, RTL, stable visual, Vercel, smoke, lint, and codemod gates pass. Broad stable visual scope is deferred under the repository's release policy. No blocking findings remain.

[Reviewed by Robohands]

@cixzhang
cixzhang merged commit 1232b85 into main Sep 9, 2026
31 checks passed

This branch was successfully deployed

1 active deployment
Preview — 553ae4c7 Deployed Sep 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant