Skip to content

history: a sprite's undo comes back when it opens again - #64

Merged
foxnne merged 1 commit into
mainfrom
history/shared-history
Oct 19, 2026
Merged

foxnne merged 1 commit into
mainfrom
history/shared-history

Conversation

@foxnne

@foxnne foxnne commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Part of fizzyedit/plans#14 (plans/SHARED_HISTORY_PLAN.md step 3; plans/RECORDING_PLAN.md step 10 for pixi).

Most of pixi's share of shared history was already on main (#48, #49, #56, #57, #59, #60, #62: step ids, every step reported with its top and author, historyLine/historyGoTo, going back as a step, the waiting draw keeping its author). This closes what was left.

What changes

  • A sprite's undo comes back when it opens again. restoreHistory: each entry one pixel step (steps.zig), kept with its id, checked against the sprite first (steps.fits, a walk back and forward on a copy of each layer the steps touch) and refused, history untouched, when it does not fit; ids must be distinct, non-zero and not the unsaved mark. A non-empty history is refused over one being made (fizzy picks a kept track up again when a restart leaves a track with no base, which could otherwise replace live history). A saved sprite stays saved. An empty history clears it, so "Forget This Document's History" works for pixi too.
  • documentFingerprint: a hash of the grid, each layer by position (name, shown, folded, pixels; a drawing still being revealed as it ends), the sprites' origins and each animation's name and frames. fizzy keeps a closed document's track only when the owner has one, so until now no pixi track was ever kept and nothing could be restored.
  • A step pixi cannot encode yet is still attributed. While tracks record (fizzy's default), every non-pixel change (add layer, rename, …) reported only restarted, so fizzy never heard of the step: an agent's Add Layer read as nobody's, and "Go back to before Claude's change" could not find it. A step added now follows its restart, effect empty; the recorder's new track drops steps before its base, so tracks are unchanged. Undo and redo of such a step still report only the restart: with the authors cleared, fizzy would read the step as the person's and announce the wrong undoer.
  • Pixi's "Undo: … / Redo: …" toast is gone (maintainer's ask): fizzy's activity feed and its "Undid Claude's Draw" bubble say it, and whose. Its quiet flag, which only silenced that toast, goes with it.

Known limit, needs fizzy: a restarted clears fizzy's author map, so after a non-pixel step the steps before it read as the person's (seen: Claude's Draw before Claude's Add Layer, after going back). Fix: either pixi encodes every Change kind (RECORDING_PLAN step 4), or fizzy's Tracks starts a new track on an empty-effect step so owners need not send restarted for it. Left as a follow-up. Also not carried yet: a take-back step's "Back to …" title across a reopen (text's #641 put it in its step format; pixi's format has no label).

How it was seen (macOS, debug fizzy at main 58cdcb16, --quiet, its own profile, pixi Debug):

  • An MCP client named Claude drew and added a layer: fizzy.undo answered {"title":"Layer","by":"Claude"}, then {"title":"Draw","by":"Claude"}; the control server's own calls read as the person's.
  • ⌘Z (played by a tape) showed "Undid Claude's Draw" with Redo and the strip at "Back to Draw 6/7"; no pixi toast.
  • fizzy.goBackBefore answered {"to":3,"by":"Claude","also_taken_back":0} and the agent's layer was gone.
  • Two draws, saved, closed, opened again: undo, undo, redo, redo walked steps 2 and 1 and back (they read as the person's after the reopen: fizzy forgets authors at close). After review: three draws with the third undone, closed and reopened: redo brought step 3 back, then undo walked 3, 2, 1.
  • zig build test: the new fits test (a history fits the sprite it leads to, not another).

Not seen: Windows/Linux (no platform code here).

🤖 Generated with Claude Code

Pixi takes its history back from fizzy's track (`restoreHistory`), and hashes a sprite for
fizzy (`documentFingerprint`), which is how fizzy knows a kept track ends where the sprite
stands: until now no pixi track was kept at all. A step pixi cannot encode yet (anything
but pixels) is still reported after its restart, so fizzy keeps who made it. Pixi's own
"Undo: …" toast goes: fizzy's bubble says it, and whose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@foxnne
foxnne force-pushed the history/shared-history branch from 47d371c to 602ea04 Compare October 19, 2026 19:11
@foxnne
foxnne marked this pull request as ready for review October 19, 2026 19:16
@foxnne
foxnne merged commit 2060de8 into main Oct 19, 2026
6 checks passed
@foxnne foxnne mentioned this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant