CODAP-1118: plugin undo/redo analysis document#2388
Conversation
V2 implementation analysis and V3 implementation plan for the undoChangeNotice plugin API (CODAP-1118). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code PRs start as drafts; docs-only PRs skip draft status. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
codap-v3
|
||||||||||||||||||||||||||||
| Project |
codap-v3
|
| Branch Review |
CODAP-1118-plugin-undo-redo
|
| Run status |
|
| Run duration | 02m 19s |
| Commit |
|
| Committer | Kirk Swenson |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
4
|
| View all changes introduced in this branch ↗︎ | |
Re-analyze V2 implementation in light of comparison with CODAP-1127 spec. Key findings: - V2's handleUndoChangeNotice is mode-agnostic (no standalone vs external branching) - V3 DI handlers already bypass undo (applyModelChange without undo strings routes through withoutUndo), matching V2's retainUndo behavior - V3 can use a single code path for both modes, same as V2 - Shadow counter approach (from CODAP-1127 spec) is not needed - Flag all-cases-handler undo strings as a bug Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
User-triggered CODAP actions (graph changes, table edits) create undo entries on the same stack as plugin entries. In standalone mode, this causes undoButtonPress to potentially undo the wrong action. Revise analysis to recommend shadow counters for standalone mode (keeping plugin undo separate from CODAP stack) while retaining CODAP undo entries for external mode (where interleaving is intentional). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #2388 +/- ##
===========================================
- Coverage 85.45% 69.24% -16.21%
===========================================
Files 753 753
Lines 41500 41500
Branches 10235 10235
===========================================
- Hits 35462 28736 -6726
- Misses 6028 12758 +6730
+ Partials 10 6 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The interleaving of plugin and CODAP undo entries on a shared stack is actually correct behavior — the most recent action is undone first. Shift recommendation from shadow counters to single code path (shared stack) for both standalone and external modes, with shadow counters as a fallback only if plugin testing reveals issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
scytacki
left a comment
There was a problem hiding this comment.
The part missing from this analysis is the potential issue with id or other state that probably won't be maintained properly when the plugin undoes or replays its actions.
For example if the plugin creates the graph and then the user modifies the graph. If the graph change is undone and then the plugin's creation of the graph is undone. If the plugin's change is then redone, it will very likely create a tile with a new id instead of using the previous id. Now when the graph change is applied it will fail.
Perhaps this kind of failure is OK, but it should be noted here. Since many of the actions plugins take are creating graphs and tables this seems like it will make the undo support not very useful.
Add test confirming that an MST action producing zero patches but calling withCustomUndoRedo creates a valid undoable history entry with working undo/redo callbacks. This resolves the open question about whether the history system needs extension for plugin undo/redo — it does not. Update analysis document accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
v3/doc/plugin-undo-redo.md) covering the V2 plugin undo/redo implementation and a V3 implementation plan for theundoChangeNoticeAPIhandleUndoChangeNoticeis mode-agnostic -- no standalone vs external branchingapplyModelChangewithout undo strings routes throughwithoutUndo), matching V2'sretainUndobehaviorall-cases-handlerundo strings as a likely bugundoButtonPresscan undo the wrong action in standalone modeRefs CODAP-1118
Test plan
Generated with Claude Code