14882 Commits

Author SHA1 Message Date
alonso.torres
8ed11dcf26 🐛 Show a component's annotation in the Inspect styles view
The annotation of a main component or a copy only showed in the
Computed view of the Inspect tab; the Styles view, the default one in
the workspace and in View mode, never rendered it.

The Styles view now shows the annotation, above the exports, as the
Computed view does.

Found by the components Qase run (PENPOT-1428, PENPOT-1429,
PENPOT-1618).

Checked in the browser: selecting an annotated main component shows
its annotation in Inspect > Styles.

AI-assisted-by: claude-opus-5-5
2026-11-19 10:09:38 +01:00
alonso.torres
36f0f3089d 🐛 Wait for a mouse position before moving a dragged asset
Dragging a component from the Assets panel onto a freshly opened file
showed "Something wrong has happened". The drag starts a move as soon as
it enters the viewport, and the move took the mouse position at once,
which is nil until the pointer has been over the viewport; the vector
from the start point to it failed (`gpt/subtract` assertion). The copy
was still created.

The move now waits for the first mouse position.

Found by the components Qase run (PENPOT-2416).

Test: `a-move-started-without-a-mouse-position-follows-the-pointer`
(drag-on-save-failure-test).

AI-assisted-by: claude-opus-5-5
2026-11-19 10:06:46 +01:00
alonso.torres
476e53744e 🐛 Paste at the viewport center before the pointer reaches it
Ctrl+V in a freshly opened file, with nothing selected, pasted nothing
until the pointer had been over the viewport: the paste took the mouse
position, which is nil until then, and failed on it.

Pasting shapes and HTML text now falls back to the center of the
viewport when there is no mouse position, as pasting path nodes
already does.

Found by the components Qase run.

Test: `paste-before-the-pointer-reaches-the-viewport-uses-its-center`
(pasting-in-containers-test).

AI-assisted-by: claude-opus-5-5
2026-11-19 10:03:56 +01:00
alonso.torres
604998a716 🐛 Start the rename group dialog from the group's current name
Renaming an assets group opened the dialog with an empty name: the
initial form data set `:asset-name`, while the form field is `:name`.

Found by the components Qase run (PENPOT-1285).

Checked in the browser: Rename group shows the current name.

AI-assisted-by: claude-opus-5-5
2026-11-19 10:00:40 +01:00
alonso.torres
047f8ae4e1 💄 Say "These libraries" in the delete libraries dialog
The dialog for deleting or unpublishing several libraries said "This
libraries are activated here".

Found by the components Qase run (PENPOT-1473).

AI-assisted-by: claude-opus-5-5
2026-11-19 09:59:16 +01:00
alonso.torres
934cdb8532 🐛 List each file once when deleting libraries it uses
Deleting or unpublishing several libraries at once listed a file that
uses more than one of them once per library, and React logged a
duplicate key error for the repeated rows. The references of each
library were joined without removing repeated files.

The dialog now lists each file once (`distinct-references`).

Found by the components Qase run (PENPOT-1473).

Test: `delete-shared-test`.

AI-assisted-by: claude-opus-5-5
2026-11-19 09:59:16 +01:00
alonso.torres
61d3313fbb 🐛 Explain in the import dialog why a components v1 file is rejected
Importing a file in the old components v1 format failed with "Something
went wrong while processing this file". The job's entry carried the
specific message (`dashboard.import.components-v1-error`), but the error
list of the dialog only knew the check error and corrupt file texts and
showed the unknown error text for everything else.

The error list now shows the components v1 message as it is
(`import-error-detail`).

Found by the components Qase run (Migration suite).

Test: `dashboard-import-errors-test`.

AI-assisted-by: claude-opus-5-5
2026-11-19 09:55:58 +01:00
alonso.torres
81ff4c0c90 🐛 Keep a flow when the context menu of its starting board opens
In Prototype mode, right-clicking a board that starts a flow removed the
flow: the "Delete flow start" entry called `do-remove-flow` while
rendering instead of on click. React also logged "Cannot update a
component while rendering a different component".

The entry now removes the flow only when it is clicked.

Found by the components Qase run (PENPOT-1771).

Test: `context-menu-prototype-test`.

AI-assisted-by: claude-opus-5-5
2026-11-19 09:49:01 +01:00
alonso.torres
b7ee5d30ec 🐛 Switch a variant set's layout between flex and grid in place
A variant set board or a variant main that already had a layout kept it
when the user picked the other type (Shift+A / Ctrl+Shift+A or the
context menu). `create-layout` sends a shape with a layout to
`create-layout-from-selection`, which refused any selection holding a
variant container or a variant, before reaching its in-place branch.

The refusal now applies only when the selection would be wrapped in a
new board; a single shape with a layout switches it in place.

Found by the components Qase run (PENPOT-2422).

Test: `create-layout-switches-a-variant-container-layout`,
`create-layout-switches-a-variant-main-layout` (groups-test).

AI-assisted-by: claude-opus-5-5
2026-11-19 09:46:31 +01:00
alonso.torres
a46fd7b898 🐛 Keep a copy grid's own empty cell where it was as it grows back
A copy grid with its own cells that lost the row its main removed, and
grew one back to hold its children, fitted its cells into the fewer
tracks first. Its authored empty cell (`align-self :end` at row 2,
column 2) was merged into an occupied one and lost (F594). User
decision: the cell keeps its place.

`assign-inherited-grid-cells` now grows the track lists its children
need before fitting the cells (`grow-for-children`), so a grid that
grows back the tracks it lost keeps its cells where they were. Only the
track lists grow; the cells it holds keep their places.

Found by a fresh gate round (seed 20261117, grid property).

Test: generated
`generated-a-copy-grid-keeps-an-authored-empty-cell-where-it-was-when-it-grows-back`
(JVM and frontend replay).

Benchmark (bench-components, alone):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.906 |  23.299 |   0.62 |
| edit-through-a-chain-of-dependents |    68.931 |  46.008 |  46.834 |   0.67 |
|         library-update-into-copies |    83.083 |  53.933 |  55.436 |   0.65 |
|        main-edit-among-many-shapes |     4.837 |   2.497 |   2.639 |   0.52 |
|           main-edit-into-10-copies |      1.79 |   1.185 |   1.228 |   0.66 |
|          main-edit-into-100-copies |    15.415 |  11.262 |  11.561 |   0.73 |
|         main-edit-into-1000-copies |   153.086 | 108.966 | 112.568 |   0.71 |
|         variant-switch-into-copies |    32.052 |  23.931 |  24.195 |   0.75 |

AI-assisted-by: claude-opus-5-5
2026-11-18 00:23:34 +01:00
alonso.torres
82d95346b3 ✨ Generate interactions and pastes out of copies, pages and files
The structure programs now cover what their worlds lacked:

- `:interact` gives a shape on a main, a copy head or a copy child its
  prototype interactions (open-URL actions, so no board ties them to
  deletions), through the prototype panel's add, edit and remove events
  in the frontend replay. Interactions are no sync attribute: the target
  must end with what was set, no other operation may change those of a
  shape that stays, and a swap or a switch keeps a head's.
- `:paste` also takes a nested copy head a copy holds, which the
  clipboard advances to its component's main. The model gives the pasted
  shapes the overrides of the references they skip, and drops the swap
  of a swapped head, now a plain copy of its component.
- Worlds with `:pages` hold a second page that a paste can land on, and
  `:library-paste` pastes library mains and copies into the consumer,
  where both become copies of the library's components. Off the current
  page or file, the node and the frontend put the pasted corner at the
  same free point; the frontend pastes with nothing selected and the
  pointer there.
- A transform no longer targets a shape without area, as a union of
  hidden shapes, which no transform can size.

Samples of 150 structure, swap and scale programs found F588, F589 and
F590 (fixed) and are then clean.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-17 11:47:22 +01:00
alonso.torres
8d32a09ca4 🐛 Make an update main into a nested copy author the sizing it fixes
An update main that pushes a transformed fill child into the nested copy
its main holds fixes that copy's layout sizing, as a resize does, so the
layout keeps the pushed size. It did not mark the sizing as the nested
copy's own override: the copy differed from its reference without an
override, and the next sync would give it the fill back and undo the
pushed size (F588, reachable since moves are generated).

A main that is itself a copy now touches the sizing groups the push
fixes. The composable model expects it to author them.

Test: generated
`generated-an-update-main-into-a-nested-copy-authors-the-sizing-it-fixes`
(JVM and frontend replay).

Benchmark (bench-components, alone):

|                             :world | :baseline |   :now |   :mean | :ratio |
|------------------------------------+-----------+--------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 | 21.333 |   22.41 |   0.61 |
| edit-through-a-chain-of-dependents |    68.931 | 42.992 |  44.734 |   0.62 |
|         library-update-into-copies |    83.083 | 55.577 |  58.064 |   0.67 |
|        main-edit-among-many-shapes |     4.837 |  2.625 |   3.164 |   0.54 |
|           main-edit-into-10-copies |      1.79 |  1.131 |   1.216 |   0.63 |
|          main-edit-into-100-copies |    15.415 | 11.226 |  12.849 |   0.73 |
|         main-edit-into-1000-copies |   153.086 | 103.22 | 108.455 |   0.67 |
|         variant-switch-into-copies |    32.052 |  23.27 |  24.267 |   0.73 |

AI-assisted-by: claude-opus-5-5
2026-11-17 11:47:05 +01:00
alonso.torres
f86b03245b 🐛 Give a pasted nested copy only the overrides of the refs it skips
A nested copy pasted out of its copy advances its refs to the component
it copies and takes the touched groups of the references it skips, so it
keeps the values they gave it. The clipboard also took those of its new
reference: a pasted rect then overrode a fill its new reference itself
overrides, and stopped following that reference's later edits. A shape
with no touched group was also left an empty touched set, which an undo
then removed, so undo did not restore the state exactly (F589).

`advance-copied-objects` takes only the touched groups of the references
between the shape and its new one, and leaves no touched set when there
are none. The golden master's case AZ, which pastes such a copy, records
its states again: its pasted head no longer has an empty touched set.

Test (copying-and-duplicating-test, fails before the fix):
`a-pasted-nested-copy-takes-only-the-overrides-of-the-references-it-skips`.

Benchmark (bench-components, alone):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |    22.2 |  22.701 |   0.63 |
| edit-through-a-chain-of-dependents |    68.931 |  43.557 |  45.725 |   0.63 |
|         library-update-into-copies |    83.083 |  52.452 |  54.294 |   0.63 |
|        main-edit-among-many-shapes |     4.837 |   2.766 |   2.895 |   0.57 |
|           main-edit-into-10-copies |      1.79 |   1.142 |   1.178 |   0.64 |
|          main-edit-into-100-copies |    15.415 |  11.615 |  12.834 |   0.75 |
|         main-edit-into-1000-copies |   153.086 | 106.297 | 109.039 |   0.69 |
|         variant-switch-into-copies |    32.052 |   23.09 |  23.778 |   0.72 |

AI-assisted-by: claude-opus-5-5
2026-11-17 11:39:21 +01:00
alonso.torres
5320fd264a 📎 Read the WASM replay's query parameters as the page loads
A replayed step that navigates replaces the page's query string, so the
replay read its `debug` and `watch` parameters as unset from then on and
logged no shapes at the end of such a program. It reads them once, as
the page loads.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-17 03:27:50 +01:00
alonso.torres
b408283e19 📎 Log shape counts and only text content in the replay debug
The WASM replay's debug log read every shape's content as text, which a
path's content is not; it reads only texts now and logs how many shapes
the page ends with.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-17 01:04:52 +01:00
alonso.torres
0713d60fb3 🐛 Keep the places a layout update gives copy shapes
A layout update applied its modifiers and then settled the placement of
the copy shapes they moved, as a transform does. For a swapped head
turned with its main and filling a row, the settle gave back the
unskewed turn of its main and undid the skew the layout gives it, which
its main keeps (F441: a swapped head turned to fill takes the skew of
its main).

A layout update no longer settles placement (`apply-modifiers` and
`apply-wasm-modifiers` take `:settle-component-placement? false`); a
transform still does. The composable model's reflow, which settled
placement since `bac1443729` to match the old update, no longer does:
with it, layout and settle undid each other and never settled.

Test: frontend generated
`generated-a-turned-fill-swap-keeps-the-skew-its-row-gives`.

ClojureScript only; the benchmark covers JVM code and is not run.

AI-assisted-by: claude-opus-5-5
2026-11-17 01:04:52 +01:00
alonso.torres
bae3b80331 📎 Model the sidebar's sizing fixes and the reflow's placement settle
Two turned-shape programs of the frontend replay differed from the
composable model:

- Setting a turned variant to fill in its hugging variant board: the
  sidebar fixes the board's width first, the model's property edit did
  not, and a layout pass of a fill child in a hugging row collapses a
  turned child before growing it, which left it a singular transform.
  The model's edit of a layout child now applies the same sizing fixes
  (`cls/fix-child-sizing`, `cls/fix-parent-sizing`).
- A swapped head turned with its main, filling a row: the frontend's
  layout update settles the placement of the copy shapes it moves, which
  gives the head its main's unskewed turn; the model's reflow did not,
  and kept the layout's skew. The model's reflow settles them too
  (`cll/generate-sync-transformed-placement`).

Both programs now pass in the frontend replay with WASM off (frontend
generated tests).

Harness only; the benchmark is not run.

Also in this commit:

- Log each shape's parent id in the WASM replay's debug output. The debug log
  named each shape's parent, which copies and their mains share; it now gives
  the parent's id too, so a subtree can be told apart from its copies'.

AI-assisted-by: claude-opus-5-5
2026-11-16 22:23:27 +01:00
alonso.torres
9d5df3c50f ♻️ Move the sidebar's layout sizing fixes to common logic
`fix-child-sizing` and `fix-parent-sizing` give a layout's children and
parent the sizing a hugging layout allows when the sidebar edits a
layout child. They move from the frontend's shape layout events to
`app.common.logic.shapes`, unchanged, so the composable model can apply
them as the sidebar does.

No behavior change; the benchmark covers sync and is not run.

AI-assisted-by: claude-opus-5-5
2026-11-16 20:32:19 +01:00
alonso.torres
fcb703fdef 🐛 Close the outline of a rect converted to a path
Converting a rect to a path gave an outline that went back to its start
with a line and stayed open, so a stroke missed its join at the first
corner. With the WASM engine on, the engine converts the rect and closes
the outline, so the two engines gave different paths for one shape.

The rect's outline now ends with `close-path`, as the WASM engine's does
(user decision). The path editor closes subpaths its own way on entry,
which its lifecycle test now expects.

Found by the WASM replay of the pinned generated programs (program 329),
which passes with the change.

Tests: `path-data-test/shape-to-path-rect-closes-its-outline`.

The conversion is outside the paths the component benchmark measures;
it is not run.

AI-assisted-by: claude-opus-5-5
2026-11-16 09:07:04 +01:00
alonso.torres
bb8b5584a1 🐛 Let the WASM engine lay out a move inside a group a layout places
With WASM on, a pure move skips the engine unless a moved shape is in a
layout's flow. A shape moved inside a group or bool that a layout places
took that shortcut: the group grew to it and stayed where the move left
it, where the CLJS engine's layout puts the group back in its place.

The check now walks up through the groups and bools around a moved
shape, and a move whose group a layout places goes through the engine.

Found by the WASM replay of the pinned generated programs (program 169,
`{:world [1 0 {:layout :flex :layout-children true}] :ops [[:structure
0 0 19] [:transform 10 0 0 12]]}`), which passes now; the WASM path does
not run in the node tests.

ClojureScript only; the benchmark covers JVM code and is not run.

AI-assisted-by: claude-opus-5-5
2026-11-16 02:47:51 +01:00
alonso.torres
c3f20ea554 🐛 Reflow the layouts an update main changes
Pushing a grid copy's column direction to its main left the main's
children in their row order, and pushing a copy's grid cells left the
main's children where they were before, outside the cells they took. A
sync reflows the layouts of the copies it changes, but `update-component`
reflowed none, so the main never laid out again.

It now emits a layout update for the frames its changes touch in the
current file, the main's among them when its component is local, in the
undo group of the update.

Test: frontend generated
`generated-an-update-main-of-a-grid-direction-orders-the-main-by-it`.
The frontend golden master of `case-ak-update-main-pushes-grid-cells` is
recorded again: its main and copy children now sit at their cells, where
they were left stacked outside their boards.

ClojureScript only; the benchmark covers JVM code and is not run.

AI-assisted-by: claude-opus-5-5
2026-11-15 18:38:48 +01:00
alonso.torres
05d87d8496 🐛 Undo a sync with the change its group was stacked into
Ungrouping a board in a grid main whose copies are ungrouped alike took
two Ctrl+Z to undo: the first only moved the copies' children back. The
layout update after the ungroup stacks onto its history entry with an
undo group of its own, which the entry records among the groups stacked
into it. The component sync that update causes commits later under that
group without stacking, and `append-undo` gave it a new entry when the
matching entry was the latest. Undo walks entries by their own undo
group, so the new entry was undone alone.

Such a commit now joins the entry that holds its group among the stacked
ones. Commits of one group in a row still keep their entries, which undo
walks together.

Tests: `workspace-undo-test/a-delayed-commit-joins-the-entry-its-group-
was-stacked-into` (fails before the fix), `adjacent-commits-of-one-group-
keep-their-entries`, and the frontend generated `generated-an-ungroup-in-
a-grid-main-undoes-in-one-step`.

ClojureScript only; the benchmark covers JVM code and is not run.

AI-assisted-by: claude-opus-5-5
2026-11-15 18:01:19 +01:00
alonso.torres
5f3c5f60e3 📎 Keep the frontend replay's library bookkeeping as the model's
The frontend interpreter recorded three library steps unlike the pure
runner, so three replayed programs differed from the model with no
difference in production:

- A detach leaves a nested copy's child plain when the loaded library no
  longer has its main; the interpreter now records those children, as the
  detach node does, and the oracle reads each as its main's child.
- A duplicate takes the reference inputs of the shapes it copies, so a
  duplicate of a copy back on an older library holds that version.
- A library sync remembers its copies against the synced library as
  loaded and the other libraries as accepted.

The detach node and the interpreter share `n/record-unlinked-children`.
Frontend generated tests replay the three programs.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-15 18:01:12 +01:00
alonso.torres
b71369157f 📎 Replay the programs of a file through the frontend in node
With `PENPOT_REPLAY_PROGRAMS` naming an EDN file of programs, a frontend
generated test replays each of them and logs its own results, which
compares the frontend with the model on many programs without a browser.
Without it the test does nothing.

Harness only; the benchmark is not run.

Also in this commit:

- Give the generated text component a measurable size. The generated worlds'
  text component had a board and a text of a hundredth of a pixel, where turning
  or moving them left the transform to float noise and the checks reported
  differences no design shows. The board is 100 by 100 and the text 100 by 20;
  `add-frame-with-text` sets up its text with the size its child params give.

AI-assisted-by: claude-opus-5-5
2026-11-15 10:37:42 +01:00
alonso.torres
d0b9af53a6 🐛 Undo a token edit and its propagation in one step
Saving a token from its form committed the edit, then propagated the new
value to the shapes in an undo transaction of its own, opened only once
the tokens resolved. One undo reverted the shapes and left the token with
its new value.

The propagation opens its transaction before the tokens resolve, and the
form commits the edit and the propagation in one transaction, which the
propagation's nests in. The frontend replay commits a token edit as the
form does.

The benchmark covers JVM code; this change is ClojureScript only, so it
is not run.

AI-assisted-by: claude-opus-5-5
2026-11-15 00:23:27 +01:00
alonso.torres
9b8e230715 🐛 Lay out the parent of a new bool again
A bool takes the bounds of its result, smaller than those of the shapes
it combines for an intersection, but creating it did not update the
layout it is in, so in a grid board it kept a place the layout does not
give it. It now updates the layout of its parent, as grouping does.

The benchmark covers JVM code; this change is ClojureScript only, so it
is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 23:53:20 +01:00
alonso.torres
b71301f160 🐛 Lay out the parents of an unmasked group again
Unmasking a group gives it the bounds of all its children instead of its
mask's, but the event did not update the layout the group is in, so in a
flex or grid board it kept the place of its old bounds and overlapped its
neighbours. It now updates the layouts of the groups' parents, as group,
mask and ungroup do.

The benchmark covers JVM code; this change is ClojureScript only, so it
is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 23:49:21 +01:00
alonso.torres
5e264ce377 📎 Compare each key within its shape when naming a difference
`oracle/inequivalence` compared a shape's values on their own, so the
geometry tolerance of `equivalent?` did not apply and float noise was
named as the first difference. Each key is compared within the shape it
belongs to.

Harness only; the benchmark is not run.

Also in this commit:

- Replay layout, structure and grid track edits as the UI does. The frontend
  interpreter set a layout's gap, padding and item alignment and a layout
  child's margin with a plain shape update, where the sidebar goes through the
  layout events that reflow the layout; a copy then kept its children where the
  old gap put them. It dispatches those events now.
- Watch the targets of a replayed program in the browser. With `watch`, the
  browser replay logs the events the store handles and each move of the shapes
  the program's operations target.

AI-assisted-by: claude-opus-5-5
2026-11-14 23:40:54 +01:00
alonso.torres
78a52917ef 📎 Log targets and final shapes in both engines of the replay
With `debug`, the browser replay logs each target and the shapes every
program ends with whether the WASM engine is on or off, so a WASM failure
can be compared with the same program on the plain engine.

Harness only; the benchmark is not run.

Also in this commit:

- Apply the generated typography only where the file holds it. A text style edit
  picks the generated typography for one of its values, but only worlds with
  text styles add that typography to the file. In the others the model applied
  the edit's styles while the frontend applied a missing typography, which sets
  no style, so the two diverged. The edit names the typography only when the
  file holds it.
- Replay programs in the browser as the frontend tests do. The browser replay
  mocks the backend and the timers as the frontend generated tests do, turns the
  WASM engine off for the plain engine even when the page's configuration turns
  it on, and in debug logs the content a text edit commits and each text's
  characters and font weights.
- Name the boards a deleted component's main was held by. The canonical design
  data names shapes and components by their place in the tree, so the model and
  the frontend compare although each allocates its own ids. A deleted component
  keeps the ids of the board that held its main, as a variant's component keeps
  its container's once the variant is undone; with that board gone the ids
  stayed raw and differed between the two runs. They are named after the
  component when no live shape is.
- Report where the model and the frontend first differ. A backend mismatch in
  the frontend replay printed the whole diff of the two canonical designs, which
  lists float noise the comparison accepts next to the difference it rejects.
  `oracle/inequivalence` walks the two designs as `equivalent?` compares them
  and returns the path of the first rejected value with both sides; the mismatch
  message leads with it.
- Keep text sizes and take inline programs in the browser replay. With the WASM
  engine on, the replay keeps each text's stored size in place of the engine's
  text resizes: the model keeps stored sizes, and the generated texts are too
  narrow to measure, so a new copy's measured text differed from its main's
  unmeasured one. The page also takes the programs inline in an `edn` query
  parameter, which a shrink loop drives.

AI-assisted-by: claude-opus-5-5
2026-11-14 16:45:55 +01:00
alonso.torres
3f69c2ba8c 🐛 Sync copies when a copy nested in a main is moved
The component watcher drops a translation commit that moves only shapes
outside mains or whole mains. It found the main of each moved shape with
`get-component-shape`, which stops at the nearest copy head, so a copy
placed in a main, or a shape inside one, looked like a shape outside any
main: moving it with the WASM engine on, whose drags commit as
translations, left the main's copies where they were.

The watcher now walks up through nested copies to the main instance the
shape lies in.

The benchmark covers JVM code; this change is ClojureScript only, so it
is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 15:20:47 +01:00
alonso.torres
82b14af949 📎 Resume, debug and compare the browser replay of programs
The replay page takes a `start` index to resume a long run, an `engine`
of `plain` to replay the same programs with the WASM engine off, and a
`debug` flag that logs each target, each WASM layout with its result and
the shapes of a failing program.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 14:56:48 +01:00
alonso.torres
b5cc197104 🐛 Send the WASM engine the paddings and margins the layout uses
A `:simple` padding or margin type repeats the top and right values on
the bottom and left, as `ctl/paddings` and `ctl/child-margins` read them,
but the WASM engine received the four stored values. A board whose type
was switched to simple after editing its sides laid out its children with
the stale bottom and left values in the WASM engine only, so moving one
child shifted all of them and marked copies as touched.

Both the shape payload and the per-attribute calls now send the values
the layout functions return.

The benchmark covers JVM code; this change is ClojureScript only, so it
is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 14:56:38 +01:00
alonso.torres
475e13e782 🐛 Let the WASM engine lay out a moved shape a layout places
With WASM on, a pure move took a shortcut: the translation was applied
to the moved shapes and their subtrees without asking the engine to lay
them out. A shape in a layout's flow then stayed where it was moved,
where the CLJS engine's layout put it back, and a copy shape kept the
move as a geometry override. A move of a shape that a layout places now
goes through the engine like any other transform.

Found by replaying generated programs in the browser with WASM on. The
JVM benchmark does not run the WASM path; it is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 12:43:09 +01:00
alonso.torres
f264c0dfd6 ✨ Replay generated programs in the browser with the WASM engine
The frontend replay of generated component programs runs in node, where
the WASM render engine is not available. A `test-wasm` build runs the same
replay in a browser page: it loads the engine on a canvas, turns on
render-wasm/v1 and loads the shapes of the replayed page into the engine
whenever they change, so every layout goes through it. Text edits commit
through the SVG editor, as the WASM editor needs its own editing session.
The page reads the programs the common tests pin, which a script writes
out, and reports each one to the console.

Build with `pnpm run build:test-wasm`, then open
`/test-wasm.html?programs=programs.js`.

Test tooling only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 12:40:35 +01:00
alonso.torres
f5c2705344 🐛 Rename a component and its main in one undo step
Renaming a component from the assets panel renames the component, then
its main root, in two commits. Undo took them back one at a time, so a
single undo left the component and its main with different names. They
are now one undo transaction.

Found by the frontend replay of generated programs with the new rename
kind. The JVM benchmark does not run frontend events; it is not run.

AI-assisted-by: claude-opus-5-5
2026-11-14 03:22:17 +01:00
alonso.torres
08d9b26534 ✨ Generate moves, renames and annotations of components
Three kinds join the structure programs, and the programs built on them:

- move: a shape a main holds, or a nested copy head, moves to the page,
  into a board or group of its own main or of another. The model gives
  an override of its constraints the defaults of its new parent, as the
  move resets them.
- rename: the assets panel's rename, with names that carry a path. The
  component must take the normalized path and name, and its main root
  the whole name.
- annotate: a component's annotation is set or removed. Only that edit,
  or its undo or redo, may change an annotation.

The frontend interpreter realises the rename and the annotation through
their workspace events.

Harness only; the benchmark is not run.

Also in this commit:

- Ignore the layout-given size of a hidden layout child in the oracle. A hidden
  shape leaves its layout's flow, so it keeps the size the layout last gave it
  along its fill or auto axes, while a sync from its main can give it the
  main's. The layout gives it its size again once it is shown. The oracle
  expected the main's size, and the design snapshots of a settled and a fully
  synced world differed by it. Those sizes are now nobody's to keep, as the
  place of a hidden layout child already is.

AI-assisted-by: claude-opus-5-5
2026-11-13 19:41:53 +01:00
alonso.torres
f61337a994 ♻️ Reindent the harness undo check and transform op
Whitespace only, as the formatter wants it after the last changes to
same-state? and the transform op of the generator.

Harness only; the benchmark is not run.

Also in this commit:

- Record the frontend golden master of case AY again. The undo and redo checks
  compare the tokens library by its exported content, so the golden master
  writes it key by key; the JVM golden master of case AY was recorded again for
  that, and the frontend one is now too. Same values, written differently.
- The harness changes that check the next commit, "Grow a track for a grid
  copy's new child and keep it at sync".

AI-assisted-by: claude-opus-5-5
2026-11-13 09:31:07 +01:00
alonso.torres
b91d84cf3d 🐛 Propagate tokens when restoring a deleted component
A token edit sets the shapes on pages, not the main a deleted component
stores, so a restored main came back with the values its tokens had when
it was deleted, and synced them into its copies.

Restoring a component in the current file propagates the tokens, so the
restored main takes their current values.

Not covered by a test: the frontend suite compiles it in the full
validation that follows.

AI-assisted-by: claude-opus-5-5
2026-11-13 08:40:36 +01:00
alonso.torres
31393c7ce9 🐛 Take off the token of the corner a flipped shape shows
A border radius token names the corners as a flipped shape shows them:
applying and propagating it mirror each corner to the one the shape
stores. A radius edit took off the token of the corner it stores, so on
a flipped shape it took off the wrong one, and a later token edit set
the corner given by hand. The sidebar's single-corner edit mirrored the
corner too but wrote only the corner it names, so on a flipped rectangle
it changed nothing.

A radius edit takes off the token of the corner the shape shows, with
the same mirroring, and the sidebar's single-corner edit writes any
corner. The harness model does the same.

Tests: unapply-the-token-of-the-corner-a-flipped-shape-shows;
a-token-edit-sets-the-corners-of-a-flipped-copy-as-it-shows-them.

The benchmark of the previous commit covers this one.

AI-assisted-by: claude-opus-5-5
2026-11-13 01:09:05 +01:00
alonso.torres
7efd67e5cf ✨ Transform shapes in the groups and bools of copies
The random histories never transformed a copy shape inside a group or a
bool. They now do, where the board around the group has no layout.
Inside a layout, a move of a group's shape makes the layout move the
group back, and its siblings with it, with nothing authored; that stays
out until it is decided.

The oracle learns:
- the shapes of a group or bool take their place from the board around
  it, or from the nearest group or bool on the way that authors its
  geometry;
- the geometry check leaves groups and bools out, as their bounds come
  from their children, which it checks.

The frontend replay realises the token value edit as the token form
commits it, with its propagation.

Test: the-shapes-of-a-moved-copy-group-follow-it; shape structure
programs pass (seeds 8101 at 150, 8102 at 300).

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-12 23:07:34 +01:00
alonso.torres
03441be4e6 🐛 Keep as an override the place a copy shape's old constraint gave it
A constraint applies to the resizes after it, so changing the constraint
of a copy shape moves nothing. But a later sync placed the shape from its
main through the new constraint, as if it had applied to the copy's
earlier resize too, so the same copy showed two places depending on the
sync. A copy shape whose constraint changes in a board sized apart from
its main's along that axis now authors its geometry: it keeps its place,
and later resizes of the board move it through the new constraint. The
frontend's shape update runs the check after any update that marks
overrides.

Tests: centring-a-nested-copy-after-its-copy-resized-keeps-its-children-in-place
(the stale gate program of seed 151006440);
a-constraint-a-copy-sets-after-a-resize-moves-nothing-at-sync expects the
override now.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), measured
with the previous commit's change in the tree as well:
|                             :world | :baseline |   :now |   :mean | :ratio |
|------------------------------------+-----------+--------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 | 21.443 |  22.755 |   0.61 |
| edit-through-a-chain-of-dependents |    68.931 | 40.138 |  42.216 |   0.58 |
|         library-update-into-copies |    83.083 | 51.127 |  55.671 |   0.62 |
|        main-edit-among-many-shapes |     4.837 |  2.516 |   3.029 |   0.52 |
|           main-edit-into-10-copies |      1.79 |   1.11 |   1.148 |   0.62 |
|          main-edit-into-100-copies |    15.415 |  9.991 |  10.514 |   0.65 |
|         main-edit-into-1000-copies |   153.086 | 97.388 | 114.808 |   0.64 |
|         variant-switch-into-copies |    32.052 | 21.907 |  23.988 |   0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-12 12:16:29 +01:00
alonso.torres
92b072431d 🐛 Ungroup the copies of a group a main ungroups in the same change
Ungrouping a group, bool or board inside a main removed it, while its
copies kept a shape that referred to it until the next sync, so the
file failed validation in between. The ungroup now takes the file's
pages and ungroups every shape of the file that refers to an ungrouped
one, directly or through other copies, in the same change: its children
move to its parent at its place, keeping their overrides, and it is
removed. The frontend's ungroup passes the file's pages.

Test: ungrouping-a-group-a-main-holds-leaves-no-copy-referring-to-it
(the copy's rectangle moves to the copy root with its opacity override).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |   :now |   :mean | :ratio |
|------------------------------------+-----------+--------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.54 |  21.937 |   0.61 |
| edit-through-a-chain-of-dependents |    68.931 | 42.565 |  43.748 |   0.62 |
|         library-update-into-copies |    83.083 | 58.686 |  78.974 |   0.71 |
|        main-edit-among-many-shapes |     4.837 |  2.503 |   3.171 |   0.52 |
|           main-edit-into-10-copies |      1.79 |  1.039 |   1.105 |   0.58 |
|          main-edit-into-100-copies |    15.415 | 10.205 |  10.895 |   0.66 |
|         main-edit-into-1000-copies |   153.086 | 102.64 | 106.511 |   0.67 |
|         variant-switch-into-copies |    32.052 | 21.481 |  22.871 |   0.67 |

AI-assisted-by: claude-opus-5-5
2026-11-12 10:26:29 +01:00
alonso.torres
6f4abafb8a ♻️ Move the group, mask and bool actions to common
The changes of grouping, ungrouping, masking, unmasking and creating
bools were built in the workspace events, which the JVM tests and the
component gates cannot run. They move to app.common.logic.groups and
app.common.logic.bool with the same behavior: the events keep their
selection and stream handling and call the common builders, and the
other callers of shapes-for-grouping and prepare-create-group use the
common namespace.

Tests: groups-test (grouping, ungrouping, copy heads left whole, mask and
unmask, bools without boards). Frontend suite: 2080 tests, 2 failures,
both the intermittent persistence-rollback-test timeout.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), measured
with the other production changes of this series in the tree; none of
them is on a measured path:
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  22.167 |  22.682 |   0.63 |
| edit-through-a-chain-of-dependents |    68.931 |  43.218 |  44.696 |   0.63 |
|         library-update-into-copies |    83.083 |  47.824 |  50.506 |   0.58 |
|        main-edit-among-many-shapes |     4.837 |   2.216 |    2.34 |   0.46 |
|           main-edit-into-10-copies |      1.79 |   1.067 |   1.133 |    0.6 |
|          main-edit-into-100-copies |    15.415 |  10.604 |  10.813 |   0.69 |
|         main-edit-into-1000-copies |   153.086 | 106.085 | 108.631 |   0.69 |
|         variant-switch-into-copies |    32.052 |  22.556 |  23.137 |    0.7 |

AI-assisted-by: claude-opus-5-5
2026-11-12 01:34:03 +01:00
alonso.torres
62dcb163f7 ✨ Generate component histories in deeper and wider worlds
The random histories ran in worlds of two or three components nested at
most two levels, each with two copies, where ordering and propagation
bugs that need deeper nesting or many copies of one main cannot show.
The scale programs build three or four components nested three or four
levels, with three to six copies of each, a larger shape budget, and
every variant operation. A world takes its number of copies per main
(two by default). Scale programs run several times longer than the
others, so the suite draws twelve; the gates draw more.

Test: random-scale-compositions.
Common suite: 2444 tests, 0 failures.

Harness only; the benchmark is not run.

Also in this commit:

- Model a head size as authored only when a sync resizes its copy. The model
  took any resized copy parent of an untouched swapped head as a sync resize and
  expected the head to author the size it was given. A user resize of a nested
  copy authors that copy's geometry and scales a swapped head under it through
  constraints, which production leaves untouched. The model now finds the
  topmost ancestor the step resized and authors the head's size only when that
  ancestor is a copy shape without authored geometry, the only shape a sync
  resizes.
- Keep the layout item overrides of a swapped head in the model. A swap restores
  the swap-keep-attrs of the old head on the new one with the touched groups
  they belong to, on every swap. The model kept the old head's layout item
  groups only on a variant switch, so after a plain swap of a head that authors
  a margin it expected the new head without that override. It now keeps them on
  every swap.
- Align the arguments of the combine test fixtures. The same-name combine
  fixtures in the variant workspace tests call their helper through the `ctho`
  alias, one character longer than develop's `tho`, so their continuation lines
  sat one column left of the first argument and the frontend format check
  failed.

AI-assisted-by: claude-opus-5-5
2026-11-11 21:46:11 +01:00
alonso.torres
ef5a883d9e 📎 Use this branch's compositions alias in develop's combine tests
The same-name combine tests that develop added build their file with the
`tho` alias, which this branch's variant workspace tests name `ctho`, so
the frontend test run stopped with a ReferenceError there.

Harness only; the benchmark is not run.

Also in this commit:

- Re-record the combine golden master for unique variant values. Combining two
  components whose names leave no value gives the second variant "Value 2" where
  it had an empty value, since develop's fix for same-name combines (#12881).
  Case au records that combine, so its two variants are recorded again on
  purpose; no other case changes.

AI-assisted-by: claude-opus-5-5
2026-11-10 21:46:48 +01:00
alonso.torres
888462d3bb ✨ Generate variant sets made from components and library set edits
The variant programs now also make sets: transform a component into a
variant set (kind make-variant) and combine two components as variants
(kind combine), each paired with a switch. The pure runner runs both
actions through their common generators with what the frontend events
do after them: the reflow of the new board's layout, and a combined
board sized 30 px past its mains on each side. Each must leave the
components it names as members of one new set in the board, with the
same property names; a transform adds a member with a value of its own.

The library editor of the stale library programs edits its variant sets
too: property edits, added variants, transforms and combines, followed
by a library sync and a switch in the consuming file. Their requested
results are checked on the library, and an added member takes on the
model of the main it duplicates. The test of undoing a library variant
a consumer switched to belongs to the previous commit's fix.

The stale library programs must cover only the library steps and the
operations they are tested with, as the variant programs do; the
structure and swap programs cover the rest. A frontend step also waits
briefly for an undo transaction its events close on a later tick, as
combining variants does, and the golden master transcripts record the
components a variant action makes.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-08 01:22:39 +01:00
alonso.torres
ed7ef53ef4 ✨ Generate and check random component histories
The Phase 4 bug hunt: random component programs, an independent model
of what they should leave, and the regression programs of what they
found. The production fixes they found are the commits before this one,
each with its regression programs; this commit holds the test harness,
the rest of the tests and the memories they grew with. A regression
program that needs the harness runs once this commit is in.

- Generation (composable gen): worlds of components, nested copies,
  variants, libraries (stale and dependent), flex and grid layouts and
  texts; operations for structure, geometry, styles, texts, layout items,
  grid tracks and cells, swaps, variant switches, update main, reset,
  detach, library edits and syncs, undo and redo; shrinking, coverage
  accounting per operation kind, and PENPOT_GEN_SEED, PENPOT_GEN_NUM
  and PENPOT_GEN_HISTORIES to choose the seed, the number of programs
  and their length.
- The oracle: invariants on touched groups, overrides, refs, settled
  versus full sync, design snapshots and the model values, with its
  own model of authored intent (shadow, geometry, grid and variant
  rules) instead of production's results.
- The frontend replays generated programs through the workspace events
  and the completion contract, with undo and redo checks.
- The oracle unit tests, the test runners' registrations, the golden
  masters recorded again where a fix changed them, and the memories of
  the component sync contract and its tests.

Harness only; the benchmark is not run.

Also in this commit:

- Adapt develop's variant set and reload tests to this branch. Develop's tests
  of transforming a component into a variant set call the event with the set's
  id and expect the defining commit to hold only the main. Here the transform
  builds the whole set, its second member included, in one commit:
  transform-in-variant takes an optional variant id, and the tests expect both
  members in that commit.
- Restore the requires and test wiring the rebase merges dropped.
- Generate variant property edits and added variants. The random programs
  switched between the members of a variant set but never changed the set.

AI-assisted-by: claude-opus-5-5
2026-11-07 18:37:51 +01:00
alonso.torres
6c4acac7f9 🐛 Give a copy its main's cells when its direction change moves none
Changing the direction of a grid copy without cell overrides reflowed its
auto cells and left the layout to pin those after a gap in the new order,
without making them an override. Changing the direction back kept the
pins, so the copy differed from its main with no override, and the next
sync of its main silently changed it.

A direction change that moves no item of such a copy gives it the cells
its main gives it, laid out as sync lays them out in the new direction,
so changing the direction back restores its main's grid; one that moves
items makes the cells an override, as before. The frontend and the test
operation set the cells first and then the direction, the only override
the change makes otherwise.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  21.653 |  0.61 |
| edit-through-a-chain-of-dependents |   68.931 |  40.646 |  0.59 |
| library-update-into-copies         |   83.083 |  49.282 |  0.59 |
| main-edit-among-many-shapes        |    4.837 |   2.415 |  0.50 |
| main-edit-into-10-copies           |     1.79 |   1.072 |  0.60 |
| main-edit-into-100-copies          |   15.415 |   9.683 |  0.63 |
| main-edit-into-1000-copies         |  153.086 | 103.559 |  0.68 |
| variant-switch-into-copies         |   32.052 |  21.623 |  0.67 |

AI-assisted-by: claude-opus-5-5
2026-11-06 09:52:06 +01:00
alonso.torres
feae1504c1 ✨ Disable update main when it would nest a component in itself
Update main from a copy that holds its own component, or a component whose
main holds it, changes nothing, because the result would nest the component
inside itself. The menus still offered it.

Disable the entry for such a copy, with the same check the update applies,
in the canvas context menu and in the design tab's component menu, which
now renders disabled entries as the context menu does.

The full rebuilt frontend passes 1799 tests / 16286 assertions; backend
passes 1838 / 9293 and exporter 16 / 40. Frontend formatting passes and
lint reports no errors for the changed files.

AI-assisted-by: claude-opus-5-5
2026-10-31 13:18:11 +01:00
alonso.torres
54e4dd5a60 🐛 Read a missing grid direction as row everywhere
A grid without a direction assigned children column-first and grew rows,
while grid creation, the direction event, the WASM renderer and CSS export
read it as a row grid. The library file builder decodes the direction as
optional, so imported files can lack it. Picking "column" on such a grid
then swapped auto-placed children.

Add grid-direction, which defaults to row, and use it for cell order, track
growth, track fitting and the direction event. The generated oracle predicts
the same flow order.

The builder regressions fail three of six assertions before the fix; the
real-event component regression fails six of 293, with main and copies
grown to 3x2 instead of 2x3. Both pass unchanged after the fix, including
exact undo and redo. The fitting flow-order control's missing-direction case
now expects row order.

Full frontend passes 1798 tests / 15737 assertions; common JVM passes
2052 / 33613. Backend passes 1838 / 9293; exporter passes 16 / 40. Lint
and formatting pass for common, backend and exporter; frontend lint and
changed-file formatting pass. Common JavaScript fails only in two random-seed
component properties. Both shrunk programs fail the same way without this
change and are fixed separately.

Compare lower-quantile milliseconds with the saved baseline; keep that
baseline unchanged. The machine/JVM warning makes ratios rough. No world
is flagged.

World                      Baseline       Now    Ratio
Main into 10 copies           1.790     0.961     0.54
Main into 100 copies         15.415     8.816     0.57
Main into 1000 copies       153.086    94.309     0.62
Three nesting levels         35.215    19.435     0.55
Dependency chain             68.931    37.850     0.55
Library update               83.083    45.747     0.55
Many plain shapes             4.837     2.153     0.45
Variant switch               32.052    20.254     0.63

AI-assisted-by: claude-opus-5-5
2026-10-30 18:36:11 +01:00