Skip to content

Guard concurrent 2D edits and add undo/redo shortcuts - #177

Merged
vycdev merged 7 commits into
vycdev:developfrom
JohnSt99:codex/edit-guards-undo
Nov 19, 2026
Merged

vycdev merged 7 commits into
vycdev:developfrom
JohnSt99:codex/edit-guards-undo

Conversation

@JohnSt99

@JohnSt99 JohnSt99 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #163. First focused split from #156, based on current develop (93b4be6).

Image-changing actions now share a processing guard: quantize, dedither and swatch deletion own the lock; imports, resize, baked adjustments, crop, swatch replacement and queued touch-ups cannot commit stale work across a source change or processing operation. Import validation already in flight is cancelled when processing starts. Pending text drafts are paused during processing and restored if processing produces no output, so they cannot be silently rasterized without an Undo entry. The existing image history and shared canvas pipeline are preserved; edit orchestration lives in hooks.

Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z undo and redo 2D image edits. They leave text and number inputs, editable content, modal drafts, crop mode, processing, docs and 3D mode alone. The 2D guide documents this in all supported languages.

Validation:

  • npm run lint and the production build, including translation checks, pass.
  • Initial commit e1be932: 205 passed across all 8 browser suites, including shared-canvas, rapid touch-up history, 3D export and localization coverage.
  • The text-draft follow-up addresses Codex’s P2 finding; final commit 9a47af0 passes lint, formatting, the production build and 27 targeted browser tests, including both quantize and dedither with a pending text draft and no processing output. The full eight-suite run was not repeated for this narrow follow-up.

Upstream GitHub CI is currently action_required, with no jobs started (run).

Maintainer follow-up

Rebased onto develop (after #176 and #178) and added fixes on top of the original two commits:

  • Refused touch-up commits no longer stay on the canvas (1b203fb, closes the Codex P2). A brush, eraser or text commit that processing refuses is rolled back. Unsaved strokes, and a stroke still being drawn, are dropped before quantize or dedither reads the canvas.
  • Undo/redo shortcuts stay out of open Radix Select lists, popovers and menus. They follow the physical Z key on non-Latin layouts and use the same edit lock as the toolbar buttons.
  • Adjustment sliders commit on blur, including a pending drag commit or a value React hasn't rendered yet, so clicking Quantize or Dedither right after changing one no longer drops the change.
  • CHANGELOG split into Added (shortcuts) and Fixed (guards). Docs in all 12 languages mention open menus and lists.

Proof: each new regression test fails without its fix and passes with it (brush rollback while saving or still drawing, for quantize and dedither; Ctrl+Z on an open select list; physical Z; keyboard, pending-drag and unrendered slider commits). Local run at 7f5c908 (ac7aaf9 only moves a comment):

  • Lint, build, check:e2e: passed.
  • Unit tests: 1154 passed.
  • Docs, i18n and i18n-build e2e suites: passed.
  • @smoke: 137 of 141 passed. The four failures are the image-decode-reuse "opaque Display P3 … through history" cases. They fail the same way on unchanged develop sources on this machine under heavy load, so they are not caused by this PR.

Council review

Rounds: 5

Delegate Round 1 Round 2 Round 3 Round 4 Round 5
Claude Opus 5.5 7/10 8.5/10 9/10 9/10 9/10
GPT-6.2 Sol 6/10 8/10 8/10 8/10 8/10

Open from the last round (Sol): a Bake and a Resize that both finish encoding before React renders can both reach history. This already happens on develop, where there is no guard at all; this PR narrows it to that window. Left out of scope.

@JohnSt99
JohnSt99 marked this pull request as ready for review November 16, 2026 22:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T22:48:48.488602Z e1be932 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e1be932980

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/App.tsx Outdated
adjustments={adjustments}
onCropSelectionChange={setHasValidCropSelection}
touchUpTool={touchUpTool}
touchUpTool={processingActive ? null : touchUpTool}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve pending text edits when starting processing

If quantize or dedither starts while a text touch-up draft is open, this sets touchUpTool to null, causing CanvasPreview to rasterize the draft into its live canvas. The touch-up callback then rejects the commit because processing is active, but the commit queue does not roll back pixels when the callback returns no URL. If processing fails or produces no output, the image source stays unchanged while the draft remains visible without a history entry, so it cannot be undone. Keep the draft intact or discard it without mutating the canvas when processing starts.

AGENTS.md reference: AGENTS.md:L48-L49

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1b203fb: refused touch-up commits now roll back, and unsaved or in-progress strokes are dropped before quantize or dedither reads the canvas (regression tests in tests/e2e/image-edit-guards.spec.ts).

@vycdev
vycdev force-pushed the codex/edit-guards-undo branch from 9a47af0 to ac7aaf9 Compare November 19, 2026 17:02
JohnSt99 and others added 7 commits November 19, 2026 19:40
A brush, eraser or text edit still encoding when quantize or dedither
started was refused by the history owner, but the commit queue only
rolled back on encode failure, so the pixels stayed on the canvas with
no undo step. Roll back on any refused commit, and when the tool is
paused for processing drop unsaved and in-progress strokes before
processing reads the canvas.

Undo/redo shortcuts now also stay out of open popovers, menus and
select lists, follow the physical Z key on non-Latin layouts, and use
the same edit lock as the toolbar buttons. Split the changelog entry
into Added and Fixed, and tighten the late-resize regression.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clicking Quantize or Dedither after changing an adjustment with the
keyboard blurred the slider, which deferred its commit to the next
frame; processing took the edit lock first and the commit was refused,
leaving the slider out of sync with the preview. Commit on blur
immediately instead.

The brush rollback tests now check the pixels processing actually
read, and the late-resize test re-arms its hold in the same browser
call that releases the stale encode.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A slider drag defers its commit by a frame after pointerup. If focus
moved to Quantize or Dedither and processing started inside that frame,
the deferred commit was refused. Blur now also flushes a pending frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valuesRef only caught up on render, so a blur right after a value
change could commit the previous value and clear the dirty flag. Update
the ref in scheduleSet, and cancel a pending drag flush when a reset
commits directly so a later blur cannot commit again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants