Repository navigation
fix(core): a Theme given a value that is not a theme keeps the page running - #12278
josephfarina wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| lab/CommentThread | 372.3 kB (+73 B) · 2.4 kB CSS (0) | — | — · — · — |
| Markdown | 205.3 kB (+71 B) · 22.1 kB CSS (0) | — | — · — · — |
| Toast | 105.6 kB (+65 B) · 11.1 kB CSS (0) | — | — · — · — |
121 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DialogHeader | 69.5 kB (+64 B) · 12.5 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 104.5 kB (+64 B) · 19.1 kB CSS (0) | — | — · — · — |
| TableCell | 104.7 kB (+63 B) · 19.3 kB CSS (0) | — | — · — · — |
| lab/ListInput | 95.4 kB (+62 B) · 922 B CSS (0) | — | — · — · — |
| Carousel | 76.5 kB (+61 B) · 11.8 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 67.0 kB (+61 B) · 11.0 kB CSS (0) | — | — · — · — |
| CodeBlock | 81.9 kB (+61 B) · 12.2 kB CSS (0) | — | — · — · — |
| DrawerHeader | 69.7 kB (+61 B) · 14.0 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 66.7 kB (+61 B) · 10.8 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 67.3 kB (+61 B) · 10.9 kB CSS (0) | — | — · — · — |
| Stepper | 68.1 kB (+60 B) · 10.9 kB CSS (0) | — | — · — · — |
| Banner | 68.4 kB (+59 B) · 11.3 kB CSS (0) | — | — · — · — |
| ChatDictationButton | 67.0 kB (+58 B) · 10.9 kB CSS (0) | — | — · — · — |
| ChatSendButton | 66.8 kB (+58 B) · 10.8 kB CSS (0) | — | — · — · — |
| Thumbnail | 70.9 kB (+57 B) · 12.4 kB CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 102.5 kB (+57 B) · 1.8 kB CSS (0) | — | — · — · — |
| charts/Chart | 242.0 kB (+56 B) · 516 B CSS (0) | — | — · — · — |
| Calendar | 77.5 kB (+56 B) · 11.4 kB CSS (0) | — | — · — · — |
| IconButton | 66.5 kB (+56 B) · 10.8 kB CSS (0) | — | — · — · — |
| Pagination | 147.8 kB (+56 B) · 19.1 kB CSS (0) | — | — · — · — |
| Button | 66.4 kB (+55 B) · 10.8 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 83.7 kB (+55 B) · 12.1 kB CSS (0) | — | — · — · — |
| DateInput | 203.3 kB (+55 B) · 18.0 kB CSS (0) | — | — · — · — |
| ChatComposerInput | 83.7 kB (+54 B) · 12.1 kB CSS (0) | — | — · — · — |
| ChatLayout | 90.0 kB (+54 B) · 11.4 kB CSS (0) | — | — · — · — |
| CommandPalette | 78.8 kB (+54 B) · 12.8 kB CSS (0) | — | — · — · — |
| lab/Comments | 379.3 kB (+54 B) · 2.5 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 79.1 kB (+53 B) · 10.5 kB CSS (0) | — | — · — · — |
| Tokenizer | 106.1 kB (+53 B) · 20.4 kB CSS (0) | — | — · — · — |
| PowerSearch | 310.6 kB (+52 B) · 25.6 kB CSS (0) | — | — · — · — |
| lab/TourStep | 95.1 kB (+52 B) · 691 B CSS (0) | — | — · — · — |
| BreadcrumbItem | 98.2 kB (+51 B) · 13.3 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 90.5 kB (+51 B) · 372 B CSS (0) | — | — · — · — |
| lab/TabBar | 83.8 kB (+51 B) · 1.8 kB CSS (0) | — | — · — · — |
| ContextMenu | 103.5 kB (+50 B) · 18.8 kB CSS (0) | — | — · — · — |
| Lightbox | 149.7 kB (+50 B) · 12.0 kB CSS (0) | — | — · — · — |
| lab/NavigationScreen | 85.4 kB (+50 B) · 1.5 kB CSS (0) | — | — · — · — |
| FileInput | 75.5 kB (+49 B) · 11.7 kB CSS (0) | — | — · — · — |
| TopNavMenu | 83.0 kB (+49 B) · 12.0 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 85.4 kB (+49 B) · 1.5 kB CSS (0) | — | — · — · — |
| AppShell | 99.0 kB (+48 B) · 14.4 kB CSS (0) | — | — · — · — |
| Table | 121.7 kB (+48 B) · 19.8 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 124.1 kB (+48 B) · 1.1 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 180.6 kB (+48 B) · 1.9 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 33.5 kB (+47 B) · 7.6 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 28.9 kB (+47 B) · 7.3 kB CSS (0) | — | — · — · — |
| ToggleButtonGroup | 41.6 kB (+47 B) · 3.7 kB CSS (0) | — | — · — · — |
| NumberInput | 104.2 kB (+46 B) · 12.2 kB CSS (0) | — | — · — · — |
| Selector | 114.9 kB (+46 B) · 18.7 kB CSS (0) | — | — · — · — |
| TopNav | 79.4 kB (+46 B) · 11.8 kB CSS (0) | — | — · — · — |
| ComplexSelector | 78.9 kB (+45 B) · 12.7 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 69.4 kB (+45 B) · 162 B CSS (0) | — | — · — · — |
| AlertDialog | 129.8 kB (+44 B) · 15.5 kB CSS (0) | — | — · — · — |
| Link | 56.9 kB (+44 B) · 7.1 kB CSS (0) | — | — · — · — |
| Overlay | 23.6 kB (+44 B) · 3.9 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 118.9 kB (+44 B) · 751 B CSS (0) | — | — · — · — |
| lab/Schedule | 116.1 kB (+44 B) · 3.9 kB CSS (0) | — | — · — · — |
| lab/TransferList | 136.5 kB (+44 B) · 1.2 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 285.3 kB (+44 B) · 2.4 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 77.7 kB (+43 B) · 12.7 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 122.9 kB (+43 B) · 773 B CSS (0) | — | — · — · — |
| lab/TransferListSelector | 145.4 kB (+43 B) · 1.4 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 309.3 kB (+43 B) · 454 B CSS (0) | — | — · — · — |
| RadioListItem | 76.6 kB (+42 B) · 10.7 kB CSS (0) | — | — · — · — |
| Slider | 115.0 kB (+42 B) · 8.9 kB CSS (0) | — | — · — · — |
| TextInput | 99.2 kB (+42 B) · 12.0 kB CSS (0) | — | — · — · — |
| SideNav | 122.7 kB (+41 B) · 12.2 kB CSS (0) | — | — · — · — |
| TabMenu | 80.2 kB (+41 B) · 11.9 kB CSS (0) | — | — · — · — |
| ChatComposer | 86.0 kB (+40 B) · 12.9 kB CSS (0) | — | — · — · — |
| MoreMenu | 109.2 kB (+40 B) · 18.9 kB CSS (0) | — | — · — · — |
| Popover | 100.4 kB (+40 B) · 15.2 kB CSS (0) | — | — · — · — |
| ProgressBar | 12.1 kB (+40 B) · 6.4 kB CSS (0) | — | — · — · — |
| TextArea | 92.8 kB (+40 B) · 9.4 kB CSS (0) | — | — · — · — |
| Typeahead | 89.4 kB (+40 B) · 13.5 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 94.5 kB (+40 B) · 2.1 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 79.8 kB (+39 B) · 11.7 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 34.0 kB (+39 B) · 8.5 kB CSS (0) | — | — · — · — |
| SelectorOption | 24.3 kB (+39 B) · 6.7 kB CSS (0) | — | — · — · — |
| Collapsible | 29.2 kB (+38 B) · 4.5 kB CSS (0) | — | — · — · — |
| TreeList | 46.5 kB (+38 B) · 5.9 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 308.1 kB (+38 B) · 2.7 kB CSS (0) | — | — · — · — |
| ToggleButton | 93.6 kB (+37 B) · 10.9 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 36.0 kB (+36 B) · 7.1 kB CSS (0) | — | — · — · — |
| DateRangeInput | 101.0 kB (+36 B) · 13.3 kB CSS (0) | — | — · — · — |
| DateTimeInput | 226.8 kB (+36 B) · 19.8 kB CSS (0) | — | — · — · — |
| DropdownMenu | 108.9 kB (+36 B) · 18.9 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 80.5 kB (+35 B) · 12.1 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 28.8 kB (+35 B) · 7.3 kB CSS (0) | — | — · — · — |
| FieldStatus | 10.2 kB (+35 B) · 3.6 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 76.7 kB (+35 B) · 14.1 kB CSS (0) | — | — · — · — |
| ChatMessageMetadata | 20.5 kB (+34 B) · 4.1 kB CSS (0) | — | — · — · — |
| CheckIndicator | 8.5 kB (+34 B) · 681 B CSS (0) | — | — · — · — |
| Icon | 8.3 kB (+34 B) · 681 B CSS (0) | — | — · — · — |
| InfoTip | 50.8 kB (+34 B) · 5.4 kB CSS (0) | — | — · — · — |
| ListItem | 79.6 kB (+34 B) · 12.1 kB CSS (0) | — | — · — · — |
| ChatMessageList | 30.0 kB (+33 B) · 7.1 kB CSS (0) | — | — · — · — |
| Citation | 20.8 kB (+33 B) · 4.4 kB CSS (0) | — | — · — · — |
| MobileNav | 77.7 kB (+33 B) · 11.4 kB CSS (0) | — | — · — · — |
| SideNavItem | 78.4 kB (+33 B) · 11.9 kB CSS (0) | — | — · — · — |
| Spinner | 26.6 kB (+33 B) · 6.3 kB CSS (0) | — | — · — · — |
| Token | 29.7 kB (+33 B) · 4.9 kB CSS (0) | — | — · — · — |
| SegmentedControl | 102.5 kB (+32 B) · 6.9 kB CSS (0) | — | — · — · — |
| Step | 31.8 kB (+32 B) · 5.6 kB CSS (0) | — | — · — · — |
| lab/PageControl | 78.4 kB (+31 B) · 709 B CSS (0) | — | — · — · — |
| CheckboxList | 73.6 kB (+29 B) · 7.8 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 28.0 kB (+29 B) · 6.9 kB CSS (0) | — | — · — · — |
| MultiSelector | 103.3 kB (+28 B) · 17.8 kB CSS (0) | — | — · — · — |
| FieldLabel | 55.7 kB (+27 B) · 5.8 kB CSS (0) | — | — · — · — |
| SideNavHeading | 83.9 kB (+27 B) · 12.1 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 60.8 kB (+27 B) · 1.2 kB CSS (0) | — | — · — · — |
| Switch | 109.6 kB (+26 B) · 10.0 kB CSS (0) | — | — · — · — |
| InputGroup | 61.5 kB (+24 B) · 7.9 kB CSS (0) | — | — · — · — |
| TabList | 47.7 kB (+24 B) · 6.5 kB CSS (0) | — | — · — · — |
| RadioList | 61.2 kB (+23 B) · 7.4 kB CSS (0) | — | — · — · — |
| TopNavHeading | 83.5 kB (+22 B) · 12.0 kB CSS (0) | — | — · — · — |
| Field | 59.9 kB (+19 B) · 7.3 kB CSS (0) | — | — · — · — |
| TimeInput | 178.0 kB (+18 B) · 17.0 kB CSS (0) | — | — · — · — |
| CheckboxInput | 69.5 kB (+17 B) · 10.2 kB CSS (0) | — | — · — · — |
| ButtonGroup | 44.3 kB (+16 B) · 3.7 kB CSS (0) | — | — · — · — |
| Timestamp | 30.8 kB (+1 B) · 11.1 kB CSS (0) | — | — · — · — |
| lab/TabBarItem | 3.9 kB (0) · 1.8 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.68 MB packed (+1.7 kB); no new dependencies.
Wide change (shared styles: packages/core/src/theme/Theme.tsx, packages/core/src/theme/useTheme.ts): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Current run: CI concluded cancelled; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
|
Owner decision (engineering owner, covering this pull request): a |
|
/approve-spec 22bd041 |
There was a problem hiding this comment.
Requesting changes. The crash fix works, and the new invalid-value rule for theme is owner-approved, but one behaviour defect and two description errors remain.
- When a Theme gets a non-theme value and no defined theme surrounds it, it provides a null context (
Theme.tsx:447-450), so a system Theme nested under<Theme theme="light" mode="dark">stays dark instead of declaringlight dark, anduseTheme()under a nested no-theme Theme reports the root's mode instead of its own, contrary to the Theme record's FR2 and FR3. - The description says an import that resolves to
undefinedrenders on the server before failing, that all 38 Theme tests pass, and that 13 new tests fail without the fix, but on the basenullandundefinedalready throw during the server render, andTheme.test.tsxhas 40 tests, all 15 new ones failing without the fix.
Keeping the mode reachable when no theme applies (for example, a context value whose theme is optional) and adding those two nested states to the regression tests would resolve the first point. Required CI jobs did not run on this head because CI was full, so CI needs a re-run.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: a string, plain object or
undefinedpassed asthemeno longer stops the page. Verified: the 15 new tests fail on the base and pass on the head, and a Storybook page renderingtheme="light"shows an error on the base and renders on the head. - Claim: strings, objects and
undefinedused to render on the server and then fail in the browser. Partly false: strings and objects do, butnullandundefinedthrow during the server render on the base. - Claim: such a Theme registers nothing, compiles no CSS and writes no theme name. Verified:
Theme.tsx:414-424, and the tests assert no CSS generation and no theme attribute. - Claim: the subtree keeps the parent's theme, or no theme at the root. Verified by the nested test.
- Claim:
modestill applies, anduseTheme()reportsdefaultand the resolved mode. Partly false: true for the Theme's own subtree at the root, but not for nested system Themes or a nested no-theme Theme (finding above). - Claim: one development warning per kind of value, naming
modefor a mode string. The mode text is verified by test;nulland plain objects share one warning key (Theme.tsx:373), so only the first is reported. - Claim: the prop description says a colour mode goes in
mode. Verified (Theme.doc.mjs:72). - Claim: the Theme record gains an invalid-value row and a verification row. Verified, and owner-approved at this head.
- Claim: interactive pages from a corpus run at three widths in light and dark. Not checked: those pages are not in the repository.
- Claim: all 38 Theme tests and all theme tests pass, and 13 new tests fail without the fix. False counts: 40 Theme tests pass, and all 15 new tests fail on the base; the 31-file, 1,831-test theme run is verified.
- Claim: the regression tests cover six values at the root and nested, hydration, the warning text and a value becoming a theme. Verified (
Theme.test.tsx:665-812). - Claim: the type check and the knowledge check pass. Verified.
- Claim: no new public API. Verified: the API surface generator reports no added, changed or removed rows.
- Changeset: no page stop for
"light", a plain object orundefined. Verified. - Changeset: no theme of its own, the surrounding theme or Core's default tokens, and it still takes its
mode. The first parts are verified; the mode part is partly false (finding above). - Changeset: server and browser render the same markup. Verified by the hydration tests.
- Changeset: the warning names the value and points to
modefor a mode string. Verified. - File
.changeset/theme-not-a-theme.md: "still takes itsmode" overstates the behaviour. - File
docs/specs/components/theme/Theme.spec.md: clear; FR2 and FR3 still apply to the mode. - File
packages/core/src/theme/Theme.doc.mjs: clear (two lines are formatting only). - File
packages/core/src/theme/Theme.test.tsx: clear, but no test covers mode under a Theme with no theme. - File
packages/core/src/theme/Theme.tsx: null-context mode defect; non-blocking notes on the warning key and comment wording.
|
/approve-spec f962937 |
There was a problem hiding this comment.
Changes requested. The crash fix and the mode fix work, and the new invalid-value rule for theme is owner-approved for this head, but one current invariant is still broken.
- Miss: under a
Themewhosethemeis not a defined theme and that has no theme around it,useTheme()(anduseThemeName()anduseThemeDefinition()) still starts the<html data-astryx-theme>observer even when that Theme forcesmode="dark", which contradicts the theme-application rule that a consumer under a Theme forcing a mode creates no document observer (packages/core/src/theme/useTheme.ts:448); skip that store for a page-root Theme that applies no theme, or amend the rule, and add an observer-count test.
A forced mode now reaches nested Themes and useTheme(), and both description corrections from the last review are in. Two small non-blocking notes (a warning helper used during render, and the ThemeModeContext comment) are in the review.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules (0): the review rules are unchanged since the last review.
- Claim (release note): a non-theme value such as a mode string, a plain object or
undefinedno longer stops the page. Verified: the 17 new tests fail on the base and pass on the head, and a Storybook page whose root Theme gets"light"throws on the base and runs on the head. - Claim (release note): such a Theme applies no theme of its own, its subtree keeps the theme around it or Core's default tokens, and it keeps its
mode. Verified: the nested and mode tests inTheme.test.tsxand a Chromium probe of a nested system Theme. - Claim (release note): server and browser render the same markup. Verified: the hydration tests for all six values.
- Claim (release note): a development warning names the value and points a mode string to
mode. Verified: the exact warning text test; the helper is a no-op in production. - Claim (description): strings and plain objects render on the server, then throw in the browser. Verified: the base test failures (
Cannot convert undefined or null to object). - Claim (description):
nullandundefinedalready throw during the server render. Verified: the base failures readnameofnullorundefinedduring render. - Claim (description): agent-written pages often put a color mode in
theme. Not checkable from the repository (the author's report). - Claim (description): the throw comes from compiling the value in the browser. Verified: the base insertion Effect hands the value to the CSS compiler.
- Claim (description):
modealready treats unknown values assystem. Verified: the Theme record's Mode row and the theme-application rules. - Claim (description): the fix uses
isDefinedTheme, registers, compiles and names nothing, keeps the parent's theme, and keepsmode. Verified:Theme.tsx:413-423,:459,:317-321. - Claim (description): the theme context is null, an internal mode context carries the mode,
useTheme()reportsdefaultand the Theme's mode, and a nested system Theme follows the reader. Verified:Theme.test.tsx:787and the Chromium probe. - Claim (description): one warning per kind of value, with
nulland objects separate, and mode strings namemode. Verified:Theme.test.tsx:752and:817. - Claim (description): the
themeprop description points tomode. Verified:Theme.doc.mjs:72. - Claim (description): in jsdom,
"light","default"and{}throw from the compiler before the change. Verified: the red-first run. - Claim (description): two rendered pages from the author's corpus fail before and run after, at three widths in light and dark. Not reproducible here (the pages are not in the repository); a Storybook page with the same failure throws on the base and runs on the head.
- Claim (description): all 42 Theme tests and all theme tests pass, and a valid theme still registers, injects and names itself. Verified: 42 and 1,833 tests pass; a defined-theme page renders identical frames on the base and the head.
- Claim (description): all 17 new tests fail on the base. Verified: 17 failed, 25 passed on the base.
- Claim (description): the Core type check and the knowledge check pass. Verified: both exit 0.
- Claim (description): no new public API, visual, default or interaction model, and no internal context. Verified: the API report lists no change for Core or the seven themes; the added text carries no internal context.
- Claim (description): writing rubric results R1 to R7. Verified against the two new record rows.
- File
.changeset/theme-not-a-theme.md: clear. - File
docs/specs/components/theme/Theme.spec.md: clear (owner-approved rows). - File
packages/core/src/theme/Theme.doc.mjs: clear. - File
packages/core/src/theme/Theme.test.tsx: clear. - File
packages/core/src/theme/Theme.tsx: non-blocking note (warning during render). - File
packages/core/src/theme/useTheme.ts: blocking finding at line 448; non-blocking comment note at lines 68-70.
|
/approve-spec 0bef42b |
There was a problem hiding this comment.
Approved. The crash fix, the mode handling and the observer fix check out against the Theme record and the theme-application rules, and the owner-approved invalid-value row for theme covers the new behavior.
Every CI check at this head passes except test-node and its test roll-up, which stop in planning because the Node suite's planned time is over its per-leg budget. The Node project does not collect packages/core tests, and this pull request changes neither its files nor its recorded times, so those checks need a fix on main and a re-run before this can merge.
Non-blocking suggestions:
Theme.tsx:423: name the system the new Effect syncs, for example "Synchronizes the development console. The key is the kind of value, so a replay or a second Theme does not warn again."useTheme.ts:17-20: the file header still says the hook reads<html>whenever no ThemeContext is reachable; below a page-root Theme that applies no theme it now reads neither attribute.
Claims and files checked
Review mode: incremental; reason: none
- Claim (changeset): the page no longer stops for a non-theme value such as
"light", a plain object orundefined. Verified: the 17 new Theme tests fail on the base and pass on the head; a Storybook fixture stops on the base and renders on the head. - Claim (changeset): such a Theme applies no theme of its own, keeps the surrounding theme or Core's defaults, and still takes its
mode. Verified:Theme.tsx:421-422,:457-464; tests "keeps the theme around it when nested, and its own mode" and "keeps its mode for the Themes and readers below it when no theme surrounds it". - Claim (changeset): server and browser render the same markup. Verified: six hydration tests with identical markup and no console error.
- Claim (changeset): a development warning names the value and points a mode string to
mode. Verified:Theme.tsx:366-385; test "names the mode prop when the value is a mode". - Claim (description): on the base, strings and objects throw in the browser and
nullorundefinedthrow on the server. Verified: base errors "Cannot convert undefined or null to object" and "reading 'name'". - Claim (description): the guard uses
isDefinedTheme; a non-theme value registers nothing, compiles nothing and writes no name of its own. Verified:Theme.tsx:421-439,generateThemeCSSnot called in the tests. - Claim (description): the theme context is null, the mode comes from an internal mode context,
useTheme()reportsdefaultand this Theme's mode, and a system Theme below a forced one follows the reader. Verified: tests and the Storybook fixture. - Claim (description): with no theme up to the page's root Theme,
<html>names no theme and readers below it create no document observer. Verified: the new observer test fails on the previous head and the base and passes on the head. - Claim (description): one warning per kind of value, with
nulland plain objects warned separately. Verified:Theme.tsx:380; test "warns for null and for a plain object separately". - Claim (description): the
themeprop description says a color mode goes inmode. Verified:Theme.doc.mjs:72. - Claim (description): all 17 new tests fail on the base. Verified, plus the new observer test.
- Claim (description): the theme test folder (31 files, 1,834 tests), the Core typecheck and the knowledge check pass. Verified by rerunning each.
- Claim (description): the two corpus pages and their headless runs. Not checkable from the repository; an equivalent Storybook fixture reproduces the base failure and the head render.
- Claim (description): no new public API. Verified: the repository's API generator reports no added, changed or removed rows.
- File
.changeset/theme-not-a-theme.md: clear. - File
docs/specs/components/theme/Theme.spec.md: clear (owner-approved rows at this head). - File
packages/core/src/theme/Theme.doc.mjs: clear. - File
packages/core/src/theme/Theme.test.tsx: clear. - File
packages/core/src/theme/Theme.tsx: non-blocking Effect note wording at line 423. - File
packages/core/src/theme/useTheme.test.tsx: clear. - File
packages/core/src/theme/useTheme.ts: non-blocking file-header wording at lines 17-20.
| // same choice, so the markup matches. | ||
| const ownTheme = isDefinedTheme(theme) ? theme : null; | ||
| const applied = ownTheme ?? parent?.theme ?? null; | ||
| // Reports a value that is not a defined theme. |
There was a problem hiding this comment.
Non-blocking (Effect note): the runtime rules ask a new Effect to name the external system it syncs. Consider the wording DateInput/useCalendarPresentation.ts uses for the same pattern: "Synchronizes the development console. The key is the kind of value, so a replay or a second Theme does not warn again."
0bef42b to
fa76ff5
Compare
|
/approve-spec fa76ff5 |
There was a problem hiding this comment.
Approved, pending CI: some required checks are still running on this head, and one failed check is a known flake in an AlertDialog motion proof that this change does not touch, so it needs a re-run before merge. The crash fix, the mode handling and the observer fix still hold after the rebase onto main, including its new system-scheme behavior, and the owner-approved invalid-value row for theme covers the new behavior.
Non-blocking suggestions:
Theme.tsx:423: name the system the new Effect syncs, for example "Synchronizes the development console. The key is the kind of value, so a replay or a second Theme does not warn again."useTheme.ts:19-22: the file header still says the hook reads<html>whenever no ThemeContext is reachable; below a page-root Theme that applies no theme it now reads neither attribute.
Claims and files checked
Review mode: full; reason: rebase
- Claim (changeset): the page no longer stops for a non-theme value such as
"light", a plain object orundefined. Verified: the 17 new Theme tests fail on the base and pass on the head; a Storybook fixture stops on the base and renders on the head. - Claim (changeset): such a Theme applies no theme of its own, keeps the surrounding theme or Core's defaults, and still takes its
mode. Verified:Theme.tsx:421-422,:457-464; tests "keeps the theme around it when nested, and its own mode" and "keeps its mode for the Themes and readers below it when no theme surrounds it". - Claim (changeset): the server and the browser render the same markup. Verified: six hydration tests with identical markup and no console error.
- Claim (changeset): a development warning names the value and points a mode string to
mode. Verified:Theme.tsx:366-385, development only throughwarnOnce; test "names the mode prop when the value is a mode". - Claim (description): on the base, strings and objects throw in the browser and
nullorundefinedthrow on the server. Verified: base errors "Cannot convert undefined or null to object" and "reading 'name'". - Claim (description): agent-written pages often put a color mode in
theme. Not checkable from the repository; it is the author's report. - Claim (description):
modealready treats a value outside its contract assystem. Verified: the Theme record's Mode row and the theme-application rules. - Claim (description): the guard uses
isDefinedTheme; a non-theme value registers nothing, compiles nothing and writes no theme name, and the subtree keeps the parent's theme. Verified:Theme.tsx:421-439;generateThemeCSSis not called in the tests. - Claim (description): the theme context is null, the mode comes from an internal mode context,
useTheme()reportsdefaultand this Theme's mode, and a system Theme below a forced one follows the reader. Verified: tests and the Storybook fixture. - Claim (description): with no theme up to the page's root Theme,
<html>names no theme and readers below it create no document observer. Verified: the observer test fails on the base and passes on the head. - Claim (description): one warning per kind of value, with
nulland plain objects warned separately. Verified:Theme.tsx:380; test "warns for null and for a plain object separately". - Claim (description): the
themeprop description says a color mode goes inmode. Verified:Theme.doc.mjs:72. - Claim (description): all 17 new tests fail on the base, and a valid theme still registers, injects and names itself. Verified, plus the new observer test; every existing Theme and useTheme test passes.
- Claim (description): the theme test folder (31 files, 1,834 tests), the Core typecheck and the knowledge check pass. Verified by rerunning each; after the rebase the folder holds 1,837 tests, all passing.
- Claim (description): the two corpus pages and their headless runs. Not checkable from the repository; an equivalent Storybook fixture reproduces the base failure and the head render.
- Claim (description): one defect, no new public API, no internal context, and the writing rubric results. Verified: the repository's API generator reports no added, changed or removed rows; the new record rows are present tense with no pull request or status text.
- File
.changeset/theme-not-a-theme.md: clear. - File
docs/specs/components/theme/Theme.spec.md: clear (owner-approved rows at this head). - File
packages/core/src/theme/Theme.doc.mjs: clear. - File
packages/core/src/theme/Theme.test.tsx: clear. - File
packages/core/src/theme/Theme.tsx: non-blocking Effect note wording at line 423. - File
packages/core/src/theme/useTheme.test.tsx: clear. - File
packages/core/src/theme/useTheme.ts: non-blocking file-header wording at lines 19-22.
fa76ff5 to
a0d1f22
Compare
|
/approve-spec a0d1f22 |
There was a problem hiding this comment.
Approved pending CI: some required checks have not finished on this head yet.
A Theme given a value that is not a defined theme now keeps the page running: it applies no theme of its own, keeps the theme around it or Core's defaults at the root, still passes on its mode, and warns in development. The new invalid-value rule for theme is approved for this head by an engineering owner, and the new tests fail before the change and pass after it.
Two optional comment touch-ups remain: the warning Effect's note could name the system it syncs (the development console), and the useTheme.ts file header still says the hook reads <html> whenever no theme context is reachable.
Claims and files checked
Review mode: full; reason: rebase
- Changeset: a Theme given a non-theme value (a mode string, a plain object,
undefined) no longer stops the page — verified: 17 newTheme.test.tsxtests fail before the change and pass after it, and a Storybook page with such a root renders and responds on the head. - Changeset: that Theme applies no theme of its own, keeps the surrounding theme or Core's defaults at the root, and keeps its
mode— verified:Theme.tsx:434-435,:495; tests for the nested and root cases. - Changeset: the server and the browser render the same markup — verified: six hydration tests with identical markup and no console error.
- Changeset: in development a warning names the value and, for a mode string, points to
mode— verified:Theme.tsx:379-398;warnOnceis a no-op in production; test for the exact message. - Description: strings and plain objects render on the server and then throw in the browser;
nullandundefinedthrow during render — verified on the base by the same tests (Cannot convert undefined or null to object,reading 'name'). - Description:
modealready treats an out-of-contract value assystem— verified: the Theme record's Mode row. - Description: the existing
isDefinedThemecheck gates registration, CSS compilation and the theme name — verified:Theme.tsx:434-457. - Description: with no theme the theme context is null, the mode still reaches nested Themes and
useTheme(), and readers under a page-root no-theme Theme create no document observer — verified:useTheme.ts:77-88,:458-529; the mode and observer-count tests. - Description: one warning per kind of value, with
nulland plain objects separate — verified: the warning key atTheme.tsx:393and its test. - Description: the
themeprop description says a color mode goes inmode— verified:Theme.doc.mjs:72. - Description: the before and after runs on two rendered pages at three widths — not checkable from the repository (the author's pages); an equivalent Storybook page reproduces the failure on the base and the fix on the head.
- Description: all Theme,
useThemeand theme tests pass — verified: 31 files pass at this head (1,839 tests after the rebase added some; the description counts 1,834). - Description: all 17 new tests fail on the base, and the observer-count test is new — verified: 18 fail on the base, all 18 pass on the head.
- Description: no new public API, default or interaction model, and no internal context — verified: the API generator lists no change for Core or any theme, and the added text has no internal references.
- Description: type check and knowledge check pass — verified: both exit 0 at this head.
.changeset/theme-not-a-theme.md— clear.docs/specs/components/theme/Theme.spec.md— clear: the two new rows are owner-approved for this head and match the code; the Public concepts header and Mode row only re-align to the wider column.packages/core/src/theme/Theme.doc.mjs— clear: the usage description changes only its quote style.packages/core/src/theme/Theme.test.tsx— clear.packages/core/src/theme/Theme.tsx— non-blocking: the Effect note at line 436 names no system.packages/core/src/theme/useTheme.test.tsx— clear.packages/core/src/theme/useTheme.ts— non-blocking: the file header at lines 19-22 still says the hook reads<html>whenever no theme context is reachable.
a0d1f22 to
f32a869
Compare
|
/approve-spec f32a869 |
There was a problem hiding this comment.
Approved pending CI: the CI run on this head was cancelled because CI was full, so its jobs need a re-run before merge.
A Theme given a value that is not a defined theme now keeps the page running: it applies no theme of its own, keeps the theme around it or Core's default tokens at the root, still applies its mode, and warns once in development. The new invalid-value row in the Theme record has an engineering owner's approval for this head, and the new tests fail on the base and pass here.
Two optional comment touch-ups remain: the warning Effect's note in Theme.tsx could name the development console it syncs, and the useTheme.ts file header still says every consumer without a theme context watches <html>.
Claims and files checked
Review mode: full; reason: rebase
Claims:
- Release note:
Themeno longer stops the page for a mode string, a plain object orundefined— verified: the new tests throw on the base and pass here (Theme.test.tsx). - Release note: such a Theme applies no theme of its own, keeps the surrounding theme or Core's defaults, and still takes its
mode— verified:Theme.tsx:437-438,:481-488, and the nested and forced-mode tests. - Release note: the server and the browser render the same markup — verified: six render-then-hydrate tests with identical markup and no hydration error.
- Release note: a development warning names the value and points a mode string to
mode— verified:Theme.tsx:382-401and the warning-text test. - Description: strings and plain objects render on the server, then throw in the browser from the CSS compiler — verified on the base in jsdom and in a Chromium story.
- Description:
nullandundefinedalready throw during the server render — verified: the base readstheme.namein render. - Description: nothing is registered, compiled or named for a non-theme value, and the mode still applies — verified:
Theme.tsx:437-463. - Description: with no theme the theme context is null, the mode reaches nested Themes and
useTheme(), and asystemTheme under a forced one follows the reader — verified:Theme.tsx:481-511,useTheme.ts:515-528and tests. - Description: at a page root with no theme,
<html>names no theme and readers create no document observer — verified:Theme.tsx:338-342,useTheme.ts:460-462,:523-526and the observer-count test. - Description: one warning per kind of value, with
nulland objects separate — verified:Theme.tsx:396and its test. - Description: the
themeprop description says a color mode goes inmode— verified:Theme.doc.mjs:72. - Description: all 17 new Theme tests fail on the base, plus one observer test — verified: 18 fail on the base and pass here.
- Description: the theme tests, type check and knowledge check pass — verified: 31 files and 1,840 tests at this head (more than the description's count, from the rebase), a clean type check and a passing knowledge check.
- Description: two generated pages run without error in a browser at three widths, light and dark — not repeatable here, since the pages are not in the repository; a Storybook story with the same values renders here and errors on the base.
- Description: agent-written pages often pass a mode as
theme— context, not checkable. - Description: the record rows describe current behavior in the present tense and the verification row names the test — verified:
Theme.spec.md:81,:138.
Files:
.changeset/theme-not-a-theme.md— clear.docs/specs/components/theme/Theme.spec.md— clear: owner-approved at this head and consistent with the record's other rows.packages/core/src/theme/Theme.doc.mjs— clear: the prop note matches the code; the other edit only changes quote style.packages/core/src/theme/Theme.test.tsx— clear.packages/core/src/theme/Theme.tsx— non-blocking note: the Effect note at line 439.packages/core/src/theme/useTheme.test.tsx— clear.packages/core/src/theme/useTheme.ts— non-blocking note: the file header at lines 19-22.
…unning A Theme given a mode string such as "light", a plain object or undefined compiled CSS from it in the browser and threw, so the whole page went dead after the server had rendered it. Such a Theme now applies no theme of its own: its subtree keeps the theme around it, or Core's default tokens at the root, and the server and the browser render the same markup. A development warning names the value and points a mode string to the mode prop.
…Themes and readers below it With no defined theme around it, a Theme given a non-theme value provided no context, so a system Theme below a forced one stayed on the forced scheme, and useTheme below it read the root's mode. Every Theme now provides its mode through its own internal context, which Theme and useTheme read when no theme context applies. Null and plain objects warn separately.
…rs watch nothing Below a page-root Theme that applies no theme, <html> names no theme, yet useTheme, useThemeName and useThemeDefinition still watched its theme attribute, also under a forced mode. The mode context now says when no theme applies up to the page's root Theme, and those readers skip the document observer then; a detached root still watches it. The warning for a value that is not a theme runs in an effect, not during render.
f32a869 to
4243d2f
Compare
|
/approve-spec 4243d2f |
There was a problem hiding this comment.
Approved pending CI: the CI run on this head was cancelled before its last test-node shards finished, and one interaction shard stopped at its 15-minute limit with no failed test, so those jobs need a re-run before merge.
A Theme given a value that is not a defined theme now keeps the page running: it applies no theme of its own, keeps the theme around it or Core's default tokens at the root, still applies its mode, and warns once in development. The new invalid-value row in the Theme record has an engineering owner's approval for this head, and the 18 new tests fail on the base and pass here.
- Optional: the note on the new warning Effect in
Theme.tsxcould name the system it syncs, for example "Synchronizes the development console."
Claims and files checked
Review mode: full; reason: rebase
Claims (changeset and description):
- A non-theme
themevalue no longer stops the page: verified (render tests for six values fail on the base and pass here; a Storybook story errors on the base and renders here). - Such a Theme keeps the surrounding theme, or Core's default tokens at the root, and still applies its
mode: verified (Theme.tsx:434-435,:495,:507; nested and root tests). - Server and browser render the same markup: verified (six server-render-then-hydrate tests).
- A development warning names the value, and
modefor a mode string: verified (Theme.tsx:379-397; warning-text test); for an object it names the kind of value. - On the base, strings and objects throw in the browser while compiling CSS, and
nullorundefinedthrow on the server: verified (base Storybook error; the base readstheme.namewhile rendering). modealready treats an out-of-contract value assystem: verified (Theme record, Mode row).- The value is checked with the existing
isDefinedTheme, and nothing is registered or compiled: verified (Theme.tsx:434,:443-447; the compiler spy is not called). - It writes no theme name: verified at the root (no name on the wrapper or the document root); a nested one repeats the surrounding theme's name, as "keeps the parent Theme's theme" describes (
Theme.tsx:495). - With no theme, the theme context is null and the mode travels on an internal mode context that nested Themes and
useTheme()read: verified (Theme.tsx:478-485,:505-511;useTheme.ts:513-528). useTheme()reportsdefaultand this Theme's mode, and asystemTheme below a forcing one follows the reader: verified (Theme.test.tsx:937).- Under a page-root Theme with no theme, readers create no document observer: verified (
useTheme.test.tsx:329). - One warning per kind of value, with
nulland objects warned separately: verified (Theme.tsx:393;Theme.test.tsx:967); strings warn once per distinct string. - The
themeprop description points a color mode tomode: verified (Theme.doc.mjs:72). - The 17 new Theme tests fail on the base: verified (they and the new
useThemetest fail on the base and pass here). - All theme tests, the typecheck and the knowledge check pass: verified (35 files and 1,870 tests at this head; the description's 31 files and 1,834 tests predate the rebase).
- No new public API: verified (the built-surface comparison lists no rows).
- Agent-written pages often put a mode in
theme, and the rendered pages pass at three widths: context the author reports, not reproduced here. - No private context in public text: verified.
Files:
.changeset/theme-not-a-theme.md: cleardocs/specs/components/theme/Theme.spec.md: clearpackages/core/src/theme/Theme.doc.mjs: clear (the usage text is only re-quoted)packages/core/src/theme/Theme.test.tsx: clearpackages/core/src/theme/Theme.tsx: one optional Effect-note suggestionpackages/core/src/theme/useTheme.test.tsx: clearpackages/core/src/theme/useTheme.ts: clear
- #12635 fix(cli): export loads and gives back a page whose modules import TypeScript files by .js names Author: @josephfarina - #12727 fix(cli): export loads a served package's subpath exported only to imports Author: @josephfarina - #12224 fix(cli): a {@link} in a template description resolves as astryx docs resolves it Author: @josephfarina - #12278 fix(core): a Theme given a value that is not a theme keeps the page running Author: @josephfarina - #12751 feat(Layout): LayoutContent names its container, so a theme styles a dialog's body apart from its header and footer Author: @josephfarina - #12168 fix(templates): header, footer and toolbar rows wrap for longer translated labels Author: @josephfarina - #12399 [experimental] export: the dropped-text warning checks Core's docs, and text not drawn yet inside Core components that take children no longer warns Author: @josephfarina - #12541 [docs] Core: list the props ComplexSelector, Selector, Toast and ContextMenuItem take Author: @josephfarina - #12676 docs(cli): a short form keeps its own 640 column inside a wide template frame Author: @josephfarina - #12458 fix(core): Field labels use the primary text colour Author: @josephfarina - #12373 [experimental] export: a link to a place in the page stays in the file in a srcdoc viewer frame Author: @josephfarina
|
Landed in #12827. |
Record change (component:Theme): adds the invalid-value rule for
theme— a value that is not a defined theme applies no theme of its own (the theme around it, or Core's default tokens at the root), and itsmodestill applies — plus one verification row naming the regression tests. Proof: the regression tests below fail on the base and pass on this head; generated pages that passed a mode string asthemenow run their script with no error at phone and desktop widths, light and dark.User impact
A page that passes
Themesomething other than a defined theme stops. A string such astheme="light"ortheme="default", or a plain object such astheme={{}}, renders on the server and then throws in the browser, where the Theme compiles CSS from it (Cannot convert undefined or null to object), so no control on the page works.null, or an import that resolves toundefined, already throws during the server render. Agent-written pages make this mistake often: they put a color mode intheme.Problem and solution fit
Themepasses whateverthemeholds to the runtime CSS compiler in an insertion effect. That effect runs only in the browser, so for a string or an object the server render succeeds and the browser render throws. Fornullorundefined, reading the theme's name throws on the server too.modealready treats a value outside its contract assystem.themehad no such rule, so one wrong prop broke a page that was otherwise correct.The fix gives
themethe same kind of rule: a value that is not a defined theme applies no theme of its own.Expected behavior and authority
component:Theme(current) definesthemeas a defined theme andmode's invalid-value behavior. This PR adds the matching invalid-value behavior forthemeto that record's public concepts, and a verification row for it. The rule followsmode's precedent: the value is treated as the default (Core's default tokens, or the theme around it), and a development warning names the problem.Smallest restoration
Themechecks the value with the existingisDefinedTheme. For any other value it registers nothing, compiles nothing, and writes no theme name. The subtree keeps the parent Theme's theme, or no theme at the root.modestill applies.null, as with no Theme above. Every Theme also provides its mode through an internal mode context, which nested Themes anduseTheme()read. SouseTheme()reportsdefaultand this Theme's mode, and asystemTheme below one that forces a mode follows the reader's preference (FR2, FR3). When no theme applies up to the page's root Theme,<html>names no theme, so theme readers below it create no document observer (architecture:theme-applicationINV6).nulland plain objects warn separately). For a mode string it names themodeprop.themeprop description says a color mode goes inmode.Evidence
<Theme theme="light">,"default"and{}each throw from the CSS compiler. In a rendered interactive page from the corpus (an animated feed usingtheme={{}}, and a form usingtheme="default"), the browser logs the same TypeError and the page's script never takes over.ThemeanduseThemetests and all theme tests pass. A valid theme still registers, injects and names itself.Theme.test.tsx"a theme value that is not a defined theme" covers"light","default","system",{},nullandundefined, at the root and nested, server render then hydration with identical markup and no hydration error, the warning text, asystemTheme and a no-theme Theme nested under a no-theme Theme that forces a mode, separate warnings fornulland an object, and a value that becomes a theme without remounting the subtree. All 17 new tests fail on the base.useTheme.test.tsxadds an observer-count test: under a page-root Theme that applies no theme and forces a mode, a consumer creates no document observer.Scope
Components: Theme
Testing
pnpm exec vitest run packages/core/src/theme(31 files, 1834 tests)pnpm exec tsc -p packages/core/tsconfig.json --noEmitpnpm check:knowledgeWriting rubric results
R1 narration: none; the new public-concepts row and verification row describe current behavior in the present tense.
R2 research: none in the record.
R3 evidence: the verification row names the test, not a pull request.
R4 rejected alternatives: none recorded.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.