Parley Bug: Double Ctrl+Z Undo Issue

by Admin 37 views
Parley Bug: Double Ctrl+Z Undo Issue

Introduction

Hey guys! We've stumbled upon a quirky little bug in Parley that we need to squash. It seems like sometimes, undoing an action requires you to press Ctrl+Z twice instead of just once. Yeah, I know, it's weird. This was first noticed during the testing phase for Issue #28, specifically while checking the autosave functionality during undo operations. This issue might be related to our autosave architecture (#62) and potentially other undo/redo related problems like #72. Let's dive into what we know so far and figure out what's going on!

The Issue: Double Tap to Undo

The main problem is that occasionally, users need to hit Ctrl+Z twice to undo a single action. Imagine you're deep in thought, making edits, and suddenly, undoing requires a double-tap. It's not the end of the world, but it's definitely a usability snag. We don't yet have a clear understanding of what causes this. It seems to pop up randomly, particularly when autosave is in the mix. It's not consistent, which makes tracking it down even more fun! The conditions triggering this behavior are unclear, and identifying them is the first step in getting this sorted out.

Steps to Reproduce (If You Can!)

Alright, so here's where it gets tricky: we haven't nailed down the exact steps to make this happen consistently. But here's what we observed during autosave testing:

  1. Open up the test dialog in Parley.
  2. Make a few changes. Add a few nodes, tweak some text – the usual stuff.
  3. Wait for the autosave to kick in. You know, that little background magic that keeps your work safe.
  4. Now, hit Ctrl+Z to undo.
  5. Observation: Sometimes, and this is the annoying part, you'll need to press Ctrl+Z twice to actually undo that last action.

Expected vs. Actual Behavior

Expected Behavior:

  • A single press of Ctrl+Z should undo one operation. Simple, right?
  • Undo behavior should be consistent across all operations. No surprises!

Actual Behavior:

  • Sometimes, it demands two Ctrl+Z presses for a single undo.
  • The conditions are murky, possibly linked to autosave timing.
  • It's inconsistent – doesn't happen every time, which is super helpful (not!).

Impact Assessment

Okay, let's talk about how serious this is. We're tagging this as Medium severity:

  • Confusing UX: Users might not be sure if their undo actually worked, leading to frustration.
  • Over-Undo: They might accidentally undo more than they intended because of the double-press.
  • Annoyance Factor: It doesn't completely break the workflow, but it's definitely annoying.
  • Autosave Innocence: The good news is that autosave itself doesn't seem to be corrupting the undo stack. So, at least there's that!

Evidence from the Testing Trenches

Here's a snippet from Issue_28_Testing_Checklist.md – specifically, Test 5:

  • Result: PASS with Notes
  • Tester notes: "It was observed that CTRL+Z had to be done twice for each undo. I'm not clear on the conditions. Autosave its self does not appear to be an issue."

The Scene of the Crime (Environment)

  • Test Date: 2025-11-08
  • Testing Session: Issue #28 verification testing
  • Commit: 8cdc835 (fix/undo-corruption-28)
  • Context: During autosave undo testing

Investigation: Time to Put on Our Detective Hats

Alright, team, we need to figure out what's causing this. Here's our checklist for the investigation:

  • [ ] Timing is Everything: Check the timing relationship to autosave operations. Is it happening right before, during, or after an autosave?
  • [ ] Operation Specifics: Are there specific types of operations that trigger this double-press requirement? Node additions? Text modifications?
  • [ ] Undo Stack Analysis: Examine the undo stack state before and after the double-press. Is anything out of order?
  • [ ] Event Handling: Scrutinize the event handling for key presses versus command execution. Are events being missed or duplicated?
  • [ ] Focus, Focus, Focus: What's the focus state when Ctrl+Z is pressed? Is the focus where it should be?

Related Mysteries (Issues)

Here's how this bug connects to other ongoing investigations:

  • #28 - Undo/Redo corruption fixes (parent)
  • #62 - Autosave architecture review
  • #72 - Redo breaks undo stack (separate but related undo/redo issue)

Important Notes

Let's keep these points in mind as we investigate:

  • Autosave is NOT corrupting the undo stack. That's a relief!
  • The issue is specifically about the number of key presses, not the core undo functionality itself.
  • It might be a UI event handling issue rather than a problem with the undo stack.

Conclusion

So, there you have it – the mystery of the double Ctrl+Z. It's a quirky bug that needs some serious investigation. By systematically checking each potential cause, we'll hopefully track down the root of the problem and get Parley back to its smooth, single-press undoing glory. Let's get to work, guys, and make Parley even better!