Plan: Undo with block IDs (#671) #768
Closed
kayg
wants to merge 11 commits from
docs/undo-block-ids-plan into proto/block-identity-v7d
pull from: docs/undo-block-ids-plan
merge into: kayg:proto/block-identity-v7d
kayg:main
kayg:port/tasks-float-2
kayg:fix/train-1116-2
kayg:fix/train-1116-3
kayg:fix/train-1116-1
kayg:fix/flake-1134
kayg:fix/server-1182
kayg:dev
kayg:port/notes-float-3c
kayg:docs/auto-update-ig
kayg:feat/dav-transport
kayg:port/tasks-float-1
kayg:wip/mail1011-sv-order-1116
kayg:fix/flake-1179
kayg:fix/flake-1178
kayg:fix/guards-1153-fsio-split
kayg:fix/guards-1153-notes-split-we
kayg:fix/guards-1153-notes-lib
kayg:fix/guards-1153-notes-home
kayg:fix/guards-1153-ui-primitives
kayg:fix/guards-1153-primitives-e2e
kayg:fix/guards-1153-visibility-doc
kayg:feat/paper-grey-1116
kayg:fix/flake-1165
kayg:fix/flake-1119
kayg:docs/imap-766-plan-v2
kayg:fix/e2e-unique-ports
kayg:t3/paged-search-reconcile-final
kayg:wip/mail1011-final-1115
kayg:docs/tasks-float-port
kayg:perf/editor-first-paint-1c
kayg:feat/imap-notes-fetch
kayg:feat/imap-notes-projection
kayg:feat/imap-notes-readonly
kayg:feat/imap-notes-auth
kayg:feat/imap-notes-server-foundation
kayg:wip/mail1011-txn-ownvocab-1115
kayg:wip/mail1011-txn-novocab-1115
kayg:perf/p1117-final-harness
kayg:perf/single-shot-repeats
kayg:port/tasks-matrix
kayg:wip/mail1011-txn-1115
kayg:fix/static-gates-1155
kayg:feat/files-s1-identity-r7
kayg:fix/files-r7-idle-loop
kayg:fix/daily-train-1152
kayg:port/notes-float
kayg:fix/editor-tables-test-types
kayg:port/notes-float-listscript
kayg:feat/tasks-actions
kayg:port/notes-float-phone-preload
kayg:perf/sound-comparator
kayg:port/notes-float-listscroll
kayg:port/notes-float-budgets
kayg:port/notes-float-suite-fix-b
kayg:port/notes-float-sidebar-fix
kayg:port/notes-float-trim
kayg:port/notes-float-3-lists
kayg:fix/attachments-meta-capability
kayg:docs/carddav-writes-v2-plan
kayg:feat/contacts-companion-pure
kayg:issue/carddav-read-perf-fix-r2
kayg:issue/carddav-read-r2
kayg:port/notes-float-devsync2
kayg:review/calendar-2
kayg:review/switcher-a-pills
kayg:port/notes-float-switcher-a
kayg:port/port-tables-2
kayg:review/switcher-ends
kayg:wip/whiteboard-s1-1114
kayg:port/port-tables
kayg:wip/mail1011-perfneutral
kayg:review/photo-tint
kayg:port/notes-float-shell
kayg:wip/local/collections-db
kayg:wip/local/mail-p1
kayg:wip/local/cold-growth-on-tiering
kayg:wip/local/tiering-v3-s1
kayg:wip/local/wal1051-cap
kayg:wip/local/tiering-v3-s1-resume
kayg:wip/local/index-position-startup-scan
kayg:port/notes-float-flat
kayg:port/notes-float-promote
kayg:wip/handover/mail1011-candidate
kayg:wip/handover/files-s1-candidate
kayg:port/notes-float-shell-only
kayg:port/notes-float-perf
kayg:feat/whiteboard-s1
kayg:feat/tiering-v5
kayg:fix/app-switch-hitch
kayg:wip/local/files-s1-dev-v4-final
kayg:feat/files-s1-dev-v4
kayg:fix/c2-glass-shared
kayg:feat/flat-lists
kayg:wip/handover/whiteboard-s1-resume
kayg:wip/att-lazy-861
kayg:feat/switcher-browse
kayg:wip/att-lazy-860
kayg:feat/tasks-float
kayg:recovered/flat-backup-candidate
kayg:perf/stalls-1054-kc
kayg:land/ai-toolbar
kayg:feat/collections-db
kayg:feat/collections-db-fixes
kayg:codex/mail-1011-redesign-20261111
kayg:fix/ai-toolbar
kayg:backup/macos-vm/st3-head
kayg:perf/trim-candidate-phonestack
kayg:feat/switcher-three
kayg:fix/1051-index-idle-checkpoint
kayg:perf/stalls-1054-kb
kayg:perf/stalls-1054-k
kayg:perf/stalls-1054-r3
kayg:fix/c2-contrast-tail
kayg:perf/stalls-1054-r3-preview
kayg:feat/collections-before
kayg:feat/tiering-v4
kayg:fix/timelog-caret
kayg:wip/local/tasks-actions
kayg:docs/tasks-writes-v2-plan
kayg:st3-r3
kayg:feat/pass8
kayg:review/calendar-2-before-1111
kayg:wip/tiering-v3-cold4
kayg:perf/stalls-1054-r2
kayg:fix/suite-A4
kayg:fix/suite-A5-probe
kayg:fix/suite-A6
kayg:fix/suite-A3
kayg:fix/suite-A2
kayg:fix/suite-A5
kayg:fix/suite-A1
kayg:wip/local/attachments-861-fix
kayg:feat/contrast
kayg:wip/local/ports-861
kayg:storage/wal-checkpoint-off-save-1051
kayg:wip/local/mail-1011-reconcile-20261110
kayg:feat/style-sheet-fixes
kayg:feat/money-round
kayg:perf/stalls-1054
kayg:wip/tiering-v3-cold5
kayg:t3/mail-1011-liveness
kayg:feat/iphone-fixes
kayg:feat/notes-approve
kayg:wip/local/shrow-work
kayg:feat/files-s1-identity
kayg:feat/quickfix
kayg:wip/tiering-v3-cold
kayg:wip/local/shared-row-swipes
kayg:backup/macos-vm/pfx-B
kayg:backup/macos-vm/pfx-C
kayg:backup/macos-vm/pfx-D
kayg:feat/contrast-r1
kayg:feat/tiering-v3-s2-tags
kayg:feat/folder-drop
kayg:t3/photos-s1
kayg:feat/tiering-v3-s1-namespace
kayg:wip/local/photos-s1
kayg:t3/photos-plan-slice-one
kayg:recovered/backup/p1b-61505
kayg:t3/paged-search-reconcile
kayg:t3/smooth-pane-transitions
kayg:t3/index-position-startup-scan
kayg:fix/private-staging-759b-r2
kayg:backup/macos-vm/hk/hk1009/pr877
kayg:backup/macos-vm/hk/hk1009/pr878
kayg:fix/undo-768
kayg:backup/macos-vm/hk/hk1009/pr875
kayg:backup/macos-vm/hk/hk1009/pr904
kayg:proto/block-identity-v7d
kayg:backup/macos-vm/hk/hk1009/pr846
kayg:backup/macos-vm/hk/hk1009/pr860
kayg:backup/macos-vm/hk/hk1009/pr861
kayg:backup/macos-vm/hk/hk1009/pr849
kayg:backup/macos-vm/hk/hk1009/pr848
kayg:backup/macos-vm/hk/hk1009/pr853
kayg:backup/macos-vm/hk/hk1009/pr957
kayg:backup/macos-vm/hk/hk1009/pr893
kayg:backup/macos-vm/hk/hk1009/pr889
kayg:backup/macos-vm/hk/hk1009/pr902
kayg:docs/imap-notes-plan
kayg:docs/quota-plan-2
kayg:fix/parallel-test-flakes
kayg:docs/calendar-backend-v2-plan
kayg:feat/calendar-ical-converter
kayg:backup/macos-vm/hk/hk1009/pr808
kayg:docs/contacts-import-v2-plan
kayg:issue/610-pm-midnight
kayg:feat/calendar-v2-s1-containment
kayg:backup/macos-vm/hk/hk1009/pr854
kayg:backup/macos-vm/hk/hk1009/pr845
kayg:backup/macos-vm/hk/hk1009/pr917
kayg:docs/dav-recorder-v2-plan
kayg:plan/previews-865
kayg:plan/save-log-durable-entry
kayg:backup/macos-vm/hk/hk1009/pr934
kayg:fix/e2e-data-on-ram
kayg:backup/macos-vm/hk/hk1009/pr888
kayg:feat/appwindow3
kayg:feat/appwindow2
kayg:feat/appwindow
kayg:feat/money-p1
kayg:feat/keys-sheet
kayg:review/calendar-2-themes
kayg:feat/smooth-cursor
kayg:fix/float-style
kayg:review/calendar-2-float
kayg:release/2026-11-06-hotfix
kayg:archive/port/rows-drop-code
kayg:archive/port/rows-actions
kayg:archive/port/rows
kayg:scratch/tasks-894-ui-gates
kayg:review/calendar-2-night-wip
kayg:recovered/flaky/toast-reduced
kayg:release/2026-11-05
kayg:archive/flaky/rows-drop-fixed
kayg:archive/flaky/rows-actions
kayg:archive/flaky/rows
kayg:sim/bm15-final
kayg:sim/bm15-bis-932
kayg:sim/bm15-bis-909
kayg:sim/bm15
kayg:sim/bm15-bis-887
kayg:perf/tiering-option-b
kayg:fix/sw-lazy-precache
kayg:archive/plan/save-log-durable-entry
kayg:mock/money-fix2
kayg:archive/fix/e2e-data-on-ram
kayg:mock/appearance-all
kayg:mock/pill-press
kayg:mock/pill-press-mac
kayg:backup/macos-vm/appearance-after
kayg:mock/auto-swipes
kayg:mock/mail-actions
kayg:backup/macos-vm/mock/mail-actions
kayg:mock/money-static
kayg:archive/review/standards-917
kayg:perf/tiering-761-fix
kayg:mock/type-audit
kayg:mock/third-pane
kayg:feat/contacts-import-v2-s1
kayg:perf/executor-hot-path
kayg:archive/port/hidden-blocks
kayg:archive/port/devices
kayg:scratch/executor-on-894
kayg:scratch/executor-spans2
kayg:scratch/executor-spans
kayg:archive/port/rows-drop
kayg:feat/tiering-761-d-scale
kayg:feat/tiering-761-c-index
kayg:feat/tiering-761-b-reader
kayg:archive/review/sharing-pr3-review-9fec3d1f
kayg:perf/ports-lazy-budgets
kayg:feat/tiering-761-a-migration
kayg:archive/review/sharing-pr3-review
kayg:archive/review/sharing-pr3-review-code
kayg:archive/plan/previews-865
kayg:archive/port/port-attachments-3
kayg:archive/port/contacts-merge
kayg:fix/motion-audit-859
kayg:fix/motion-audit-859-mac
kayg:archive/port/port-pickers
kayg:archive/port/port-tables-2
kayg:archive/port/port-tables
kayg:recovered/local/sharing-s1-pr2-room-snapshot-candidate
kayg:archive/fix/parallel-test-flakes-code-minipc01
kayg:docs/imap-766-readonly-slice
kayg:feat/dav-recorder-v3
kayg:research/788-diagnosis
kayg:archive/fix/parallel-test-flakes
kayg:archive/perf/pr792-cold-index-edit
kayg:docs/sharing-slice-1
kayg:recovered/feat/dav-recorder-v2
kayg:recovered/feat/dav-recorder-v2-edd7bbb
kayg:spike/imap-766-s0-cases
kayg:archive/fix/undo-768
kayg:recovered/feat/dav-recorder
kayg:recovered/feat/dav-recorder-901acd4
kayg:feat/contacts-import
kayg:perf/cold-growth-on-764
kayg:perf/cold-growth-on-tiering
kayg:recovered/feat/tasks-set-status
kayg:feat/tasks-move-reorder
kayg:feat/tasks-delete-promote-duplicate
kayg:feat/carddav-writes
kayg:perf/quota-on-tiering
kayg:perf/quota-simple
kayg:perf/cold-growth-on-quota-stack
kayg:recovered/perf/cold-growth-on-tiering
kayg:feat/calendar-identity
kayg:feat/calendar-event-parser
kayg:feat/calendar-props-maps
kayg:port/glass-when-ring
kayg:recovered/feat/tiering-761-s1-wip-8132a84
kayg:recovered/feat/tiering-761-s1-wip-9da4094
kayg:recovered/feat/tiering-761-s1-wip-724512c
kayg:recovered/feat/tiering-761-s1-wip-66e667e
kayg:recovered/feat/tiering-761-s1
kayg:wip/6by32-01-tier-761-s1-pause-20261030
kayg:spike/imap-766-s0
kayg:wip/6by32-02-calternal-pause-20261030
kayg:wip/8by64-01-review-688-pause-20261030
kayg:wip/6by32-01-verify-744-pause-20261030
kayg:wip/6by32-01-verify-742-pause-20261030
kayg:fix/private-staging-759b
kayg:wip/6by32-01-review-748-pause-20261030
kayg:wip/6by32-01-review-733c-pause-20261030
kayg:wip/6by32-01-review-733b-pause-20261030
kayg:review/calendar-month
kayg:wip/local/bm15-trash
kayg:plan/759b-staging
kayg:review/767b-tests
kayg:review/preview-2026-10-29
kayg:docs/tiering-731-plan
kayg:wip/c6b02-review-733d
kayg:wip/c6b02-bm1-full-a
kayg:docs/deploy-plan
kayg:fix/storage-owner-liveness-642
kayg:fix/storage-fix-7
kayg:feat/tiering-731
kayg:wip/tiering-731-first-attempt
kayg:perf/idle-honest-2
kayg:fix/storage-private-tmp-642-dev
kayg:fix/storage-exact-file-quarantine-642
kayg:perf/one-flush-save
kayg:review/calendar-static
kayg:review/indexing-ring
kayg:review/when-field-2
kayg:proto/block-identity-2-review
kayg:proto/block-identity-review
kayg:review/when-field
kayg:issue/tasks-create-ids
kayg:issue/tasks-create
kayg:review/combined
kayg:review/task-polish
kayg:review/top-buttons
kayg:review/q1-q5
kayg:archive/integ325-293
kayg:archive/integ325-ci
kayg:issue/calendar-adr
kayg:archive/old/train/2026-10-23bk2
kayg:archive/old/train/2026-10-23bk
kayg:issue/469-mockup-9a
kayg:issue/smart-tasks-mockup
kayg:issue/469-menus
kayg:issue/652-signout-flake
kayg:issue/652-history-fix7
kayg:issue/652-history-fix6
kayg:archive/old/issue/spring-check-perf
kayg:issue/spring-check-perf
kayg:issue/659-rename-fast
kayg:archive/old/train/2026-10-21ar
kayg:issue/search-hardening-3
kayg:issue/652-history-fix5
kayg:issue/660-port-sheets-glass
kayg:issue/652-history-fix4
kayg:issue/652-history-fix3
kayg:issue/652-history-fix2
kayg:issue/652-history-flake
kayg:train/2026-10-21an
kayg:issue/settings-admin-port
kayg:issue/search-port
kayg:train/2026-10-20am
kayg:issue/storage-split-fix2
kayg:issue/storage-split
kayg:archive/old/issue/folder-ids-fix
kayg:train/2026-10-20al
kayg:archive/old/issue/folder-ids
kayg:train/2026-10-20ak
kayg:issue/tables-mockup
kayg:train/2026-10-19aj
kayg:train/2026-10-19ai
kayg:issue/469-merge-fixes
kayg:issue/sidebar-band
kayg:archive/old/issue/608-settings-spec
kayg:train/2026-10-19ah
kayg:issue/swipe-offscreen
kayg:train/2026-10-19ag
kayg:archive/old/issue/590-nlp-adr
kayg:archive/old/issue/587-event-after-write-2
kayg:train/2026-10-19af
kayg:archive/old/issue/587-event-after-write
kayg:issue/469-pill-room-c
kayg:issue/469-pill-room
kayg:train/2026-10-19ae
kayg:issue/469-narrow-handle
kayg:issue/397-ios-swipe-2
kayg:issue/469-desk-fixes
kayg:archive/old/issue/auto-update-adr
kayg:issue/469-filter-gap
kayg:issue/469-port-1b
kayg:issue/442-opacity-flake
kayg:issue/327-web-fast-3
kayg:archive/old/issue/469-port-1
kayg:issue/469-port-1
kayg:issue/327-web-fast-2
kayg:archive/old/issue/327-web-fast
kayg:archive/old/issue/425-stt-bench-vq1
kayg:archive/old/issue/445-no-bleed
kayg:archive/old/issue/400-swipe-mockup-2
kayg:issue/426-client-review
kayg:issue/426-client-2
kayg:issue/426-client
kayg:archive/old/issue/476-safe-area-lab
kayg:archive/old/issue/445-top-light
kayg:issue/471-blocks-mockup
kayg:archive/old/issue/448-links-app-2
kayg:archive/old/issue/448-links-app
kayg:archive/old/issue/398-cold-links
kayg:issue/434-442-small-2
kayg:issue/434-442-small
kayg:archive/old/issue/398-unload
kayg:archive/old/issue/445-bottom-band
kayg:issue/445-bottom-band
kayg:issue/351-rem-3
kayg:issue/351-rem-2
kayg:issue/351-rem
kayg:archive/old/issue/327-first-note
kayg:issue/395-width-phone
kayg:archive/old/issue/327-typing
kayg:issue/396-ios-edges
kayg:issue/397-ios-swipe
kayg:archive/old/issue/327-notes-index
kayg:issue/345-347-contrast-empty-2
kayg:archive/old/issue/44-arenas
kayg:issue/44-arenas
kayg:archive/integ325
kayg:archive/old/issue/327-perf-harness
kayg:archive/old/issue/44-thp
kayg:issue/44-thp
kayg:archive/old/issue/285-sticky-pills
kayg:archive/old/issue/44-trim-3
kayg:issue/44-trim-3
kayg:archive/old/issue/165-cards
kayg:archive/old/issue/165-picker-2
kayg:archive/old/issue/212-multi-select
No reviewers
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
kayg/calternal!768
Loading…
Reference in a new issue
No description provided.
Delete branch "docs/undo-block-ids-plan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Repeated split/join Undo defects in #758 expose a shared identity invariant that native CRDT history does not preserve. Add a three-page design plan choosing server-validated structural inverse operations, durable boundary receipts, and one normaliser, while retaining native Undo for human text.
The plan compares all three options, specifies B5 concurrent-Undo behavior, O(edited region) work and the existing perf-VM bounds, shared invariant checks/property testing across the three harnesses and fuzz target, migration constraints, and five likely failure modes. Existing review reproducers remain required.
Documentation only, based on proto/block-identity-v7d at
57724c04. Validation: git diff --check; rendered as three A4 pages with 11-point body text. Product tests were not run for this writing task.Refs #671 and #758; review comments 69930 and 69997.
Independent design review — PR #768, round 1
Verdict: revise. Reviewed
docs/undo-block-ids-planat2f1ac759636dedfb4679a1117f094b8725114cb8, based on57724c04, on10by32-01-std. Fresh detached worktree:/home/agent/wt/review-768.The representation change is a credible direction. Removing structural separators from native Undo, retaining semantic boundary identity, and deriving separators once addresses the actual failure mechanism. The independent text/owner oracle, join probes, intermediate-delivery checks, and unchanged performance gates are also appropriate. However, three design blockers remain. These concern unspecified transitions and observable behavior; they are not claims that an implementation of this proposal has already failed.
Ranked blockers and required revisions
1. High: define rejection/rewrite reconciliation before promising offline inverse operations
Plan lines 86–106 say to validate dependencies/current membership atomically, predict locally, and rebase on accepted records without replaying human edits. They do not define the outcome when a predicted operation or its inverse is refused or rewritten.
Concrete scenario: A disconnects, splits a block, types into the new side, undoes that typing and then the split, and types again. B deletes the original block and syncs. On reconnect, delete-wins must keep A's text recoverable, while the new-side dependency and inverse must acquire a definite accepted, ineffective, or rejected result. Does A's provisional row disappear? Where can A recover its text? Does Undo now target the last typing step, a rejected split, or the previous accepted action? Retrying after an acknowledgement is lost or after a server restart must give the same answer. The plan currently supplies no answer to those questions.
There is also an unresolved contract boundary: “Rejected operations change nothing observable or durable” (line 35) cannot describe the whole lifecycle of an operation that already changed the offline screen and outbox. It can describe an immediate local refusal or an atomic server admission attempt. The later reconciliation needs its own contract.
This is a real protocol change from the current behavior:
Device::syncretains a refused outbox and returns before replacing the device state;pullrefuses to replace state while requests remain pending (client.rs:336–358). “Rebase” does not specify how that behavior changes. B5 defines server authority over IDs and immediate offline links; it does not supply this rejection protocol.Required edits: specify a compact lifecycle for original operations, Undo and Redo: pending, accepted/canonicalized, ineffective, and rejected, including durable receipt identity and the authoritative result returned for each. Define how an inverse references an unacknowledged original, how canonicalized receipts and ID re-keys are followed, how dependent requests proceed after rejection, and how the local text document, recovery data, outbox, Undo stack and Redo stack are reconciled. Include duplicate delivery/lost acknowledgement/restart. Distinguish server rejection atomicity from observable rollback of a provisional prediction. State the user-visible result for the scenario above and for Undo of a refused original; neither may undo an unrelated earlier action.
2. High: define the boundary/ownership reducer sufficiently to determine remote-edit and nested-history results
Plan lines 68–85 introduce stable keys, ordered sides and “current membership,” but do not define how those sides acquire human items or how withdrawing nested split contributions changes membership. A deterministic normaliser can make an incorrect choice consistently. The proposed invariants are a strong oracle once expected history is defined; they do not themselves define that history.
Concrete scenario: start with linked blocks
abandcd. A joins them; B seesabcdand insertsXat the old seam. A then undoes its Join. BothabX | cdandab | Xcdcan have complete coverage, one separator, immutable claim owners, valid aliases and stable export. Which result is intended? An independent expected-history oracle cannot decide without a rule for insertion affinity/ownership at a suppressed boundary. Repeat with an empty side, with the seam's human anchors deleted and restored by native Undo, and with delivery/reload between those steps. Referring to causal positions alone does not choose a side or specify durable restoration of those positions.Another required case is already represented by
structured.rs::creation_undo_keeps_remote_human_bytes: A createsLOCAL, B insertsREMOTEinside it, A undoes creation, and B's bytes must remain visible. Withdrawing a structural creation/split cannot orphan those surviving human items. A first link created by B must also continue to target the prescribed surviving identity. The plan explicitly discusses another author's deletion but does not state the corresponding creation/remote-edit outcome.The human/structural newline partition also needs a transition rule. Enter, multiline paste, deleting a selection across a separator, and a fence/table delimiter edit can combine human edits and structural effects. Specify whether existing newline roles remain attached to their original semantic records or change with grammar, and how Undo preserves their exact bytes in either case. The current format map can preserve owners even when Markdown grammar changes (
format/edit.rs); the replacement must retain that ability.Required edits: describe the semantic record fields and reducer rules for initial/imported boundaries, split creation/withdrawal, Join contribution/withdrawal, Redo, side ordering, owner/primary-ID placement, and human insertion/deletion affinity. Cover empty sides, tombstoned/restored human anchors, nested splits of joined groups, and surviving remote edits. Give literal text, owner and link-target expectations for the scenarios above. Expand the known reproducer walkthroughs below into explicit reducer outcomes. This need not be implementation code, but it must determine one result independently of the normaliser being tested.
3. Medium: include editor positions and one local history sequence in the contract
The invariant list, lines 11–39, never mentions caret, selection or the next Undo/Redo target. A state can satisfy every listed invariant while putting the caret in the wrong block.
For example, render
a\nbwith a derived structural separator and a human-only native text containingab. The editor positions immediately before and after the separator map to the same human offset. A native text-relative position without a boundary-side identity cannot distinguish them. Undo, remote normalization or reconnect can move a caret/selection to the other side while text, ownership, ID resolution and disk round trips all remain correct. This is the requested counterexample to completeness of the stated invariants.The existing browser editor binds
yCollaband its native UndoManager directly to the shared Y.Text (packages/editor/src/editor.ts:120–138); the Rust prototype currently pairs each inverse with a native stack item (client_history.rs:9–17). Excluding separators from client text updates therefore needs an editor-position mapping and a history coordinator, not just a server reducer. A replacement selection spanning human text and a derived separator must be one user Undo step. Separate native and structural stacks would otherwise permit a valid intermediate document with the wrong next Undo target.Required edits: add an editor contract for caret/selection anchors that includes boundary side/order, stable human positions and a defined fallback when the target is retired. Define a single chronological local action history pairing native text changes with semantic contributions, including grouping for Enter/paste/cross-boundary replacement. Require local completion and display before any network acknowledgement, online as well as offline; later authoritative correction must map the current selection rather than restore an obsolete numeric offset. Extend the checker inputs or add an editor-level companion checker with expected selection/history transitions, and require adapter tests alongside the crate harnesses. The full export/join-probe checker can remain test-only.
Walkthrough of the three known bugs
Comment 69930: empty owner becomes unjoinable. Split
neighborat zero to create E before S; Join E/S suppresses their boundary; Undo must withdraw that Join while preserving E's independent empty-side order. Splitting S at byte 4 creates a second boundary betweenneigandhbor. The E/S boundary must remain between E andneig; the final Join E/S consumes that logical boundary and succeeds before and after reload. The proposed separation from native separator items removes the old collapsed-separator-anchor mechanism. The remaining proof obligation is the reducer's side/membership rule in blocker 2.Comment 69997: concurrent Undo duplicates a separator. Both offline Joins must reference the same existing boundary key with distinct contributions J_A and J_B. With both known, either local Undo alone leaves it joined. After U_A reaches the server, J_B still suppresses it, including across server restart. After U_B, the same boundary is exposed exactly once; duplicate packets and device reload cannot create another separator. This case is structurally addressed by the explicit contribution-set rule in lines 93–97, provided checkpoint/receipt replay preserves withdrawals. The visible no-op for the first Undo is intentional selective-Undo behavior.
Comment 69997: nested history moves the empty prefix. Visible texts through the reproducer are
["", "text"]→["text"]→["text", ""]→["", "text", ""]→["", "text"]. Undoing the four actions must yield["", "text", ""]→["text", ""]→["text"]→["", "text"]. The original prefix boundary must retain its ordered empty side even while hidden inside later owner groups;target-idmust return to thetextgroup. Never restoring old display order is necessary. The plan names ordered sequence keys, but needs the membership/withdrawal rules to establish these intermediate outcomes by construction.I would retain both reviewer branches unchanged as specified. The first repro is fixed on this base; the other two are documented remaining failures. This review inspected their source and prior findings; it did not rerun the implementation campaigns or add tests/code.
Concurrency and local UX assessment
Cost assessment
Section 4 sets the right acceptance conditions: delta processing, indexed boundaries, no whole-note map rewrite/stringify on a keypress, grammar-bounded reparsing, and fixed-region scaling against note size and history depth. It does not yet establish an O(affected region + logarithmic lookup) implementation or a new timing result. The cited 0.504 ms added Enter p95 is the existing implementation's perf-VM baseline; the acceptance ceiling remains 1 ms, not 0.504 ms.
One specific measurement detail to add: include native CRDT items traversed and anchor-resolution work in the counters. An indexed semantic boundary lookup followed by
StickyIndex::get_offsetcan still walk retained sequence history; the current code documents that behavior intext_positions.rs. Counting only materialized bytes or semantic records can miss it. Likewise, repeatedly splitting/undoing one short block must not force visits to every historical joined member. Test interleaved remote edits that invalidate cached positions, as well as the unchanged immediate Enter/Undo benchmark. Keep full invariant scans and durable-copy join probes outside the production keystroke path. No performance experiment is necessary to review this document, and I did not run one.Simpler alternative worth separating in the decision
The table correctly rejects deriving identity from text alone and separating mixed edits by origin alone. It combines two independent decisions, however: semantic local history with derived separators, and server validation of every structural inverse. B5 requires server authority over public ID claims; it does not, by itself, require server arbitration of every boundary toggle.
Compare (c) with a local deterministic semantic contribution model using the same ordered receipts/normaliser, while the server remains authoritative for ID allocation, retirement and other genuinely conflicting operations. This would still require the representation change, so it is not a cheap origin-filter patch, but it may reduce rejection/rebase machinery. Explain which boundary conflict requires rejection rather than a deterministic accepted no-op or contribution merge. The review does not require selecting that alternative; it requires separating the rationale for semantic history from the rationale for expanding server validation.
Evidence and scope
Read the complete plan; ADR 0056 including B1–B5 and ADR 0022; issue #671 and the cited Undo/performance evidence; PR #758 comments 69930 and 69997; both reviewer branches (
0f34e47fand42aac955); and the relevant client history/edit/store, native text/position/projection, format, authority/admission/marker code and structural-history tests. Also inspected the browser history/editor integration for the cursor and grouping question.Documentation review only. No repository edits, production fixes, deployments, or performance/test pass claims. Approval should wait for the three ranked revisions; the existing implementation/fuzz/perf gates remain delivery requirements afterward.
Round 2/3 revision pushed in
ad60fee09b5ecf3734ef42a278c38a8c202ba702, addressing review 70006. Onlydocs/plans/0671-undo.mdchanged.Blocker 1 — rejection/replay: Added a shared original/Undo/Redo lifecycle (pending, accepted/canonicalized, ineffective, rejected), durable operation IDs, canonical effect/ID maps, dependency handling, and idempotent receipts across duplicate delivery, lost acknowledgements and restart. Specified replacement of stop-on-refusal sync/pending-pull refusal; reconciliation of text, recovery, outbox and both history directions; tombstoned native-ID scaffolding for later causal updates. The offline split/type/Undo/delete scenario now has explicit receipts, disappearing provisional row, recoverable bytes and next Undo target. Undo of a refused original consumes only its own history entry. Rejection atomicity is separate from correcting an already-visible prediction.
Blocker 2 — ownership: Added record fields and reducer rules for imported/split cuts, ordered empty slots, generation-scoped Join contributions, split withdrawal/Redo, insertion affinity, durable tombstone/restoration anchors, remote-survivor container pins, claim placement/aliases and retirement contributions. Literal text/owner/link expectations cover the seam insertion (including empty and deleted/restored anchors),
LOCAL/REMOTEcreation Undo, and all three known reproducers. Existing newline roles stay fixed through grammar changes via the format map; Enter/paste/cross-cut edits undo as exact-byte mixed actions.Blocker 3 — editor/history: Added boundary-side selection anchors to distinguish equal human offsets, mapped Undo/Redo positions and retirement fallback, plus one chronological local action sequence pairing native text with semantic effects. Keyboard/Vim/menu/mobile/app Undo must share a coordinator and projection adapter. Every command displays immediately before acknowledgement, online and offline; correction maps the current selection. Added editor endpoint/next-target checks and adapter tests alongside crate harnesses.
Should-fix — simpler alternative: Separated semantic history/derived separators from server arbitration. Recommend deterministic local contribution merge, with server guards for authorisation, dependencies, delete-wins and public IDs; ordinary boundary races merge or become ineffective rather than requiring rejection. B5 remains intact.
Should-fix — cost/evidence: Added native CRDT-item traversal and anchor-resolution counters, retained-history/short-block scaling and remote cache invalidation. Kept O(edited region) normalisation, unchanged perf-VM gates and well-under-1-ms Enter goal at 10k lines. The 0.504-ms number remains the old baseline. Full invariant scans and join probes remain test-only; both reviewer branches remain unchanged.
Product choices / failure analysis: Added “Decisions for kayg” with options, recommendations and visible examples for device history scope, Undo after remote edits/seam placement, and cursor placement/fallback. These are explicitly pending, not silently adopted. Updated the failure table / five likely failure modes.
Validation:
git diff --check; checked table columns and local source links; rendered the body to 3 A4 pages (10.5-pt body, 9-pt tables, 16-mm margins), plus the decisions section. Docs-only writing round: no product-code edits, implementation-test/perf claims or deploys. Round-2 independent review is still required.Independent design review — PR #768, round 2 of 3
Verdict: approve with required edits. Two bounded documentation edits are listed below. The three round-1 blockers are resolved at design level; neither required edit calls for a different representation or another open-ended design round.
Reviewed
docs/undo-block-ids-planatad60fee09bon 10by32-01-std, in the fresh detached worktree/home/agent/wt/review-768b, created fromorigin/docs/undo-block-ids-plan. Line references below refer to this plan at the reviewed commit.Required edits — exact list
State the result of Undoing deletion after delayed text was put in recovery. Add one reducer example/paragraph beside lines 119–125 or the examples table, preserving
review758::server_resolution_overrides_cached_local_claim_after_split_move_delete_reloadonreview/758-tests: A moves linkedalpha; B, offline, insertsREMOTEat position 1; A deletes and syncs; B syncs; A pulls and Undoes the deletion. Before that Undo the block is retired and B's text is recovery-only. After it, the original ID resolves toaREMOTElphain the moved destination, also after server restart/fresh-device load. Explain that the deletion-Undo effect can restore retained lineage text without changing the original terminal receipt; genuinely rejected text and text explicitly undone by its author must not be resurrected by this restoration. With another active deletion, it remains retired. Lines 55–57 restore retirement contributions, while lines 83 and 90–100 make blocked edits ineffective and exclude refused native items/restorations; the link between those rules and this existing passing control is currently implicit. This is a narrow restoration clarification, not a request to replay typing or to relax delete-wins.Apply the cost contract explicitly to the recovery journal. At lines 81/101–102, qualify “raw before/after text” as the changed spans plus durable shared-version/item references, or an equivalent delta representation, with full recovery reconstruction outside the key path. A one-character edit in a large note must not synchronously materialize/write two full-note strings. Require the fixed-region cost check to include recovery capture/persistence preparation as well as normalisation, selection mapping and native anchor work. This removes an avoidable full-snapshot reading of the new recovery requirement; it does not change the perf budget or demand a new benchmark in this writing round.
Round-1 blockers
1. Rejection/replay — resolved. Lines 76–105 now define pending, accepted/canonicalized, ineffective and rejected outcomes for originals and inverses. Stable operation IDs and payload hashes, persisted receipts and canonical mappings make duplicate delivery/lost acknowledgement/server restart deterministic. Dependents of absent sides become ineffective while independent requests continue. Tombstoned causal scaffolding and receipt-aware projection address the missing-clock problem without replaying human commands. The plan expressly replaces stop-on-refusal sync and the pending-pull prohibition.
The original offline split → type → Undo typing → Undo split → type scenario has a definite result after B deletes the lineage: the provisional row disappears, its ID remains retired, all provisional text remains recoverable, and the next Undo consumes only the last typing entry and explains the no-op. A refused original also consumes its own entry. Rejected inverses roll back prediction and restore that entry's eligibility without popping an unrelated action. Server rejection atomicity is correctly separated from correcting a screen that already displayed a prediction. Required edit 1 covers the subsequent deletion-Undo compatibility case, rather than reopening this lifecycle.
2. Ownership after remote edits — resolved. Lines 24–62 supply durable cut keys, ordered owner slots, retained gap/tombstone identities, restoration mappings, contribution generations and side affinity. Exposed cuts partition ordered intervals; withdrawing a Join changes only its contribution. Split withdrawal preserves surviving runs and pinned handles in the merged group. Human ownership is no longer reconstructed from a repaired newline or the nearest current offset.
Under the proposed K2 default, joining linked
ab/cd, insertingXat the hidden seam and Undoing Join givesab | Xcd, with original L/R link ownership restored separately. Empty left and deleted/restored b/c anchors have literal outcomes too. Undoing creation ofLOCALafter B inserts/linksREMOTEleavesREMOTEin C, and B's link stays on C. Fixed newline roles and the format map preserve exact human bytes through grammar changes; Enter/paste/cross-cut replacement pair bytes and semantic effects in one action. These are independently checkable rules, rather than an assertion that a deterministic normaliser will choose correctly.3. Cursor/selection and unified history — resolved. Lines 107–136 define one chronological local sequence pairing native text stack items, semantic effects and before/after anchors. Enter, paste, cross-cut replacement, IME and make-note-from-block have explicit grouping; all command surfaces must share the coordinator. Boundary side/order distinguishes the two projected positions at human offset 1 in
a\nb. Undo/Redo map stored action anchors; remote correction maps the current selection; retirement has a deterministic fallback. Editor endpoint/next-target assertions and adapter tests accompany the crate oracles. Correct text with the wrong next Undo target or caret is now explicitly a failure.Reproducer walkthroughs
review758_minimalreview758bfilesalphabeta; no native Undo can insert an extra separator. Unknown remote contributions may correct a provisional split later, as the plan explicitly permits.review758bfilestext→ `textThe plan requires the reviewer branches unchanged, the checker to catch the two remaining failures on the base, and checks after intermediate publication/delivery/reload—not merely final convergence. That is the right implementation gate. This walkthrough establishes removal of the three reported failure mechanisms by construction; it is not a claim that the unimplemented reducer or randomized campaigns have passed.
Immediate/offline behavior and performance
Lines 7–8 explicitly require local display before acknowledgement for every edit/Undo/Redo, online and offline, with atomic text/owners/projection/selection publication. Ordinary boundary races merge locally instead of waiting for server arbitration. B5 still guards public IDs. Reconnect correction and recovery do not block the initial command. This satisfies the requested interaction contract.
The normalisation budget is preserved: O(edited region) plus O(log note size) lookup, delta ropes, indexed cuts/owners and contribution counts/shared endpoints; no whole-note rewrite or historical-member walk. Native item traversal and anchor resolution are now counted, including remote cache invalidation and repeated split/Undo of a short block as retained history grows. Head-walking
StickyIndex::get_offsetis expressly forbidden as a hidden fallback. Grammar-changing fences may enlarge the actual region; ordinary Enter may not. Required edit 2 extends this same discipline to the new synchronous recovery obligation.The unchanged seven-key and immediate Enter/Undo/Redo perf-VM gates remain, with well-under-1-ms added Enter p95 at 10k lines/500 links and a hard 1-ms ceiling. 0.504 ms is prior-implementation evidence only. The design provides a plausible bounded path and enforceable acceptance criteria, not proof of a new timing result. Implementation approval still requires the listed functional, fuzz, editor and perf evidence.
Decisions for kayg
K1–K3 are real product choices, with options, recommendations and observable consequences:
ab | XcdversusabX | cd). These can be answered independently despite sharing a heading. The recommended preservation rule fits ADR 0022.The section correctly labels these as pending and uses the recommendations only to make the examples definite. No additional product decision is needed to resolve the three reviewed failures. The two required edits concern compatibility and bounded implementation work, and should not be turned into questions for kayg. Chosen alternatives must be reflected in the examples and editor oracle before implementation approval.
Evidence and scope
Read the round-1 report at
/home/agent/codex-jobs/review-768/review.md/ 70006, the author's 70016, the complete revised plan, ADR 0056 and ADR 0022, issue #671 and relevant review/perf comments, both reviewer branches at0f34e47f77579e03deebabb14a57f9054ed1fb99and42aac955e4944a612a8c6ea6f6ca68ca212eeb59, their minimal/random/control test source, and the relevant block-ids client/history/store, authority/admission/recovery, projection/position/format and editor-binding code.Documentation review only. Worktree HEAD and cleanliness verified;
git diff --checkpassed. No repository source edits, new tests, test/perf execution, commits, merges or deployments. The required edits are documentation changes for the author; this reviewer has not changed the plan.Applied the two required edits from round-2 review 70018 in
003f869c399fe39accb518d05a6b56a9142c796d. Onlydocs/plans/0671-undo.mdchanged, including matching failure-table rows 1 and 5. “Decisions for kayg” is unchanged byte-for-byte.Validation:
git diff --checkpassed; verified the single-file scope and unchanged decisions section. Documentation only; no product code changes or test/perf runs.kayg referenced this pull request2026-11-05 23:21:11 +00:00
housekeeping #1009: rebased+green for the targeted gates below, left open for review.
rebased undo/block identity proposal on #758.
head:
be9023beb946bb211e8db72c6055465f13a0c1a1, based on devcd7f84432febfc63b788fbb9b9f9950452982d74; pushed with the original exact force-with-lease.Mac VM validation through Nix and the shared Mac lock/slot passed: frontend frozen install, check, lint, build, bundle gate and unit tests;
cargo fmt -p calternal-block-ids -- --check;cargo check -j4 --locked -p calternal-block-ids --all-targets;cargo clippy -j4 --locked -p calternal-block-ids --all-targets -- -D warnings;cargo test -j4 --locked -p calternal-block-ids --lib(35 tests). frontend inputs are unchanged since the initial frontend pass. commands and logs.this is prototype/package validation. the historical five-hour verify5 randomized qualification, fuzzing and performance qualification were not rerun; no merge or production-readiness claim. carriage-return/CRLF fuzz seeds intentionally retain their original line-ending bytes.
original-head patch inventory,
pr-768.md.triage 2026-11-11: closing as covered plan: Undo/block-ID plan is carried byte-for-byte in implementation #816, on #758.
Pull request closed