Skip to content

feat(cli): theme build names a page-rule setting of the theme that the browser does not show as written - #12400

Merged
josephfarina merged 1 commit into
mainfrom
theme-build-setting-effects
Nov 18, 2026
Merged

josephfarina merged 1 commit into
mainfrom
theme-build-setting-effects

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What users see

astryx theme build warns about a component setting of a theme's page rules that the browser doesn't show as written: each one a key of the theme's own file (or a local theme it extends) writes, also through a call, a const or a spread. Each warning gives the line, the rule that wins and a fix. The build output is unchanged and nothing is refused: old themes build exactly as before, with one warning per issue. The onDark/onLight surfaces and adaptation rules aren't read yet; the title, changeset and docs say so.

The check reads the component rules Core generates (the CSS the browser gets). It reports three kinds:

  • hidden: another rule that reaches everything the setting reaches wins. Examples: a border written after its own block's borderTopColor, a gradient background after its own backgroundRepeat, or a second key that builds the same selector later (selected and selected:selected).
  • loses: a more specific rule of the theme it extends wins on a variant or state. Example: a plain button.base.backgroundColor under a base theme's variant:primary background.
  • collides: two situations meet on one element and cascade order or weight decides what shows. Examples: a :hover against a base theme's variant at the same weight, or the theme's own variant beating its own whole-part hover. It is reported whichever way it ends, since a reorder flips it. When the theme also sets the property for the exact situation where both hold (a variant's own hover), it isn't reported.

Example:

[warn] components.tab.selected["@light"].borderTopColor (#dddddd) never shows: border: 1px solid transparent (components.tab["selected:selected"], from this theme) sets border-top-color through border later at the same weight (themes/t/t.settings.ts, line 1778). Fix: set borderTopColor in components.tab["selected:selected"]["@light"] instead: that rule wins everywhere this one reaches.

The JSON receipt lists them in settingIssues: {kind, wins, part, element, key, state, conditions, property, value, path, line, file?, by, why, against, message, fix}. by is the rule that wins most, as {part, element, key, state, conditions, property, value, from: theme | extended, path}, and against lists every such rule. theme build --check carries the same list when there are any, and so does a --family build, at the member that writes the setting. All fields are documented in the themeBuild doc and the response types.

Review fixes

  1. When two keys build one selector and both set a property, the winning rule is now the block that actually writes that declaration. Each declaration is mapped to its block by Core itself: Core regenerates the parts with a probe value in every block, so each rule names its block. The fix line reads "write them as one block, with the borderTopColor you want".
  2. Pseudo-elements (::before, ::after) are boxes of their own. They are never compared with their element or with each other, and fixes put them at the end of the block key.
  3. --family receipts and --family --check carry settingIssues.
  4. Entries carry only documented fields. Internal fields (signature) are gone. from, why, by.conditions, element and against are documented.
  5. The title, changeset and docs say the check reads page rules only (not onDark/onLight or adaptation rules).

Review fixes, second round

  1. A fix for a one-mode setting (@light/@dark) names a block of that mode (components.tab["selected:selected"]["@light"]), so following it changes nothing in the other mode.

  2. An :active setting is read once, as :active: Core writes it twice (as :active off a coarse pointer, and as its press attribute under one), and the press copy is no longer read as a second setting. The fix names [":active"].

  3. Lines are matched from the theme object's root, so an onDark block that writes the same keys earlier is never named for a components setting.

  4. The line index follows components given through a call (withOwnFillText({...})), a const of the module or a spread, so those themes are checked too. To keep that honest, a rule for a runtime state alone (:hover, selected) counts as that state's own look, never as hiding a resting setting.

  5. Official themes: all 7 (neutral, butter, chocolate, gothic, matcha, stone, y2k) report 0 issues, including butter, gothic and y2k, whose components the check now reads through their helper call. Nothing in them needs fixing.

  6. A test per issue type, including the fix clearing it (build-stable-setting-effects.test.mjs):

    • each kind is reported at its line with its fix: hidden, loses, collides, and the theme's own variant beating its own hover;
    • applying the named fix clears the warning, for each kind: the longhand moved after the shorthand, the setting repeated on the variant, the setting made where both situations hold;
    • two keys building one rule name the right block;
    • a one-mode setting's fix keeps its mode, and applying it clears a loss; two settings alike but for their mode are both named; :active is reported once; an onDark block is never named for a components line; components given through a call, a const and a spread are read; a runtime state's own look is never counted;
    • pseudo-elements are kept apart;
    • a --family build names the member;
    • the reader keeps color modes apart, honors Core's hover guard, never reports Core's private variables, and reads a gradient after its own repeat as hiding it.
  7. Doctor: reports these as warnings, never failures (feat(cli): doctor warns about a local theme setting that does not show as written #12408).

How

  • api/theme/build/setting-effects.mjs parses the generated rules with css-tree into each declaration's part, pseudo-element, attributes, states, conditions and specificity. A declaration is the theme's when its own file, or a local theme it extends, writes it.
  • A setting that a nearer source hides everywhere (the theme's own file over a theme it extends) is that source's choice and isn't reported.
  • Rules under different conditions (a color mode's ancestors, a media query) are compared only with rules of the same conditions or none. Core's hover guard keeps hover and disabled rules apart. Rules for a prop named for the property (a Text size for font-size, weight, color) count as the choice made where the part is used.
  • longhandsOf and coversProperty move from the theme editor's CSS module to the css-tree loader, so the build and the editor share one reading of shorthands. The editor re-exports them, so its behavior doesn't change.
  • Source key paths are read once per file. On a large hand-written theme (196 KB of CSS) the check adds about 0.35 s.

Test plan

  • CI=1 vitest run packages/cli/api/theme packages/cli/api/doctor packages/cli/foundation: the only failures are ones the same box also has on plain main (they're environment failures).
  • node scripts/check-cli-structure.mjs, the README check, and tsc -p packages/cli/tsconfig.strict.json (whole CLI, 0 errors).
  • The 7 official themes built with the check: 0 issues each.

@vercel

vercel Bot commented Nov 17, 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 Nov 18, 2026 5:42am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 5:56 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 76f87dd

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.40 MB packed (+15.8 kB); no new dependencies.

API changes: cli +0 · ~2 · −0

2 API changes (advisory)
Package Where Signature Usage
~ cli ./api · Types · type ThemeBuildCheckResponse data: { name: string; upToDate: boolean; stale: Array<{ path: string; reason: "missing" | "outdated" }>; checked: string[]; code?: "ERR_THEME_STALE" } → data: { name: string; upToDate: boolean; stale: Array<{ path: string; reason: "missing" | "outdated" }>; checked: string[]; code?: "ERR_THEME_STALE"; settingIssues?: … #47860e0b import type {ThemeBuildCheckResponse} from '@astryxdesign/cli/api'; const x: ThemeBuildCheckResponse = {data: …}
~ cli ./api · Types · type ThemeBuildResponse data: { name: string; tokenCount: number; componentCount: number; sizeKB: number; outputs: { css: string; cssDts: string; js: string; dts: string; variantsDts?: strin … #1a55d687 → data: { name: string; tokenCount: number; componentCount: number; sizeKB: number; outputs: { css: string; cssDts: string; js: string; dts: string; variantsDts?: strin … #7227285d import type {ThemeBuildResponse} from '@astryxdesign/cli/api'; const x: ThemeBuildResponse = {data: …}

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot 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.

Changes requested: the new warnings work for the tested cases and leave the built CSS unchanged, but five problems need fixing, and the new diagnostic needs an owner decision before approval.

  • When components.tab.selected and components.tab["selected:selected"] both set borderTopColor, the warning names components.tab.selected as the winning rule and suggests "write borderTopColor after borderTopColor", because the lookup in build.mjs (lines 5700-5702) takes the first block path the source writes without comparing values; pick the block whose value matches the declaration and add this case to the tests.
  • Miss: a pseudo-element block is read as a state of its element (situationOf and meet in setting-effects.mjs), so a child's button.base.backgroundColor under a base theme's button.base["::before"] background is told to copy its value into ::before, and a ::before color against a base ::after color gets the impossible fix components.button.base["::before::after"]; keep different pseudo-elements, and an element and its pseudo-element, apart.
  • Miss: --family builds return theme.build and theme.build.check receipts without settingIssues even when members warn, although ThemeBuildResponse declares the field always present, so list the members' entries in both family receipts or make the field optional and document that.
  • Each settingIssues entry also carries undocumented from, signature and why fields (and by.conditions, by.signature), which the earlier review called a smaller point but spec:AST-017 DEC-4 requires to be documented or removed for a CLI response field.
  • The title and changeset say every setting the browser does not show as written is named and listed in the receipt, but settings under onDark/onLight and in adaptation rules are not read and --family receipts list none, so narrow the wording to the theme's page component rules.

No current spec record covers the new warnings or the settingIssues receipt field, so approval also needs an engineering owner to provide or identify the governing spec for that addition. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. The earlier README finding is fixed: the generated table is in sync and lint passes.

Claims and files checked

Review mode: full; reason: history

  • Claim: theme build warns about each setting the browser does not show as written, at its line, with the change that makes it show: false as worded; onDark/onLight and adaptation settings are not read, two keys of one selector setting one property get the wrong rule and fix, and pseudo-element blocks raise false warnings.
  • Claim: the build output is unchanged and old themes build exactly as before: verified; CSS and JS are byte-identical on base and head for the eight bundled themes and four fixture themes, and every build exits 0.
  • Claim: a later shorthand of the block, a gradient background after its own repeat, and a second key that builds the same selector are reported as hidden: verified for the first two (new tests); partly for the third, which is reported but misattributed when both keys set the same property.
  • Claim: a plain setting under a base theme's more specific variant is reported as loses: verified (new test and a fixture build).
  • Claim: a state against a base variant at the same weight is reported as collides whichever way it ends: verified (new test).
  • Claim: the example folder-tab warning at line 1778: not verifiable (that theme is not in the repository); the message shape matches the code.
  • Claim: the JSON receipt lists settingIssues with the documented fields: partly; entries also carry from, signature and why, and family receipts have no settingIssues.
  • Claim: theme build --check carries the same list when there are any: verified for single themes (new test); false for --family --check.
  • Claim: a declaration counts as the theme's when its own file or a local theme it extends writes it, with the block path read from Core through a probe build: verified (a child build names the extended file and its line).
  • Claim: a rule of the same source counts only when it hides the setting everywhere, and a nearer source overriding one it extends is never reported: verified (comparison loop and the refinement test).
  • Claim: rules under different conditions are compared only with the same conditions or none, and the hover guard keeps hover and disabled apart: verified (rule-reader tests).
  • Claim: longhandsOf and coversProperty move to the css-tree loader with no behavior change: verified (same MDN data; theme editor re-exports them).
  • Claim: only page rules are read, not onDark/onLight or adaptation rules: verified.
  • Claim: every official theme builds with no setting issues and no new warnings: verified.
  • Claim: a large hand-written theme reports exactly its four tab border colors: not verifiable.
  • Claim: about 0.35 s added build time on that theme: not verifiable.
  • Claim: the listed tests, structure check and typechecks pass: verified; the new test file, the theme, runtime and editor suites and the structure check pass, and both typechecks show no errors in touched files.
  • Claim (changeset): the receipt lists them in settingIssues: false for --family builds.
  • Claim (changeset): the output is the same as before: verified.
  • File: .changeset/theme-build-settings-that-never-show.md: finding (overstated coverage).
  • File: packages/cli/README.md: clear (generated, in sync).
  • File: packages/cli/api/theme-edit/_css.mjs: clear.
  • File: packages/cli/api/theme/build/build-stable-setting-effects.test.mjs: clear (no case for one property set by two keys, pseudo-elements or families).
  • File: packages/cli/api/theme/build/build.mjs: finding (wrong winning rule; family receipts).
  • File: packages/cli/api/theme/build/null-values.mjs: clear.
  • File: packages/cli/api/theme/build/setting-effects.mjs: finding (pseudo-element blocks; undocumented entry fields).
  • File: packages/cli/api/theme/theme.type.mjs: finding (field typed required but absent from family receipts).
  • File: packages/cli/api/theme/themeBuild.doc.mjs: finding (entry fields not documented).
  • File: packages/cli/foundation/response/response-types.doc.mjs: finding (entry fields not documented).
  • File: packages/cli/foundation/runtime/css-tree.mjs: clear.

Automated review (maintainer link)

Comment thread packages/cli/api/theme/build/build.mjs Resolved
Comment thread packages/cli/api/theme/theme.type.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): stable theme build warns, and never refuses, for each theme setting the browser does not show as written. Each warning names the setting's line, the rule that wins over it and a fix that can be run as written. The output CSS is unchanged, and the JSON receipt adds settingIssues. The official themes report no issues, a test covers each issue type, and a test shows that applying the suggested fix clears the warning.

@josephfarina
josephfarina force-pushed the theme-build-setting-effects branch from 5416f13 to fd88bd7 Compare November 17, 2026 21:16
@josephfarina josephfarina changed the title feat(cli): theme build names each setting the browser does not show as written feat(cli): theme build names each page-rule setting the browser does not show as written Nov 17, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec fd88bd7

@astracat-bot astracat-bot Bot 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.

Changes requested: the five earlier findings are fixed and the owner decision settles the new warnings and settingIssues field, but four problems remain, three of them against that decision's own conditions (the setting's line, and a fix that can be run as written).

  • Miss: the fix for a @light or @dark setting names a block with no mode, so following it puts the value in both modes (the description's own components.tab.selected["@light"] example ends up writing border-top-color: #dddddd in dark mode too); keep the mode in the fix, such as components.tab["selected:selected"]["@light"].
  • Miss: an :active setting that collides with a base theme's variant is reported twice, and the second fix names Core's internal press selector ([":is([data-astryx-press=\"on\"],…)"]), which no theme can write and which does not clear the warning, so report it once with the [":active"] fix.
  • When a theme's onDark block writes the same key path before components, the warning names the onDark line (line 5 for a setting at line 10), because the lookup in build.mjs and null-values.mjs accepts any path that ends with the key path; match from the theme object's root instead.
  • The changeset and title say each page-rule setting is named, but nothing is reported when components goes through a function call, a variable or a spread, which is how butter, gothic and y2k write theirs (withOwnFillText({...})), so narrow the wording to settings written as literal keys or make the line index follow them.

The built CSS is byte-identical for every bundled theme, and exit codes do not change. Also worth a look: the repository's probe theme now prints 764 collides warnings during pnpm build, because sibling prop keys such as size:xsm and shape:circle count as a variant beating the setting.

Claims and files checked

Review mode: full; reason: history

  • Claim: theme build warns about each page-rule component setting the browser does not show as written, giving its line, the winning rule and a fix: false as worded; settings under a helper call, variable or spread are never read, an earlier onDark block takes the line, color-mode fixes drop the mode, and an :active setting gets an unusable second fix.
  • Claim: the output is unchanged and nothing is refused; old themes build as before with one warning per issue: output verified (theme.css byte-identical for the seven published themes and the probe theme, every build exits 0); "one warning per issue" is false for :active settings, which warn twice.
  • Claim: onDark/onLight surfaces and adaptation rules are not read yet, and the title, changeset and docs say so: verified.
  • Claim: hidden covers a border after its own borderTopColor, a gradient background after its own backgroundRepeat, and a second key building the same selector: verified (new tests and probes).
  • Claim: loses covers a plain setting under a base theme's more specific variant: verified (new test).
  • Claim: collides covers a hover against a base variant and the theme's own variant beating its own whole-part hover, reported either way, and is silent when the theme sets the property where both hold: verified (new tests); the same-theme rule also fires for sibling prop keys, which the probe theme shows 764 times.
  • Claim: the example tab warning at line 1778: that theme is not in the repository; the same structure reproduces the message, and its fix drops the @light block.
  • Claim: the JSON receipt lists settingIssues with the documented fields, by and against: verified (entry keys read off a build match the docs).
  • Claim: --check carries the list when there are any, and --family names the member: verified (new test and probes of both family receipts).
  • Claim: review fix 1, the winning rule is the block that writes the declaration: verified.
  • Claim: review fix 2, pseudo-elements are kept apart and fixes put them last: verified.
  • Claim: review fix 3, --family and --family --check receipts carry settingIssues: verified.
  • Claim: review fix 4, entries carry only documented fields: verified.
  • Claim: review fix 5, the title, changeset and docs say only page rules are read: verified for onDark/onLight and adaptations; they still say each setting is named (finding).
  • Claim: all seven official themes report 0 issues, so nothing in them needs fixing: 0 is verified, but the reader maps none of butter's, gothic's or y2k's settings, so it shows nothing for those three.
  • Claim: a test per issue type, including the fix clearing it: verified.
  • Claim: doctor reports these as warnings, never failures: belongs to another pull request; not part of this change.
  • Claim: a declaration is the theme's when its own file or a local theme it extends writes it, and a nearer source's choice is not reported: verified, for settings written as literal keys.
  • Claim: rules under different conditions are compared only with the same conditions or none; the hover guard and props named for the property are honoured: verified (rule-reader tests).
  • Claim: longhandsOf and coversProperty move to the css-tree loader and the editor re-exports them unchanged: verified (same data source on the base).
  • Claim: source key paths are read once per file, adding about 0.35 s on a large theme: the single read is verified; the timing is not verifiable here.
  • Claim: the listed tests, structure check, README check and strict typecheck pass: verified (the theme, editor, runtime, build-theme, JSON-contract and doctor suites pass, the structure and README checks pass, and the strict typecheck reports no errors).
  • Claim (changeset): each such setting is warned about, with its line, the winning rule and the change that makes it show: false as worded (see the first claim).
  • Claim (changeset): the receipt lists them in settingIssues, and the output is the same: verified.
  • File: .changeset/theme-build-settings-that-never-show.md: finding (claims every page-rule setting is named).
  • File: packages/cli/README.md: clear (generated, in sync).
  • File: packages/cli/api/theme-edit/_css.mjs: clear.
  • File: packages/cli/api/theme/build/build-stable-setting-effects.test.mjs: clear (no case for color-mode fixes, :active, an earlier onDark block or wrapped components).
  • File: packages/cli/api/theme/build/build.mjs: finding (line taken from an earlier onDark block).
  • File: packages/cli/api/theme/build/null-values.mjs: finding (suffix match and the reset at a call, behind two findings).
  • File: packages/cli/api/theme/build/setting-effects.mjs: finding (color-mode fixes, :active reported twice; non-blocking sibling-key collides).
  • File: packages/cli/api/theme/theme.type.mjs: clear.
  • File: packages/cli/api/theme/themeBuild.doc.mjs: clear.
  • File: packages/cli/foundation/response/response-types.doc.mjs: clear.
  • File: packages/cli/foundation/runtime/css-tree.mjs: clear.

Automated review (maintainer link)

Comment thread packages/cli/api/theme/build/build.mjs Resolved
Comment on lines +345 to +352
function variantRival(a, b) {
const added = [...b.attrs].filter(([name]) => !a.attrs.has(name));
return (
added.length > 0 &&
added.every(([name, value]) => value != null && value !== name.replace(/^data-/, '')) &&
b.states.every(st => a.states.includes(st))
);
}

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.

Non-blocking: variantRival does not require b to refine a, so two sibling prop keys of one part (size:xsm and shape:circle) count as a variant beating the setting. The repository's probe theme now prints 764 collides warnings (about 291 KB) during pnpm build, where the base printed none. If the intent is the variant-over-whole-part case the description names, also require a's attributes to be within b's.

@josephfarina
josephfarina force-pushed the theme-build-setting-effects branch from fd88bd7 to 7d981a5 Compare November 17, 2026 23:11
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 7d981a5

@astracat-bot astracat-bot Bot 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.

Changes requested: the four earlier findings are fixed (fixes keep a @light/@dark block, :active is read once, lines are matched from the theme's root, and components given through a call, a const or a spread is read), but three problems remain.

  • A loses fix for a @light or @dark setting never clears: after adding components.button["variant:primary"]["@light"] as told, the next build prints the same warning and fix, because only collides checks for a theme rule that settles the situation where both hold (setting-effects.mjs:539), so run that check for loses too and test the applied fix.
  • Miss: two settings that share a part, key, property and value become one settingIssues entry (the same borderTopColor hidden in both @light and @dark, or a background on an element and on its ::before), so one of them is never named; add the setting's source path to the id in settingIssueEntries (setting-effects.mjs:751-762).
  • The changeset still says the build warns about "each component setting" and about losses "on a variant or state", but settings in a module the theme imports are not read and a runtime state's own rule never counts, so word it (and the title) to the scope the themeBuild doc already states.

Every file the build writes for the bundled themes is byte-identical to the base, and exit codes do not change. Also worth a look: a base theme defined in the same file as the theme that extends it counts as that theme, so its variants never produce loses.

Claims and files checked

Review mode: full; reason: history

  • Claim: theme build warns about each page-rule component setting the browser does not show as written, giving its line, the winning rule and a fix: false as worded; settings in an imported module are not read, two settings can share one entry, and a one-mode loses fix never clears.
  • Claim: the build output is unchanged and nothing is refused; old themes build as before with one warning per issue: output verified (every written file byte-identical for the seven bundled themes and the probe theme, every build exits 0); "one warning per issue" is false where two settings share a part, key, property and value.
  • Claim: onDark/onLight surfaces and adaptation rules are not read, and the title, changeset and docs say so: verified.
  • Claim: hidden covers a border after its own borderTopColor, a gradient background after its own backgroundRepeat, and a second key building the same selector: verified (new tests).
  • Claim: loses covers a plain setting under a base theme's more specific variant: verified (new test and probe).
  • Claim: collides covers a hover against a base variant and the theme's own variant beating its own hover, reported either way, and is silent when the theme sets the property where both hold: verified (new tests).
  • Claim: the example tab warning at line 1778: that theme is not in the repository; the same structure gives the same message, and its fix keeps the @light block.
  • Claim: the JSON receipt lists settingIssues with the documented fields, by and against: verified (entry keys read off a build match the docs).
  • Claim: --check carries the list when there are any, and --family names the member: verified (new tests).
  • Claim: first-round review fixes 1-5 (winning block, pseudo-elements, family receipts, documented fields only, page-rule wording): verified.
  • Claim: a one-mode setting's fix names a block of that mode: verified; for loses, the applied fix leaves the warning (finding).
  • Claim: an :active setting is read once, with an [":active"] fix: verified (probe: one issue, and the applied fix clears it).
  • Claim: lines are matched from the theme object's root, never from an earlier onDark block: verified (probe: line 10, not line 4).
  • Claim: components given through a call, a const of the module or a spread are read, and a runtime state's own rule never counts: verified (probes and new tests).
  • Claim: all seven official themes report 0 issues, including butter, gothic and y2k read through their helper call: verified (0 each; a hidden setting injected into butter is reported at its line).
  • Claim: a test per issue type, including the fix clearing it, and the listed cases: verified (21 tests pass); no case covers a one-mode loses fix applied or two settings sharing an entry.
  • Claim: doctor reports these as warnings, never failures: belongs to another pull request; not part of this change.
  • Claim: a declaration is the theme's when its own file or a local theme it extends writes it, and a nearer source's choice is not reported: verified, except that a base theme defined in the same file counts as the theme itself.
  • Claim: rules under different conditions are compared only with the same conditions or none; the hover guard and props named for the property are honoured: verified (rule-reader tests).
  • Claim: longhandsOf and coversProperty move to the css-tree loader and the editor re-exports them unchanged: verified (same data source on the base).
  • Claim: source key paths are read once per file, adding about 0.35 s on a large theme: the single read is verified; the timing comes from a theme not in the repository.
  • Claim: the listed vitest suites, structure check, README check and strict typecheck pass: verified (the theme build, theme editor, runtime, build-theme, JSON-contract and doctor theme-check suites pass, 493 files; the structure and README checks pass; the strict typecheck reports no errors once the bundled themes are built).
  • Claim (changeset): warns about each component setting of the page rules, onDark, onLight and adaptations aside: false as worded (imported modules, runtime-state rules).
  • Claim (changeset): a setting loses to a more specific rule of the extended theme on a variant or state: false for a state alone since this head.
  • Claim (changeset): each warning names the line, the winning rule and the change that makes it show, the receipt lists settingIssues, and the output is the same: verified, except the one-mode loses fix.
  • File: .changeset/theme-build-settings-that-never-show.md: finding (claims broader than the reader).
  • File: packages/cli/README.md: clear (generated, in sync).
  • File: packages/cli/api/theme-edit/_css.mjs: clear.
  • File: packages/cli/api/theme/build/build-stable-setting-effects.test.mjs: clear (no case for a one-mode loses fix applied or two settings sharing an entry).
  • File: packages/cli/api/theme/build/build.mjs: non-blocking (a same-file base theme counts as the theme's own layer).
  • File: packages/cli/api/theme/build/null-values.mjs: clear.
  • File: packages/cli/api/theme/build/setting-effects.mjs: finding (one-mode loses fix never clears; entry id merges settings; non-blocking sibling-key collides).
  • File: packages/cli/api/theme/theme.type.mjs: clear.
  • File: packages/cli/api/theme/themeBuild.doc.mjs: clear.
  • File: packages/cli/foundation/response/response-types.doc.mjs: clear.
  • File: packages/cli/foundation/runtime/css-tree.mjs: clear.

Automated review (maintainer link)

at => {
for (const [layer, {lineOf}] of writtenIn.entries())
for (const keys of declarationPaths(at, blocks))
if (lineOf(keys, {fromRoot: true}) != null)

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.

Non-blocking: a base theme defined in the same file (const base = defineTheme({...}), then extends: base) is found here from the root of the same file, so its rules count as layer 0, the theme's own. Its variant:primary background then never makes the child's button.base.backgroundColor a loses issue (a probe reports 0). Index the extended theme's object as its own layer, or name the limit in the doc.

@josephfarina
josephfarina force-pushed the theme-build-setting-effects branch from 7d981a5 to 8855da3 Compare November 18, 2026 00:36
@josephfarina josephfarina changed the title feat(cli): theme build names each page-rule setting the browser does not show as written feat(cli): theme build names a page-rule setting of the theme that the browser does not show as written Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 8855da3

@astracat-bot astracat-bot Bot 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.

Changes requested: the three earlier findings are fixed (a followed @light/@dark loses fix now clears, settings alike but for their mode or pseudo-element are each named, and the changeset states the reader's limits), and two wording fixes remain.

  • Miss: the themeBuild doc says conditions holds "the color-mode and media conditions", but entries also carry Core's zero-weight guards (a :hover setting comes back with :where(:not(:disabled,[aria-disabled="true"]))), so describe it as every condition of the rule other than its part, key, state and pseudo-element, as written (themeBuild.doc.mjs:88).
  • Miss: the description's example warning for components.tab.selected["@light"].borderTopColor ends with the fix components.tab["selected:selected"], but the build now names components.tab["selected:selected"]["@light"] for that setting, so update the example.

Every file the build writes for the bundled themes is byte-identical to before, exit codes do not change, and the bundled themes report no issues. Also worth a look: the private probe theme prints 764 collides warnings in every root build, and a base theme defined in the same file still counts as the theme itself.

Claims and files checked

Review mode: full; reason: history

  • Claim: theme build warns about a page-rule component setting the browser does not show as written, for keys of the theme's file or a local theme it extends, also through a call, a const or a spread: verified (new tests and probes).
  • Claim: each warning gives the line, the winning rule and a fix: verified.
  • Claim: the build output is unchanged, nothing is refused, and old themes build as before with one warning per issue: verified (every written file byte-identical for the bundled themes and the probe theme; every build exits 0; two settings alike but for their mode or pseudo-element are each named).
  • Claim: onDark/onLight and adaptation rules are not read, and the title, changeset and docs say so: verified.
  • Claim: hidden covers a border after its own borderTopColor, a gradient background after its own repeat, and a second key that builds the same selector: verified (new tests).
  • Claim: loses covers a plain setting under a more specific variant of the theme it extends, also in a state: verified for a variant and a variant's state; a rule for a state alone never counts, as the description's own later item says.
  • Claim: collides covers a hover against a base variant and the theme's own variant over its own hover, is reported either way, and is silent when the theme sets the property where both hold: verified (new tests and probes).
  • Claim: the example warning for a light-mode borderTopColor: false; the build now names the light-mode block in the fix (finding).
  • Claim: the receipt lists settingIssues with the documented fields, by and against: verified (keys read off a build match the docs); the conditions field is described too narrowly (finding).
  • Claim: the check receipt carries the list when there are any, and a family build names the member: verified (new tests).
  • Claim: first-round review fixes 1-5 (winning block, pseudo-elements, family receipts, documented fields only, page-rule wording): verified.
  • Claim: second-round fixes 1-4 (fixes keep the color mode, :active read once, lines from the theme root, calls, consts and spreads followed with runtime-state rules not counted): verified.
  • Claim: all seven bundled themes report 0 issues, including those read through their helper call: verified.
  • Claim: a test per issue type, including the fix clearing it, and the listed cases: verified (23 tests pass); the test named for color mode or pseudo-element builds only the color-mode case.
  • Claim: doctor reports these as warnings, never failures: belongs to another open pull request; not part of this change.
  • Claim: the rules are parsed with css-tree, a nearer source's choice is not reported, conditions are compared only with the same or none, the hover guard and props named for the property are honoured: verified (rule-reader tests and probes).
  • Claim: longhandsOf and coversProperty move to the css-tree loader and the editor re-exports them unchanged: verified (the editor read the same MDN data before).
  • Claim: source key paths are read once per file, adding about 0.35 s on a large theme: the single read is verified; the probe theme's build takes about 0.35 s longer, and the large theme is not in the repository.
  • Claim: the listed vitest suites, the structure check, the README check and the strict typecheck pass: verified (the theme build, theme editor, runtime, doctor, build-theme and JSON-contract suites pass, 516 files; the structure and README checks pass; the strict typecheck reports no errors once the bundled themes are built)
  • Claim (changeset): warns about each setting a key of the theme's file or a local theme it extends writes, also through a call, a const or a spread, and not helper-built, imported, onDark, onLight or adaptation settings: verified.
  • Claim (changeset): names a later shorthand reset or a second key building the same rule, a more specific rule of the extended theme on a variant, and a situation whose order decides: verified.
  • Claim (changeset): a rule for a runtime state alone never counts: verified (new test).
  • Claim (changeset): each warning names the line, the winning rule and the fix, the receipt lists settingIssues, and the output is the same: verified.
  • File: .changeset/theme-build-settings-that-never-show.md: clear.
  • File: packages/cli/README.md: clear (generated, in sync).
  • File: packages/cli/api/theme-edit/_css.mjs: clear.
  • File: packages/cli/api/theme/build/build-stable-setting-effects.test.mjs: clear (non-blocking: one test title names a case it does not build).
  • File: packages/cli/api/theme/build/build.mjs: non-blocking (a comment calls the probe generation lazy; a same-file base theme counts as the theme).
  • File: packages/cli/api/theme/build/null-values.mjs: non-blocking (the keyPathLine comment still says a spread gives no line).
  • File: packages/cli/api/theme/build/setting-effects.mjs: non-blocking (sibling prop keys collide in the probe theme).
  • File: packages/cli/api/theme/theme.type.mjs: non-blocking (its comment names only the onDark, onLight and adaptation limits).
  • File: packages/cli/api/theme/themeBuild.doc.mjs: finding (conditions described too narrowly).
  • File: packages/cli/foundation/response/response-types.doc.mjs: clear.
  • File: packages/cli/foundation/runtime/css-tree.mjs: clear.

Automated review (maintainer link)

{file: filePath, source: themeSource},
...extendedSources,
].map(s => ({file: s.file, lineOf: keyPathIndex(s.source, s.file)}));
// The rules of the theme it extends, generated once when first asked.

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.

Non-blocking: blockPaths runs here on every build and regenerates the resolved theme's parts at once, so "generated once when first asked" reads as lazy when it is not. Suggest: "Core generates the resolved theme's parts again, each block with a probe value, so each rule names its block."

).toEqual([]);
});

it('names each of two settings alike but for their color mode or their pseudo-element', async () => {

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.

Non-blocking: the title names two settings alike but for their pseudo-element, but the test builds only the color-mode pair. The case holds (an element and a ::before background under matching base variant rules give two loses entries), so add it here or drop "or their pseudo-element".

@josephfarina
josephfarina force-pushed the theme-build-setting-effects branch from 8855da3 to 1d36344 Compare November 18, 2026 01:36
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 1d36344

@astracat-bot astracat-bot Bot 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.

Approved pending CI: CI has not run on this head yet, so this is not yet ready to merge. Both earlier findings are fixed — the conditions field is no longer described as colour-mode and media conditions only, and the example warning in the description now shows the light-mode block in its fix. Every file the build writes is byte-identical to before for the seven bundled themes, builds exit as they did, and the bundled themes report no issues.

Worth a look, none of it blocking:

  • The repository's own probe theme prints 764 collides warnings (about 291 KB) in every root build, all of them two sibling prop keys of one part (typeahead["status:success"] against typeahead["size:sm"]) that refine nothing; requiring the setting's attributes to be within the rival's would keep the variant-over-whole-part case the description names and drop these.
  • conditions is documented as every other condition of the rule as written, but an :active setting comes back with conditions: [] even though Core writes that rule under a coarse-pointer media query; one clause saying the press model's media is not listed would close it (themeBuild.doc.mjs:88).
  • A base theme defined in the theme's own file (const base = defineTheme({…}) beside extends: base) counts as the theme's own layer, so its variant rules never produce a loses; the same pair in two files does report one.
  • Three texts no longer match the code: the comment at build.mjs:5703 ("generated once when first asked", and "the rules of the theme it extends", though the blocks are regenerated from the resolved theme on every build), the keyPathLine note at null-values.mjs:144 (a spread now gives a line), and the test title at build-stable-setting-effects.test.mjs:419, which names a pseudo-element pair it does not build — that case does hold, so it is worth adding.
Claims and files checked

Review mode: full; reason: history

  • Claim: the build warns about a page-rule component setting the browser does not show as written, for settings a key of the theme's own file or a local theme it extends writes, also through a call, a const or a spread: verified (new tests, and probe builds of each shape).
  • Claim: each warning names the setting's line, the rule that wins and a fix that can be run as written: verified, including a fix that keeps the setting's colour mode and, for a one-mode state, its mode and state block (applied, it clears).
  • Claim: the output is the same, nothing is refused, and old themes build as before with one warning per issue: verified (every written file byte-identical for the seven bundled themes between the base and this head; a build with 764 warnings exits 0).
  • Claim: onDark/onLight surfaces and adaptation rules are not read, helper-built and imported settings are not read, and the title, changeset and docs say so: verified.
  • Claim: hidden covers a shorthand after its own longhand, a gradient after its own repeat, and a second key that builds the same rule: verified (new tests).
  • Claim: loses covers a plain setting a more specific rule of the extended theme beats on a variant, and a rule for a runtime state alone never counts: verified (new tests).
  • Claim: collides is reported whichever way it ends and stays silent when the theme sets the property where both hold: verified (new tests, and probes for a colour mode and a state).
  • Claim: the receipt lists them in settingIssues with the documented fields, by and against; a --check receipt carries them when there are any; a --family build names the member: verified (the keys of a real entry match the documented list exactly, and a stale --check receipt carries both the stale code and the list).
  • Claim: the fields are documented in the response types and the generated README: verified (the README's generated tables are in sync, and the JSON API typecheck is clean).
  • Claim: conditions is every other condition of the rule as written: false for one case; an :active setting reports no conditions although Core writes that rule under a coarse-pointer media query (non-blocking finding).
  • Claim: all seven bundled themes report 0 issues, including those read through their helper call: verified (measured at this head: 0 each).
  • Claim: a test per issue type, including the fix clearing the warning: verified (23 tests pass); one test title names a pseudo-element case it does not build.
  • Claim: the rules are read with css-tree, a nearer source's own choice is not reported, conditions are compared only with the same conditions or none, the hover guard is honoured, Core's private variables are never reported, and a prop named for the property counts as the choice made where the part is used: verified (reader tests and probes).
  • Claim: longhandsOf and coversProperty move to the css-tree loader and the theme editor re-exports them, so its behaviour does not change: verified (the implementation and its data source are unchanged, and the editor's modules still import them from the editor module).
  • Claim: source key paths are read once per file, adding about 0.35 s on a large hand-written theme: the single read is verified; that theme is not in the repository, so the figure stays unverified.
  • Claim: the listed test suites, the structure check, the README check and the strict typecheck pass: verified, except that the strict typecheck reports two missing built-theme modules in two unchanged page templates until the theme packages are built in the tree.
  • Claim (changeset): the same scope and kinds as the description, with the runtime-state and imported-module limits stated: verified.
  • Claim: astryx doctor reports these as warnings, never failures: belongs to another pull request, not to this change.
  • File: the changeset: clear.
  • File: the CLI README: clear (generated, in sync).
  • File: the theme editor's CSS module: clear (re-export only).
  • File: the new build test: clear, apart from the test title above.
  • File: the theme build entry (build.mjs): non-blocking (the stale comment, and the same-file base theme).
  • File: null-values.mjs: non-blocking (the stale note about a spread).
  • File: setting-effects.mjs: non-blocking (sibling prop keys count as variants).
  • File: the theme response types: clear.
  • File: the themeBuild doc: finding (the conditions clause above).
  • File: the response-type docs: clear.
  • File: the css-tree loader: clear.

Automated review (maintainer link)

type: 'theme.build',
description:
'Build receipt {name, tokenCount, componentCount, sizeKB, outputs, warnings, notices}: the theme name; how many tokens (portable plus theme-local) and component targets it overrides; the CSS size in KB; the written outputs {css, cssDts for strict side-effect imports, js, dts, and variantsDts when custom prop values were augmented}; warnings, the defects the author should fix, including exact canonical replacements for deprecated component target keys and declarations the generator dropped; and notices, advisories about a correct theme, such as a font it names but does not load. Resolves to null instead when the theme produced no CSS (nothing to build).',
'Build receipt {name, tokenCount, componentCount, sizeKB, outputs, warnings, notices, settingIssues}: the theme name; how many tokens (portable plus theme-local) and component targets it overrides; the CSS size in KB; the written outputs {css, cssDts for strict side-effect imports, js, dts, and variantsDts when custom prop values were augmented}; warnings, the defects the author should fix, including exact canonical replacements for deprecated component target keys and declarations the generator dropped; and notices, advisories about a correct theme, such as a font it names but does not load; and settingIssues, each component setting of the page rules (the file of the theme or a local theme it extends; not its onDark and onLight surfaces or adaptation rules) the browser does not show as written, also among the warnings: {kind, wins, part, element, key, state, conditions, property, value, path, line, file?, by, why, against, message, fix}. `kind` is `hidden` (another rule reaching everything it reaches wins: a later shorthand of its block, or a second key that builds the same rule), `loses` (a more specific rule of the theme it extends wins on a variant) or `collides` (where both situations hold, cascade order or weight decides; `wins` says which way it ends). A rule for a runtime state (`:hover`, `selected`) alone is the look of that state and never counts. A setting is named when a key of the source writes it, also through a call, a const or a spread; one a helper function builds, or one a module the theme imports writes, is not. `by` is the rule that keeps it from showing most, as {part, element, key, state, conditions, property, value, from: `theme` (the source of the setting) | `extended` (a theme it extends), path (null when no source of the theme writes it)}, and `against` lists every such rule as {kind, wins, by, why}; `element` is the pseudo-element (`::before`) or null, `conditions` every other condition of the rule as written (color-mode ancestors, media queries, and the zero-weight guards Core adds, such as the disabled guard of a `:hover` rule), beyond its part, key, state and pseudo-element, `path` the key path of the setting in the source, `line` its line (in `file` when a local theme it extends writes it, or, on a --family build, the member that does), `why` and `message` say it in words, and `fix` is the change that makes it show. Resolves to null instead when the theme produced no CSS (nothing to build).',

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.

Non-blocking: conditions is now described as every other condition of the rule as written, media queries included, but an :active setting comes back with conditions: [] — Core writes that rule under @media not all and (pointer:coarse), and the reader folds the two press rules into one :active reading and drops that media (setting-effects.mjs:222, :249). Add a clause saying so, such as "the coarse-pointer media of Core's press model is not listed: an :active setting is read once, as :active".

…e browser does not show as written

A component setting another rule of the theme layer beats where it
reaches: a later shorthand of its own block (or a second key that builds
the same rule), a more specific rule of the theme it extends on a variant
or state, or a situation whose order against such a rule, or the theme's
own variant, decides what shows. Read from the component rules Core
generates; Core also maps each declaration back to the block that writes
it. Pseudo-elements are boxes of their own; keys that match nothing take
no part. Each is a warning at its line with the fix, and a settingIssues
entry on the receipt, the check receipt and the --family receipt; the
output is the same. onDark/onLight and adaptation rules are not read yet.

longhandsOf and coversProperty move to the css-tree loader so the build
and the theme editor share one reading of shorthands.
@josephfarina
josephfarina force-pushed the theme-build-setting-effects branch from 1d36344 to 76f87dd Compare November 18, 2026 05:29
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 76f87dd

@astracat-bot astracat-bot Bot 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.

Approved pending CI: CI has not finished on this head yet. Every bundled theme builds the same files with the new warnings in place, builds exit as they did, and the seven official themes report no issues.

Worth a look, none of it blocking:

  • The repository's probe theme prints 764 collides warnings in every root build, all from two sibling prop keys of one part (such as typeahead["status:success"] against typeahead["size:sm"]); requiring the setting's attributes to be within the rival's would keep the variant-over-whole-part case and drop these.
  • conditions is documented as every other condition of the rule, but an :active setting comes back with conditions: [] although Core writes that rule under a coarse-pointer media query (themeBuild.doc.mjs:88).
  • A base theme defined in the theme's own file counts as the theme's own layer, so its variant rules never produce a loses; the same pair in two files does.
  • Three texts no longer match the code: the comment at build.mjs:5714, the keyPathLine note at null-values.mjs:145 (a spread now gives a line), and the test title at build-stable-setting-effects.test.mjs:419, whose pseudo-element case holds and is worth adding.
Claims and files checked

Review mode: full; reason: rebase

  • Claim: the build warns about a page-rule component setting the browser does not show as written, for settings the theme's own file or a local theme it extends writes, also through a call, a const or a spread: verified (new tests and fixture builds).
  • Claim: each warning names the setting's line, the rule that wins and a fix: verified, and applying the named fix clears the warning for each kind (tests).
  • Claim: the output is unchanged, nothing is refused, and old themes build as before: verified (every written file identical with and without the change for the seven official themes and the probe theme; warning builds exit 0).
  • Claim: onDark/onLight surfaces, adaptation rules, helper-built settings and imported modules are not read, and the title, changeset and docs say so: verified.
  • Claim: hidden covers a shorthand after its own longhand, a gradient after its own repeat, and a second key that builds the same rule: verified (tests).
  • Claim: loses covers a plain setting an extended theme's variant beats, and a rule for a runtime state alone never counts: verified (tests).
  • Claim: collides is reported whichever way it ends and stays silent when the theme sets the property where both hold: verified (tests).
  • Claim: settingIssues carries the documented fields with by and against, and the --check and --family receipts carry it: verified (a real entry's keys match the documented list; stale and up-to-date checks carry it; family test).
  • Claim: the review fixes hold (the right block for two keys of one rule, pseudo-elements kept apart, one-mode fixes keep their mode, :active read once, lines matched from the theme root, components through a call, const or spread): verified (tests and probes).
  • Claim: conditions is every other condition of the rule as written: false for one case; an :active setting reports none though Core writes it under a coarse-pointer media query (non-blocking).
  • Claim: all seven official themes report 0 issues: verified (measured at this head).
  • Claim: a test per issue type, including the fix clearing it: verified (23 tests pass); one test title names a pseudo-element pair it does not build.
  • Claim: the reader's rules (css-tree parse, a nearer source's own choice not reported, conditions compared only alike, the hover guard, private variables skipped, props named for the property): verified (reader tests and code).
  • Claim: longhandsOf and coversProperty move to the css-tree loader and the editor re-exports them, so its behaviour does not change: verified (same implementation over the same data).
  • Claim: source key paths are read once per file, adding about 0.35 s on a 196 KB hand-written theme: the single read is verified; the timing is unverified, as that theme is not in the repository.
  • Claim: the listed test suites, structure check, README check and strict typecheck pass: the CLI theme, theme editor, runtime, response, doctor and JSON-contract suites pass (521 files, 6,329 tests, 6 skipped); the structure and README checks pass and the JSON API typecheck is clean; the strict typecheck reports only two missing built-theme modules in unchanged templates, in a tree without built themes.
  • Claim: astryx doctor reports these as warnings: belongs to another pull request, not this change.
  • Claim (changeset): the same scope, kinds and limits as the description: verified.
  • File: the changeset: clear.
  • File: the CLI README: clear (generated, in sync).
  • File: the theme editor's CSS module: clear (re-export only).
  • File: the new build test: non-blocking (the test title).
  • File: the theme build entry: non-blocking (the stale comment, the same-file base theme).
  • File: the source-line index module: non-blocking (the stale note about a spread).
  • File: the cascade reader: non-blocking (sibling prop keys count as variants).
  • File: the theme response types: clear.
  • File: the themeBuild doc: non-blocking (the conditions clause).
  • File: the response-type docs: clear.
  • File: the css-tree loader: clear.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 7819d1d into main Nov 18, 2026
81 checks passed
@github-actions
github-actions Bot deleted the theme-build-setting-effects branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 76f87dd3 Deployed Nov 18, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant