Repository navigation
feat(cli): theme build names a page-rule setting of the theme that the browser does not show as written - #12400
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
4bcda05 to
be03d1f
Compare
be03d1f to
5416f13
Compare
PR Analysis Report🔎 Preview ·
|
| 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
There was a problem hiding this comment.
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.selectedandcomponents.tab["selected:selected"]both setborderTopColor, the warning namescomponents.tab.selectedas the winning rule and suggests "write borderTopColor after borderTopColor", because the lookup inbuild.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 (
situationOfandmeetinsetting-effects.mjs), so a child'sbutton.base.backgroundColorunder a base theme'sbutton.base["::before"]background is told to copy its value into::before, and a::beforecolor against a base::aftercolor gets the impossible fixcomponents.button.base["::before::after"]; keep different pseudo-elements, and an element and its pseudo-element, apart. - Miss:
--familybuilds returntheme.buildandtheme.build.checkreceipts withoutsettingIssueseven when members warn, althoughThemeBuildResponsedeclares the field always present, so list the members' entries in both family receipts or make the field optional and document that. - Each
settingIssuesentry also carries undocumentedfrom,signatureandwhyfields (andby.conditions,by.signature), which the earlier review called a smaller point butspec:AST-017DEC-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/onLightand in adaptation rules are not read and--familyreceipts 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.
|
Owner decision (engineering owner, covering this pull request): stable |
5416f13 to
fd88bd7
Compare
|
/approve-spec fd88bd7 |
There was a problem hiding this comment.
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
@lightor@darksetting names a block with no mode, so following it puts the value in both modes (the description's owncomponents.tab.selected["@light"]example ends up writingborder-top-color: #ddddddin dark mode too); keep the mode in the fix, such ascomponents.tab["selected:selected"]["@light"]. - Miss: an
:activesetting 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
onDarkblock writes the same key path beforecomponents, the warning names theonDarkline (line 5 for a setting at line 10), because the lookup inbuild.mjsandnull-values.mjsaccepts 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
componentsgoes 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.
| 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)) | ||
| ); | ||
| } |
There was a problem hiding this comment.
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.
fd88bd7 to
7d981a5
Compare
|
/approve-spec 7d981a5 |
There was a problem hiding this comment.
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
losesfix for a@lightor@darksetting never clears: after addingcomponents.button["variant:primary"]["@light"]as told, the next build prints the same warning and fix, because onlycollideschecks for a theme rule that settles the situation where both hold (setting-effects.mjs:539), so run that check forlosestoo and test the applied fix. - Miss: two settings that share a part, key, property and value become one
settingIssuesentry (the sameborderTopColorhidden in both@lightand@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 insettingIssueEntries(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
themeBuilddoc 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
losesfix 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
@lightblock. - Claim: the JSON receipt lists settingIssues with the documented fields, by and against: verified (entry keys read off a build match the docs).
- Claim:
--checkcarries the list when there are any, and--familynames 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
:activesetting 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
losesfix 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
losesfix. - 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-modelosesfix 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-modelosesfix 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.
| at => { | ||
| for (const [layer, {lineOf}] of writtenIn.entries()) | ||
| for (const keys of declarationPaths(at, blocks)) | ||
| if (lineOf(keys, {fromRoot: true}) != null) |
There was a problem hiding this comment.
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.
7d981a5 to
8855da3
Compare
|
/approve-spec 8855da3 |
There was a problem hiding this comment.
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
themeBuilddoc saysconditionsholds "the color-mode and media conditions", but entries also carry Core's zero-weight guards (a:hoversetting 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"].borderTopColorends with the fixcomponents.tab["selected:selected"], but the build now namescomponents.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.
| {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. |
There was a problem hiding this comment.
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 () => { |
There was a problem hiding this comment.
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".
8855da3 to
1d36344
Compare
|
/approve-spec 1d36344 |
There was a problem hiding this comment.
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
collideswarnings (about 291 KB) in every root build, all of them two sibling prop keys of one part (typeahead["status:success"]againsttypeahead["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. conditionsis documented as every other condition of the rule as written, but an:activesetting comes back withconditions: []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({…})besideextends: base) counts as the theme's own layer, so its variant rules never produce aloses; 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), thekeyPathLinenote atnull-values.mjs:144(a spread now gives a line), and the test title atbuild-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/onLightsurfaces and adaptation rules are not read, helper-built and imported settings are not read, and the title, changeset and docs say so: verified. - Claim:
hiddencovers 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:
losescovers 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:
collidesis 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
settingIssueswith the documented fields,byandagainst; a--checkreceipt carries them when there are any; a--familybuild names the member: verified (the keys of a real entry match the documented list exactly, and a stale--checkreceipt 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:
conditionsis every other condition of the rule as written: false for one case; an:activesetting 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:
longhandsOfandcoversPropertymove 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 doctorreports 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
themeBuilddoc: finding (theconditionsclause above). - File: the response-type docs: clear.
- File: the css-tree loader: clear.
| 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).', |
There was a problem hiding this comment.
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.
1d36344 to
76f87dd
Compare
|
/approve-spec 76f87dd |
There was a problem hiding this comment.
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
collideswarnings in every root build, all from two sibling prop keys of one part (such astypeahead["status:success"]againsttypeahead["size:sm"]); requiring the setting's attributes to be within the rival's would keep the variant-over-whole-part case and drop these. conditionsis documented as every other condition of the rule, but an:activesetting comes back withconditions: []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, thekeyPathLinenote atnull-values.mjs:145(a spread now gives a line), and the test title atbuild-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:
hiddencovers a shorthand after its own longhand, a gradient after its own repeat, and a second key that builds the same rule: verified (tests). - Claim:
losescovers a plain setting an extended theme's variant beats, and a rule for a runtime state alone never counts: verified (tests). - Claim:
collidesis reported whichever way it ends and stays silent when the theme sets the property where both hold: verified (tests). - Claim:
settingIssuescarries the documented fields withbyandagainst, and the--checkand--familyreceipts 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,
:activeread once, lines matched from the theme root, components through a call, const or spread): verified (tests and probes). - Claim:
conditionsis every other condition of the rule as written: false for one case; an:activesetting 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:
longhandsOfandcoversPropertymove 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 doctorreports 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
themeBuilddoc: non-blocking (theconditionsclause). - File: the response-type docs: clear.
- File: the css-tree loader: clear.
What users see
astryx theme buildwarns 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:
borderwritten after its own block'sborderTopColor, a gradientbackgroundafter its ownbackgroundRepeat, or a second key that builds the same selector later (selectedandselected:selected).button.base.backgroundColorunder a base theme'svariant:primarybackground.:hoveragainst 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:
The JSON receipt lists them in
settingIssues:{kind, wins, part, element, key, state, conditions, property, value, path, line, file?, by, why, against, message, fix}.byis the rule that wins most, as{part, element, key, state, conditions, property, value, from: theme | extended, path}, andagainstlists every such rule.theme build --checkcarries the same list when there are any, and so does a--familybuild, at the member that writes the setting. All fields are documented in thethemeBuilddoc and the response types.Review fixes
::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.--familyreceipts and--family --checkcarrysettingIssues.signature) are gone.from,why,by.conditions,elementandagainstare documented.Review fixes, second round
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.An
:activesetting is read once, as:active: Core writes it twice (as:activeoff 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"].Lines are matched from the theme object's root, so an
onDarkblock that writes the same keys earlier is never named for acomponentssetting.The line index follows
componentsgiven 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.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.
A test per issue type, including the fix clearing it (
build-stable-setting-effects.test.mjs)::activeis reported once; anonDarkblock is never named for acomponentsline; components given through a call, a const and a spread are read; a runtime state's own look is never counted;--familybuild names the member;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.mjsparses 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.sizefor font-size,weight,color) count as the choice made where the part is used.longhandsOfandcoversPropertymove 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.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, andtsc -p packages/cli/tsconfig.strict.json(whole CLI, 0 errors).