precogly / precogly/precogly

Make guest node deletion fully undoable

Open
#496 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
155
Forks
37
Avg merge
1d 17h
Merged PRs (30d)
82

Description

## Summary

Deleting a guest-editor node does not create an atomic undoable operation for the complete threat-model state. Keyboard and toolbar Undo/Redo can restore an incomplete or unexpected canvas state.

## Steps to reproduce

1. Open the Guest Editor.
2. Add a Process node.
3. Add a threat and countermeasure to that process.
4. Move the process once and release it to create an undo history entry.
5. Select the process and press **Delete** or **Backspace**.
6. Try Undo with **Ctrl/Cmd+Z**.
7. Repeat with a fresh file and use the toolbar **Undo** button instead.

## Actual behavior

The deletion itself is not stored as a complete history entry. Undo can restore only an earlier canvas snapshot, while the deleted threat and countermeasure remain removed. In some sequences the node is not restored at all. Keyboard and toolbar actions can also appear inconsistent because they operate against the incomplete history state.

## Expected behavior

Deletion should be one atomic, undoable operation. Undo and Redo from both keyboard shortcuts and toolbar buttons should restore or remove the node, connected edges, threats, and countermeasures together.

## Related issues

- [#278](https://github.com/precogly/precogly/issues/278) covers the original Undo/Redo feature and drag-history behavior.
- [#323](https://github.com/precogly/precogly/issues/323) covered orphaned guest threats and countermeasures after deletion.

This follow-up concerns undo transaction integrity after the orphan cleanup behavior was added.

Source:

https://github.com/precogly/precogly/blob/cb37379df2bfa9b43b02327e006b4cb6f92e035f/frontend/src/features/guest-editor/GuestDFDEditor.tsx

https://github.com/user-attachments/assets/859fee13-ec7c-4b49-9a78-320dbf43280b

Contributor guide

Open the contributing guide

Research direction

Start in frontend/src/features/guest-editor/GuestDFDEditor.tsx and reproduce deletion with both keyboard shortcuts and the toolbar Undo/Redo controls. Trace how deletion, orphan cleanup, and drag-history entries are recorded, then verify that one deletion history entry restores or removes the node, connected edges, threats, and countermeasures together.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.