A copy whose nested head was switched to another variant was nested into
the main of the component that head's main still holds. The loop check
only compared the components in the moved subtree with the parent
chain, so it let the nest through; a reset then brought the held
component back, and the sync cascade grew the cycle until it gave up.
The check now follows each component the moved shapes hold into its
main, through every level, as sync and reset can bring any of them
back. Moving, pasting and dropping in the layers share it.
Benchmark (scripts/bench-components, lower quantile in ms):
| world | baseline | now | ratio |
|------------------------------------+----------+---------+-------|
| deepest-edit-through-three-levels | 35.215 | 19.778 | 0.56 |
| edit-through-a-chain-of-dependents | 68.931 | 39.309 | 0.57 |
| library-update-into-copies | 83.083 | 49.107 | 0.59 |
| main-edit-among-many-shapes | 4.837 | 2.271 | 0.47 |
| main-edit-into-10-copies | 1.79 | 1.001 | 0.56 |
| main-edit-into-100-copies | 15.415 | 10.29 | 0.67 |
| main-edit-into-1000-copies | 153.086 | 101.796 | 0.66 |
| variant-switch-into-copies | 32.052 | 20.72 | 0.65 |
AI-assisted-by: claude-opus-5-5