Repository navigation
test(cli): guard public component theme vars against being documented but unsettable - #5409
Merged
Merged
Conversation
… but unsettable collectThemingVars joins collectThemingTargets as part of the one theming enumeration, and two checks ride on it. A documented public var no component reads compiles to a declaration that never applies (#5012). A var the component writes inline outranks every cascade layer, so no theme can reach it (#4530). Both shipped, and neither is visible in the generated theme CSS, which is the artifact the jsdom suites assert on.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cixzhang
enabled auto-merge (squash)
August 24, 2026 07:37
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A theme author reads
--tree-list-indentin the TreeList docs, writes theoverride, and has no way to find out whether it did anything. Two shapes have
already shipped where it did nothing:
taught
--button-press-scale, which no component read. A theme setting itcompiled to a declaration nothing consumed.
was written as an inline longhand on the element carrying the theme target.
Inline outranks every cascade layer, so
@layer astryx-themecould not reachit. The var was real, read, and documented, and still unsettable.
Neither is visible in the generated theme CSS, which is the artifact the jsdom
suites assert on —
TreeList.test.tsxsays so in as many words: "jsdom cannotresolve the @layer cascade, so the generated CSS is what proves the override
reaches the lever." It proves the declaration was emitted. That is a different
claim.
What this adds
collectThemingVarsjoinscollectThemingTargetsinpackages/cli/foundation/discovery/theming-targets.mjs, so the public vars comeout of the same enumeration the
theme targetslisting andtheme buildvalidation already read. Private
--_*plumbing is excluded — it is not atheme's to set.
Two checks ride on it, both against live source:
What it catches today
Zero on
main— all four documented public vars(
--button-focus-offset,--button-icon-only-aspect,--tree-list-indent,--tree-list-row-gap) are read from a StyleX rule and none is written inline.A guard that fires zero times is unfalsifiable, so both were run against the two
shapes that actually shipped. Re-adding
--button-press-scaletoButton.doc.mjsfails withButton: nothing reads var(--button-press-scale);moving
--tree-list-row-gapback to an inlinestyle={{}}on the TreeList rootfails with
TreeList: TreeList.tsx sets --tree-list-row-gap inline.What it does not prove
Whether the theme's declaration then wins the cascade on the element. That is a
browser fact — no jsdom test can stand in for it, and this PR does not pretend
to. The file docblock says so.
Test plan
pnpm test— 11725 passed, 2 failures both pre-existing macOScase-insensitivity (
hook-discovery,componentdispatcher), unrelated.No runtime code changes; nothing renders differently.