Repository navigation
fix(cli): a padding of two to four lengths where only one works offers its sides - #12729
josephfarina wants to merge 2 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 ·
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about this change's direction; every side line the refusal offers runs as printed and the new test fails on the base and passes here, so no code fix is required.
No current spec record says which lines an astryx experimental theme editor set refusal offers, so an engineering owner needs to approve, for this head, two things: offering the side longhands with the typed lengths for a padding of two to four lengths on a part that reads its padding inside calc(), and the repair gate counting the tokens of a line it reads whole toward coverage in every set refusal. An engineering owner records that by commenting /approve-spec <full head SHA>, and the author may do so as one. CI's test jobs were cancelled on this head, so they need to run again before merge.
- Non-blocking: the gate change counts every line it reads whole, including one that reads the entire typed value, so a line that keeps only part of the value can now be offered beside it in any
setrefusal; limiting the count to whole-read lines that offer fewer tokens than were typed, or a test that pins the wider rule, would keep "a part alone is not offered" exact (inline note).
Claims and files checked
Review mode: full; reason: no-earlier-review
- Changeset: a multi-length padding on a calc() part such as
5px 0on dropdown-menu now offers its sides instead of only ahowpointer: verified for two lengths (_check.mjs:7318; the new test fails on the base with onlyhow padding); for three or four lengths the base offered one first-value line (non-blocking wording, inline note). - Changeset: two lengths give
padding-blockandpadding-inline, three givepadding-top,padding-inlineandpadding-bottom, four give each side, each with its typed length: verified (_check.mjs:287-305; test lines 56-70). - Changeset: a repair gate fix lets three or four side lines be offered together: verified (
_normal.mjs:1841-1847; without the offered values those lines do not cover the typed value). - Description: Core reads a menu's padding inside
calc(), so the set is refused: verified (_check.mjs:7297-7316). - Description: the refusal pointed only at
how padding, and its one-length line was dropped by the gate: verified on the base for5px 0. - Description:
padding-blockandpadding-inlineboth work on that part: verified (both run on dropdown-menu). - Description: for three or four values the gate dropped side lines because it did not count a whole-read line's tokens: verified (the first side line reads whole; coverage fails without the new count).
- Description: the same length on every side still offers the one length: verified (
_check.mjs:285; test line 78). - Description:
boxSideLinesserves only the calc() padding refusal: verified (one call,_check.mjs:7318). - Description: only the set refusal gate passes offered values to
coversTyped: verified (_edit.mjs:4433-4441; the other three callers pass none); that gate serves everysetrefusal. - Description: before,
5px 0got onlyhow paddingand2px 15px 3pxgot onlypadding 2px: verified on the base. - Description: after, the listed side lines are offered and each runs: verified (all 32 offered lines across 13 values ran).
- Description: one length, a variable and
calc()/min()/max()/clamp()are taken as before: verified (the one-length check is unchanged; the palette suite's calc() cases pass). - Description: the regression test fails before the change: verified (its sides case fails on the base).
- Description: the palette case for two spacing variables now expects one per axis: verified (
theme-palette.test.mjs:3510-3517, passes). - Description: no new public API, default or interaction model under the fix label: no public API changes (verified); the refusal-line direction waits on the owner decision above.
- Description: no internal context in public text: verified.
- Description: the listed test run passes apart from files that fail the same on main: partly reproduced (the two changed suites and six repair-gate suites pass; the full run was not repeated).
- Description: typechecks, the CLI structure check and Prettier are clean: Prettier and eslint verified on the changed files; the strict CLI typecheck reports only two unchanged template pages that need a built theme; the structure check was not run.
- File
.changeset/experimental-theme-calc-padding-sides.md: non-blocking wording note. - File
packages/cli/api/theme-edit/_check.mjs: owner decision on the side lines. - File
packages/cli/api/theme-edit/_edit.mjs: owner decision on the gate. - File
packages/cli/api/theme-edit/_normal.mjs: owner decision on the gate; non-blocking scope note. - File
packages/cli/api/theme-edit/theme-edit-calc-padding-sides.test.mjs: clear (non-blocking: the run test runs only the two-length lines). - File
packages/cli/api/theme-edit/theme-palette.test.mjs: clear.
| for (const w of T) typedCount.set(w, (typedCount.get(w) ?? 0) + 1); | ||
| for (const r of reads) if (Array.isArray(r)) r.forEach(carry); | ||
| for (const [i, r] of reads.entries()) | ||
| if (r === true && offered[i] != null) |
There was a problem hiding this comment.
Non-blocking: this counts the tokens of every line read whole, including one that reads the entire typed value, so a line that keeps only part of the value is now kept beside it in any set refusal: coversTyped([true, [0]], 'all 200', 'x', ["'all 200'", 'all']) returns true, where the same reads without the offered values return false. The JSDoc above describes only a line that offers one of several typed values (padding-top 2px for 2px 15px 3px). Counting only whole-read lines that offer fewer tokens than were typed, or a test that pins the wider rule, would keep "a part alone is not offered" exact.
|
/approve-spec caad34d |
…s its sides, each with the length typed for it [skip ci]
caad34d to
e173ca5
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner recording this change's direction for the current head; no code change is required.
No current spec record says which lines an astryx experimental theme editor set refusal offers, so an engineering owner needs to approve two things for this head: offering the side longhands with the typed lengths for a padding of two to four lengths on a part that reads its padding inside calc(), and the repair gate counting the tokens of a line it reads whole toward coverage in every set refusal. The /approve-spec posted earlier names the commit from before the rebase, so it does not carry over: an engineering owner records the decision by commenting /approve-spec <full head SHA> for the current head, and the author may do so as one. CI has not run on this head because its commit message carries [skip ci], so the required checks still need a run before merge.
- Non-blocking: the two earlier inline notes still apply (the gate also counts a line that reads the whole typed value, so a part line can now be kept beside it; the release note's "instead of only a pointer to
how" fits only some values), and the new test runs only the two-length side lines.
Claims and files checked
Review mode: full; reason: rebase
- Changeset: a multi-length padding such as
5px 0on a calc() part like dropdown-menu now offers its sides instead of only ahowpointer: verified for5px 0(_check.mjs:7329; the new test fails on the base with onlyhow padding); for2px 15px 3pxand four lengths the base offered one first-value line (non-blocking wording, inline note). - Changeset: two lengths give
padding-blockandpadding-inline, three givepadding-top,padding-inlineandpadding-bottom, four give each side, each with its typed length: verified (_check.mjs:287-305; test lines 56-70). - Changeset: a repair gate fix lets three or four side lines be offered together: verified (
_normal.mjs:1841-1847; without the offered values those lines do not cover the typed value). - Description: Core reads a menu's padding inside
calc(), so the set is refused: verified (_check.mjs:7296-7335). - Description: the refusal pointed only at
how padding, and its one-length line was dropped by the gate: verified on the base for5px 0. - Description:
padding-blockandpadding-inlineboth work on that part: verified (both run on dropdown-menu). - Description: for three or four values the gate dropped side lines because it did not count a whole-read line's tokens: verified (the first side line reads whole; coverage fails without the new count).
- Description: the same length on every side still offers the one length: verified (
_check.mjs:285; test lines 78-80). - Description:
boxSideLinesserves only the calc() padding refusal: verified (one call,_check.mjs:7329). - Description: only the set refusal gate passes offered values to
coversTyped: verified (_edit.mjs:4434-4442; the three other callers pass none); that gate serves everysetrefusal. - Description: before,
5px 0got onlyhow paddingand2px 15px 3pxgot onlypadding 2px: verified on the base. - Description: after, the listed side lines are offered and each runs: verified (all 75 offered lines across 10 values and three parts ran).
- Description: one length, a variable and
calc()/min()/max()/clamp()are taken as before, and5px 5pxofferspadding 5px: verified (the one-length check is unchanged; the palette suite's calc() cases pass). - Description: the regression test fails before the change: verified (both changed tests fail on the base).
- Description: the palette case for two spacing variables now expects one per axis: verified (
theme-palette.test.mjs:3510-3517, passes). - Description: no new public API, default or interaction model under the fix label: no public API changes (verified); the refusal-line direction waits on the owner decision above.
- Description: no internal context in public text: verified.
- Description: the listed test run passes apart from files that fail the same on main: partly reproduced (eight related suites pass; the full run was not repeated).
- Description: typechecks, the CLI structure check and Prettier are clean: Prettier, ESLint and the structure check verified; the strict CLI typecheck reports only two unchanged template pages that need a built theme, as on the base;
sync:api-typeswas not run. - File
.changeset/experimental-theme-calc-padding-sides.md: non-blocking wording note. - File
packages/cli/api/theme-edit/_check.mjs: owner decision on the side lines. - File
packages/cli/api/theme-edit/_edit.mjs: owner decision on the gate. - File
packages/cli/api/theme-edit/_normal.mjs: owner decision on the gate; non-blocking scope note. - File
packages/cli/api/theme-edit/theme-edit-calc-padding-sides.test.mjs: clear (non-blocking: the run test runs only the two-length lines). - File
packages/cli/api/theme-edit/theme-palette.test.mjs: clear.
|
/approve-spec e173ca5 |
…value line it offered for three or four lengths [skip ci]
|
/approve-spec c38034e |
There was a problem hiding this comment.
Changes requested: one sentence in the release note needs correcting; the code change itself needs no fix.
- The changeset's new "Before" sentence misstates the old behaviour: on the base,
2px 15pxgotpadding 2pxrather than a pointer tohow, and4px 0 4pxgot onlyhow paddingrather than a first-value line, so it could read "Before, it offered either only a pointer tohow(for5px 0) or one line with the first length only (padding 2pxfor2px 15pxor2px 15px 3px), which dropped the other lengths."
The /approve-spec for this head settles the direction for the side lines and the repair gate's coverage count, but the fix makes a new commit, so an engineering owner records /approve-spec <full head SHA> again for that head (the author may, as one). CI has not run on this head because its commit carries [skip ci], so the required checks still need a run before merge. Two earlier non-blocking notes still apply: the gate counts every line it reads whole, and the run test covers only the two-length lines.
Claims and files checked
Review mode: incremental; reason: none
- Release note:
set <theme> padding '5px 0' --on dropdown-menu, or any part whose padding Core reads inside calc(), now offers the sides: verified on dropdown-menu, context-menu and segmented-control (_check.mjs:7329). - Release note: before, two lengths got a pointer to
howand three or four lengths (or two variables) got one first-value line: false; on the base2px 15pxgotpadding 2pxand4px 0 4pxand0 4px 0 4pxgot onlyhow padding(blocking finding). - Release note: two lengths give
padding-blockandpadding-inline, three give top, inline and bottom, four give each side, each with its typed length: verified (_check.mjs:279-306; probe; test lines 56-70). - Release note: a repair gate fix lets three or four side lines be offered together: verified (
_normal.mjs:1841-1847; without the offered values the lines do not cover the typed value). - Description: Core reads a menu's padding inside calc(), so the set is refused: verified (
_check.mjs:7296-7334). - Description: the refusal pointed only at
how padding, and its one-length line was dropped because it carries only part of the value: verified on the base for5px 0. - Description:
padding-blockandpadding-inlineboth work on that part: verified (both run on all three parts). - Description: for three or four values the gate dropped side lines because it did not count a whole-read line's tokens: verified (the first side line reads whole; coverage fails without the new count).
- Description: the same length on every side still offers the one length: verified (
_check.mjs:285;5px 5pxand5px 5px 5px 5pxofferpadding 5px). - Description:
boxSideLinesserves only the calc() padding refusal: verified (one call,_check.mjs:7329). - Description: only the set refusal gate passes offered values to
coversTyped: verified (_edit.mjs:4434-4442; the other three callers pass none). - Description: before,
5px 0got onlyhow paddingand2px 15px 3pxgot onlypadding 2px: verified on the base. - Description: after, the listed side lines are offered and each runs: verified (96 offered lines across 17 values and three parts ran).
- Description: one length, a variable and a math function are taken as before, and
5px 5pxofferspadding 5px: verified (the one-length path is unchanged; the palette suite's calc() case passes). - Description: the regression test fails before the change, and the palette case now expects one variable per axis: verified (both fail on the base and pass on the head).
- Description: no new public API, default or interaction model under the fix label: verified for public API; the refusal-line direction is owner-approved for this head.
- Description: no internal context in public text: verified.
- Description: the listed test run passes apart from files that fail the same on main, and the typechecks, structure check and Prettier are clean: partly reproduced (five related suites pass; Prettier and ESLint clean; the full run, typechecks and
sync:api-typeswere not repeated). - File
.changeset/experimental-theme-calc-padding-sides.md: blocking wording finding. - File
packages/cli/api/theme-edit/_check.mjs: clear. - File
packages/cli/api/theme-edit/_edit.mjs: clear. - File
packages/cli/api/theme-edit/_normal.mjs: clear (non-blocking gate-scope note). - File
packages/cli/api/theme-edit/theme-edit-calc-padding-sides.test.mjs: clear (non-blocking: the run test covers only two lengths). - File
packages/cli/api/theme-edit/theme-palette.test.mjs: clear.
| '@astryxdesign/cli': patch | ||
| --- | ||
|
|
||
| [experimental] `astryx experimental theme editor set <theme> padding '5px 0' --on dropdown-menu` (or any part whose padding Core reads inside `calc()`, where one length is all that works) now offers the sides it means. Before, it offered a pointer to `how` for two lengths, and for three or four lengths (or two variables) one line with the first value only, such as `padding 2px`, which dropped the other lengths. Now it offers `padding-block 5px` and `padding-inline 0` for two lengths, `padding-top`, `padding-inline` and `padding-bottom` for three, and each side for four, each with the length you typed for it. A repair gate fix lets such a refusal offer three or four side lines together. |
There was a problem hiding this comment.
Blocking: this "Before" sentence does not match the base. There, two lengths 2px 15px get padding 2px --on dropdown-menu, not a pointer to how, and 4px 0 4px or 0 4px 0 4px get only how padding, not a first-value line: the split follows whether the lengths are of one kind, not how many there are. My earlier note framed it by count, which was wrong too. Suggested wording: "Before, it offered either only a pointer to how (for 5px 0) or one line with the first length only (padding 2px for 2px 15px or 2px 15px 3px), which dropped the other lengths."
- #12407 fix(cli): theme palette generate names a newer CLI's recipe and the update step Author: @josephfarina - #12729 fix(cli): a padding of two to four lengths where only one works offers its sides Author: @josephfarina - #12893 docs(cli): name the StyleX plugin that works under Vite Author: @josephfarina
|
Landed in #13025. |
Stack: #12729 → #12742
User impact
A theme that recreates a classic look asks for a menu with
5pxabove and below its rows and nothing at the sides:astryx experimental theme editor set <theme> padding '5px 0' --on dropdown-menu. Core reads a menu's padding insidecalc()(its corners and inner rows follow it), where only one length works, so the set is refused. The refusal pointed only athow padding. The one-length line it built (padding 5px) was dropped by the repair gate, because it carries only part of what was typed. The user was left with no way forward, althoughpadding-blockandpadding-inlineboth work on that part.Problem and solution fit
calc()takes there. That stays true.padding-top 2pxfor2px 15px 3px).The fix makes the refusal offer the sides as CSS gives them out. Each side carries the length typed for it:
padding-block+padding-inlinefor two lengths,padding-top+padding-inline+padding-bottomfor three, and each side for four. The repair gate now counts the tokens of a line it reads whole toward coverage, so the side lines are offered together.Expected behavior and authority
The editor's refusal contract: a refusal offers runnable lines that keep the value the user typed, and never a stock or nearest value. When the value is the same length on every side (
5px 5px), the refusal still offers the one length.Smallest restoration
boxSideLinesin_check.mjsbuilds the side lines forpaddingormarginof 2–4 lengths. It is used only by the calc() padding refusal.coversTypedin_normal.mjstakes each line's offered value, and a line read whole carries its tokens. Only the set refusal gate in_edit.mjspasses those values.Evidence
set t padding '5px 0' --on dropdown-menurefuses with onlyhow padding. With'2px 15px 3px', it offers onlypadding 2px.padding-block 5px+padding-inline 0;padding-top 2px+padding-inline 15px+padding-bottom 3px;padding-top/right/bottom/leftfor four lengths. Each line runs.calc()/min()/max()/clamp()on these parts are taken as before.5px 5pxofferspadding 5px.theme-edit-calc-padding-sides.test.mjs(fails before the change). Thetheme-palettecase forvar(--spacing-2) var(--spacing-3)now expects both variables, one per axis.Scope
Components: cli (experimental theme editor)
Testing
CI=1 vitest run --project node packages/cli/api/theme-edit packages/cli/api/theme packages/cli/clients/cli/commands/experimental: 483 of 492 files pass. The 9 failing files (app copy, compile check, clean-checkout builds and one picture run) fail the same on main in this environment. The five CLI typechecks andsync:api-typesare clean, the CLI structure check passes, and Prettier is clean on the touched files.