Skip to content

feat: merge concurrent ChangeSet edits - #21

Merged
yuyukosama2004 merged 1 commit into
mainfrom
codex/r3-three-way-merge
Jul 20, 2026
Merged

yuyukosama2004 merged 1 commit into
mainfrom
codex/r3-three-way-merge

Conversation

@yuyukosama2004

Copy link
Copy Markdown
Owner

What changed

  • add conservative three-way merging for concurrent edits to the same Tiptap block
  • tokenize text per character while carrying rich-text marks; keep non-text and nested nodes atomic
  • merge only independent edits and reject overlapping ranges, conflicting same-point insertions, type conflicts, attribute conflicts, and unsafe structure changes
  • preserve the current target node identity even when a proposal supplies another ID
  • distinguish no-op decisions from document-changing decisions so revisions advance only when content changes
  • persist direct, rebased, or three_way application mode on accepted operations
  • reevaluate remaining pending operations after each document change and immediately classify newly orphaned/conflicted proposals
  • show application mode and user-readable conflict reasons in the review UI

Why

Authors can continue editing after an AI ChangeSet is generated. Safe changes should still be applicable when they touch different parts of the same paragraph, while ambiguous overlap must remain an explicit conflict.

Safety model

  • no last-write-wins fallback
  • changed deletes never auto-merge
  • overlapping text/format edits never auto-merge
  • ambiguous insertion order never auto-merges
  • canonical versions remain untouched; only the optimistic working draft can advance

Validation

  • Ruff check and format
  • Mypy — 101 source files
  • Alembic base → head → base → head round trip
  • backend Pytest — 106 passed
  • frontend Prettier and ESLint
  • frontend Vitest — 69 passed
  • frontend production build

@yuyukosama2004
yuyukosama2004 marked this pull request as ready for review July 20, 2026 09:55
@yuyukosama2004
yuyukosama2004 merged commit cb6bbbe into main Jul 20, 2026
2 checks passed
@yuyukosama2004
yuyukosama2004 deleted the codex/r3-three-way-merge branch July 20, 2026 10:01
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