get-ref-chain-until-target-ref, which the keep-touched variant switch
and the paste of a nested copy use to collect the touched groups along
a copy's ref chain, had two faults:
- it compared each shape with the target's id, so it never stopped at
the target and merged the touched groups of the whole chain (F62):
a copy pasted out of its main could take overrides its new near
main does not have;
- it looked each next link up in the container it started in, so a
chain whose next main lives on another page, or in a library,
stopped after one link and missed the groups beyond it (F31).
It now compares ids and takes each link's own container. The golden
master and the composable cases are unchanged: none of them reaches a
chain past its target or across containers with an override.
file-test checks both: the chain stops at a target in its middle, and
it follows a copy on one page through mains on another.
Benchmark (lower quantile, ms; baseline / now / ratio):
deepest-edit-through-three-levels 35.2 / 16.0 / 0.45
edit-through-a-chain-of-dependents 68.9 / 33.7 / 0.49
library-update-into-copies 83.1 / 38.6 / 0.46
main-edit-among-many-shapes 4.8 / 2.2 / 0.46
main-edit-into-10-copies 1.8 / 0.7 / 0.42
main-edit-into-100-copies 15.4 / 7.1 / 0.46
main-edit-into-1000-copies 153.1 / 77.2 / 0.50
variant-switch-into-copies 32.1 / 17.1 / 0.53
AI-assisted-by: claude-opus-5-5