alonso.torres e410278c91 🐛 Delete a switch's unplaced swapped children so undo restores them
A switch deletes the old head without its swapped children, which it
moves into the new head. A swapped child whose place the new variant
lacks found no counterpart and was never moved: it went with the old
head's subtree without changes of its own, so undo left it out.

The switch keeps out of the deletion only the swapped children whose
place, by name and ancestor kinds in their main, the new variant has;
the others are deleted with the old head and restored by undo.

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

| world                              | baseline |     now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels  |   35.215 |  21.011 |  0.60 |
| edit-through-a-chain-of-dependents |   68.931 |  40.794 |  0.59 |
| library-update-into-copies         |   83.083 |  45.598 |  0.55 |
| main-edit-among-many-shapes        |    4.837 |   2.087 |  0.43 |
| main-edit-into-10-copies           |     1.79 |   1.001 |  0.56 |
| main-edit-into-100-copies          |   15.415 |   10.11 |  0.66 |
| main-edit-into-1000-copies         |  153.086 |  98.638 |  0.64 |
| variant-switch-into-copies         |   32.052 |  19.844 |  0.62 |

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