Skip to content

fix(tools): support contour segmentation undo and redo#2817

Draft
sedghi wants to merge 1 commit into
mainfrom
codex/fix-contour-segmentation-undo-redo
Draft

fix(tools): support contour segmentation undo and redo#2817
sedghi wants to merge 1 commit into
mainfrom
codex/fix-contour-segmentation-undo-redo

Conversation

@sedghi

@sedghi sedghi commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • preserve contour-segmentation state across undo/redo after boolean stroke processing replaces the source annotation
  • add Undo/Redo controls and standard keyboard shortcuts to the planar freehand contour segmentation example
  • add HistoryMemo unit coverage and a browser-state regression for contour merge → undo → redo
  • update the GenericViewport test harness to use the current RenderBackends enum name

Root cause

The planar freehand tool initially records an annotation-creation memo for the source stroke. Contour boolean processing then removes that source annotation and rebuilds the resulting contour annotations, leaving the memo pointed at an annotation that no longer exists. Undo therefore could not remove the committed contour, and redo could restore the obsolete source stroke.

This change replaces that provisional memo in-place with a memo that swaps the complete pre-stroke and post-stroke annotation sets, preserving a single undo step for creation, merges, and holes.

Validation

  • corepack pnpm run test:vitest:browser tests/vitest-browser/undoRedoHistory.browser.test.ts — 9 passed, 1 expected failure
  • corepack pnpm exec jest packages/core/test/utilities/historyMemo.jest.js --runInBand — 5 passed
  • corepack pnpm exec tsc --project packages/core/tsconfig.json
  • corepack pnpm exec tsc --project packages/tools/tsconfig.json
  • Prettier, oxlint, and git diff --check

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dca387ae-9899-4935-a60c-8d0fc52d14f4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-contour-segmentation-undo-redo

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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