alonso.torres 88b8a3c697 🐛 Restore the main children an update main deleted in their order
A copy swapped two adjacent children of its main, and update-main
deleted both main children and added their replacements. Undoing it
put the main's children back out of order. Each restore was recorded at
the shape's position in the original state, as the update-main builder
does not apply its changes locally; the undo restores in reverse order,
so the second deleted sibling came back at a position counted with the
first still in place.

Without the builder's local objects, a restore now takes the position
the shape had when the batch deleted it, as the earlier changes leave
its parent.

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

|                             :world | :baseline |    :now |   :mean | :ratio |
|------------------------------------+-----------+---------+---------+--------|
|  deepest-edit-through-three-levels |    35.215 |  22.018 |   22.34 |   0.63 |
| edit-through-a-chain-of-dependents |    68.931 |  42.507 |    43.3 |   0.62 |
|         library-update-into-copies |    83.083 |  47.544 |  49.173 |   0.57 |
|        main-edit-among-many-shapes |     4.837 |   2.058 |   2.319 |   0.43 |
|           main-edit-into-10-copies |      1.79 |   0.977 |   1.075 |   0.55 |
|          main-edit-into-100-copies |    15.415 |   9.676 |  10.209 |   0.63 |
|         main-edit-into-1000-copies |   153.086 | 104.546 | 108.771 |   0.68 |
|         variant-switch-into-copies |    32.052 |  19.974 |  22.679 |   0.62 |

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