Repository navigation
fix(cli): doctor's theme font check counts a family any imported font stylesheet loads - #12090
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested: the doctor fix matches the app-theme spec and its tests pass, but the release note names a case the change does not affect.
- The changeset (and the description's User impact) says a theme made with the theme editor ships no font stylesheet and got the "import no font stylesheet" warning, but the editor's app copy always writes
<slug>.fonts.css, which imports the base theme's font stylesheet on neutral, sodoctoralready passed those themes; please drop the editor from that sentence and say thattheme ejectcopies a theme rather than extends it, for example: "A local theme built on neutral, such as one whose source extends neutral or a copy thattheme ejectmakes, names neutral's fonts but ships no font stylesheet of its own."
Two non-blocking points: when another theme's stylesheet loads every family a theme names, that theme's own imported font stylesheet is no longer reported if it cannot be parsed, although the comment at theme-checks.mjs:1897 says it is. The new warn test would also pass without the message narrowing; a theme that names one covered and one uncovered family would pin it down.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: doctor counts a family as loaded when any font stylesheet the generated module imports loads it. Verified:
theme-checks.mjs:1882-1912; the new pass test fails before the change and passes after it. - Claim: a local theme made with
theme ejectnames neutral's fonts and ships no font stylesheet. Verified: eject copies only the theme's source files. False in part: eject makes an independent copy, not an extension. - Claim: a theme made with the theme editor ships no font stylesheet of its own. False: the editor's app copy always writes
<slug>.fonts.css(theme-edit/_preview.mjs:2189-2193,theme-hunt62.test.mjs:102-110), and an editor theme on neutral passes before and after this change. - Claim: before the change, doctor warned with the quoted message even though the module imported neutral's font stylesheet. Verified for a local theme without a font stylesheet, on a fixture app.
- Claim: a family that no imported font stylesheet loads still warns. Verified:
theme-checks.test.mjs:1717-1733and a fixture app. - Claim: every font stylesheet the generated module imports loads at once, so a family that one of them loads is loaded for every theme. Verified: the app-theme spec's FR9 and FR11 check 10, and the generated module's static imports.
- Claim: after the change the check passes with the quoted message. Verified on a fixture app.
- Claim: every app with a custom theme built on an Astryx theme gets a warning on a correct setup. Verified for apps that add both themes, the scenario the description gives; an app with only the custom theme still warns, which is correct.
- Claim: the spec's FR11 check 9 accepts a family loaded by any imported font stylesheet, and no record changes. Verified.
- Claim: only
theme-checks.mjschanges behavior, and no other check changes. Verified: the other check results are the same on a fixture app. - Claim: the regression tests cover the pass case and the warn case. Verified; the warn test does not test the narrowed message (non-blocking).
- Claim: 73 tests pass, and the new pass test fails without the change. Verified.
- Claim: ESLint and Prettier pass on the changed files. Verified.
- Claim: no new public API, default or interaction model. Verified: no command, option or export changes.
- Claim: public text has no internal context. Verified.
- Claim: a custom brand theme built on neutral is the common way to theme an app. Context: matches the theme docs' advice to extend a package theme.
- File
.changeset/doctor-fonts-from-any-imported-stylesheet.md: blocking finding (the theme-editor claim). - File
packages/cli/api/doctor/theme-checks.mjs: matches FR11 check 9; non-blocking note about the unparseable-stylesheet comment. - File
packages/cli/api/doctor/theme-checks.test.mjs: clear; non-blocking suggestion to test the narrowed message.
… stylesheet loads
…nnot parse; release note names the themes it changes
51c63ea to
370aab2
Compare
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
The doctor font-check change matches the app-theme spec, and the earlier points are addressed: the release note no longer names theme-editor themes, an imported font stylesheet that cannot be parsed fails again, and the warn test now pins the narrowed message.
Claims and files checked
Review mode: full; reason: rebase
- Claim:
doctor's theme font check counts a family as loaded when any font stylesheet the generated theme module imports loads it. Verified:theme-checks.mjs:1887-1908and:1928-1931; testtheme-checks.test.mjs:1747-1761. - Claim: a local theme built on neutral, by extending it or as a
theme ejectcopy, names neutral's fonts but ships no font stylesheet. Verified:theme buildwrites no font stylesheet (build.mjs:5880-5894only warns about side-effect stylesheets), and the bundled neutral copy that eject writes has nofonts.css. - Claim: a theme the theme editor makes writes its own font stylesheet, so it is not affected. Verified: the editor always writes
<slug>.fonts.css(theme-edit/_preview.mjs:2333-2337,theme-app-copy-written-around.test.mjs:104-112). - Claim: an app that adds both themes imports neutral's font stylesheet from the generated module, which loads the fonts for both. Verified: the module imports each added theme's font stylesheet (
theme-state.mjs:452-454); neutral's stylesheet requests Figtree from a font service. - Claim: before the change, doctor warned with the quoted "import no font stylesheet" message on that setup. Verified on a test app with a local theme beside its parent theme.
- Claim: after the change the check passes with the quoted message. Verified on the same test app; message at
theme-checks.mjs:2059-2060. - Claim: a family that no imported font stylesheet loads still gets the warning. Verified:
theme-checks.test.mjs:1786-1802, and a local theme without its parent still warns. - Claim: the check proved each theme's families only from its own font stylesheet, and reported a theme with none at once. Verified: base
theme-checks.mjs:1891-1900. - Claim: every app with a custom theme built on an Astryx theme gets a warning on a correct setup. Verified for apps that add both themes, the scenario the description gives; an app with only the custom theme still warns, which is correct.
- Claim: a custom brand theme built on neutral is the common way to theme an app. Context: the theme docs advise extending a package theme.
- Claim: all font stylesheets the module imports load at once, so a family one loads is loaded for every theme. Verified: the app-theme spec's FR9 and FR11 check 10, and the module's static imports.
- Claim: the app-theme spec's FR11 check 9 accepts a family loaded by any imported font stylesheet, and no record changes. Verified.
- Claim: each imported font stylesheet is read once, and a theme whose own imported font stylesheet cannot be parsed is still reported. Verified:
theme-checks.mjs:1894-1908,:1921-1927; testtheme-checks.test.mjs:1763-1784. - Claim: only
theme-checks.mjschanges behavior, and no other check changes. Verified: the diff touches only the font block ofcheckAppThemes. - Claim: the regression tests cover the pass case, the covered-plus-uncovered warn case and the unparseable stylesheet. Verified; the first two fail before the change.
- Claim: 77 tests pass, and the new pass test fails on main's check. Verified.
- Claim: ESLint and Prettier pass on the changed files. Verified.
- Claim: no new public API, default or interaction model, and no internal context in public text. Verified.
- File
.changeset/doctor-fonts-from-any-imported-stylesheet.md: clear. - File
packages/cli/api/doctor/theme-checks.mjs: clear; matches the app-theme spec's font check. - File
packages/cli/api/doctor/theme-checks.test.mjs: clear.
PR Analysis Report🔎 Preview ·
|
User impact
A local theme built on an Astryx theme, such as one whose source extends neutral or a copy of neutral that
theme ejectmakes, uses neutral's fonts but has no font stylesheet of its own. (A theme the theme editor makes writes its own font stylesheet, so it is not affected.) An app that adds both themes imports neutral's font stylesheet once, from the generated theme module, and that stylesheet loads the fonts for both.astryx doctorstill warns about the local theme:The fonts load, so there is nothing to fix. People and agents follow the fix anyway and copy neutral's font stylesheet into the local theme by hand, which then has to be kept in step with neutral's.
After this change, a family that any font stylesheet the generated module imports loads counts as loaded for every added theme, and the check passes:
A family that no imported font stylesheet loads still gets the warning.
Problem and solution fit
All the stylesheets the generated module imports load in the app at once, so a family one of them loads is loaded for every theme in the app. The check now gathers the families from every font stylesheet the module imports, then judges each theme's families against them; a theme's own font stylesheet still decides the message when a family is missing.
Expected behavior and authority
spec:AST-050FR11 check 9: every font family an added theme names is a system font or is loaded by a font stylesheet the module imports. The module imports every added theme's font stylesheet, so a family any of them loads meets the claim as written; no record changes.Smallest restoration
api/doctor/theme-checks.mjs: before judging each theme, the check reads every font stylesheet the generated module imports once, gathers the families they load, and leaves those families out of each theme's unloaded ones. A theme whose own imported font stylesheet cannot be parsed is still reported, whatever the other stylesheets load.Evidence
team-purpletheme that extends neutral, checked by the current canary installed for the computer. Before:theme-fontswarn "Added themes name font families but import no font stylesheet (team-purple: Figtree (font stylesheet is not imported))."api/doctor/theme-checks.mjsreplaced in that copy:theme-fontspass. No other check changed.Scope
Components: CLI (
doctor's theme font check)Testing
vitest run --project node packages/cli/api/doctor/theme-checks.test.mjs: 77 passed, on main after the latest theme-check changes. The new pass test fails on main's check.