forked from 1b-agent/opencadstudio-upstream
The internal per-call push_undo fractured plugin-composed operations: history has no nested scopes, so each push finished the plugin's still-pending scope and opened its own — an operation of several writes became several undo steps and the plugin's label was lost (measured: 3 creates + update + delete in one scope = 5 steps). Follow the entity-write contract instead: a mutation inside a plugin-opened push_undo scope joins it, so the whole operation is a single undo step under the plugin's label; a scope-less mutation opens and finishes its own scope, keeping one undo step per call; refusals record no undo step in either regime. Document the contract on the trait methods and the host docs; the composition experiment becomes the permanent xrecord_writes_join_a_plugin_initiated_undo_scope test.