feat(collab): local-ops-only undo — remote applies skip the undo stack (ysync miss 09)
Ctrl+Z after a peer's edit no longer reverts (and re-broadcasts) the peer's work, and the adopt undo-bomb is gone: - doApply/doApplyItems (both editors) Push with SKIP_UNDO; the emit path is unaffected (suppression keys off s_applyingRemote, not undo). - With SKIP_UNDO no picker owns removed items — the bindings free them after Push (explicit removals + upsert's remove-before-re-add; fields excluded: CHT_REMOVE hides them, parent keeps ownership). Freeing stays out of the fork commit classes so DRC's SKIP_UNDO callers can't double-free. - Test hooks kicadCollabTestUndo/UndoDepth, registered per-editor AND in the kicad_editor dispatcher (merged image compiles out per-app registrations). - kicad pointer: eeschema UUID undo guard + SKIP_UNDO connectivity split + quiet stale-entry drop (ca8877324c). - tests/kicad/collab-undo.spec.ts: 5 scenarios (no undo entry from remote applies; selective undo; stranded replaced/deleted entries) — 5/5, plus collab/ysync regression 30 pass. - docs: ysync-review 20 fix record; 09 marked FIXED; overview indexed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ejJEvS7ogef2o9gVTXjmp
This commit is contained in:
parent
cd68114cdc
commit
574284c486
8 changed files with 528 additions and 6 deletions
|
|
@ -45,6 +45,9 @@ std::string pcbCollabTestMoveFirst( int aDx, int aDy );
|
|||
std::string pcbCollabGetPos( std::string aId );
|
||||
bool pcbCollabTestRemoveItem( std::string aId );
|
||||
bool pcbCollabTestRotateItem( std::string aId, double aDeg );
|
||||
// Collab-aware undo (ysync miss 09).
|
||||
bool pcbCollabTestUndo();
|
||||
int pcbCollabTestUndoDepth();
|
||||
// Presence (collab-presence 0002) + comment pins/panning (0005).
|
||||
void pcbCollabPresenceStart();
|
||||
void pcbCollabSetRemote( std::string aJson );
|
||||
|
|
@ -74,6 +77,9 @@ std::string schCollabTestMoveFirst( int aDx, int aDy );
|
|||
std::string schCollabGetPos( std::string aId );
|
||||
bool schCollabTestRemoveItem( std::string aId );
|
||||
bool schCollabTestRotateItem( std::string aId, double aDeg );
|
||||
// Collab-aware undo (ysync miss 09).
|
||||
bool schCollabTestUndo();
|
||||
int schCollabTestUndoDepth();
|
||||
// Presence (collab-presence 0003 — eeschema counterparts) + pins (0005).
|
||||
void schCollabPresenceStart();
|
||||
void schCollabSetRemote( std::string aJson );
|
||||
|
|
@ -171,6 +177,16 @@ static bool collabTestRotateItem( std::string aId, double aDeg )
|
|||
: schCollabTestRotateItem( aId, aDeg );
|
||||
}
|
||||
|
||||
static bool collabTestUndo()
|
||||
{
|
||||
return pcbEditorActive() ? pcbCollabTestUndo() : schCollabTestUndo();
|
||||
}
|
||||
|
||||
static int collabTestUndoDepth()
|
||||
{
|
||||
return pcbEditorActive() ? pcbCollabTestUndoDepth() : schCollabTestUndoDepth();
|
||||
}
|
||||
|
||||
// Presence shims (collab-presence 0002 pcbnew / 0003 eeschema): route to the live
|
||||
// editor's implementation, same pattern as the collab bridge shims above.
|
||||
static void collabPresenceStart()
|
||||
|
|
@ -271,6 +287,9 @@ EMSCRIPTEN_BINDINGS(kicad_editor) {
|
|||
// endpoint, field text — flow from the per-editor blocks unchanged).
|
||||
function("kicadCollabTestRemoveItem", &collabTestRemoveItem);
|
||||
function("kicadCollabTestRotateItem", &collabTestRotateItem);
|
||||
// Collab-aware undo (ysync miss 09).
|
||||
function("kicadCollabTestUndo", &collabTestUndo);
|
||||
function("kicadCollabTestUndoDepth", &collabTestUndoDepth);
|
||||
// Presence (collab-presence 0002/0003) + comment pins/panning (0005).
|
||||
function("kicadCollabPresenceStart", &collabPresenceStart);
|
||||
function("kicadCollabSetRemote", &collabSetRemote);
|
||||
|
|
|
|||
Loading…
Reference in a new issue