Repository navigation
feat(cli): upgrade codemod keeps a theme's 28px chat corners - #12483
kentonquatman merged 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested. The codemod is the right tool for this default change, and it handles root defineTheme() configs well, but two theme shapes still lose their chat corners on upgrade and one TODO gives the wrong value.
- A theme with
extendsthat also sets its ownradiusis skipped (preserve-chat-radius.mjs:176), but its own scale overrides what it inherits, soextends: neutralTheme, radius: {base: 4, multiplier: 1.5}goes from 42px to 18px; skipextendsonly when there is noradius, and correct the description's line that such a theme inherits its base's chat radius. - A
radiusscale inside anadaptationsrule writes--radius-chatunder that rule, so with a root{base: 4, multiplier: 1}and a rule{multiplier: 2}belowmdthe corners go from 56px to 24px even after the codemod adds the root token; add the page step to that rule'stokens, or leave a TODO. - The TODO for an unreadable
radiusscale tells authors to add 28px "to keep its previous chat corners", but that theme's previous value was base × 7 × multiplier, so give that case its own wording. - The fixtures assert emitted source only; add the downstream proof the release-compatibility spec asks codemods to carry, for example a test that builds each migrated theme with Core's
defineThemeand compares--radius-chatwith its value before the default change, including the two shapes above.
Two smaller points: a top-level spread gets the TODO even when the config sets --radius-chat after it, and a plain-object default-export theme, which astryx theme build accepts, gets neither the token nor a TODO.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Changeset: the upgrade keeps the 28px chat corners of a theme that sets neither the token nor
extends: partly false, not below an adaptation rule's radius scale (second finding). - Changeset:
--radius-chatnow defaults to the container radius: verified in the base branch's token defaults. - Changeset: the token added is 28px or the page step of a literal scale: verified (
preserve-chat-radius.mjs:110-121, scale fixture at 38px). - Changeset: a TODO is left where the theme cannot be read: verified (
:171-193, TODO fixture); its wording is wrong for scales (third finding). - Description: themes with neither token nor
extends, and scale-based themes, change on upgrade: verified in the base branch's token defaults and radius scale. - Description: each Astryx-imported
defineThemethat sets neither is edited: verified with aliased, namespace and shadowed imports. - Description: 28px with no scale, the page step for a literal scale, nothing when the steps round equal: verified (38px and multiplier-0 fixtures).
- Description: the token goes before any spread in
tokens: verified (:199-201, spread fixture). - Description: a theme that extends another inherits its chat radius and is left alone: false when it sets its own
radius(first finding). - Description: a TODO for a top-level spread, non-literal tokens or a non-literal scale: verified (TODO fixture).
- Description: idempotent: verified (second-run fixtures and extra runs).
- Description: 7 test cases: verified, 7 pass.
- Description: the codemod suite passes 1078 tests: verified, 1078 of 1078.
- Description: depends on #12482: verified, the base branch is that pull request's head.
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: passes the changeset check; claims more than the code (second finding).packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: first, second and third findings, plus the two smaller points.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: source-only assertions, no fixture for the first two findings (fourth finding).packages/cli/assets/codemods/transforms/next/index.mjs: clear.
508a194 to
3e2b10b
Compare
There was a problem hiding this comment.
Changes requested. The codemod handles root defineTheme() configs well, but several theme shapes still lose their chat corners on upgrade with no token and no TODO, and one TODO gives the wrong value.
- A theme with
extendsthat also sets its ownradiusis skipped (preserve-chat-radius.mjs:200), soextends: neutralTheme, radius: {base: 4, multiplier: 1.5}goes from 42px to 28px; skipextendsonly when there is noradius, and write the child's page step otherwise. - Adaptation rules are never read (
:123-145), so a ruleradius: {multiplier: 2}belowmdgoes from 56px to 28px, and a theme with--radius-container: 28pxand a rule that sets it to 16px now gets no token and goes from 28px to 16px belowmd; give such rules their own--radius-chat, or skip the equality shortcut and leave a TODO. - An explicit
--radius-containerfollowed by a spread intokensis trusted (:137-143), so{'--radius-container': '28px', ...brand}withbrandat 12px goes from 28px to 12px; treat the container as unknown when a spread follows it. - Miss:
defineTheme(config)with a non-literal config returns silently (:194), the one unreadable shape that gets no TODO, so its corners go from 28px to 12px unreported; add the TODO there. - The TODO for an unreadable
radiusscale tells authors to add 28px (:43-46), but their previous value was base × 7 × multiplier; give that case its own wording. - The fixtures check emitted source only; add the downstream proof the release-compatibility spec asks codemods to carry, for example a test that builds each migrated fixture with Core's
defineThemeand compares--radius-chat, at the root and in each adaptation rule, with its value before the default change.
Two smaller points: a top-level spread still gets the TODO when the config sets --radius-chat after it, and a plain-object default-export theme gets neither the token nor a TODO.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Changeset: the upgrade keeps the 28px chat corners of a theme that sets neither
--radius-chatnorextends: false for adaptation rules, a spread after an explicit container and a non-literal config (second to fourth findings). - Changeset:
--radius-chatnow defaults to the container radius: verified in the base branch's token defaults. - Changeset: the token added is 28px or the page step of a literal radius scale: verified (28px, 42px and 38px when built with Core).
- Changeset: a TODO is left where the theme cannot be read: partly false, with none for a non-literal config and the wrong value for a scale (fourth and fifth findings).
- Description: a theme with neither the token nor
extends, and a theme on a radius scale, change on upgrade: verified (28px to 12px, 42px to 18px). - Description: each Astryx-imported
defineThemethat sets neither is edited: verified for literal configs through the shared import resolver; a non-literal config is skipped (fourth finding). - Description: 28px for a theme with no radius scale: verified.
- Description: the old page step for a literal scale (base × 7 × multiplier): verified (38px fixture).
- Description: nothing when the container radius the theme ends up with already equals that value: false when a spread follows the explicit container or an adaptation rule changes it (second and third findings).
- Description: the token goes before any spread in the tokens: verified (
preserve-chat-radius.mjs:225, spread fixture). - Description: a theme that extends another inherits that theme's chat radius and is left alone: false when it sets its own
radius(first finding). - Description: a TODO for a top-level spread, non-object tokens or a non-numeric scale: verified (TODO fixture); its wording is wrong for scales (fifth finding).
- Description: idempotent: verified (second-run fixtures, and a second run over thirteen theme shapes).
- Description: 8 test cases: verified, 8 pass.
- Description: 1650 tests pass with the theme, native and visual-gate suites: not reproduced as stated; the codemod suite alone passes 1079 of 1079.
- Description: depends on #12482: verified, the base branch is that pull request's branch.
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: passes the changeset check; claims more than the code (second to fourth findings).packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: the first five findings, plus the two smaller points.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: source-only assertions (sixth finding).packages/cli/assets/codemods/transforms/next/index.mjs: clear.
03bd843 to
ccf2962
Compare
3e2b10b to
aebcccf
Compare
There was a problem hiding this comment.
Changes requested: the codemod now keeps the chat corners for every root, adaptation-rule, spread and non-literal case raised earlier, and its Core-built fixtures match the pre-change output, but two cases still need a fix.
- Miss: a theme that extends a base with no
--radius-chatof its own (Y2K, or a base the container shortcut leaves alone) and sets its own--radius-containerstill changes on upgrade with no token or TODO, becausepreserve-chat-radius.mjs:297-300skips every extending theme without its own scale (a Y2K child with an 8px container goes from 0px to 8px). - Default-exported plain objects are edited on their shape alone (
preserve-chat-radius.mjs:352-365), so anyexport default {name, tokens}file gets--radius-chateven with no Astryx import, which the consumer-file contract forbids; leave them unchanged and report them as a manual migration instead.
Please add a downstream fixture for each case, and update the changeset's "keeps the inherited value" once the first one is fixed.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: each Astryx
defineTheme()config gets the chat token, 28px or its scale's page step: verified (fixtures and Core-built output). - Claim: each default-exported theme object is migrated: it is, but on shape alone (second finding).
- Claim: nothing is added when the container the theme ends up with already equals that value, and a trailing spread or a rule that changes the radius makes it unknown: verified.
- Claim: a theme that extends another and has no scale of its own keeps the inherited value: false when its base sets no chat token and it sets its own container (first finding).
- Claim: an extending theme with its own scale gets that scale's page step: verified.
- Claim: each adaptation rule with a scale gets its page step, completed from the theme's scale: verified; an extending theme's partial rule scale gets a TODO.
- Claim: the token goes before any spread, so a spread still wins: verified.
- Claim: unreadable shapes get a TODO, the scale TODO names the page step, and a top-level spread followed by the token needs nothing: verified.
- Claim: the codemod is idempotent: verified.
- Claim: 25 test cases, 13 of them built with Core: verified; their expected values match what the pre-change Core renders, 13 of 13.
- Claim: the codemod suite passes, 1096 tests: verified.
- File
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: one false claim (first finding); the tag and bump pass the changeset check. - File
packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: first and second findings. - File
packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: no fixture for a base without a chat token (first finding); the default-export fixture expects the edit (second finding). - File
packages/cli/assets/codemods/transforms/next/index.mjs: clear.
aebcccf to
7d4a229
Compare
There was a problem hiding this comment.
Changes requested: the codemod now keeps the chat corners for every root, adaptation-rule, spread and non-literal case raised earlier, and its Core-built fixtures match the pre-change output, but two cases still need a fix.
- Miss: a theme that extends a base with no
--radius-chatof its own (Y2K, or a base the container shortcut leaves alone) and sets its own--radius-containerstill changes on upgrade with no token or TODO, becausepreserve-chat-radius.mjs:297-300skips every extending theme without its own scale (a Y2K child with an 8px container goes from 0px to 8px). - Default-exported plain objects are edited on their shape alone (
preserve-chat-radius.mjs:352-365), so anyexport default {name, tokens}file gets--radius-chateven with no Astryx import, which the consumer-file contract forbids; leave them unchanged and report them as a manual migration instead.
Please add a downstream fixture for each case, and update the changeset's "keeps the inherited value" once the first one is fixed.
Claims and files checked
Review mode: carry-forward; reason: none
- Claim: each Astryx
defineTheme()config gets the chat token, 28px or its scale's page step: verified (fixtures and Core-built output). - Claim: each default-exported theme object is migrated: it is, but on shape alone (second finding).
- Claim: nothing is added when the container the theme ends up with already equals that value, and a trailing spread or a rule that changes the radius makes it unknown: verified.
- Claim: a theme that extends another and has no scale of its own keeps the inherited value: false when its base sets no chat token and it sets its own container (first finding).
- Claim: an extending theme with its own scale gets that scale's page step: verified.
- Claim: each adaptation rule with a scale gets its page step, completed from the theme's scale: verified; an extending theme's partial rule scale gets a TODO.
- Claim: the token goes before any spread, so a spread still wins: verified.
- Claim: unreadable shapes get a TODO, the scale TODO names the page step, and a top-level spread followed by the token needs nothing: verified.
- Claim: the codemod is idempotent: verified.
- Claim: 25 test cases, 13 of them built with Core: verified; their expected values match what the pre-change Core renders, 13 of 13.
- Claim: the codemod suite passes, 1096 tests: verified.
- File
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: one false claim (first finding); the tag and bump pass the changeset check. - File
packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: first and second findings. - File
packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: no fixture for a base without a chat token (first finding); the default-export fixture expects the edit (second finding). - File
packages/cli/assets/codemods/transforms/next/index.mjs: clear.
7d4a229 to
ed95c4c
Compare
727ffb3 to
40f111c
Compare
ed95c4c to
6d3d183
Compare
There was a problem hiding this comment.
Changes requested: one theme shape still loses its chat corners on upgrade with no token or TODO.
- Miss:
preserve-chat-radius.mjs:244-255treats a top-level spread followed by tokens that set--radius-chatas needing nothing, so an adaptation rule with a radius scale that the spread brings drops from 56px to 20px on upgrade; give every top-level spread the TODO (with the wording that names the adaptation rules), update the fixture at__tests__/preserve-chat-radius.test.mjs:176-179, and drop "A top-level spread followed by tokens that set the token needs nothing" from the description.
The extending-theme and default-export problems are fixed: every shipped and migrated base now carries a pinned value, and a theme-shaped default export is reported instead of edited. Optional: the manual-migration message for a file that also holds defineTheme() themes (inline), an extending theme with its own radius scale over a base rule with a partial scale, and the codemod description's "the buttons inside the composer", since the send button no longer follows the composer corner.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Changeset: each
defineTheme()theme gains--radius-chat(28px or its scale's page step): verified, tests at__tests__/preserve-chat-radius.test.mjs:26-59and the downstream fixtures. - Changeset: each adaptation rule with a radius scale gains its page step: verified,
:102-114and fixtures 10 and 17. - Changeset: an extending theme without its own scale inherits its base's value, which every Astryx theme and migrated theme now sets: verified, the seven theme packages on the base set the token, fixtures 8 and 13-16.
- Changeset: a TODO is left where the theme cannot be read: verified for the listed shapes (
:160-174); false for a top-level spread followed by tokens that set the token. - Changeset: a theme-shaped default export is reported for manual migration: verified,
:140-158. - Description: the chat radius now follows the container and a scale no longer sets it, so an unmigrated theme changes: verified on the base's Core and by each fixture's unmigrated check.
- Description: the token is also added where the container already has that value: verified,
:61-85. - Description: rule scales are completed from the theme's scale as Core does: verified by a probe (a rule
{base: 6}keeps 42px). - Description: the token goes before any spread in the tokens: verified,
:129-138. - Description: the listed unreadable shapes get a TODO, and the scale TODO names the page step: verified,
:160-174andpreserve-chat-radius.mjs:56-61. - Description: a top-level spread followed by tokens that set the token needs nothing: false, an adaptation rule the spread brings changes.
- Description: a theme-shaped default export stays unchanged and is reported with the value to add: verified,
:140-158. - Description: the codemod is idempotent: verified,
:173and:181-190. - Description: 29 cases, 17 built with Core against the values before the default change: verified, 29 pass and all 17 expected values match
main. - Description: the codemods test project passes: verified, 1100 of 1100.
Files:
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: its TODO sentence is false for the top-level spread shape (blocking finding);[feat]patch tag valid.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: the fixture at:176-179encodes the spread shortcut (blocking finding); the rest clear.packages/cli/assets/codemods/transforms/next/index.mjs: clear.packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: the spread shortcut at:244-255(blocking); three non-blocking notes.
There was a problem hiding this comment.
Changes requested: the codemod now gives every top-level spread a TODO and names every value in its manual report, but one theme shape still loses its chat corners on upgrade, and the description has one stale sentence.
- Miss: a theme that extends a base imported from another package, such as
defineTheme({name: 'app', extends: brandTheme})withbrandThemefrom@acme/brand-theme, is left unchanged with no TODO, so its chat corners drop from 28px to that base's container radius (16px for a base with'--radius-container': '16px'), because an upgrade never migrates installed dependencies; atpreserve-chat-radius.mjs:259, leave the TODO unlessextendsresolves to an@astryxdesign/theme-*import or a theme defined in this project, and add a fixture for it. - The description still says "A top-level spread followed by tokens that set the token needs nothing", but
preserve-chat-radius.mjs:241now leaves a TODO for every top-level spread (the test at__tests__/preserve-chat-radius.test.mjs:188-193expects it), so please delete that sentence.
Non-blocking: a theme with its own radius scale that extends a base whose adaptation rule has a partial scale still goes from 70px to 56px on coarse pointers; a TODO on an extending theme that sets its own radius would report it.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Description: with the new default,
--radius-chatfollows the container radius and a radius scale no longer sets it. Verified in Core's token default and radius scale on the base branch. - Description: a theme's tokens get 28px or its literal scale's page step, also where its container already has that value. Verified (
preserve-chat-radius.mjs:255-262; tests at__tests__/preserve-chat-radius.test.mjs:45-85). - Description: a theme that extends another and has no scale of its own is left to inherit, since every Astryx theme sets the token. Verified for Astryx themes and themes in the same project; false for a base from another package (first finding).
- Description: an extending theme with its own scale gets that scale's page step. Verified (test at
:87-100). - Description: each adaptation rule with a radius scale gets its page step, completed from the theme's scale. Verified (test at
:102-114and the downstream fixtures). - Description: the token goes before any spread in the tokens, so a spread that sets it wins. Verified (
preserve-chat-radius.mjs:185-198; test at:129-138). - Description: unreadable shapes get a TODO, and the TODO names the page step. Verified (
preserve-chat-radius.mjs:52-57; test at:172-186). - Description: a top-level spread followed by tokens that set the token needs nothing. False (second finding).
- Description: a theme-shaped default export stays unchanged and is reported for manual migration with the value to add. Verified (
preserve-chat-radius.mjs:362-399; test at:140-170). - Description: the codemod is idempotent. Verified (second-run assertions in the tests).
- Description: 29 cases, 17 of them built with Core, each also checking whether the unmigrated fixture changes; the codemods suite passes with 1100 tests. Verified (29 and 1100 passed).
- Changeset: adds the token to each theme and the page step to each adaptation rule with a radius scale, leaves a TODO where it cannot read, and reports a theme-shaped default export. Verified.
- Changeset: an extending theme without its own scale inherits a value every Astryx theme and every migrated theme now sets. Verified as stated.
- Changeset: the upgrade keeps each theme's chat corners. Does not hold for a theme that extends a base from another package (first finding).
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: clear.packages/cli/assets/codemods/transforms/next/index.mjs: clear.packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: first finding, plus the non-blocking partial-rule note.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: clear; it needs a fixture for the first finding.
There was a problem hiding this comment.
Approved: the codemod now leaves a TODO on a theme whose base comes from another package, and the description matches the code.
CI does not run on pull requests into this base branch, so the repository checks run once this work reaches a pull request into main.
Two non-blocking suggestions:
- A base re-exported through a local file (for example
import {brandTheme} from './themes', where./themesre-exports another package's theme) is trusted as a theme this project defines, so its child gets no TODO and its chat corners move to that base's container radius; consider saying in the changeset that a project import is trusted, or leaving the TODO unless the base is adefineTheme()call in the same file. - The TODO for a base from another package does not mention that base's adaptation rules, so following it still moves a rule with a radius scale (56px to 28px on coarse pointers for a base
{base: 4, multiplier: 1}with a coarse rule{multiplier: 2}); the rule sentence from the own-scale TODO would cover it.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Description: with the base branch, the chat radius follows the container radius and a radius scale no longer sets it. Verified in Core's token default and radius scale on the base branch.
- Description: without the codemod, a theme that did not set the token changes its chat corners on upgrade. Verified: the unmigrated downstream fixtures change (
__tests__/preserve-chat-radius.test.mjs:404-417). - Description: the codemod is staged in the next-release folder and runs once promoted. Verified (
transforms/next/index.mjs). - Description: a theme's tokens get 28px or its literal scale's page step, also where its container already has that value. Verified (
preserve-chat-radius.mjs:285-287; tests at:26-85). - Description: a theme that extends another and has no scale of its own is left alone when the base is an Astryx theme (Y2K included) or a theme this project defines through a relative or aliased import, a binding in the file, or an inline call. Verified (
preserve-chat-radius.mjs:352-396; tests at:87-136; every shipped theme sets the token); a re-exported base is the first suggestion. - Description: a base from another package, or a value the codemod cannot resolve, gets a TODO. Verified (
preserve-chat-radius.mjs:288-290; test at:126-135). - Description: an extending theme with its own scale gets that scale's page step and a TODO for its base's rules, unless the base is an Astryx theme, which has no radius rules. Verified (
preserve-chat-radius.mjs:291-293; tests at:87-101and:138-146). - Description: each adaptation rule with a radius scale gets its page step, completed from the theme's scale as Core does. Verified (
preserve-chat-radius.mjs:296-320; test at:148-160). - Description: the token goes before any spread in the tokens, so the spread still wins. Verified (
preserve-chat-radius.mjs:214; test at:175-184). - Description: the before and after example for a base of 4 and a multiplier of 1 adds 28px. Verified.
- Description: an unreadable config, spread, tokens object, radius scale or adaptations gets one TODO that names the value to add. Verified (
preserve-chat-radius.mjs:264-269,:424-430; tests at:218-239). - Description: a default-exported object shaped like a theme is not edited and is reported for manual migration with the values to add, including the file's
defineTheme()themes. Verified (preserve-chat-radius.mjs:483-492; test at:186-216). - Description: a theme whose container already has the old value is not skipped. Verified (no such shortcut; tests at
:61-85). - Description: 32 cases, 18 of them built with Core and compared at the root and in each rule with the value before the default change. Verified: 32 pass, and all 18 expected values match what the previous default renders.
- Description: the
extendscase fails when every base is trusted. Verified: trusting every base fails the classification and base-rules tests. - Description: the codemods suite passes with 1103 tests, and the changeset and comment-provenance checks pass. Verified.
- Description: public text and artifacts contain no internal context. Verified.
- Changeset: the upgrade adds the token to each
defineTheme()theme and the page step to each adaptation rule with a radius scale. Verified. - Changeset: a theme that extends an Astryx theme or a theme this project defines, with no scale of its own, inherits; one that extends another theme gets a TODO. Verified, with the first suggestion.
- Changeset: an unreadable theme gets a TODO, and a theme-shaped default export is reported for manual migration. Verified.
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: clear.packages/cli/assets/codemods/transforms/next/index.mjs: clear.packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: the two non-blocking suggestions.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: clear.
There was a problem hiding this comment.
Approved: the TODO for a theme whose base this upgrade does not migrate now covers that base's adaptation rules, also when the theme already sets --radius-chat, and the changeset states that a relative or aliased import is trusted as a theme this project defines.
CI does not run on pull requests into this base branch, so the repository checks run once this work reaches a pull request into main.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Description: on the base branch the chat radius follows the container radius and a radius scale no longer sets it. Verified in Core's token default and radius scale on the base branch.
- Description: without the codemod, a theme that did not set the token changes its chat corners on upgrade. Verified: the unmigrated downstream fixtures change on the new default (
__tests__/preserve-chat-radius.test.mjs:414-427). - Description: the codemod is staged for the next release and runs through
astryx upgradeonce promoted. Verified (transforms/next/index.mjs). - Description: each Astryx
defineTheme()theme gets 28px or its literal scale's page step, also where its container already has that value. Verified (preserve-chat-radius.mjs:301-303; tests at:26-85). - Description: a theme that extends an Astryx theme or a project theme (relative or aliased import, a binding in the file, or an inline call) and has no scale of its own is left to inherit, and a re-exported base from another package is not detected. Verified (
preserve-chat-radius.mjs:371-415; tests at:103-123); every published Astryx theme sets the token on the base branch. - Description: a base from another package, or a value the codemod cannot resolve, gets a TODO that also covers that base's adaptation rules, even when the theme already sets the token. Verified (
preserve-chat-radius.mjs:304-308; tests at:125-145), and the protected rule corner was reproduced with Core. - Description: an extending theme with its own scale gets that scale's page step and a TODO for its base's rules, unless the base is an Astryx theme, which has no radius rules. Verified (
preserve-chat-radius.mjs:310-312; tests at:87-101and:148-156). - Description: each adaptation rule with a radius scale gets its page step, completed from the theme's scale as Core does. Verified (
preserve-chat-radius.mjs:315-339; test at:158-170). - Description: the token goes before any spread in the tokens, so the spread still wins. Verified (
preserve-chat-radius.mjs:230; test at:185-194). - Description: the before-and-after example for a base of 4 and a multiplier of 1 adds 28px. Verified.
- Description: an unreadable config, top-level spread, tokens value, radius scale or adaptations gets a TODO that names the value to add. Verified (
preserve-chat-radius.mjs:280-285,:299-300,:315-316,:443-450; tests at:228-249). - Description: a theme-shaped default export is not edited and is reported for manual migration with the values to add, including the file's
defineTheme()themes. Verified (preserve-chat-radius.mjs:473-512; test at:196-226). - Description: a theme whose container already has the old value is not skipped. Verified (no such shortcut; tests at
:61-85). - Description: 32 cases, 18 of them built with Core and compared at the root and in each rule with the value before the default change. Verified: 32 pass, and all 18 before-values match what the previous default renders.
- Description: the
extendscase fails when every base is trusted. Verified by mutation: the classification test fails. - Description: the codemods suite passes with 1103 tests, and the changeset and comment-provenance checks pass. Verified.
- Description: public text and artifacts contain no internal context. Verified.
- Changeset: the upgrade adds the token to each
defineTheme()theme and the page step to each adaptation rule with a radius scale. Verified. - Changeset: a theme that extends an Astryx theme or a project theme (a relative or aliased import is trusted) inherits; one that extends another theme gets a TODO that also covers its adaptation rules. Verified.
- Changeset: an unreadable theme gets a TODO, and a theme-shaped default export is reported for manual migration. Verified.
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: clear.packages/cli/assets/codemods/transforms/next/index.mjs: clear.packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: clear.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: clear.
--radius-chat now defaults to the container radius. The codemod adds --radius-chat to the tokens of each defineTheme that sets neither the token nor extends: 28px, or the page step of a literal radius scale. A theme that extends another theme inherits its value and is left alone. Where it cannot read the theme, it leaves a TODO comment.
…themes and default exports Review follow-ups: an adaptation rule with a radius scale gets its own page step, completed from the theme's scale; a theme with an adaptation rule that changes its radius, or a spread after its container radius, keeps its token; an extending theme with its own scale keeps that scale's page step; a non-literal config and an unreadable adaptation get a TODO; a TODO for a radius scale names the page step; a top-level spread followed by the token needs no TODO; a default-exported theme object is migrated. Fixtures are built with Core and their chat radius compared, at the root and under each adaptation rule, with the value before the default change.
…eports plain objects Review follow-ups: a theme whose container radius equals its old chat radius now gets the token too, so a theme that extends it and sets its own container keeps it. A default-exported object shaped like a theme is not proven to be one: the file stays unchanged and is reported for manual migration with the value to add.
…us TODO Review follow-ups: a spread can bring a radius scale or adaptation rules, so a theme with one always gets the TODO, which now names the adaptation rules' tokens too. The manual-migration report for a default export also names what the file's defineTheme() themes need, since nothing in the file is written. The description no longer counts the send button among the buttons that follow the composer corner.
…t migrate Review follow-ups: an extending theme keeps its base's chat radius only when the base is an Astryx theme or a theme this project defines (a relative or aliased import, a defineTheme() binding in the file, or an inline defineTheme()), which this upgrade migrates. A base from another package, or a value the codemod cannot resolve, gets a TODO. An extending theme with its own radius scale also gets a TODO for its base's adaptation rules, which that scale completes, unless the base is an Astryx theme.
…tation rules Review follow-ups (non-blocking): the TODO for a theme that extends a theme this upgrade does not migrate also asks for the base's adaptation rules, and a theme that already sets the token still gets that part. The header, description and changeset say that a relative or aliased import is trusted to be a theme this project defines.
40f111c to
b1a7cbd
Compare
75077ab to
2ea437b
Compare
There was a problem hiding this comment.
Approved: the preserve-chat-radius codemod keeps each theme's chat corners on upgrade, or leaves a TODO or a manual-migration report where it cannot prove the old value, and the description and changeset match the code.
CI does not run on pull requests into this base branch, so the repository's checks run once this work reaches a pull request into main.
Claims and files checked
Review mode: full; reason: rebase
- Description: on the base branch the chat radius follows the container radius and a radius scale no longer sets it. Verified in Core's token default and radius scale on the base branch.
- Description: without the codemod, a theme that did not set the token changes its chat corners on upgrade. Verified: the unmigrated downstream fixtures change on the new default (
__tests__/preserve-chat-radius.test.mjs:422-424). - Description: the codemod is staged for the next release and runs through
astryx upgradeonce promoted. Verified (transforms/next/index.mjs:13-15,:23-27). - Description: the cited release and file-modification rules ask for a codemod for a mechanical rewrite, stage it before promotion, and allow edits only on a resolved binding. Verified against the current records.
- Description: each Astryx
defineTheme()theme gets 28px or its literal scale's page step, also where its container already has that value. Verified (preserve-chat-radius.mjs:299-303; tests at:26-85). - Description: a theme that extends an Astryx theme or a project theme (a relative or aliased import, a binding in the file, or an inline call) and has no scale of its own is left to inherit, and a re-exported base from another package is not detected. Verified (
preserve-chat-radius.mjs:371-415; test at:103-146); every published Astryx theme sets the token on the base branch. - Description: a base from another package, or a value the codemod cannot resolve, gets a TODO that also covers that base's adaptation rules, even when the theme already sets the token. Verified (
preserve-chat-radius.mjs:304-308; tests at:125-145). - Description: an extending theme with its own scale gets that scale's page step and a TODO for its base's rules, unless the base is an Astryx theme. Verified (
preserve-chat-radius.mjs:301-303,:310-312; tests at:87-101,:148-156). - Description: each adaptation rule with a radius scale gets its page step, completed from the theme's scale as Core does. Verified (
preserve-chat-radius.mjs:314-339; test at:158-170). - Description: the token goes before any spread in the tokens, so the spread still wins. Verified (
preserve-chat-radius.mjs:230; test at:185-194). - Description: the example with a base of 4 and a multiplier of 1 adds 28px, and removing an added token adopts the container radius. Verified (
preserve-chat-radius.mjs:182; the base branch's default). - Description: an unreadable config, top-level spread, tokens value, radius scale or adaptations gets a TODO that names the value to add. Verified (
preserve-chat-radius.mjs:280-285,:299-300,:315-316,:443-450; tests at:228-249). - Description: a theme-shaped default export is not edited and is reported for manual migration with the values to add, including the file's
defineTheme()themes. Verified (preserve-chat-radius.mjs:473-512; test at:196-226). - Description: a theme whose container already has the old value is not skipped. Verified (no such shortcut; test at
:61-85). - Description: 32 cases, 18 of them built with Core and compared at the root and in each rule with the value before the default change. Verified: 32 pass, and the 18 fixtures sit at
:319-412. - Description: the
extendscase fails when every base is trusted. Verified by mutation: only the classification test fails. - Description: the codemods suite passes with 1103 tests, and the changeset and comment-provenance checks pass. Verified.
- Description: public text and artifacts contain no internal context. Verified.
- Changeset: the upgrade adds the token to each
defineTheme()theme and the page step to each adaptation rule with a radius scale. Verified. - Changeset: a theme that extends an Astryx theme or a project theme (a relative or aliased import is trusted) inherits; one that extends another theme gets a TODO that also covers its adaptation rules. Verified.
- Changeset: an unreadable theme gets a TODO, and a theme-shaped default export is reported for manual migration. Verified.
.changeset/astryx-upgrade-keeps-the-28px-chat-corners-of-a--0qsj.md: clear.packages/cli/assets/codemods/transforms/next/index.mjs: clear.packages/cli/assets/codemods/transforms/next/preserve-chat-radius.mjs: clear.packages/cli/assets/codemods/transforms/next/__tests__/preserve-chat-radius.test.mjs: clear.
e80224d
into
feat/chat-radius-follows-container
User need
--radius-chatnow follows the container radius, and a radius scale no longer sets it (#12482). A theme that did not set the token changes its chat corners on upgrade: from 28px, or from its radius scale's page step, to its container radius. Its author gets no warning, and has to find every theme and work out the old value by hand.Problem and solution fit
A staged
astryx upgradecodemod,preserve-chat-radius, writes the old value into each theme, so the upgrade changes nothing that a theme author sees. It adds a TODO where it cannot read the old value, and reports a file it cannot prove is a theme.Current specification
spec:AST-017FR28: a compatible release ships "an exact migration command or codemod when the rewrite is mechanical"; FR52: a codemod is staged intransforms/next/and promoted at release.spec:AST-040FR1: an edit needs a resolved binding to the migrated export; shape alone is not proof, and the file stays unchanged and is reported.Public delta and caller burden
astryx upgrade --from <0.7.x> --applyruns the codemod once it is promoted. For eachdefineTheme()imported from Astryx:--radius-chat: 28px, or the page step of its literal radius scale (base × 7 × multiplier). It is added also where the theme's container radius has that value, so a theme that extends it and sets its own container keeps it.defineTheme()binding in the file, or an inlinedefineTheme()). A relative or aliased import is trusted to be such a theme, so a project file that re-exports a theme from another package is not detected. A base from another package, or a value the codemod cannot resolve, gets a TODO that also covers that base's adaptation rules, even when the theme already sets the token: an upgrade never edits installed dependencies.baseandmultipliercompleted from the theme's scale, as Core does.Before and after, for
defineTheme({name: 'app', radius: {base: 4, multiplier: 1}}):The caller decides only whether to keep each added token; removing it adopts the container radius. Where the codemod cannot read the theme (a non-literal config, a spread at the top of the config, tokens that are not an object literal, a radius scale that is not numeric literals, adaptations it cannot read), it leaves one TODO that names the value to add. A default-exported object shaped like a theme is not edited; the upgrade reports it as a manual migration (
ManualMigrationRequired) with the values to add, including those for the file'sdefineTheme()themes, since nothing in the file is written.Design and alternatives
spec:AST-040FR1.Evidence
transforms/next/__tests__/preserve-chat-radius.test.mjs, 32 cases. 18 of them build each migrated fixture with Core'sdefineThemeand compare its chat radius, at the root and under each adaptation rule, with the value before the default change, including themes that extend an unmigrated base in the same file and set their own container; each also checks whether the unmigrated fixture changes on the new default. The others cover the TODO and manual-migration paths, howextendsis classified (an Astryx theme import, a relative or aliased import, a binding in the file, a theme from another package, an unknown value), adefineThemefrom another library, and a second run (idempotent). Theextendscase fails when every base is trusted.Scope
Components:
astryx upgrade(codemodpreserve-chat-radius)Testing
vitest run --project node packages/cli/assets/codemods: 1103 passed.check:changesets, the comment-provenance baseline check.Depends on #12482.