409 Commits

Author SHA1 Message Date
alonso.torres
a6eff8b74e ✨ Generate pastes of copies and main shapes to the page
A paste kind joins the structure programs: the clipboard's copy of a top
copy, or of a shape a main holds, pasted at the page root. Nothing in
them leaves a copy level, so no ref is advanced. The model carries the
overrides of the copied subtree to the pasted one, as for a duplicate.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
d3aea752d6 🐛 Give a grid copy its main's tracks when syncing its main's cells
Sync adds the copies of a main's new children before it removes those of
the children the main lost. Grouping two children of a full grid main
gave each grid copy one flow child more than its cells for a moment, so
it grew a column; the removals left that column empty and the next sync
dropped it. A copy that does not override its cells now takes its main's
tracks on each axis it does not override (all of them on a reset) before
it takes its main's cells.

Benchmark (lower quantile, ms):

| world                              | baseline |     now |    mean | ratio |
|------------------------------------+----------+---------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  20.772 |  21.537 |  0.59 |
| edit-through-a-chain-of-dependents |   68.931 |  41.197 |  42.556 |  0.60 |
| library-update-into-copies         |   83.083 |  49.581 |  51.122 |  0.60 |
| main-edit-among-many-shapes        |    4.837 |   2.181 |   2.405 |  0.45 |
| main-edit-into-10-copies           |    1.79  |   1.108 |   1.158 |  0.62 |
| main-edit-into-100-copies          |   15.415 |  10.273 |  10.948 |  0.67 |
| main-edit-into-1000-copies         |  153.086 | 100.399 | 109.973 |  0.66 |
| variant-switch-into-copies         |   32.052 |  21.866 |  22.788 |  0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
bca17d5dac ✨ 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-18 10:29:49 +01:00
alonso.torres
d862f99bb9 🐛 Mark the arrangement of a laid-out copy group a transform changes
Moving a shape of a copy group that a layout places changes the group's
bounds, and the layout moves the group back: the moved shape ends where
it was and its siblings move the other way. Nothing was marked, so the
next sync put the siblings back and the user's move was lost.

When a transform moves some copy shapes of the outermost group or bool a
layout places and leaves others, every copy shape in that group now
authors its geometry. A transform of the whole group or of its board
marks nothing more. The harness model authors the same shapes, and
transforms of copy shapes in groups inside layouts are generated again.

Benchmark (lower quantile, ms):

| world                              | baseline |     now |    mean | ratio |
|------------------------------------+----------+---------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  23.506 |  23.987 |  0.67 |
| edit-through-a-chain-of-dependents |   68.931 |  40.749 |  42.565 |  0.59 |
| library-update-into-copies         |   83.083 |  49.609 |  50.752 |  0.60 |
| main-edit-among-many-shapes        |    4.837 |   2.344 |   2.551 |  0.48 |
| main-edit-into-10-copies           |    1.79  |   1.103 |   1.179 |  0.62 |
| main-edit-into-100-copies          |   15.415 |  10.109 |  10.492 |  0.66 |
| main-edit-into-1000-copies         |  153.086 | 103.527 | 107.994 |  0.68 |
| variant-switch-into-copies         |   32.052 |  21.691 |  22.453 |  0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
0a69ef65c2 🐛 Order a main grid copy's children by its cells when updating the main
An update main pushes a copy's grid direction into its main. When that
main is itself a grid copy with its own cells, sync orders its children
as they flow in those cells, but the update ordered them as the pushing
copy lists them. The next sync of that copy then reordered them with no
edit. The update now gives such a main the order of the copy's cell
flow.

Benchmark (lower quantile, ms):

| world                              | baseline |     now |    mean | ratio |
|------------------------------------+----------+---------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  21.632 |  22.076 |  0.61 |
| edit-through-a-chain-of-dependents |   68.931 |  42.236 |  44.386 |  0.61 |
| library-update-into-copies         |   83.083 |  48.557 |  51.934 |  0.58 |
| main-edit-among-many-shapes        |    4.837 |   2.443 |   2.556 |  0.51 |
| main-edit-into-10-copies           |    1.79  |   1.129 |   1.149 |  0.63 |
| main-edit-into-100-copies          |   15.415 |  10.085 |  10.387 |  0.65 |
| main-edit-into-1000-copies         |  153.086 | 101.224 | 103.687 |  0.66 |
| variant-switch-into-copies         |   32.052 |  20.846 |  21.588 |  0.65 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
6eff483b22 📎 Size the shapes of a group a layout sizes in the harness oracle
A copy bool set to fill in a grid cell is sized by the grid, and its
shapes scale with it. The oracle expected them at their main's size and
place. The shapes of a group or bool whose size a layout owns are now
sized and placed by that layout too.

Test: the-shapes-of-a-copy-bool-a-grid-fills-are-sized-with-it; shape
structure programs pass (seed 9008, 300).

Harness only; the benchmark is not run.

Also in this commit:

- Compare the corners of a masked group in any order on undo. A masked group
  takes the corners of its mask. When the mask is a bool, a sync that refits it
  computes them again from its children in any order, and the undo of that sync
  refits it the same way. The undo check already compares the corners of a bool
  in any order; a masked group now follows its mask.
- Read the size of a copy path from its bounds in the harness model. A path
  stores no width or height, so the model saw no change when a copy path that a
  layout places was resized: its place is the layout's and its size values stay
  nil. The model now reads a size change of a shape with no width from its
  bounds, and expects the resize to mark it.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
f924b93a82 📎 Pin the deferred F408 and F414 programs as tests
The two programs deferred during the variant runs pass on the current
branch with every step executed, after the round 4 fixes. Generated
tests keep them passing.

Tests: a-flipped-turned-copy-switches-without-losing-its-geometry,
a-turned-pushed-copy-made-a-variant-keeps-a-valid-file.

Harness only; the benchmark is not run.

Also in this commit:

- The harness changes that check the next commit, "Read a bool's orientation
  from its turn and flips when syncing".

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
e0e5966b7e 🐛 Carry no size a copy's layout gave it over a variant switch
A nested copy that fills its flex parent while its main is turned gets
its size from the layout. Switching it to a variant without that layout
carried the size as an override, as both mains agree on their size and
its copy chain authors a turn, so it kept the layout's size for good.

A dimension the layout of the copy gave it before the switch is no
override: the copy takes the new variant's.

Test: a-switch-carries-no-size-the-old-layout-gave-a-child.
Switch, swap, sync and golden master tests pass (215); variant programs
pass (seed 9007, 300).

Benchmark (alone):

|                             :world | :baseline |   :now |   :mean | :ratio |
|------------------------------------+-----------+--------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 | 20.013 |  20.948 |   0.57 |
| edit-through-a-chain-of-dependents |    68.931 | 39.641 |  40.924 |   0.58 |
|         library-update-into-copies |    83.083 | 50.865 |  52.074 |   0.61 |
|        main-edit-among-many-shapes |     4.837 |  2.536 |   3.259 |   0.52 |
|           main-edit-into-10-copies |      1.79 |   1.04 |   1.067 |   0.58 |
|          main-edit-into-100-copies |    15.415 |  9.946 |  10.414 |   0.65 |
|         main-edit-into-1000-copies |   153.086 | 99.227 | 101.039 |   0.65 |
|         variant-switch-into-copies |    32.052 | 21.451 |  24.531 |   0.67 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:49 +01:00
alonso.torres
6f7a77504f 📎 Model an authored size through its parent's later resizes
A nested copy in a main that authors its height and scales vertically
has its height scaled when an update main resizes that main. The model
kept only the size as authored, as the copy's place in a plain main is
not an override, and compared it raw. An authored size now follows its
parent's later resizes through its constraints, though its place stays
unauthored.

Test: an-authored-size-follows-a-resize-of-its-main-through-its-constraint.
Structure, swap and scale programs pass (seed 9006, 150 each).

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
782623c935 🐛 Give a grid copy's children free cells in the order of their mains
A grid copy that authors its cells gives its children without a cell
free cells at sync. It took them in the copy's order of its children,
which grid reordering changes, so a child given back by a shrunk track
and a child new from the main could take each other's cells. They now
take free cells in the order of the main shapes they refer to, as sync
adds children.

Test: a-grid-copy-gives-free-cells-to-children-in-their-main-order.
Grid, sync and golden master tests pass (399).

Benchmark (alone):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |   21.19 |   22.83 |    0.6 |
| edit-through-a-chain-of-dependents |    68.931 |  42.408 |  44.279 |   0.62 |
|         library-update-into-copies |    83.083 |  53.897 |  55.394 |   0.65 |
|        main-edit-among-many-shapes |     4.837 |   2.367 |   2.548 |   0.49 |
|           main-edit-into-10-copies |      1.79 |   1.031 |   1.103 |   0.58 |
|          main-edit-into-100-copies |    15.415 |  10.483 |  10.835 |   0.68 |
|         main-edit-into-1000-copies |   153.086 | 100.626 | 107.239 |   0.66 |
|         variant-switch-into-copies |    32.052 |  23.355 |  23.926 |   0.73 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
73b4e0795b 🐛 Grow a track for a grid copy's new child and keep it at sync
A grid copy that authors its cells and has no free cell for a child its
main gains grew a column for it at the first sync. The next sync gave
the copy its main's columns again, took the grown column for a shrunk
inherited track, and fitted the child back into the inherited tracks,
stacking it in another child's cell.

When a copy's inherited tracks shrink, its default cells past them
(automatic, single, aligned by default) give their children back, which
take a free slot or a track the grid grows for them, as when they first
came. Cells with something of their own are fitted as before, and the
overflow is no longer fitted back into the inherited tracks. The grid
model does the same, and the oracle accepts the default tracks a grid
grows along its flow past its main's.

Tests: a-grid-copy-with-its-own-cells-grows-a-column-for-a-new-child-for-good,
a-grid-copy-keeps-an-aligned-cell-its-main-takes-a-column-from,
a-grid-copy-keeps-its-aligned-cell-when-its-main-adds-a-row.
Grid, sync and golden master tests pass (315); grid programs pass
(seed 9004, 300).

Benchmark (alone; a first run under load read 1.09 for the variant
switch world, which F526 does not reach):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  23.132 |  28.537 |   0.66 |
| edit-through-a-chain-of-dependents |    68.931 |  47.053 |  57.855 |   0.68 |
|         library-update-into-copies |    83.083 |  55.445 |  64.964 |   0.67 |
|        main-edit-among-many-shapes |     4.837 |   3.117 |   3.305 |   0.64 |
|           main-edit-into-10-copies |      1.79 |   1.169 |   1.544 |   0.65 |
|          main-edit-into-100-copies |    15.415 |  13.442 |  14.626 |   0.87 |
|         main-edit-into-1000-copies |   153.086 | 119.198 | 141.449 |   0.78 |
|         variant-switch-into-copies |    32.052 |  25.091 |  29.622 |   0.78 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
e22ca8b7ce 📎 Compare groups and bools and their shapes by corners in the harness
A bool's stored flip flags and transform drift apart, so neither sync
nor the model can read its orientation. The model and the oracle now
compare a group or bool, and the shapes it holds, by their corners in
any order, without their turn and flips, whether or not the authored
values record corners. Their corners are ordered by angle around their
centre: an order by position to the hundredth of a pixel swapped the
corners of an empty bool, 0.01 px wide, with float noise.

Resizing a copy bool after its main was flipped leaves settled and
fully synced files apart (F518, deferred until a bool keeps a reliable
orientation); the generator skips resizes of copy bools until then.

Tests: a-copy-bool-and-its-shapes-are-compared-by-their-corners,
an-empty-bool-in-a-copy-keeps-its-corners-in-one-order.

Harness only; the benchmark is not run.

Also in this commit:

- Leave a group's flip flags out of the harness undo check. Undoing a text style
  edit fits the group around the text again, and fitting a group clears its flip
  flags by design, though its corners and transform still show the flip. The
  undo check now leaves the flip flags of groups and bools out and compares
  their corners.
- Round corner angles before they wrap in the harness corner order. The harness
  orders the corners of groups, bools and their shapes by angle around their
  centre. A corner level with the centre, as in a square turned 45 degrees, fell
  at 0 or just under a full turn as noise fell, and its order flipped. Angles
  are now rounded before they wrap.
- Read the size of a bool from its selrect in the update main check. The harness
  check of an update main compared the sizes of the parent of a pushed shape by
  their width and height, and crashed when that parent was a bool, which has no
  width or height of its own. Sizes are read from the selrect.
- Order the corners of groups in the harness design snapshot. The settled and
  fully synced files of a bool made in a variant main whose copies are turned
  differed only by noise: up to 5e-6 px in the bool, which computes its geometry
  in single precision. But the design snapshot ordered only a bool's corners,
  not a group's, and the angle order, to the millionth of a radian, flipped a
  corner level with the bool's centre under that noise.
- Author no size for a swapped head a layout places in the harness. Switching a
  nested head in a filling grid copy to a wider variant grows the grid. The
  model took the grown copy for a sync resize and made the untouched swapped
  head author the size the resize gives it, though the layout sizes it, not its
  constraints. Heads a layout places are left out.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
fa1edc78bd 📎 Place a group's shapes from its board when the harness orients them
Flipping the mask of a mask group in a copy makes the group follow it.
The model applied the mask's change twice, as the modifier tree passes
a mask's change to its group and back, and when the group's orientation
changed it placed the mask's authored geometry in the group, whose
bounds come from that mask, halving it.

The requested geometry of a group's mask applies its change once, and
authored geometry under a group or bool follows the board around it
when its parent's orientation changes, as elsewhere in the model.

Test: flipping-the-mask-of-a-copy-group-flips-the-group-for-good;
shape structure programs pass (seed 9002, 300).

Harness only; the benchmark is not run.

Also in this commit:

- Compare a bool by its children, not its segments, when checking undo. Undoing
  an update main that pushed a flip into a main holding a bool gives the bool
  back the same rectangle with its segments drawn the other way round. A bool
  computes its segments from its children, in an order that depends on how it
  computed them.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
8c2ef98bb2 🐛 Fit a copy's masked group to its mask whenever sync changes it
A masked group takes all its geometry from its mask. When the mask of a
group in a copy authors a flip, the untouched group follows it; a later
sync gave the group its main's unflipped geometry, apart from its mask.

A masked group whose geometry sync changes in any way carries nothing
and takes its mask's geometry again, as a group a sync moves or resizes
fits its shapes again.

Test: flipping-the-mask-of-a-copy-group-flips-the-group-for-good.

The benchmark of the previous commit covers this one.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
fb24f8c19e 🐛 Count a copy bool that mirrors apart from its main as moved
A bool keeps its corners in one order whatever its flips. Sync places
the shapes of a copy shape that authors its geometry like it only when
its geometry differs from its main's, so a flipped bool in a copy
looked like its main, and sync gave its shapes their main's unflipped
geometry.

A group or bool also differs from its main when it mirrors differently,
read from its transform.

Test: syncing-the-shapes-of-a-flipped-copy-bool-keeps-them-flipped.

Benchmark (alone, shared with the next commit):

|                             :world | :baseline |   :now |   :mean | :ratio |
|------------------------------------+-----------+--------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 | 20.498 |  21.134 |   0.58 |
| edit-through-a-chain-of-dependents |    68.931 | 40.257 |  42.557 |   0.58 |
|         library-update-into-copies |    83.083 | 51.433 |  52.577 |   0.62 |
|        main-edit-among-many-shapes |     4.837 |  2.145 |   2.365 |   0.44 |
|           main-edit-into-10-copies |      1.79 |  1.012 |   1.093 |   0.57 |
|          main-edit-into-100-copies |    15.415 | 10.535 |  10.754 |   0.68 |
|         main-edit-into-1000-copies |   153.086 |  99.04 | 105.491 |   0.65 |
|         variant-switch-into-copies |    32.052 | 22.662 |  23.464 |   0.71 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
c1778338e4 🐛 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-18 10:29:48 +01:00
alonso.torres
f6d4e5dcd5 🐛 Unmask copies without overriding them when a main loses its mask
Removing the mask shape of a masked group in a main unmasks the group.
The deletion reaches the copies through the same deletion, which
ignores touched groups, but the step that unmasks a group that lost its
mask did not, so every copy's group came out unmasked and marked as
overriding its mask.

The unmask follows the deletion's ignore-touched option.

Test: removing-the-mask-of-a-main-unmasks-its-copies-without-overriding-them.

Benchmark (alone, shared with the next commit):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.715 |  24.396 |   0.62 |
| edit-through-a-chain-of-dependents |    68.931 |  48.192 |  53.222 |    0.7 |
|         library-update-into-copies |    83.083 |  50.508 |  52.972 |   0.61 |
|        main-edit-among-many-shapes |     4.837 |   2.345 |   2.775 |   0.48 |
|           main-edit-into-10-copies |      1.79 |   1.172 |   1.479 |   0.65 |
|          main-edit-into-100-copies |    15.415 |  11.582 |  13.079 |   0.75 |
|         main-edit-into-1000-copies |   153.086 | 102.539 | 133.903 |   0.67 |
|         variant-switch-into-copies |    32.052 |  22.204 |  24.303 |   0.69 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
c9683d7398 🐛 Place the shapes of a copy group in its board when detaching
A detach advances the references of the nested copies and makes
authored the place of a shape its new main would put elsewhere. It
measured the shapes of a group or bool from the group, whose bounds
differ from its main's when one of its shapes authors a move, so it
authored places nothing had moved, and authored the group's own
geometry for the same reason.

The shapes of a group or bool are measured in the board around it, as
a group takes its bounds from its shapes, and a group or bool never
authors its geometry there. The harness model does the same.

Test:
detaching-keeps-a-shape-of-a-copy-bool-unauthored-where-its-main-places-it.
Shape structure programs pass (seed 9001, 150).

The benchmark of the commit before the previous one covers this one.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
97d0ed02c3 🐛 Keep the ids of the cells a copy's own grid tracks add
A copy that authors a grid column its main lacks takes its main's cells
fitted to its own tracks. The fitting gave the cell of that column a new
id at every sync, so the copies that follow it took a new id each time,
while one that authors its own cells kept the old one.

The cells a copy's own tracks add keep the ids of its cells in the same
place.

Test: syncing-a-copy-with-its-own-columns-keeps-the-ids-of-their-cells.
Focused grid, sync and golden master tests pass (315 tests).

The benchmark of the previous commit covers this one.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
f8272d89b1 🐛 Fit a group again when undoing the sync of its attributes
An update main that pushes a turn into a main holding a group turns the
group and its shapes. Its undo restores the shapes first and fits the
group around them while the group still has the turned transform, which
writes the turned bounds into its width and height; the group's own undo
then restores only the attributes the update main changed, so the group
kept the turned size.

The undo of a shape's synced attributes fits the shape itself, after its
own undo, as well as its parents; only groups and bools are fitted.

Test: undoing-an-update-main-that-turns-a-group-gives-the-group-its-size-back.
Focused sync, undo, group and golden master tests pass.

Benchmark (alone, shared with the next two commits):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |   20.59 |  22.349 |   0.58 |
| edit-through-a-chain-of-dependents |    68.931 |  41.197 |   42.87 |    0.6 |
|         library-update-into-copies |    83.083 |  50.286 |  53.679 |   0.61 |
|        main-edit-among-many-shapes |     4.837 |   2.582 |   3.885 |   0.53 |
|           main-edit-into-10-copies |      1.79 |   1.132 |    1.22 |   0.63 |
|          main-edit-into-100-copies |    15.415 |  10.634 |  11.318 |   0.69 |
|         main-edit-into-1000-copies |   153.086 | 100.406 | 125.813 |   0.66 |
|         variant-switch-into-copies |    32.052 |  21.303 |  22.718 |   0.66 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
47603c4aa9 ✨ 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-18 10:29:48 +01:00
alonso.torres
6a5aa99f79 🐛 Keep the geometry a shape in a copy group authors through sync
When a shape in a group of a copy authors a move or a resize, the
untouched group's bounds follow it. Sync moved or resized the group
back to its main's bounds and carried its whole subtree with it, so the
shape lost the geometry it authored.

A group or bool takes its bounds from its children, which sync places
one by one: a move or resize of its bounds now carries nothing, and the
group fits its children again. A turn or flip still carries the subtree.

Tests: syncing-a-copy-group-keeps-the-place-its-shape-authors,
syncing-a-copy-group-keeps-the-size-its-shape-authors,
undoing-a-turn-of-a-copy-group-gives-the-groups-of-its-copies-their-bounds-back.
The full common suite passes.

The benchmark of the previous commit covers this one.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
2abe61e181 🐛 Read whether a group mirrors from its transform when syncing
A group takes its bounds from its children and resets its flip flags
while its transform keeps the mirror. Sync turns and flips the children
of a copy shape like the shape, composing the flips of the copy and of
its main through their flags, so a flipped group in a copy gave its
children a mirroring transform stored as a half turn without flips.

Sync reads whether a group or bool mirrors from its transform.

Test: syncing-the-shapes-of-a-flipped-copy-group-keeps-them-flipped.
The full common suite passes.

Benchmark (alone, shared with the next commit):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  24.408 |  25.288 |   0.69 |
| edit-through-a-chain-of-dependents |    68.931 |  49.305 |  51.709 |   0.72 |
|         library-update-into-copies |    83.083 |  57.405 |  59.433 |   0.69 |
|        main-edit-among-many-shapes |     4.837 |   2.779 |   2.943 |   0.57 |
|           main-edit-into-10-copies |      1.79 |   1.176 |   1.221 |   0.66 |
|          main-edit-into-100-copies |    15.415 |  11.968 |   13.13 |   0.78 |
|         main-edit-into-1000-copies |   153.086 | 121.213 | 125.656 |   0.79 |
|         variant-switch-into-copies |    32.052 |  24.938 |   26.57 |   0.78 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
310dac9e42 ✨ Generate border radius tokens in component histories
The random histories never applied a design token. The token programs
give the file an active set of three border radius tokens and add token
steps: apply a token to every corner of a rectangle or board, main or
copy; take one off; set a corner's radius by hand, which takes its token
off; and edit a token's value, which sets it on every shape that applies
it, without touching, as the token editor and its propagation do.

The model learns what tokens change:
- the tokens of a shape's corners go with its radius group, so a copy
  that applies or takes off a token authors its radius;
- a token edit sets the authored corners that apply it; a token names
  the corners as a flipped shape shows them, so they are set mirrored;
- a switch carries each corner's token, or its lack of one, with its
  radius.
The undo and redo checks compare the tokens library by its exported
content, as undo gives it back with new modification times. The golden
master of case AY is recorded again for that: its token library is now
written as that content, key by key, with the same values.

A token edit does not reach the shapes deleted components store, so a
copy of a deleted main loses the edit at its next sync; no token edit is
made while a deleted component stores a shape that applies the token.

Tests: random-token-compositions, 200 programs pass;
a-token-edit-sets-the-corners-of-a-flipped-copy-as-it-shows-them,
switching-a-copy-carries-the-radius-tokens-it-applied,
switching-a-copy-carries-each-corner-token-with-its-radius.

Harness only; the benchmark is not run.

Also in this commit:

- Leave undone creations out of the harness sync comparisons. Undoing a new
  variant set leaves its component deleted, its stored objects holding the
  nested copies as they were. Undoing an earlier edit of a main restores the
  main, but an undo starts no sync, so those stored copies keep the edit. Only
  redo brings that component back, and redo restores the edit first, so no user
  sees them. The I5 and I6 checks compare the settled file with a full sync,
  which rewrites them.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
0009acf42d 🐛 Check a switched head's kept place through its own constraints
A nested copy head in a copy that is resized apart from its main keeps
its place as authored geometry when its constraint changes. Switching it
keeps that place and, keeping the touched groups, its constraints, but
the switch compared the place with its position placed through the
main's own constraints. Where the two matched it dropped the geometry
override, and the next sync of its parent moved the head through the
constraints it carries.

When a switch keeps the touched groups and the head authored its
constraints, the kept place is compared with its position placed
through those constraints, as sync places it. The harness model does
the same.

Test: switching-a-copy-head-keeps-the-place-its-own-constraint-kept.
Focused switch, swap and composable tests pass (288 tests).

Benchmark (alone):

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |   23.06 |  29.353 |   0.65 |
| edit-through-a-chain-of-dependents |    68.931 |  46.664 |  61.416 |   0.68 |
|         library-update-into-copies |    83.083 |  49.118 |  51.106 |   0.59 |
|        main-edit-among-many-shapes |     4.837 |   2.744 |   3.366 |   0.57 |
|           main-edit-into-10-copies |      1.79 |   1.306 |    2.48 |   0.73 |
|          main-edit-into-100-copies |    15.415 |   11.34 |  12.203 |   0.74 |
|         main-edit-into-1000-copies |   153.086 | 130.776 | 191.745 |   0.85 |
|         variant-switch-into-copies |    32.052 |  22.084 |  26.522 |   0.69 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
dc485e2e08 🐛 Give the groups around a new bool the bounds of its result
A group takes its bounds from its children. Creating a bool inside a
group left the group with its old bounds, though the bool's result can
be smaller: a difference of a 12 px shape and a 20 px one inside a 30 px
group kept the group at 30 px in the main, while sync gave the copies'
groups the bool's 12 px. Creating a bool now refreshes the groups around
it, as masking does.

Tests: a-bool-made-in-a-group-gives-the-group-its-bounds;
a-bool-made-in-a-main-group-gives-the-copy-groups-its-bounds (the shape
structure program of gate seed 660536824).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), with a
3 GB heap, alone:
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.558 |  23.752 |   0.61 |
| edit-through-a-chain-of-dependents |    68.931 |  43.004 |  48.489 |   0.62 |
|         library-update-into-copies |    83.083 |  50.926 |  53.941 |   0.61 |
|        main-edit-among-many-shapes |     4.837 |   2.427 |   2.862 |    0.5 |
|           main-edit-into-10-copies |      1.79 |   1.121 |   1.214 |   0.63 |
|          main-edit-into-100-copies |    15.415 |  10.652 |  11.179 |   0.69 |
|         main-edit-into-1000-copies |   153.086 | 105.051 | 119.813 |   0.69 |
|         variant-switch-into-copies |    32.052 |  23.083 |  25.483 |   0.72 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
bc5eb3f15c 📎 Read groups and bools in copies by their corners and their board
A group or bool takes its corners from its children, so its stored turn
and flips say nothing its corners do not: the oracle failed a copy group
whose main turned for a flip flag at its expected corners. It no longer
compares a group's or bool's turn and flips once its corners match. And
the oracle placed a copy child of a bool from the bool's stored transform,
which need not carry the bool's flip; it now places children of groups
and bools from the board around them, as the snapshot measures them.

Tests (programs of the shape structure property):
a-copy-group-whose-main-turns-matches-its-corners-whatever-its-flips;
a-copy-shape-in-a-bool-takes-its-place-from-its-board-when-the-main-flips.
Harness only; the benchmark is not run.

Also in this commit:

- Allow a group's recomputed bounds the bool tolerance when checking undo. A
  group computes its bounds again from its children, as a bool does: undoing an
  unmask gave a turned mask group 0.01 high its bounds back about 1e-6 apart,
  beyond the undo check's 1e-10. A group now takes the 1e-4 tolerance of bools
  and paths.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
3d1ea0b599 🐛 Scale the shapes of a bool with it, as a group's
A resize reaches the shapes of a group or bool through their constraints,
and a bool takes its bounds from its shapes. Grouping sets its shapes'
constraints to scale for this, but creating a bool kept theirs: a bool
made of a shape constrained to the left could not be resized, since its
shape kept its width and the bool its bounds. A bool now sets the
constraints of its shapes to scale, as a group does.

Test: resizing-a-bool-resizes-the-shapes-it-combines (found by a shape
structure program of seed 498).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), with a
3 GB heap while a second devenv ran on the machine; no benchmark world
creates a bool, and the two higher ratios are that load:
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.819 |  24.186 |   0.62 |
| edit-through-a-chain-of-dependents |    68.931 |  49.562 |  52.525 |   0.72 |
|         library-update-into-copies |    83.083 |  57.254 |   63.14 |   0.69 |
|        main-edit-among-many-shapes |     4.837 |   2.973 |   3.289 |   0.61 |
|           main-edit-into-10-copies |      1.79 |   1.551 |   2.602 |   0.87 |
|          main-edit-into-100-copies |    15.415 |  15.578 |   24.16 |   1.01 |
|         main-edit-into-1000-copies |   153.086 | 107.415 | 126.523 |    0.7 |
|         variant-switch-into-copies |    32.052 |   25.21 |  26.393 |   0.79 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
a1339154cb 📎 Compare the corners of a bool in any order when checking undo
A bool computes its corners again from its shapes, so the same bounds can
come back in another order: undoing an edit left two flipped copy bools
with their corners listed the other way round, and the undo check took it
for a change. The undo check now compares a bool's corners in any order,
as the oracle already does.

Test: undoing-an-edit-compares-the-corners-of-a-copy-bool-in-any-order
(a shape structure program of seed 489).
Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
17539d9f0e 🐛 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-18 10:29:48 +01:00
alonso.torres
e595ac8b0b 🐛 Keep an empty bool at its place when its geometry updates
A bool whose shapes do not intersect has no content. Its geometry took
the bounds of empty content, a rect at the page origin, and turned it
about its old center with the bool's transform: a bool turned 180° moved
to twice its center at each update, so in a grid copy turned that way it
ran away and the layout moved its shapes after it. A shape with no
content now keeps its center.

Tests: an-empty-turned-shape-keeps-its-place-when-its-geometry-updates;
settling-a-bool-in-a-grid-copy-twice-keeps-its-shapes-in-place (the
shape structure program that found it).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), measured
with the next 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-18 10:29:48 +01:00
alonso.torres
3b8a2ce11a 📎 Anchor the geometry a switch carries to its new parent in the model
The model records an authored geometry with the parent it sits in, so a
later resize of that parent moves and sizes it through its constraints,
as production does. The geometry a switch carries into the new copy was
recorded without it: after a variant main shrank, the switched copy's
child, which authors its geometry and stretches left and right, followed
its parent in production while the model kept its old width. A carried
geometry below the head now records its new parent.

Test (the stale gate program of seed 175377838):
resizing-a-variant-main-resizes-a-switched-copy-child-through-its-constraint
Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
2588315b9a 🐛 Keep the pushed size of a swap head whose copy authors its geometry
An update main that pushes a copy's swap into a copy inside the main
makes the head a plain copy of its position when both have the same
component, and gives it the position's size unless the replaced child
authored its geometry. A head whose copy authored its own geometry took
that touched group into the main but the position's size, so the main
kept a geometry override it did not hold. Such a head now keeps the size
it pushes.

Test: updating-a-main-after-a-reset-keeps-the-size-a-switch-gave-the-copy
(the scale gate program of seed 175377838).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |   :now |   :mean | :ratio |
|------------------------------------+-----------+--------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 | 20.374 |  21.102 |   0.58 |
| edit-through-a-chain-of-dependents |    68.931 |  40.71 |  44.564 |   0.59 |
|         library-update-into-copies |    83.083 | 48.986 |  51.548 |   0.59 |
|        main-edit-among-many-shapes |     4.837 |  2.255 |   2.557 |   0.47 |
|           main-edit-into-10-copies |      1.79 |  0.987 |   1.028 |   0.55 |
|          main-edit-into-100-copies |    15.415 | 10.394 |  10.601 |   0.67 |
|         main-edit-into-1000-copies |   153.086 | 99.622 | 102.888 |   0.65 |
|         variant-switch-into-copies |    32.052 | 21.928 |  23.985 |   0.68 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
f901d6974d 🐛 Keep on the copy the layout child overrides a pushed swap holds
Under a main parent with no layout, an update main leaves on the copy the
layout child attributes it authored, as no layout parent uses them. An
update main that pushes a swap adds the copy's subtree to the main
instead, with every override it holds, so a maximum width a copy shape
authored under the swapped board moved to the main. Pushing a swap now
keeps those overrides on the copy shapes and off the new main shapes, as
pushing a pair does.

Test: updating-a-main-keeps-the-max-width-override-a-switched-copy-holds
(the variant gate program of seed 175377838).

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.071 |  22.737 |    0.6 |
| edit-through-a-chain-of-dependents |    68.931 |  44.394 |   45.61 |   0.64 |
|         library-update-into-copies |    83.083 |  53.752 |  54.632 |   0.65 |
|        main-edit-among-many-shapes |     4.837 |   2.372 |   2.633 |   0.49 |
|           main-edit-into-10-copies |      1.79 |   0.997 |   1.029 |   0.56 |
|          main-edit-into-100-copies |    15.415 |  10.009 |  11.143 |   0.65 |
|         main-edit-into-1000-copies |   153.086 | 109.767 | 112.342 |   0.72 |
|         variant-switch-into-copies |    32.052 |  22.182 |  23.614 |   0.69 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
ed1dbca6da 🐛 Keep the fill sizing of a shape an update main leaves absolute
An update main that resizes a main shape a layout fills fixes its sizing,
so the layout does not undo the pushed size; for a shape that is not a
layout, that drops the sizing. A copy child made absolute pushed its
absolute flag and its width, so its main shape came out absolute without
the fill sizing the copy keeps. No layout fills an absolute shape: a fill
axis of a shape the push leaves absolute now keeps its sizing.

Test: updating-a-main-keeps-the-fill-sizing-its-child-authors (the
library gate program of seed 175377838).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), measured
with the next commit's change in the tree as well:
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.071 |  22.737 |    0.6 |
| edit-through-a-chain-of-dependents |    68.931 |  44.394 |   45.61 |   0.64 |
|         library-update-into-copies |    83.083 |  53.752 |  54.632 |   0.65 |
|        main-edit-among-many-shapes |     4.837 |   2.372 |   2.633 |   0.49 |
|           main-edit-into-10-copies |      1.79 |   0.997 |   1.029 |   0.56 |
|          main-edit-into-100-copies |    15.415 |  10.009 |  11.143 |   0.65 |
|         main-edit-into-1000-copies |   153.086 | 109.767 | 112.342 |   0.72 |
|         variant-switch-into-copies |    32.052 |  22.182 |  23.614 |   0.69 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
e766345cd0 🐛 End the swap of a nested swapped shape a kept swap points at its component
A switch that keeps a copy's swapped child in place of the new copy's
child makes it a plain copy of its new position when both have the same
component, and points its descendants at the position's descendants. A
swapped shape among those descendants kept its swap though its new
reference had its own component, as a plain copy of it does: a copy
switched to a variant whose nested board its main had swapped to that
same component stayed marked as swapped, while the variant's other
copies were not. Such a descendant now drops its swap as well.

Test: switching-a-copy-takes-the-swap-of-a-nested-board-from-its-main
(the variant program of the common suite's seed 1794464684740).

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |   21.57 |  22.621 |   0.61 |
| edit-through-a-chain-of-dependents |    68.931 |   43.16 |  45.931 |   0.63 |
|         library-update-into-copies |    83.083 |  53.172 |  58.967 |   0.64 |
|        main-edit-among-many-shapes |     4.837 |   2.439 |    2.93 |    0.5 |
|           main-edit-into-10-copies |      1.79 |    1.12 |    1.22 |   0.63 |
|          main-edit-into-100-copies |    15.415 |  10.261 |  11.179 |   0.67 |
|         main-edit-into-1000-copies |   153.086 | 102.918 | 110.051 |   0.67 |
|         variant-switch-into-copies |    32.052 |  23.136 |  24.466 |   0.72 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
59e8da6070 🐛 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-18 10:29:48 +01:00
alonso.torres
8bf641ee81 🐛 Keep the geometry of a swapped shape a pushed swap carries
An update main that pushes a copy's swap into a copy inside the main
places the pushed shapes like the shape the head takes the place of.
That placement holds every shape of the main's page, and a pushed shape
followed any entry its reference names: a swapped board inside the
pushed swap took the size of the board it replaced, and its children
the place of their own component's main children, at the page origin.
The subtree of a swapped shape now keeps its pushed geometry, as the
subtree of a shape that authors its geometry does.

Test: updating-a-main-pushes-a-swapped-shape-nested-in-a-swap-with-its-children
(the scale gate program of seed 660536824).

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.827 |  22.409 |   0.62 |
| edit-through-a-chain-of-dependents |    68.931 |  45.406 |  46.777 |   0.66 |
|         library-update-into-copies |    83.083 |  56.396 |   58.29 |   0.68 |
|        main-edit-among-many-shapes |     4.837 |   2.456 |   2.809 |   0.51 |
|           main-edit-into-10-copies |      1.79 |   1.143 |   1.177 |   0.64 |
|          main-edit-into-100-copies |    15.415 |   11.12 |  11.591 |   0.72 |
|         main-edit-into-1000-copies |   153.086 | 111.472 | 118.427 |   0.73 |
|         variant-switch-into-copies |    32.052 |  22.527 |  23.487 |    0.7 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
d5cdebc478 🐛 Fit the cells a copy takes from its main within its own tracks
A copy that authors its track lists keeps them when its main adds or
removes tracks, but sync gave it its main's cells as they were: after
the main added a column, a copy with two columns of its own held a cell
in a third. A copy whose track counts differ from its main's now fits
the main's cells within its own tracks as the contract keeps cells when
tracks shrink (move, shorten or join), and the oracle expects the same.

Test: a-copy-with-its-own-columns-takes-its-main-cells-within-them (the
grid gate program of seed 175377838).
Common suite: as the previous commit.

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 |   22.04 |   22.52 |   0.63 |
| edit-through-a-chain-of-dependents |    68.931 |  43.463 |   44.28 |   0.63 |
|         library-update-into-copies |    83.083 |  48.024 |  50.138 |   0.58 |
|        main-edit-among-many-shapes |     4.837 |   2.247 |   2.418 |   0.46 |
|           main-edit-into-10-copies |      1.79 |    1.06 |   1.078 |   0.59 |
|          main-edit-into-100-copies |    15.415 |  10.242 |  11.303 |   0.66 |
|         main-edit-into-1000-copies |   153.086 | 110.068 | 112.273 |   0.72 |
|         variant-switch-into-copies |    32.052 |  22.921 |  23.391 |   0.72 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
9e2a50da3c 🐛 Keep the layout's place and sizes out of a detach's kept geometry
A detach advances the references of nested copies, and marks the
geometry of one authored when its new main would place it elsewhere. For
a nested copy a layout places, that compared the place and the sizes
the layout gives it: a grid that starts its tracks at 0.01 px, or a copy
that fills its grid, made its geometry an override, while the contract
keeps the place of a layout child and the sizes it fills or hugs the
layout's. Such a copy now keeps as authored only an orientation or a
size of its own, leaving out the dimensions its layout gives it, and the
model checks the same.

Tests: detaching-after-a-main-adds-a-row-leaves-the-copy-boards-unauthored
(the grid gate program of seed 673701779) and
detaching-keeps-unauthored-a-nested-copy-a-grid-fills (a random grid
program of the common suite).
Common suite: 2466 tests; only the open red tests and a new random shape
structure case (F488 family) fail.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile), measured
with the next commit's change in the tree as well:
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |   22.04 |   22.52 |   0.63 |
| edit-through-a-chain-of-dependents |    68.931 |  43.463 |   44.28 |   0.63 |
|         library-update-into-copies |    83.083 |  48.024 |  50.138 |   0.58 |
|        main-edit-among-many-shapes |     4.837 |   2.247 |   2.418 |   0.46 |
|           main-edit-into-10-copies |      1.79 |    1.06 |   1.078 |   0.59 |
|          main-edit-into-100-copies |    15.415 |  10.242 |  11.303 |   0.66 |
|         main-edit-into-1000-copies |   153.086 | 110.068 | 112.273 |   0.72 |
|         variant-switch-into-copies |    32.052 |  22.921 |  23.391 |   0.72 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
a64ea2121c ✨ Generate group, mask, bool and path edits inside mains
The random histories never changed the structure of the shapes a main
holds. The shape structure programs add a structure edit on a shape a
main holds, and its next sibling: group, mask, unmask, combine into a
bool of each type, or convert to a path, through the changes of
app.common.logic.groups and app.common.logic.bool the workspace events
commit, and the frontend's path conversion without the WASM renderer.
Ungrouping, and grouping that takes every child out of a group, stay out
until copies follow the removal of a shape their main holds.

The oracle and the model learn the shapes these edits make:
- bools and paths keep their bounds in their selrect only, which the
  geometry checks read when a shape has no box of its own;
- path segments compare within the geometry tolerance, and the design
  snapshot leaves out a bool's segments, which it computes from its
  children in an order that depends on how it was computed;
- children of groups and bools measure from, and anchor authored places
  to, the board around them, as a group's bounds come from its children;
- differing flip flags count only when the ordered corners differ too;
- undo and redo compare geometry within 1e-10, and bool and path
  geometry within 1e-4, as a group computes its geometry again from its
  children and a path stores its segments in single precision.
Transforms of copy shapes inside groups and bools stay out until the
oracle places them.

Test: random-shape-structure-compositions.
Focused only; the full common suite runs at the end of this series.

Harness only; the benchmark is not run.

Also in this commit:

- Count differing flip flags unless they decompose the same corners. The shape
  structure gates ignored differing flip flags whenever the ordered corners
  matched, so a shape whose flags disagree with its own transform passed as well
  (both-flags-and-a-half-turn-equal-neither). Flags count now unless the corners
  match and the shape's flags and rotation decompose its transform, so they
  store the same transform otherwise.
- Resize the groups around a shape the harness transforms. The frontend's
  transform resizes the groups around the shapes it changes (reg-objects,
  pcb/resize-parents); the harness transform did not, so a main's group kept the
  bounds of a child it moved while sync gave its copies' groups bounds from
  their children, and the oracle found them apart. The harness transform resizes
  the parents too.
- Reflow layouts only after the structure edits whose events do. The structure
  node reflowed the layouts of the parents after every edit, but the workspace
  events update layouts only after grouping, masking and ungrouping; unmasking,
  creating a bool and converting to a path do not. The extra reflow left an undo
  that did not give back the place of the children of a mask unmasked in a flex
  main. The node reflows as the events do.
- Compare the corners of a bool in any order. A bool computes its points from
  its segments, so their order follows the path, not the transform: a flipped
  main gave its copies' bools the same corners in another order, which the
  geometry check and the design snapshot read as another place. Both compare a
  bool's corners in a sorted order.
- Check only the first corner of a place whose size a layout gives. The model
  checks an authored place by the corners of the shape placed in its parent, but
  leaves out the dimensions a layout gives it. A moved copy whose main came to
  hug its grid took the hugged width from its layout and kept its first corner,
  yet the corner check compared all four corners with the authored width. With a
  size the layout gives, only the first corner is checked, which a layout resize
  keeps.
- Sort the corners of a bool by their rounded position. Sorting a bool's corners
  by their raw coordinates swapped two corners whose x differed only by noise,
  so two equal bools compared apart. The corners sort by position rounded to the
  hundredth of a pixel.
- The harness changes that check the next commit, "Keep the layout's place and
  sizes out of a detach's kept geometry".

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
61b52860e5 🐛 Give a bool created in a grid the cell of the shape it replaces
Creating a bool from shapes in a grid board left the bool without a grid
cell: the JVM layout read the cell of a missing row and threw, and the
frontend laid the bool out in no cell. A group takes the cell of its
last shape and reassigns its grid's cells; the bool now takes the cell
of the shape whose place it takes in the parent, and the grid parents of
its shapes reassign their cells.

Test: a-bool-in-a-grid-takes-the-cell-of-its-last-shape (found by the new
shape structure gate).
Focused: groups-test, 6 tests, 0 failures; the full common suite runs at
the end of this series.

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-18 10:29:48 +01:00
alonso.torres
a9357626ac ♻️ 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-18 10:29:48 +01:00
alonso.torres
ecea59761f ✨ Generate edits of grid tracks in component histories
The random histories edited a grid's direction and its cells, but never
its rows and columns. The grid programs build worlds whose first
component is a grid, with copies in grids, and add a track edit: add,
remove, resize or reorder a row or column, or merge a cell into an area,
through the production grid functions the frontend's track editor calls.
A main edits all of them; a copy only resizes its tracks, so the edits
that move cells reach copies through sync from their main.

The model takes the tracks an edit asks for and the default tracks a grid
grows after them to hold children that lose their cells. When a copy's
inherited tracks shrink, the cells it authors move, shorten or join as
the contract keeps them (move into a free slot, else into one track,
else into the cell where they would start).

Test: random-grid-compositions; 200 programs pass.
Focused only; the full common suite runs at the end of this series.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
a871ea42a0 ✨ 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-18 10:29:48 +01:00
alonso.torres
230dc0b4c2 🐛 Author the size a sync resize gives a swapped head
When sync resizes a copy parent, sync-descendant-orientation places its
subtree through constraints, which scales an untouched swapped head with
a scale constraint. Update-swapped-placement then only moves the head, so
a later sync of every component gave it back the size of its own main:
the result depended on the order of the syncs. Sync cannot tell a main
change from a reset of a copy sized apart from its main, which must scale
the head back (#12716), as it never sees the main's earlier size. The
resize now marks the geometry group of an untouched swapped head it gives
another size, so later syncs keep that size. The composable model records
the same: a swapped head without authored geometry whose copy parent and
own size both change in a step authors its new geometry in that parent.

Test: syncing-a-resized-copy-parent-authors-the-size-it-gives-a-swapped-
head (the variant gate program of round 16, seed 212451915).
Common suite: 2441 tests, 0 failures.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.568 |   22.51 |   0.61 |
| edit-through-a-chain-of-dependents |    68.931 |  42.762 |  46.833 |   0.62 |
|         library-update-into-copies |    83.083 |  52.439 |  55.324 |   0.63 |
|        main-edit-among-many-shapes |     4.837 |   2.443 |   2.762 |   0.51 |
|           main-edit-into-10-copies |      1.79 |   1.124 |   1.217 |   0.63 |
|          main-edit-into-100-copies |    15.415 |  10.254 |  11.046 |   0.67 |
|         main-edit-into-1000-copies |   153.086 | 103.629 | 107.266 |   0.68 |
|         variant-switch-into-copies |    32.052 |  22.861 |  23.944 |   0.71 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
67484aff60 📎 Judge the turns of two mirrored mains by their axes in the model
A switch carries a copy's turn only where the old and the new main agree
on it. Two mirrors can store the same rotation while their placed axes
point 180 degrees apart, and the model let them agree by that number, so
it expected a carried geometry override the editor rightly drops. The
turns of two mirrored mains now agree only where their placed axes do.

Harness only; the benchmark is not run.

Also in this commit:

- The harness changes that check the next commit, "Author the size a sync resize
  gives a swapped head".

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
b9a62f23ea 🐛 Keep on the copy a layout child override no layout parent pushes
A copy can author a layout child attribute, such as a margin, on a shape
whose main has no layout parent. Update-main pushed it into the main,
where it does nothing, and sync, which sends layout child attributes only
through layout parents, left the main's other copies without it. A later
switch could turn one of them into a swapped head, which takes its
placement from the main, with the stale value. Update-main now pushes
neither the value nor the touched group of such a layout child group;
the copy keeps its override. The composable model keeps those groups on
the copy too, and the update-main check takes layout child groups as
pushed only under a layout parent in the main.

Tests: switching-to-a-head-under-a-plain-parent-keeps-the-margin-its-
main-never-took (the variant gate program of round 15, seed 371855618);
updating-a-main-keeps-on-the-copy-a-margin-a-switch-carried-out-of-a-
layout, renamed from the test of the push it replaces.
Common suite: 2439 tests, 0 failures.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  21.015 |   21.76 |    0.6 |
| edit-through-a-chain-of-dependents |    68.931 |  39.553 |  41.298 |   0.57 |
|         library-update-into-copies |    83.083 |  51.286 |  55.732 |   0.62 |
|        main-edit-among-many-shapes |     4.837 |   2.221 |   2.392 |   0.46 |
|           main-edit-into-10-copies |      1.79 |   1.034 |   1.069 |   0.58 |
|          main-edit-into-100-copies |    15.415 |  10.101 |   10.67 |   0.66 |
|         main-edit-into-1000-copies |   153.086 | 100.646 | 103.375 |   0.66 |
|         variant-switch-into-copies |    32.052 |  22.132 |  22.822 |   0.69 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
35f4b5ef91 📎 Judge the turns of two mirrored children by their axes in the model
A mirror stores one turn as two rotations, such as 315 and 45, with the
same transform. On a switch, the old copy child stored 315 and its new
copy 45, so the editor rightly carried nothing, while the composable
model compared the rotations by number and expected the turn to carry.
The turns of two mirrored child shapes now differ in the model only
where their placed axes do.

Test: switching-a-copy-carries-no-mirrored-turn-stored-the-other-way-in-
the-model (the variant gate program of round 15, seed 164135730).
Common suite: 2438 tests, 0 failures (with the next commit).

Harness only; the benchmark is not run.

Also in this commit:

- Model only the turn a resized top root shows against its parent. A top copy
  root that authors its geometry inherits its parent's turn, and update-main
  pushes only the turn it shows against that parent. In a turned parent, a
  resized root then leaves the main root and a swapped head pushed with it
  unturned. The composable model took the whole turn of such a root as pushed
  and expected the new head turned with it. It now takes a root that authors its
  geometry as inheriting its parent's turn, as a nested root does; only a top
  root that authors none inherits all of its turn.
- The harness changes that check the next commit, "Keep on the copy a layout
  child override no layout parent pushes".

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:48 +01:00
alonso.torres
f7627ec5e0 🐛 Push the layout child attributes a copy authored outside a layout
A copy can set the margin of a nested copy in a flex, and a switch can
carry that override under a parent that is no layout. Update-main moved
the touched layout item group to the main, but not its value: only a
layout parent pushes the layout child attributes of its children. The
main took the override without the copy's margin. Update-main now pushes
the layout child attributes the copy authored when the main's parent is
no layout, except at the copy root.

Test: updating-a-main-pushes-a-margin-a-switch-carried-out-of-a-layout
(the variant gate program of round 14, seed 371855618).
Common suite: 2436 tests, 0 failures.

Benchmark (scripts/bench-components, ms, lower 2.5% quantile):
|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  24.588 |  26.788 |    0.7 |
| edit-through-a-chain-of-dependents |    68.931 |   45.07 |  48.822 |   0.65 |
|         library-update-into-copies |    83.083 |  53.351 |  60.769 |   0.64 |
|        main-edit-among-many-shapes |     4.837 |   2.871 |    3.13 |   0.59 |
|           main-edit-into-10-copies |      1.79 |   1.153 |   1.216 |   0.64 |
|          main-edit-into-100-copies |    15.415 |  10.844 |  11.122 |    0.7 |
|         main-edit-into-1000-copies |   153.086 | 108.081 | 112.553 |   0.71 |
|         variant-switch-into-copies |    32.052 |  23.078 |  29.003 |   0.72 |

AI-assisted-by: claude-opus-5-5
2026-11-18 10:29:47 +01:00