Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./api · Types · type ComponentListLeafResponse |
type ComponentListLeafResponse |
import type {ComponentListLeafResponse} from '@astryxdesign/cli/api' |
| + | cli |
./api · Types · type ComponentTheme |
type ComponentTheme |
import type {ComponentTheme} from '@astryxdesign/cli/api' |
| + | cli |
./api · Types · type ComponentThemeField |
type ComponentThemeField |
import type {ComponentThemeField} from '@astryxdesign/cli/api' |
| + | cli |
./json · Also exported from an earlier entry point · ComponentListLeafResponse |
ComponentListLeafResponse (./api) |
import {ComponentListLeafResponse} from '@astryxdesign/cli/json' |
| + | cli |
./json · Also exported from an earlier entry point · ComponentTheme |
ComponentTheme (./api) |
import {ComponentTheme} from '@astryxdesign/cli/json' |
| + | cli |
./json · Also exported from an earlier entry point · ComponentThemeField |
ComponentThemeField (./api) |
import {ComponentThemeField} from '@astryxdesign/cli/json' |
| ~ | cli |
./api · Types · type ComponentDetailResponse |
data: ComponentDoc & ComponentOwnership & ComponentDetailScope → data: ComponentDoc & ComponentOwnership & ComponentDetailScope & ComponentThemeField |
import type {ComponentDetailResponse} from '@astryxdesign/cli/api'; const x: ComponentDetailResponse = {data: …} |
| ~ | cli |
./api · Types · type ComponentListResponse |
data: ComponentListData → data: ComponentListData & ComponentThemeField |
import type {ComponentListResponse} from '@astryxdesign/cli/api'; const x: ComponentListResponse = {data: …} |
| + | theme-butter |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-butter/built' |
| + | theme-chocolate |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-chocolate/built' |
| + | theme-gothic |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-gothic/built' |
| + | theme-matcha |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-matcha/built' |
| + | theme-neutral |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-neutral/built' |
| + | theme-stone |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-stone/built' |
| + | theme-y2k |
./built · Values · const themeVariants |
const themeVariants: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>> |
import {themeVariants} from '@astryxdesign/theme-y2k/built' |
Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Current run: CI concluded failure; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
cixzhang
left a comment
There was a problem hiding this comment.
Builders using current custom Heading types need those values to remain discoverable. This head conflicts with main, and its test still expects heading.type:hero to be excluded even though Heading is now intentionally extensible. Please rebase, preserve main’s shared value classification across root/onDark/onLight, derive declarations and runtime metadata from that same set, and update the stale expectation.
[Reviewed by Robohands]
f329eb3 to
7f76856
Compare
There was a problem hiding this comment.
Thanks for rebasing onto the shared classification and keeping custom Heading types discoverable — the single collector keeping declarations and runtime data aligned is the right shape, and the focused coverage is strong.
Two changes are needed before this can be approved:
- Carry the CLI metadata outside the built theme object. The built module's export is declared as
DefinedTheme, and the current theme-authoring contract requires build/CLI metadata that has no normalized-theme effect to stay outsideDefinedTheme. Emitting the same data as a separate export or sidecar thatresolveThemereads would preserve the fix without that contract break. - Preserve which prop each custom value belongs to. The runtime map currently flattens values by component, so for a component with two extensible props (for example Banner's
containerandstatus) the full and brief output lists the starred values beside both prop names without saying which prop accepts which value. Keeping the prop axis through the metadata and rendering each value under its exact prop — with a two-axis regression — would make the documentation trustworthy.
Separately, the resolver's new automatic loading of a package's /built export when a package root is configured is separable and has no governing specification yet; please split it into its own change so it can be settled on its own, rather than expanding this restoration.
[Automated review]
7f76856 to
8916ca6
Compare
|
Thanks for the review. I rebased onto current
The PR description is updated with the new output and test results. |
There was a problem hiding this comment.
Thanks for reworking this — the metadata now sits beside the built theme instead of inside it, and each custom value is shown under the prop that accepts it, so the two-axis output is trustworthy.
Built themes with custom values now expose them to astryx component in both full and brief output, including custom Heading types, while themes without custom values and older artifacts keep their previous output. The focused builder, resolver, and formatter coverage passes, including the Banner two-prop regression.
Automatic loading of a package root's /built companion stays split out for its own decision, as discussed; pointing the theme config at the built module itself works with this change.
[Automated review]
8916ca6 to
f0fda84
Compare
|
Rebased onto current Validation: all 43 builder/formatter/resolver regressions, CLI strict typecheck (after regenerating API declarations), strict lint/repository checks, and the full package build pass. The Banner two-axis and Heading custom-type regressions pass on this rebased head. @cixzhang Please re-review the updated head and the previously addressed change request. The automated reviewer already approved those changes before this rebase. The formal review-request API rejects my account's permissions in this repository, so this comment is the re-review request; existing reviewer assignments are retained. The separate repository-wide run during this update still has macOS tooling compatibility failures and is not reported as green. |
|
/approve-spec 5067578 |
There was a problem hiding this comment.
Changes requested: three fixes, plus the earlier change request.
The change does what #5059 asks: one collector feeds both the .variants.d.ts augmentations and the themeVariants export, astryx component stars each theme value under the prop that accepts it, and an engineering owner approved INV18 for this head.
Needs changes
- Miss: the
prop:value*entries and the brieftheme:field appear only in text output whileastryx component --jsoncarries no theme values, whicharchitecture:cli-surfaceINV4 and INV5 rule out and the INV18 approval does not amend, so either carry the values in the JSON result or add an owner-approved INV4/INV5 exception. - The description still says themes without custom values get no
themeVariantsand build byte-identically (Smallest restoration, Regression coverage, Maintainer update) and ticks "no new public API", butbuild.mjs:4248and:4259-4261export and declare it on every single-theme module, so those passages need rewriting to match the changeset. - The INV18 record change needs a
## Writing rubric resultssection in the description, whicharchitecture:knowledge-contractsasks of any pull request that changes a record.
Also needed
- The earlier change request (review 5153033104) still needs its reviewer's approving re-review or dismissal, and the
test-buildjob needs a re-run: it was cancelled while checking out the merge commit and never ran against this change.
Optional: INV18's "the values the theme adds" leaves out the inherited values the build includes and has no Verification row; a [feat] changeset line would announce the new export as a capability (spec:AST-017 FR7); and the theme-authoring guide still lists the built .js as exporting only the theme object.
Claims and files checked
Claims (changeset):
- Built themes export their custom values as
themeVariantsbeside the theme object: verified (build.mjs:3152-3157,:4248, and a build of all seven themes). astryx componentstars them with the theme footnote: verified (component-format.mjs:245,:353-363, and a build-then-componentrun).- Each value prints as its
prop:valuekey, so Banner says which prop takes it: verified (component-format.mjs:177-185; the run printscontainer:glass*, status:critical*). - The export and
.variants.d.tscome from the same classified values across root,onDarkandonLight, Heading types included: verified (build.mjs:2135-2200,:4214-4219, the deduplication test). - Built-in values and props without an augmentation point stay out: verified (
build.mjs:2158, the Buttonsizetest). - Every single-theme module exports and declares
themeVariants, an empty object when none: verified (build.mjs:4248,:4259-4261; five of the seven themes ship{}). - A
--familymodule exports and declares none: verified (build.mjs:4924,:4938,build.family.test.mjs:179-182).
Claims (description):
- One collector using the existing classification feeds both outputs: verified.
- The metadata is a sibling export and the theme export stays a
DefinedTheme: verified (the no-variantsassertions). resolveTheme()readsthemeVariantsfrom the loaded module on both config paths: verified (resolve-theme.mjs:88-112, the resolver tests).- The declaration is an inline type that imports nothing from Core: verified (
build.mjs:3210). - The classifier and adaptation validation are unchanged: verified (only a comment changes).
- The export and declaration appear only when the theme adds custom values, and other themes build byte-identically: false (
build.mjs:4248,:4259-4261). - The
.d.tsdeclaresthemeVariantsonly when values exist: false (the empty-export test). - An icon-only theme writes no
themeVariantsexport: false (the icon-variant test expects{}). - No new public API ships under the bug-fix label: false (INV18; seven
./builtexports). --familyoutput, Core, styles and public props are unchanged: verified (Core has no API change;theme.cssis unchanged).resolveTheme()no longer reads avariantsfield on the theme object: verified (resolver test).- Package-root
/builtloading stays out, and the generated theme record loads the built module: verified (the package-field loader is unchanged; the generated-record resolver test). - The Banner output shown: matches a run of the head CLI.
- The stated test counts: stated for earlier heads; at this head the five touched suites pass (97 tests).
- One defect is restored with no tagalongs, and public text has no internal context: verified.
Files:
.changeset/theme-build-runtime-variants.md: accurate; filed under[fix](optional note).docs/architecture/theme-compilation.md: INV18 approved by an engineering owner for this head; inherited-values wording and no Verification row (optional); rubric results missing.packages/cli/api/theme/build/build.mjs: logic sound; the always-present export is the approved INV18 surface.packages/cli/api/theme/build/build.family.test.mjs: clear.packages/cli/api/theme/build/build.icon-function-entries.test.mjs: clear; the INV15 fixtures pass.packages/cli/clients/cli/commands/build-theme.variants.test.mjs: clear.packages/cli/clients/cli/lib/component-format.mjs: text-only annotation against cli-surface INV4/INV5.packages/cli/clients/cli/lib/component-format.test.mjs: clear.packages/cli/clients/cli/lib/resolve-theme.mjs: clear.packages/cli/clients/cli/lib/resolve-theme.test.mjs: clear.
…t prints The text view marks each theme value with `*` and the brief view prints a `theme:` field, but the JSON result carried no theme values. A detail, list or batch result now carries `data.theme`: the configured theme's name and the custom values it adds by component and prop, or null without a theme. The CommandDoc names the key, and the Banner end-to-end test checks that the JSON values match the text. Co-authored-by: jiunshinn <[email protected]>
There was a problem hiding this comment.
Changes requested: four fixes, all from the commit that adds theme values to astryx --json component.
Built themes now export their custom values as themeVariants, which an engineering owner approved as INV18 for this head. astryx component stars each value under the prop that accepts it, and the JSON result now carries the same values, which closes the earlier text-versus-JSON gap.
Needs changes
data.themeis added by thecomponentcommand aftercomponent()returns (component.mjs:73-85,:307), socomponent()from@astryxdesign/cli/apiand--jsonreturn different results, whichspec:AST-042FR1 rules out and which CI's API↔CLI parity check reports for 254 cases; returndata.themefromcomponent()itself.data.themeis not declared in the component response types that@astryxdesign/cli/jsonexports, so the cast atcomponent.mjs:81fails strict typecheck (TS2352, which also fails thebuildgate) and thecomponent.jsonandcomponent-zh.jsongolden snapshots fail, whilespec:AST-017DEC-4 asks for the type, contract tests and docs of a new response field in the same change.--json componentnow loads the theme on every call (component.mjs:294-305) and prints⚠ theme: …warnings on stderr, including for--props,--source,--showcaseand--blocks, againstarchitecture:cli-surfaceINV12, and 9 tests inresolve-theme.test.mjsnow fail: 8 on that stderr and 1 that still expects exit 0 when a recorded theme throws, where INV8 makes exit 1 correct.- The description's Scope says
themeVariantsis the one new public export, butdata.themeinastryx --json componentis new public schema too, so name it in Scope and in the changeset.
Also needed
- The earlier change request (review 5153033104) still needs its reviewer's approving re-review or dismissal.
Optional: resolve-theme.mjs:125 still says JSON output never needs the theme; INV18's "the values the theme adds" leaves out inherited values, and INV18 has no Verification row; [feat] fits the changeset's two new capabilities (spec:AST-017 FR7); the theme-authoring guide still says the built .js exports only the theme object.
Claims and files checked
Claims (changeset):
- Built themes export their custom values as
themeVariantsbeside the theme object: verified (build.mjs:3152-3157,:4248, and a build of all seven themes). astryx componentstars them with a theme footnote: verified (component-format.mjs:245,:358-362, and a head CLI run).- Each value prints as its
prop:valuekey, so Banner says which prop takes it: verified (component-format.mjs:177-185; the run printscontainer:glass*, status:critical*). - The export and
.variants.d.tscome from the same classified values across root,onDarkandonLight, Heading types included: verified (build.mjs:2135-2200,:4214-4219, the deduplication test). - Built-in values and props without an augmentation point stay out: verified (the Button
sizetest). - Every single-theme module exports and declares
themeVariants, an empty object when the theme adds none, so a named import resolves: verified (build.mjs:4248,:4260, the static-import test). - A
--familymodule exports and declares none: verified (build.family.test.mjs:179-182).
Claims (description):
- Built JavaScript carried no metadata, so the annotation never appeared before: verified (base theme builds have no such export).
- One collector using the existing classification feeds both outputs: verified.
- The metadata is a sibling export and the theme export stays a
DefinedTheme: verified (the no-variantsassertions). resolveTheme()readsthemeVariantsfrom the loaded module on both config paths: verified (resolve-theme.mjs:96-112, the resolver tests).- The theme-authoring contract keeps such metadata outside
DefinedThemefor a named reader: verified. - The declaration is an inline type that imports nothing from Core: verified (
build.mjs:3209-3212). - Custom Heading types take part in the augmentation: verified (the deduplication test).
- The classifier and adaptation validation are unchanged: verified (only a comment changes).
- Every standalone module exports
themeVariants, recorded in INV18 and owner-approved: verified (the spec-owner check succeeds for this head). --familyoutput, Core, styles and public props are unchanged: verified (Core has no API change).resolveTheme()no longer reads avariantsfield on the theme object: verified (resolver test).- Package-root
/builtloading stays out, and the generated theme record loads the built module: verified. - The Banner and Badge output shown: matches a head CLI run and the passing end-to-end test.
- The listed regression coverage exists: verified; those tests pass.
- No new public API beyond
themeVariantshides under the bug-fix label: false (data.themeinastryx --json component). - Writing rubric results for INV18: verified against the record.
- The stated test counts: stated for earlier heads; at this head 9
resolve-theme.test.mjstests fail, and CItypecheck,smoke-testandtest-node (1/5)fail. - The maintainer update's "plus
themeVariantswhen the theme has custom values": stale, corrected by its own "Since that update" line. - The merge with
mainkeeps main's work, and every resolver warning goes throughwarnTheme: verified.
Files:
.changeset/theme-build-runtime-variants.md: accurate forthemeVariants; omitsdata.theme; filed under[fix](optional note).docs/architecture/theme-compilation.md: INV18 owner-approved for this head; inherited-values wording and no Verification row (optional).packages/cli/api/theme/build/build.mjs: clear.packages/cli/api/theme/build/build.family.test.mjs: clear.packages/cli/api/theme/build/build.icon-function-entries.test.mjs: clear.packages/cli/clients/cli/commands/build-theme.variants.test.mjs: clear; passes, including the new JSON assertion.packages/cli/clients/cli/commands/component.doc.mjs: describesdata.theme, which the response types andcomponent()do not carry.packages/cli/clients/cli/commands/component.mjs: handler-onlydata.theme, a cast that fails typecheck, and theme warnings under--json.packages/cli/clients/cli/lib/component-format.mjs: clear.packages/cli/clients/cli/lib/component-format.test.mjs: clear.packages/cli/clients/cli/lib/resolve-theme.mjs: clear; one stale comment (line 125).packages/cli/clients/cli/lib/resolve-theme.test.mjs: its new tests pass; 9 existing tests in the file fail because ofcomponent.mjs.
|
/approve-spec acbae9e |
|
/approve-spec 653eddd |
|
Decision: D-20261113-103 Records the owner's pick that every built theme module publicly exports themeVariants, at 653eddd. The CLI's JSON output carries the same theme values its text prints, as the CLI records require. It waives nothing. |
There was a problem hiding this comment.
Changes requested: four fixes, all in how astryx --json component gains theme values.
Built themes now export their custom values as themeVariants, which an engineering owner approved as INV18 for this head, and astryx component stars each value under the prop that accepts it.
Needs changes
data.themeis added by thecomponentcommand aftercomponent()returns (component.mjs:73-85,:307), socomponent()from@astryxdesign/cli/apiand--jsonreturn different results, whichspec:AST-042FR1 rules out and which CI's API↔CLI parity check reports for 254 cases; returndata.themefromcomponent()itself.data.themeis not declared in the component response types that@astryxdesign/cli/jsonexports, so the cast atcomponent.mjs:81fails strict typecheck (TS2352) and thecomponent.jsonandcomponent-zh.jsongolden snapshots fail, whilespec:AST-017DEC-4 asks for the canonical type and contract tests of a new response field in the same change.--json componentnow loads the theme on every call (component.mjs:294-305) and prints⚠ theme: …warnings on stderr, including for--props,--source,--showcaseand--blocks, againstarchitecture:cli-surfaceINV12, so 8 tests inresolve-theme.test.mjsfail, and a ninth still expects exit 0 when a recorded theme throws, where INV8 now makes exit 1 correct.- The description's Scope says
themeVariantsis the one new public export and that no other public API hides under the fix label, butdata.themeinastryx --json componentis new public schema too, so name it in Scope and in the changeset.
Also needed
- The earlier change request (review 5153033104) still needs its reviewer's approving re-review or dismissal; this head meets the four points it raised.
Optional: resolve-theme.mjs:125 still says JSON output never needs the theme; INV18's "the values the theme adds" leaves out inherited values, and INV18 has no Verification row; [feat] fits the changeset's new capabilities (spec:AST-017 FR7); the theme-authoring guide still lists only the theme and icon exports for the built module.
Claims and files checked
Claims (changeset):
- Built themes export their custom values as
themeVariantsbeside the theme object: verified (build.mjs:3306-3311,:4491, and a build of all seven themes). astryx componentstars them with a theme footnote: verified (component-format.mjs:263,:374-378, and the end-to-end Badge, Heading and Banner tests).- Each value prints as its
prop:valuekey, so Banner says which prop takes it: verified (component-format.mjs:195-203; the two-prop test). - The export and
.variants.d.tscome from the same classified values across root,onDarkandonLight, Heading types included: verified (build.mjs:2290-2320,:4457-4462, the deduplication test). - Built-in values and props without an augmentation point stay out: verified (the Button
sizetest). - Every single-theme module exports and declares
themeVariants, an empty object when the theme adds none, so a named import resolves: verified (build.mjs:4491,:4502-4504, the static-import test). - A
--familymodule exports and declares none: verified (build.family.test.mjs:179-182).
Claims (description):
- Built JavaScript carried no metadata, so the annotation never appeared before: verified (the base resolver read a theme field that no build emitted).
- One collector using the existing classification feeds both outputs: verified.
- The metadata is a sibling export and the theme export stays a
DefinedTheme: verified (the no-variantsassertions). resolveTheme()readsthemeVariantsfrom the loaded module on both config paths: verified (resolve-theme.mjs:96-115, the resolver tests).- The theme-authoring contract keeps such metadata outside
DefinedThemefor a named reader: verified. - The declaration is an inline type that imports nothing from Core: verified (
build.mjs:3364-3366). - Custom Heading types take part in the augmentation: verified (the deduplication test).
- The classifier and adaptation validation are unchanged: verified (only a comment changes).
- Every standalone module exports
themeVariants, recorded in INV18 and owner-approved: verified (owner approval for this head). --familyoutput, Core, styles and public props are unchanged: verified (Core has no API change).resolveTheme()no longer reads avariantsfield on the theme object: verified (resolver test).- Package-root
/builtloading stays out, and the generated theme record loads the built module: verified. - The Banner and Badge output shown: matches the passing end-to-end tests.
- The listed regression coverage exists: verified; those tests pass.
- No new public API beyond
themeVariantshides under the bug-fix label: false (data.themeinastryx --json component). - Writing rubric results for INV18: verified against the record.
- The stated test results: stated for earlier heads; at this head 9
resolve-theme.test.mjstests and 2 golden snapshots fail, and strict typecheck fails. - The maintainer update (the merge keeps main's work, icon-only themes write their augmentation and an empty export, family modules emit none, the icon test skips the export): verified; those tests pass.
- The four outcomes of the earlier change request are met: verified.
Files:
.changeset/theme-build-runtime-variants.md: accurate forthemeVariants; omitsdata.theme; filed under[fix](optional note).docs/architecture/theme-compilation.md: INV18 owner-approved for this head; inherited-values wording and no Verification row (optional).packages/cli/api/theme/build/build.mjs: clear.packages/cli/api/theme/build/build.family.test.mjs: clear.packages/cli/api/theme/build/build.icon-function-entries.test.mjs: clear; passes.packages/cli/clients/cli/commands/build-theme.variants.test.mjs: clear; passes, including the JSON assertion.packages/cli/clients/cli/commands/component.doc.mjs: documentsdata.theme; clear.packages/cli/clients/cli/commands/component.mjs: the first three findings.packages/cli/clients/cli/lib/component-format.mjs: clear.packages/cli/clients/cli/lib/component-format.test.mjs: clear; passes.packages/cli/clients/cli/lib/resolve-theme.mjs: clear apart from the stale comment at:125(optional).packages/cli/clients/cli/lib/resolve-theme.test.mjs: new tests pass; its existing broken-theme block fails at this head (third finding).
|
(Posted by Cindy's agent.) Hi @jiunshinn, thanks for sticking with this one. The design is settled: built themes export |
Conflicts kept both sides: - theme-compilation.md: main added INV18-INV20, so the built-theme export record becomes INV21. - build.mjs: the built module keeps main's always-named cssFileName and the local compiled icon info, plus runtimeVariants; the .d.ts keeps themeVariants and main's colorModes declaration. - component.mjs: main's batch receipt and failAfterOutput kept; the theme still loads before the JSON branch.
The command added data.theme after component() returned, so the API and
`--json` differed (spec:AST-042 FR1), the response types did not declare it,
and `--json` loaded the theme on every read and printed theme warnings on
stderr (cli-surface INV12).
- The theme resolver moves from clients/cli/lib/resolve-theme.mjs to the
component subject's adapter helper api/component/_theme.mjs. It prints
nothing: it reports each problem, and the INV22 seam check follows it.
- component() adds data.theme to a detail or list result, and a batch carries
it on each found detail row: {name, values, problem}, or null without a
theme. Props, source, showcase, and blocks do not load the theme.
- A configured theme that does not resolve is data.theme.problem; the text
prints it as the `⚠ theme:` warning, and JSON prints nothing on stderr.
- A theme module that throws for another reason fails the read with
ERR_THEME_LOAD in JSON too, as in text (cli-surface INV8).
- ComponentTheme and ComponentThemeField are declared in component.type.mjs,
which @astryxdesign/cli/json exports; the golden snapshots gain
"theme": null.
- INV21 names the inherited values the build includes and gains its
Verification row. The changeset names data.theme as a [feat].
- Two build-then-component tests ask for --detail full, since main's
component read now prints the compact answer by default.
|
@cixzhang Thanks. Yes, I am still on this one. I pushed two commits on top of
Validation at One question before I update the description. The description's land path says this PR is held until #11510 merges and then drops its CLI half. #11510 makes the same change, and its design differs from
Which path do you prefer?
I recommend (a), because only the per-prop shape mirrors the text this PR prints. Either way works for me. After you choose, I will rewrite the description (Smallest restoration, Regression coverage, Scope, Writing rubric results for INV21, and Testing). |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and three fixes are needed either way.
This head adds architecture:theme-compilation INV21 (the themeVariants export), reworded since the earlier approval, and returns data.theme from component() and astryx --json component in a shape that differs from the open #11510. Any engineering owner, the author included if they are one, records the decision on both for this exact head by commenting /approve-spec <full head SHA>, or chooses #11510's CLI half instead. cixzhang's earlier change request also stays open until she re-reviews or dismisses it.
- A batch beside a theme module that throws now becomes per-row
ERR_THEME_LOADerrors instead of stopping before its receipt, so both "component: a batch beside a recorded theme that does not load" cases inpackages/cli/clients/cli/commands/failure-codes.test.mjsfail (CItest-node (2/9)). component()can now throwERR_THEME_LOAD, but neither itsthrowslist inapi/component/component.doc.mjsnor the exit-code text inclients/cli/commands/component.doc.mjsnames it.- The description's Scope, Owner and land path, Writing rubric results and Testing sections still describe INV18, an approval, a CLI half that drops and an older head, and Scope omits
data.theme.
The fixes from the previous review hold: the API and --json now agree, the response types and golden snapshots are updated, and --json prints no theme warnings.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim, changeset: built themes export
themeVariantsbeside the theme object, one value set across root,onDarkandonLightincluding custom Heading types: verified (build-theme.variants.test.mjs). - Claim, changeset: each value shows as
prop:value, and built-in or non-augmentable props stay excluded: verified (Banner and Buttonsizetests). - Claim, changeset: every single-theme module exports and declares
themeVariants,{}without custom values, and a--familymodule none: verified (variants and family tests; seven themes built). - Claim, changeset:
--jsonandcomponent()carrydata.themewithname,valuesandproblem,nullwithout a theme, and props, source, showcase and blocks do not load the theme: verified (_theme.test.mjs, Banner test, parity script 416 of 416). - Claim, changeset: a theme module that throws fails the read with
ERR_THEME_LOADin JSON too: true for detail and list, false for a batch (finding above). - Claim, description: custom values were never visible for a built theme, and the theme export stays a
DefinedTheme: verified (base resolver;'variants' intest). - Claim, description: the existing classifier is reused, and Core behavior, styles and public props are unchanged: verified (
classifyComponentValue; every theme'stheme.cssidentical). - Claim, description: the resolver no longer reads a
variantsfield, and reads the export on both the generated-record and package-field paths: verified (_theme.test.mjs). - Claim, description: the one new public export is
themeVariants, recorded as INV18 and owner-approved: false (INV21, no approval at this head,data.themealso new). - Claim, description: the CLI half drops once #11510 merges: false at this head.
- Claim, description: the testing results and the rubric's record number: stale (older head, INV18).
- Claim, description: the earlier change request's four points are met: verified (merge of current
main, one collector, Headingheroexpectation). - Files:
.changeset/theme-build-runtime-variants.md(batch claim false),docs/architecture/theme-compilation.md(needs owner approval),packages/cli/api/component/_adapter.mjs(ERR_THEME_LOADundocumented),packages/cli/api/component/component.mjs(batch regression),packages/cli/api/component/component.doc.mjs(throwsincomplete),packages/cli/clients/cli/commands/component.doc.mjs(exit codes incomplete),packages/cli/api/component/component.type.mjs(non-blocking note). - Files, clear:
_theme.mjs,_theme.test.mjs,list/list.mjs,build.mjs,build.family.test.mjs,build.icon-function-entries.test.mjs,build-theme.variants.test.mjs,clients/cli/commands/component.mjs,component-format.mjs,component-format.test.mjs,doc-loads.test.mjs, both golden snapshots,scripts/check-cli-structure.mjs, both duration tables.
| return response; | ||
| return { | ||
| ...response, | ||
| data: {...response.data, theme: await componentTheme(cwd)}, |
There was a problem hiding this comment.
A batch reaches this once per found row, because componentBatch calls component() for each selector. When the theme module throws, each found row becomes an ERR_THEME_LOAD error row (batchFailure) instead of the read stopping before its receipt, as text did on main. Both cases of "component: a batch beside a recorded theme that does not load" in clients/cli/commands/failure-codes.test.mjs now fail (CI test-node (2/9)). Resolving the theme once per batch and throwing ERR_THEME_LOAD before the receipt keeps main's behavior and the changeset's "fails the read" claim. The JSON case then needs updating, because its receipt now needs the theme.
| throw new AstryxError( | ||
| `Could not load the recorded theme: ${message}`, | ||
| undefined, | ||
| ERROR_CODES.ERR_THEME_LOAD, |
There was a problem hiding this comment.
component() can now throw this. On main only the text handler loaded the theme. But the throws list in api/component/component.doc.mjs and the command's exit-code text in clients/cli/commands/component.doc.mjs do not name ERR_THEME_LOAD. spec:AST-017 DEC-4 asks for complete consumer documentation in the same change. One throws entry ("the configured theme's module throws while loading, for a detail, list or batch read") and a clause in the exit-code-1 text close it.
| /** | ||
| * What the list leaf (`componentList`) returns: the catalog before the | ||
| * `component()` dispatcher adds `data.theme`. | ||
| * @typedef {object} ComponentListLeafResponse |
There was a problem hiding this comment.
Non-blocking: @astryxdesign/cli/json re-exports this file with export type *, so this list-leaf shape, which exists only before component() adds data.theme, becomes public. An @internal tag, or a private typedef next to the leaf, would keep it off the CLI's public surface.
|
(Posted by Cindy's agent.) A correction to my note above, @jiunshinn, sorry: please hold off on the four |
(Posted by Cindy's agent.) Dismissed as stale on the owner's decision: this review is on an outdated head. Please re-review the current head if concerns remain.
Open PRs meta#12378 and meta#12564 claim INV21, so this record takes INV22.
|
@cixzhang Thanks for the correction. The renumber is done in c551100: the One note on the number: #12639 also claims INV22 in the same record. Please tell me if you want a different number for this PR. About the four
I will wait for the decision before I rewrite the description. |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and three fixes are needed either way.
This head proposes architecture:theme-compilation INV22 (the themeVariants export), which no approval names yet, and returns data.theme from component() and astryx --json component in a shape that is still an open owner decision beside #11510. Any engineering owner, the author included if they are one, records the decision for this exact head by commenting /approve-spec <full head SHA> and saying which data.theme shape ships.
- A batch beside a theme module that throws now becomes per-row
ERR_THEME_LOADerrors instead of stopping before its receipt, so both "component: a batch beside a recorded theme that does not load" cases inpackages/cli/clients/cli/commands/failure-codes.test.mjsfail. component()can now throwERR_THEME_LOAD, but neither itsthrowslist inpackages/cli/api/component/component.doc.mjsnor the exit-code text inpackages/cli/clients/cli/commands/component.doc.mjsnames it.- The description's Scope, Smallest restoration, Owner and land path, Writing rubric results and Testing sections still describe INV18, an approval, a CLI half that drops and an older head, and Scope omits
data.theme.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim, changeset: built themes export
themeVariantsbeside the theme object, from one value set across root,onDarkandonLight, including custom Heading types: verified (build-theme.variants.test.mjs). - Claim, changeset: each value shows as
prop:value, and built-in or non-augmentable props stay excluded: verified (Banner and Buttonsizetests; a Banner project read with the head CLI). - Claim, changeset: every single-theme module exports and declares
themeVariants,{}without custom values, and a--familymodule none: verified (variants and family tests; all seven themes built). - Claim, changeset:
--jsonandcomponent()carrydata.themewithname,valuesandproblem,nullwithout a theme, and props, source, showcase and blocks reads do not load the theme: verified (_theme.test.mjs, Banner test, API and CLI parity check, 416 of 416). - Claim, changeset: a theme module that throws fails the read with
ERR_THEME_LOADin JSON too: true for detail and list reads, false for a batch (first finding). - Claim, description: custom values never showed for a built theme, and the theme export stays a
DefinedTheme: verified (base CLI read of the same project;'variants' intest). - Claim, description: the existing classifier is reused, and Core behavior, styles and public props are unchanged: verified (
classifyComponentValue; every theme'stheme.cssidentical). - Claim, description: the resolver no longer reads a
variantsfield and reads the export on both the generated-record and package-field paths: verified (_theme.test.mjs). - Claim, description:
--familyoutput is unchanged: verified (build.family.test.mjs). - Claim, description: the one new public export is
themeVariants, recorded as INV18 and owner-approved: false (the record is INV22, no approval names this head, anddata.themeis also new). - Claim, description: the CLI half drops once #11510 merges: false at this head.
- Claim, description: the testing results and the rubric's record number: stale (an older head, INV18).
- Claim, description: the earlier change request's points are met (current
mainmerged, one collector, the Headingheroexpectation): verified (build-theme.variants.test.mjs). - Files with findings:
.changeset/theme-build-runtime-variants.md(batch claim false),docs/architecture/theme-compilation.md(needs owner approval),packages/cli/api/component/component.mjs(batch regression),packages/cli/api/component/_adapter.mjs(ERR_THEME_LOADundocumented),packages/cli/api/component/component.doc.mjs(throwsincomplete),packages/cli/clients/cli/commands/component.doc.mjs(exit codes incomplete),packages/cli/api/component/component.type.mjs(non-blocking note). - Files, clear:
packages/cli/api/component/_theme.mjs,_theme.test.mjs,list/list.mjs,packages/cli/api/theme/build/build.mjs,build.family.test.mjs,build.icon-function-entries.test.mjs,packages/cli/clients/cli/commands/build-theme.variants.test.mjs,packages/cli/clients/cli/commands/component.mjs,packages/cli/clients/cli/lib/component-format.mjs,component-format.test.mjs,packages/cli/foundation/doc-compiler/doc-loads.test.mjs, both golden snapshots,scripts/check-cli-structure.mjs, both duration tables.
Closes #5059
User impact
Builders using custom theme values could not find them through
astryx component. The theme's generated TypeScript declarations accepted those values, but the built JavaScript had no metadata for the CLI's*annotation, so the annotation could never appear.Problem and solution fit
Custom values are collected once, using main's existing classification across root,
onDark, andonLight. Both.variants.d.tsand the runtime metadata come from those entries, so the values the CLI shows always match the public types, including custom Heading types.The metadata is a separate export next to the built theme object, not a field on it:
resolveTheme()readsthemeVariantsfrom the configured module, and the theme export stays aDefinedTheme.astryx componentshows each value as theprop:valuekey the author wrote indefineTheme. A component with two extensible props therefore says which prop accepts each value.Expected behavior and authority
variants, soastryx component's custom-variant*annotation can never fire #5059 describes the existing custom-value annotation promise.DefineThemeInputandDefinedTheme" and needs a named current reader. Here the reader isresolveTheme()→astryx component. The export's declaration is an inline type (Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>) that imports nothing from Core, so it adds no Core/runtime compatibility requirement.Smallest restoration
theme buildmodule exportsthemeVariantsand declares it in its.d.ts: the theme's custom values, or an empty object when it adds none (architecture:theme-compilationINV18, owner-approved as a public export).--familyoutput (AST-034) is unchanged.resolveTheme()no longer reads avariantsfield on the theme object. No build ever emitted one ([Bug] Built themes never carry runtimevariants, soastryx component's custom-variant*annotation can never fire #5059), and reading it would put CLI metadata back into the theme object in the old flattened shape.Split out
Loading a package's
/builtexport automatically when a package root is configured stays out of this PR. Since then, main's generated theme record (#6874) loads the built module itself: a local<slug>.js, a package'sthemes/<slug>export, or a single-theme package's/builtshorthand.resolveTheme()readsthemeVariantsfrom the module that path loads, so a project on the generated record gets the annotation with no extra lookup. On the releasedpackage.json#astryx.themepath, point the field at a built module (a file path or a/builtsubpath such as@astryxdesign/theme-neutral/built).Evidence
Before: every built theme resolved with
variants: null, so no*or footnote appeared (#5059).After, with
package.json→"astryx": {"theme": "./acme.js"}and a theme declaringbanner['container:glass'],banner['status:critical'], andbadge['variant:gray']:Regression coverage:
componentfull and brief) and at the formatter unit level. Each value stays under its prop, andcontainer:critical/status:glassnever appear.variantskey, every single-theme module exports and declaresthemeVariants(an empty object without custom values, imported statically as ESM), and a--familymodule exports and declares none.package.json#astryx.themepath, ignores avariantsfield on the theme object, and returnsnullwithout the export.hero, declaration/runtime agreement, root/dark/light deduplication, surface-only values, built-theme inheritance, closed props, and older artifacts.Scope
@astryxdesign/cli) changes, and its output reaches the built theme packages, such as@astryxdesign/theme-neutral/builtand@astryxdesign/theme-butter/built.themeVariantson every single-theme module, is recorded inarchitecture:theme-compilationINV18 and owner-approved.Writing rubric results
Record changed:
architecture:theme-compilationINV18 (thethemeVariantsexport).Testing
On head
63a40a651f(rebased onto8f6f0008fe):build-theme.variants,component-format,resolve-theme) with--maxWorkers=1: 3 files, 65 tests passed. With default parallelism, the existing 30s full-pipeline resolver test (loads a real built local default with an icon registry) timed out once under load; alone it passes in 6.5s.api/theme/build,commands/build-theme*,commands/component*,component-format): 38 files, 520 tests passed.pnpm -F @astryxdesign/cli typecheck:strict: passed, afterpnpm -F @astryxdesign/cli sync:api-typesrefreshed stale, git-ignoredapi/**/*.d.mts.pnpm check:repo,pnpm check:cli-structure,pnpm check:changesets, Prettier, and ESLint on the changed files: passed.Maintainer update (rebased onto main)
This pull request is carried forward by a maintainer, keeping jiunshinn's commit and authorship.
main. The build now keeps both main's work and this change:collectCustomVariantsfeeds the.variants.d.tsand thethemeVariantsexport, andgenerateVariantDeclarationsalso writes a theme's icon variants intoIconVariantMapin@astryxdesign/core/Icon; the main.d.tsstill declares the theme withbuiltThemeType, plusthemeVariantswhen the theme has custom values. The built module keeps main's component-icon prelude and node view, withthemeVariantsafter the theme object..variants.d.ts(theIconVariantMapaugmentation, referenced from the main.d.ts) and exports an emptythemeVariants, under a new test inbuild-theme.variants.test.mjs.themeBuildFamily) emit nothemeVariantsexport and declare none.themeVariants,{}when the theme adds no custom values (INV18).build.icon-function-entries.test.mjs's node-view check skips that export.vitest(node project) forbuild-theme.variants.test.mjs,component-format.test.mjs,resolve-theme.test.mjsandpackages/cli/api/theme/build: 26 files, 392 tests pass. Strict lint on the changed files: clean.Review outcomes at 1aa643f
One row per point in the earlier change request (at f329eb3), checked at this exact head.
mainmainmerged without a rebase. The one conflict, inresolve-theme.mjs, keepsmain'swarnTheme(one inert warning line) beside this PR'sextractVariants; every warning in the file goes throughwarnTheme.main's shared value classification across root,onDarkandonLightcollectCustomVariantsreads every layer throughgetThemeComponentLayersand keeps a value only whenclassifyComponentValue(the classifier adaptation validation uses) calls it an enrollment. "unions and deduplicates root, onDark, and onLight values in types and runtime metadata" inbuild-theme.variants.test.mjspasses.generateVariantDeclarationsrenders the.variants.d.tsandcollectRuntimeVariantsshapes thethemeVariantsexport, both from the onecollectCustomVariantsresult, so the types and whatastryx componentreports cannot disagree.heading.type:heroexpectation'hero': true;in the declarations andherointhemeVariants(heading: {type: ['shared', 'hero', 'editorial']}), matching Heading's extensibletype.Testing at this head:
vitestforbuild-theme.variants.test.mjs,component-format.test.mjs,resolve-theme.test.mjsandpackages/cli/api/theme: 42 files, 501 tests pass. CI at this head: pending; the drain addsci:runandci:run-a11y.(Posted by Cindy's agent on her behalf.)
Owner and land path