Repository navigation
Description
Part of #499. Read the parent first. Not on the release path. Owner of the Decision: the maintainer.
This issue measures and designs. It writes no product code. Code waits for a ruling on Decision CM1.
Summary
Two peers who move TOC sets at the same time can duplicate sets that nobody dragged. The duplicate toc-ids then stay in the document (measured on a scratch copy, 2026-10-15). A peer's concurrent typing can be lost, also in a set that nobody moved (measured on a scratch copy).
Names in this issue:
- A set (R6) is one heading plus its whole subtree. This issue says "set" for the thing a user moves.
- A section is the flat-document range that holds a set. It runs from the heading to the next heading at its level or higher. This issue says "section" only for that range, as in
moveSection.
The cause is not new. Today's moveSection moves a section as one delete plus one insert (move-section.ts:8-26; read from code). The new planner in #500 keeps that path for real moves. So this defect does not gate the TOC move release.
This issue reproduces the defect on a real local pad, confirms or refutes the lost-edit case, and posts one recommended design for a maintainer ruling.
Maintainer rulings that bind this issue
The full text is on #499. One line each:
- R1. A level change of
don the dragged heading shifts every sub-heading in its set by the samed. So a moved set can carry several markup steps. - R2. Think like a flat document. A level change is a level change, and the section logic derives the tree. So an in-place re-level needs no delete and no insert.
- R3. The Title never moves and is never a drop target above. Step 0 checks that every merged and reloaded outline still starts with one H1 Title with its original toc-id.
- R4. A shift that passes H6 stays at H6. No case here needs a depth refusal.
- R5. A drop on a heading puts the set inside it. That is one more move path with the same delete plus insert (case 8b-5 below).
- R6. A set is one heading plus its whole subtree. The set is the unit that a move deletes and re-inserts.
Depends on / Blocks
- Depends on Move a TOC section with its sub-headings and keep the Title fixed #500. It ships markup-only re-levels in place, and it ships the R1 shift.
- Today
moveHeadingSectionre-levels the dragged heading only (moveHeading.ts:108-111; read from code). So a case that changes a level on today'smainwould record a shape that R1 overturns. - Cases R-4, R-4b, R-5, L-3 and L-3b need Move a TOC section with its sub-headings and keep the Title fixed #500.
- Cases R-1, R-2, R-3, L-1, L-1b and L-2 can run on today's
main.
- Today
- Optional: case R-5 is cleanest after Drop a section onto a TOC heading to put it inside #508 ships.
- Blocks nothing. It does not gate Run the TOC move hallway test before drop inside ships #509 or the TOC move release.
Current behaviour
Why a move rewrites content
moveSectioncopies the section slice, then deletes the old range and inserts the copy in one transaction (move-section.ts:8-26; read from code).- The TOC calls it from
moveHeadingSection(moveHeading.ts:94-115; read from code). - Today a pure re-level also takes this path.
isSamePositionis true only when the level does not change, so a same-slot level change still runsmoveSection(moveHeading.ts:75-112; read from code). Move a TOC section with its sub-headings and keep the Title fixed #500 changes that to markup steps only. - The pad syncs through the Tiptap Collaboration extension on the provider's Y.Doc (
TipTap.tsx:296-299; read from code). - The ProseMirror-to-Yjs sync does not replay a move.
updateYFragmentmatches child nodes from the left and from the right. It then rewrites the middle, or deletes and re-inserts it. Source (read from code, no repo permalink): installed@tiptap/[email protected],dist/y-tiptap.jslines 1542-1690, "find number of matching elements from left" / "from right". - So the blocks that get new Yjs items are the ones the diff picks. That can be the moved set, or the blocks it jumped over (secondary / inferred from that code and from the lost-edit rows below).
- Two peers who both delete the same old items and both insert new copies get two copies after the merge (secondary / inferred).
Why duplicate toc-ids stay
- UniqueID skips every transaction from a collab change origin (
TipTap.tsx:147-152,filterTransaction: (transaction) => !isChangeOrigin(transaction); read from code). - On a local transaction, UniqueID re-keys a duplicate only when the step deleted its old position. Source (read from code, no repo permalink): installed
@tiptap/[email protected],dist/index.jslines 193-195,if (deleted && duplicatedNewIds.includes(id)). - So nothing re-keys a duplicate that arrived by sync, and a later local edit does not either (measured: rows 8b-1, 8b-2 and 8b-5 below).
What a duplicate toc-id breaks (secondary / inferred, not run in the UI)
findHeadingByIdreturns the first top-level heading with the id (moveHeading.ts:16-39; read from code). A later move of the second copy moves the first one.- A heading chat room is keyed by
(workspace_id, heading_id)(apps/hocuspocus.server/CLAUDE.md:131; read from code). Two headings would share one room and one unread count. - Fold state is a set of toc-ids (
heading-fold-plugin.ts:13-19; read from code). Two copies would fold together. - The change digest pairs sections by toc-id.
pairSectionspairs them (apps/hocuspocus.server/CLAUDE.md:102). A reorder that keeps itstoc-idismoved(:104).zippablerefuses to zip two sections that both carry atoc-id(:107). All three read from code. A duplicate may report the wrong section.
How wide the window is
- Two edits conflict only when each is made before its peer sees the other. With both peers online, that is about one network round trip (secondary / inferred, not measured).
- The pad keeps an IndexedDB mirror of every Y update (
useYdocAndProvider.ts:86-92;apps/webapp/CLAUDE.md:185; read from code). An offline peer's edits merge on reconnect. So the window can be the whole offline time (secondary / inferred). - A peer can keep editing only while the browser itself reports offline. A dropped socket with
navigator.onLinetrue ends inproviderStatus: 'error', and'error'turns on the editing lock (useYdocAndProvider.ts:185-195;isDocumentEditingLocked.ts:8-14; read from code).
Evidence from a scratch copy (measured, 2026-10-15)
Harness: a headless Tiptap Editor in jsdom with the real Collaboration extension (ySync and yUndo), the repo's UniqueID config and the repo's TitleDocument. Two Y.Docs relay updates through an in-memory link. The link is paused for each case, both peers move, then the link resumes. The moves use a scratch planner that copies moveSection line for line and adds the R1 shift. Versions: tiptap 3.31.3, y-tiptap 3.0.9, yjs 13.6.32, jsdom 26.1.0, Bun 1.4.3.
How to read the rows:
- 8b-1 to 8b-5 are the scratch case ids.
Name#idis a heading and its toc-id.- After the merge, the harness edited one heading's text in one peer.
!Xmarks that edit in the first (or only) copy.?Amarks it in the second copy.
Start outline for every 8b case: Title#T A#A B#B X#X X1#X1 X1a#X1a Z#Z. That is H1 Title, H2 A, H2 B, H2 X (with H3 X1 and H4 X1a) and H2 Z, with one paragraph each.
| Case | Peer A | Peer B | Merged on both peers | Result |
|---|---|---|---|---|
| 8b-1 | X before A | X before A | Title X X1 X1a A B A B Z |
duplicates=Ax2,Bx2. A and B were never dragged. |
| 8b-2 | A after Z | A after Z | Title B X X1 X1a Z A A |
duplicates=Ax2 |
| 8b-3 | X before A | X after Z | Title Z X X1 X1a A B |
duplicates=none, but Z jumped to the top. Nobody moved Z. |
| 8b-4 | X before A | re-level X in place, d=+1, markup steps only |
Title X X1 X1a A B Z, X H3, X1 H4, X1a H5 |
duplicates=none. Both edits kept, and the R1 shift held. |
| 8b-5 | X inside A, last child | the same | Title A XX X1 X1a B B Z |
duplicates=Bx2, and heading text X doubled to "XX". |
-
In every case both peers converged to the same document (
Y fragments equal=true PM JSON equal=true). The document is wrong, not split. -
After a local edit in either copy, the duplicates stayed. 8b-2 and 8b-5 gave the same result. The 8b-1 harness output was:
after a local edit in the 2nd copy of A: Title#T !X#X X1#X1 X1a#X1a A#A B#B ?A#A B#B Z#Z duplicates=Ax2,Bx2
Lost-edit rows. This harness calls updateYFragment directly on a minimal schema, not through ySync and the real Editor. Peer B types PEER- into one paragraph while peer A moves. The labels in the first column are the scratch labels.
| Move by peer A | Peer B edits | Edit kept |
|---|---|---|
| small A section after D | a1, inside the moved set |
false |
| small A section after D | b1, outside |
true |
| D section before A (up) | d1, inside the moved set |
false |
A after C with cascade +1 |
a2, inside the moved set |
false |
| re-level A only, markup steps | a1, inside the set |
true |
| LARGE A section after small B | a1, inside the moved set |
true |
| LARGE A section after small B | b1, the set that stayed |
false |
- The last two rows show the rule. The edit is lost in whichever blocks the diff rewrites, and that can be a set nobody moved.
- The LARGE rows used the start outline
Title,A(a1-a5),B(b1), with no other sets (measured: scratchmeasure/move-yjs.mjs:85). - The scratch scripts are not in the repo. The maintainer can attach
editor-real.ts,planner.ts,measure/move-yjs.mjsand their output files if wanted.
Harness limits (why Step 0 exists)
- The 8b provider stub sits on
Collaboration. The app puts the real provider onCollaborationCaret(TipTap.tsx:296-299; read from code). - The lost-edit rows never ran through the real Editor, Hocuspocus or the IndexedDB mirror.
- 8b-4 used one set size: a 3-heading X jumped over the 2-heading A+B. A peer move over a larger block may rewrite the re-levelled items and drop the markup (secondary / inferred). Cases R-4b and L-3b check that.
- 8b-5 used a last-child drop. D4 is ruled on Move a TOC section with its sub-headings and keep the Title fixed #500: the first child. So Step 0 re-runs it that way when possible.
- No case ran with one peer online and one peer offline, which is the common real shape (secondary / inferred).
Target behaviour
- This issue holds a real-pad reproduction with outlines and toc-ids for each case.
- The lost-edit case is confirmed or refuted on a real pad. It covers an edit in the moved set and an edit in a set that stayed.
- One comment holds the coverage table below, filled with real-pad results, and one recommended design for Decision CM1.
- No product code changes until the maintainer rules.
Micro-interactions
Not a UI issue. This issue builds no visual and no motion. A ruled option may need a visible state, such as a refused move. Then the follow-up code issue owns that state and its design-system Decision.
Implementation steps
Work on main. Read AGENTS.md, apps/webapp/CLAUDE.md, apps/webapp/src/components/TipTap/CLAUDE.md and apps/hocuspocus.server/CLAUDE.md first. Do the steps in this order. Change no repo file.
Step 0. Reproduce on a real local pad (gates every later step)
-
Start the local stack with
make dev-local. Read the WEBAPP line for the port (usually 3000). The WS server is on 4001 (README.md:45-59; read from code). -
Record
git rev-parse HEAD. Note which of Move a TOC section with its sub-headings and keep the Title fixed #500 and Drop a section onto a TOC heading to put it inside #508 are in that commit. For each issue:- run
gh issue view <n> --json state,closedAtandgit log --oneline --grep '#<n>'; - then check that the fix commit is an ancestor of HEAD with
git merge-base --is-ancestor <sha> HEAD. Exit code 0 means it is in the commit.
- run
-
Use two signed-in browsers with two different users. Two Chrome profiles work. Sign in with an email link from the local inbox at
http://127.0.0.1:54324. -
Use a real pad, not
/editor. The playground passesprovider: null, so it has no peers (EditorPlayground.tsx:49; read from code).window._editorandwindow._moveHeadingdo not exist on pad routes. So every move is a real pointer drag in the TOC, or a Section options row once Add Move rows to Section options and open the menu from the grip #501 ships. -
Open
/newin browser A. Open the same pad URL in browser B. Type the start outline with the Block style select: H1Title, H2A, H2B, H2X, H3X1, H4X1a, H2Z. Give each heading one paragraph:t0,a0,b0,x0,x1,x1a,z0. Every case uses this start outline, except L-2. -
Read the outline and ids in each browser with this DevTools line. It is scoped to
.ProseMirror, because rail ticks also carrydata-toc-id:[...document.querySelectorAll('.ProseMirror :is(h1,h2,h3,h4,h5,h6)[data-toc-id]')].map((h) => `${h.tagName} ${h.textContent}#${h.dataset.tocId}`).join(' | ')
-
Cut the offline browser off. In most cases that is browser B. In L-1b it is browser A. Use DevTools → Network → Offline in that browser. The status chip is not proof, because the browser
offlineevent alone sets it (useYdocAndProvider.ts:359-366; read from code).- Proof: a word typed in the offline browser does not appear in the other browser within 5 seconds. Delete that word before the case starts.
- DevTools offline may not close an open WebSocket (secondary / inferred). If the word crosses, use the fallback below.
- Fallback: run the four processes in separate terminals instead of
make dev-local(Makefile:212-219; read from code).- First run
bun scripts/dev-local-preflight.tsonce (Makefile:213; read from code). - Then run one of these in each of four terminals:
bun --filter @docs.plus/hocuspocus dev:rest,bun --filter @docs.plus/hocuspocus dev:ws,bun --filter @docs.plus/hocuspocus dev:worker,bun --filter @docs.plus/webapp dev(Makefile:215-219; read from code). - The scripts exist in
apps/hocuspocus.server/package.json:8-10andapps/webapp/package.json:7(read from code). - Set DevTools Offline in both browsers, then stop only the WS process: press Ctrl+C in the
dev:wsterminal. Both peers now queue edits, which is the scratch shape. - Both browsers need DevTools Offline first. Otherwise the dropped socket ends in the editing lock (see Current behaviour).
- Prove the fallback cut with the same typed-word test. To merge, restart
dev:wsin its terminal, then clear DevTools Offline in both browsers.
- First run
- Post which cut you used for each case.
-
Run each case below on a fresh pad. Post five entries for each case. For the merged entry and the reload entry, post one line per browser.
- the start outline;
- the online browser's local outline, before the offline browser goes back online;
- the offline browser's local outline, at the same time;
- the merged outline;
- the outline after a reload.
Read the merged outline only after two checks. First, the status chip in both browsers leaves
offline. Second, a word typed int0in browser A shows in browser B. Delete that word before the reload.Check that every merged and reload outline starts with one
H1 Titlewith its start toc-id (R3).In every row except L-1b, browser A stays online and browser B is cut off. In the fallback, both are cut off.
Some cases need setup before the cut-off. Do the setup, confirm in both browsers that it shows, then cut off.
| Id | Setup before the cut-off | Browser A | Browser B | Needs |
|---|---|---|---|---|
| R-1 | none | Online (offline in the fallback). Drag X before A. | Cut off. Drag X before A. | today's main |
| R-2 | none | Drag A after Z | Drag A after Z | today's main |
| R-3 | none | Drag X before A | Drag X after Z | today's main |
| R-4 | none | Drag X before A | Re-level X in place, one level deeper. Use Demote from #501, or a same-slot drag with the sideways offset while it still exists. | #500 |
| R-4b | Give X five more paragraphs, xp1-xp5. |
Drag A after Z | Re-level X in place, one level deeper, as in R-4 | #500 |
| R-5 | none | Drop X inside A | Drop X inside A | #500; #508 preferred |
| L-1 | none | Drag A after Z | Type PEER- at the start of paragraph a0 |
today's main |
| L-1b | none. Browser A is cut off here. Use the same cut-off proof. | Cut off. Drag A after Z. | Online. Type PEER- at the start of paragraph a0. |
today's main |
| L-2 | Own start outline: H1 Title (t0), H2 A (a0-a5), H2 B (b0). It matches the scratch LARGE fixture. |
Drag A after B | Type PEER- at the start of b0 |
today's main |
| L-3 | none | Re-level A in place, one level deeper, as in R-4 | Type PEER- at the start of a0 |
#500 |
| L-3b | Give A five more paragraphs, a1-a5. |
Drag B before A | Re-level A in place, one level deeper, as in R-4 | #500 |
R-5 needs #500 for the R1 shift. Before #508 ships, drop X in the gap before B with the sideways offset at H3, on a commit that has #500. Otherwise mark R-5 "skipped: needs #500". Say which drop you ran.
Expected levels after the R1 shift: X H3, X1 H4, X1a H5 in R-4, R-4b and R-5. A H3 in L-3 and L-3b.
- Post one comment headed
## Real-pad reproduction, <date>with the commit, the cut-off proof and every case. Mark a case "skipped: needs " when that issue is not in the commit. For R-4, R-4b, R-5, L-3 and L-3b, that issue is Move a TOC section with its sub-headings and keep the Title fixed #500. A missing Drop a section onto a TOC heading to put it inside #508 does not skip R-5. Run the fallback drop above instead.
Step 1. Confirm or refute the lost-edit case
Read the L-1, L-1b, L-2 and L-3 results from Step 0. State for each one whether PEER- survived after both reloads. For L-3b, state whether A kept its new level after both reloads. Then state the rule in one sentence: which blocks lose concurrent edits. If L-2 keeps the edit, say that the scratch "section that stayed" result did not reproduce.
Step 2. Fill the coverage table
Copy this table into the comment and replace each cell with the real-pad result or a one-line reason. The cells now are predictions (secondary / inferred), except the R-4 / 8b-4 and L-3 cells marked measured.
| Case | (a) Stateless or awareness lock | (b) Post-merge toc-id dedupe | (c) Markup-only re-level (shipped in #500) | (d) Refuse a TOC move while this client is offline |
|---|---|---|---|---|
| R-1 / 8b-1 duplicates | Helps only if both peers are online and the lock arrives first. Cannot reach an offline peer. | Deletes the later equal copy of A and B. Outline becomes correct. | No effect. | Prevents it when the mover is the offline peer. |
| R-2 / 8b-2 duplicates | As above. | Deletes the later equal copy. | No effect. | As above. |
| R-3 / 8b-3 reorder | As above. | No effect: there is no duplicate. | No effect. | As above. |
| R-4 / 8b-4, R-4b | Not needed. | Not needed. | Merges cleanly (measured on one set size; R-4b checks the other). | Not needed. |
| R-5 / 8b-5 duplicates and "XX" | As above. | Deletes the later B. "XX" stays. | No effect. | As above. |
| L-1 / L-1b / L-2 lost edit | No effect: typing is not a move. | No effect. | No effect on a real move. | Helps only in L-1b, where the mover is offline. An offline typist (L-1, L-2) still loses edits. |
| L-3 lost edit on re-level; L-3b re-level under a peer move | Not needed. | Not needed. | L-3 keeps the edit (measured on scratch). L-3b checks that the new level survives; a prediction. | Not needed in L-3. In L-3b, helps only when the mover is offline. |
Step 3. Write down the cost of each option
Put one short paragraph per option in the comment. Use these facts.
- (a) Lock. The stateless relay is an allowlist that holds only
docTitle(statelessRelay.ts:13,:26-39;hocuspocus.server.ts:346-366; read from code).- The relay has no authorization and reaches the whole fleet. Any public room is joinable with no credentials (
apps/hocuspocus.server/CLAUDE.md:50-55; read from code). - So a new relayed type is a security change. An anonymous viewer could send a fake lock and block every move in the room (secondary / inferred).
- Sub-question: carry the lock in awareness instead. Awareness needs no relay change.
- A remote awareness state is dropped after 30 seconds with no update. Source (read from code, no repo permalink): installed
[email protected],awareness.jsline 13,outdatedTimeout = 30000, and line 70. - A state is also removed when its client disconnects (secondary / inferred, not read in the Hocuspocus source).
- It has a 64 KiB frame budget (
apps/hocuspocus.server/CLAUDE.md:57; read from code). Any client can still write a fake field (secondary / inferred).
- A remote awareness state is dropped after 30 seconds with no update. Source (read from code, no repo permalink): installed
- Either way, the lock never reaches an offline peer. It narrows only the online window.
- The relay has no authorization and reaches the whole fleet. Any public room is joinable with no credentials (
- (b) Dedupe. It needs its own pass, because UniqueID ignores synced transactions (see Current behaviour).
- Say where it runs. On every client, all clients may repair at once. Deleting the same Yjs items twice is safe, but two clients must pick the same copy (secondary / inferred).
- Rule to evaluate: keep the first copy in document order. Delete a later copy only when its content equals the first copy.
- When the copies differ (a peer edited one, as in
?A#A), deleting loses that edit. Re-keying keeps both copies, but the second one loses its chat room, folds and unread count. Name which trade you recommend. - It does not fix the 8b-3 reorder, the "XX" text or a lost edit.
- (c) Markup-only re-level. Already shipped by Move a TOC section with its sub-headings and keep the Title fixed #500. No extra cost. It covers only re-levels.
- (d) Offline refusal. Reuse the
'locked'refusal that Move a TOC section with its sub-headings and keep the Title fixed #500 adds (not on main at 85295b8; read from code:moveHeading.tsreturns only booleans). Key it on the provider status.- The app sets
providerStatusto'offline'on the browserofflineevent (useYdocAndProvider.ts:359-366; read from code). - On a disconnect it sets
'offline'only whilenavigator.onLineis false, and otherwise takes an error path (:170-190; read from code). So the gate must name every status that means "not connected". - It needs a visible state (no grip, or a disabled Move group), which is a design-system Decision in the code issue.
- Notion allows offline editing: "All Notion users can view, edit, and create pages offline on the desktop or mobile app." (Notion guide; primary source).
- Its offline exclusions name embeds, forms, buttons, sharing and permissions, and no move limit (secondary / inferred: the guide does not mention moves).
- Google Docs and Word were not checked.
- So no checked peer refuses a move offline. Flag this under
AGENTS.md:151before you recommend it.
- The app sets
- (e) Count before repair. One Sentry message per pad session when a synced transaction leaves two top-level headings with one toc-id. Reuse
captureCollabIssueOnce(observability.ts:75-91; read from code). It repairs nothing. It tells the maintainer how often this happens.- Run the check only when the list of top-level heading ids changes, not on every remote keystroke (
TipTap/CLAUDE.md§Editor Performance; read from code).
- Run the check only when the list of top-level heading ids changes, not on every remote keystroke (
- Rejected: a server-side move op. It would serialize two moves. But a server write loses authorship: "
applyContentToDocclones every node under the server document's own clientID" (apps/webapp/CLAUDE.md:260; read from code). It still deletes and re-inserts, so it keeps the lost-edit case, and it cannot reach an offline peer (secondary / inferred).
Step 4. Post the Decision
Post one comment headed ## Design proposal, <date>. It holds the Step 1 rule, the filled table, the Step 3 costs and Decisions CM1 and CM2 below, each with the recommended answer first. Update the recommended answer if Step 0 hits a flip rule. Then stop. Code waits for a Maintainer ruling, <date> comment.
Out of scope
- Any product code before a ruling. That includes a lock, a dedupe pass, a refusal and a detector.
- Changes to the collab storage design are settled (root
CLAUDE.md:44;apps/hocuspocus.server/CLAUDE.md:5). A change to Yjs itself is out of scope for this issue. - A patch to
@tiptap/y-tiptapso that a move keeps its Yjs items. If Step 1 shows that is the only real fix, say so in the proposal as an upstream follow-up. - Concurrent typing with no move. Yjs already merges it.
- The phone TOC. It has no move path today (tracker D27).
Decisions
The recommended answer comes first. Owner: the maintainer. The ruling is posted as a comment headed Maintainer ruling, <date>. These ids are local to this issue and do not collide with the tracker's D numbers.
- CM1. Which design handles concurrent TOC moves? Recommended (before Step 0): accept the loss as a recorded hazard, and ship only the log-only detector (e). Build no lock and no repair yet.
- The loss you accept, stated plainly: a peer's typing in any block the diff rewrites can be lost when the peers merge. With an offline peer, that is every edit made in those blocks while offline.
- Also accepted: duplicate sets and toc-ids stay until someone deletes them by hand.
- Reason: no option fixes the lost-edit case, and the lock cannot reach an offline peer. A repair that deletes content needs evidence that the risk is worth it.
- Why not (d): it prevents a duplicate only when the mover is the offline peer. It helps a lost edit only when the mover is offline (L-1b).
- Notion allows offline editing (Notion guide; primary source: "All Notion users can view, edit, and create pages offline on the desktop or mobile app."). Its guide names no move limit (secondary / inferred).
- Google Docs and Word were not checked. So no checked peer refuses a move offline (
AGENTS.md:151). - It also adds a visible state that needs a design-system ruling.
- Flip rule 1: if L-1 or L-2 loses
PEER-on a real pad, say which peer was offline. Re-weigh (d) only when the lost edit happened with the mover offline, as in L-1b. - Flip rule 2: the production count from (e) is the only real frequency gate. A local stack cannot show how often moves race. If the count is not zero, bring it and re-open this Decision. The house treats a repair like the Report route: the count first.
- Alternatives: (a) a stateless or awareness lock. (b) Dedupe now. (d) Refuse moves while offline; no checked peer supports it. The server-side move op is rejected in Step 3.
- CM2. Where is the accepted hazard recorded? Recommended: one bullet in
apps/webapp/src/components/TipTap/CLAUDE.md§Heading Schema, next to "Section reorder is TOC-only".- Reason: the defect lives in the client move path, so that is where an agent who touches the move reads first.
- Alternative:
apps/hocuspocus.server/CLAUDE.md§Documented hazards we accept, which holds the server-side collab hazards.
Acceptance criteria
- A
## Real-pad reproduction, <date>comment names the commit and the cut-off method. It proves that the offline browser was cut off for each run. - Each case in the Step 0 table shows the five entries with toc-ids from Step 0 item 8. That is R-1 to R-5, R-4b, L-1 to L-3, L-1b and L-3b. A skipped case names the issue it waits for.
- For R-4, R-4b and R-5, check the merged outline and the reload outline in both browsers. X, X1 and X1a each shift by the same d (expected H3, H4, H5 from H2, H3, H4). Read the levels from the tag names in the Step 0 item 6 DevTools line. A case that loses the shift on any sub-heading is reported as a defect.
- Every merged and reload outline starts with one H1
Titlewith its start toc-id. A case that breaks this is reported as a defect. - The lost-edit case is confirmed or refuted on a real pad. It covers an edit in the moved set and an edit in a set that stayed.
- A
## Design proposal, <date>comment holds the filled coverage table and the cost of each option. - The same comment states CM1 and CM2, each with the recommended answer first.
-
No repo file changed and no product code was written.Dropped by maintainer ruling, 2026-11-09:745f4c04eshipped the repair.
Verification
- No test is added. This issue changes no code, so there is no failure mode to pin (
AGENTS.md§Test Policy,AGENTS.md:102-110). - Local stack:
make dev-local, or the four-terminal fallback in Step 0 item 7. Bun only. Do not runnext buildagainst the live dev server. - Check the working tree after the run:
git status --shortmust show no change caused by this issue. - Browser runs use a visible tab. A hidden tab pauses
requestAnimationFrameand can stall the TOC. - When the follow-up code issue exists, a test is allowed only for a dense branch. For example, the dedupe rule "delete a later copy only when it equals the first" may get one unit test, proved by sabotage.
Docs to update
- None in this issue.
- After the ruling, the code issue adds the CM2 bullet. If it ships a refusal or a repair, it also updates
apps/webapp/CLAUDE.md§TOC And Heading Actions.
Read first
AGENTS.md§Workflow And Review Expectations (filing is read-only work; majority rule at line 151) and §Test Policy.- Root
CLAUDE.md§Settled: Collab storage design. apps/hocuspocus.server/CLAUDE.md: the opening paragraph, §Runtime limits (the stateless relay and the awareness budget) and §Documented hazards we accept.apps/webapp/CLAUDE.md§Slug Page Entry And Skeletons (Offline mirror) and §TOC And Heading Actions.apps/webapp/src/components/TipTap/CLAUDE.md§Heading Schema.- The tracker [Tracking] Move TOC sections like folders: cascade, drop inside, and a menu path #499: the rulings R1-R6 and the Shared rules (The level rule: every move keeps every toc-id).
Generated by Claude Code
Activity
HMarzban commentedon Nov 3, 2026
Status, 2026-11-03. No reproduction or design comment exists yet. The 2026-11-03 push (
a9b0c69e8..8e25e83df) does not touchmoveSection, so the measured duplicate case is still live.Left:
main" can run now; the rest wait on Move a TOC section with its sub-headings and keep the Title fixed #500 (and Drop a section onto a TOC heading to put it inside #508 for R-5).## Real-pad reproductionand## Design proposalcomments.HMarzban commentedon Nov 6, 2026
Measured, 2026-11-06
Short answer: yes. The duplicate still reproduces after the planner rewrite. Delete-first moves did not remove it.
What ran, and what did not
EditorViews in jsdom, the realySyncPluginandyUndoPlugin, two Y.Docs and a paused relay.planTreeMoveandtreeMoveTransaction(delete first, then insert), imported frommainat 44be025. Each peer plans on its own state.@tiptap/y-tiptap3.0.10 with the repo patch, yjs 13.6.33, prosemirror-view 1.42.6,@tiptap/pm3.32.2, jsdom 26.1.0, Bun 1.4.4.Results
Start outline:
Title#T A#A B#B X#X X1#X1 X1a#X1a Z#Z, one paragraph each.Title X X1 X1a A B A B ZTitle B X X1 X1a Z A ATitle Z X X1 X1a A BTitle X(H3) X1(H4) X1a(H5) A B ZTitle B X(H3) X1 X1a Z APEER-in a0Title B X X1 X1a Z APEER-lost on both peers.PEER-lost. A paused relay is symmetric, so L-1b equals L-1 here.PEER-in b0Title B APEER-lost, in the set that did not move.Notes
shiftLevelsrebuilds every shifted heading before the insert. WithsetNodeMarkupafter the insert, only X and B double.PEER-inside a moved set. Delete-first keeps that edit.Limits
toc-id, and paragraphs. No UniqueID, fold plugin, HeadingScale, Hocuspocus or IndexedDB.ySyncPlugin, not the Tiptap Collaboration extension.locked: falsein the planner. On a real pad,isTocMoveLockeddoes not lock whileoffline, so an offline peer can still move.Scripts:
run510-planner.mjsandprobe-r5-cause.mjs, in the local 11-04 harness folder. No code changed for #510, and nothing was committed.HMarzban commentedon Nov 6, 2026
Design proposal, 2026-11-06 (harness only)
This is a harness result, not the real-pad Step 0. Step 0 and the real-pad half of Step 1 are still owed. Every cell below comes from the harness.
Commit:
c8ce4adeb. The move code (planTreeMove.ts,tocMove.ts) has not changed since44be02585.Harness: the same setup as the "Measured, 2026-11-06" comment. Two
EditorViews in jsdom, the realySyncPluginandyUndoPlugin, and a paused relay. Option 4 adds a third Y.Doc as the server. Peer A is online and peer B is offline; B's requests queue and replay after the merge. Two runs gave byte-identical output.Step 1. Lost edits (harness)
PEER-after the mergea0(moved set)b0(the set that stayed)x1(moved set)a0(jumped over)a3(moved set)The rule. With delete-first, y-tiptap keeps the Yjs items of the longer run of top-level blocks. It creates new items for the shorter run. A concurrent edit in the shorter run is lost, and that run can be a set nobody moved (L-2). No option below fixes this. Only a native Yjs move or an upstream move rebase could.
Step 2. Coverage table (harness)
Options:
setNodeMarkupafter the insert, instead of rebuilding headings withshiftLevels.In-place re-level is no longer reachable in the UI, so the old markup-only column is gone.
noop)A B Z X: the later request winsX A B Z; B refusedH1 Title#Tfirst.Extra findings:
PEER-.setNodeMarkupafter the insert, the caret stays. Undo of a solo move stays clean.H1headings withtoc-idnull, with or without a repair. A repair cannot fix that.Step 3. Cost of each option
TipTap/extensions/, about 80 lines plus a unit test. It runs on collab-origin transactions that change the list of top-level heading ids, inside oneydoc.transactwith its own origin, so it never lands on an undo stack. Pass 1 deletes a bare copy only when the next block is an equal heading. Pass 2: the first copy owns the id; a later equal set is deleted, and a different set is re-keyed. A new id must be a deterministic hash that fitsheading_id varchar(36). It must be gated likeisTocMoveLocked, because the server drops writes from read-only connections. Risk: it deletes content, guarded by equality, and it was measured with two peers only.treeMoveTransaction: insert the slice unshifted, thensetNodeMarkup. It keeps the caret carry and theNEW_HEADING_CREATEDmeta.captureCollabIssueOnce, fired before the repair and before the read-only gate.Step 4. Decision
CM1 (maintainer, 2026-11-06): build (2), (e) and (1) now.
PEER-with the mover offline.CM2. One bullet in
apps/webapp/src/components/TipTap/CLAUDE.mdrecords the hazards that stay: typing in the shorter run of a concurrent move can be lost; R-3 can reorder a set nobody moved; R-4 can leave a level that does not fit its parent; undo after an R-5 race leavesH1headings withtoc-idnull.Limits
ySyncPlugin, not the Tiptap Collaboration extension.fix(webapp): repair duplicate sections after concurrent moves
refactor(webapp): share the TOC row lookup, scroll lock and labels
HMarzban commentedon Nov 9, 2026
Maintainer ruling, 2026-11-09
The acceptance box "No repo file changed and no product code was written" is dropped.
745f4c04eshipped the repair under the 2026-11-06 ruling. The real-pad Step 0 and the design comment below still stand.Real-pad reproduction, 2026-11-09
Short answer: every Step 0 case ran on a real local pad. The shipped repair (
745f4c04e) removes the duplicates of R-1, R-2 and R-5 within milliseconds. R-3, R-4 and three lost-edit cases (L-1, L-1b, L-2) still happen. L-1b lostPEER-with the mover offline, so flip rule 1 fires.Commit and setup
d31ed9033f81a01e3e150e1c388a3834e06478f2(git rev-parse HEAD).dd287cbfb. Drop a section onto a TOC heading to put it inside #508 drop inside is in it:8d4ef6057. The repair745f4c04eis in it.git merge-base --is-ancestorexited 0 for all three.make dev-local(webapp :3000, WS :4001). Real pads made with/new, one fresh pad per case.applyActorSession.UniqueIDgives the ids. Browser B must show the same blocks and ids before the cut..toc-drag-handle, move in steps, release. Each drag was checked to change the local outline. No move went through a script.Mod-Alt-3, with the caret in A. The TOC cannot re-level A in place, because A has no earlier sibling. A has no sub-headings, so this gives the same document as an R1 re-level by +1.PEER-.Cut-off method
DevTools Offline was not used. The cut is a WebSocket gate in the test browser, plus the browser offline flag.
ws://localhost:4001throughcontext.routeWebSocket. The gate forwards frames by hand in both directions.context.setOffline(true), then close the open socket. While cut, every new socket is closed at once, before it reaches the server.setOffline(true)makesnavigator.onLinefalse. So the app setsproviderStatus: 'offline', not'error', and the cut peer can still edit and move.Offline, andnavigator.onLinewas false.setOffline(false). Theonlineevent callsprovider.connect(), and a fresh socket runs a full sync. Both peers converged within about 0.3 s.Offline. ThenQQtyped int0in A showed in B within about 1.5 s, and was deleted before the reload.Results
Start outline:
Title A B X X1 X1a Z, H1, H2, H2, H2, H3, H4, H2, one paragraph each (t0a0b0x0x1x1az0). L-2 and L-2m useTitle A(a0-a5) B(b0).Title X X1 X1a A B ZTitle B X X1 X1a Z ATitle Z X X1 X1a A BTitle X(H3) X1(H4) X1a(H5) A B ZTitle B X(H3) X1(H4) X1a(H5) Z ATitle A X(H3) X1(H4) X1a(H5) B ZPEER-ina0Title B X X1 X1a Z A,a0PEER-lost (moved set)PEER-ina0Title B X X1 X1a Z A,a0PEER-lost. The mover was offline.PEER-inb0Title B A,b0PEER-lost (set that stayed)PEER-ina3Title B A,PEER-a3PEER-kept (moved set, longer run)Mod-Alt-3on APEER-ina0Title A(H3) B X X1 X1a Z,PEER-a0PEER-kept. A kept H3.Mod-Alt-3on A (A has a1-a5)Title B A(H3) X X1 X1a Zout/run-2026-11-09T05-29-35-742Z.log).H1Title with its start toc-id. No case broke it.Lost edits (Step 1)
PEER-ina0lost after both reloads. Typist offline; edit in the moved set.PEER-ina0lost after both reloads. Mover offline. The typist was online, and their edit had reached the server.PEER-inb0lost after both reloads. Typist offline; edit in the set that stayed. The scratch result reproduced.PEER-ina3kept. The moved set was the longer run.PEER-kept. A markup-only re-level rewrites no blocks.Per-case entries
Each entry lists the headings in order, as
Name(level). Each name stands for the toc-id in the case'sIdsline. The script maps every id back to a start id, and found no unknown id.R-1
/7sowq7sjz6x. Ids:Title#Kx6af15822aENlt2 A#gLX6af15824BOar3 B#ks6af15824K9oKK2 X#56af15824jGw8HE1 X1#Ot6af15824FigxF2 X1a#OQuoQ76af15824G6 Z#VYeMXzR6af158247Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)A: Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) A(H2) B(H2) Z(H2);B: Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) A(H2) B(H2) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1513 ms, then was removed.R-2
/b8nc00lv5dy. Ids:Title#FZD6af1583bgvcH3 A#l7jau6af1583ed55 B#6af1583esyQOcrY0 X#oPs6af1583ex33n3 X1#yTybUo6af1583eQ6 X1a#ZRtoT6af1583ei65 Z#EE6af1583e1tuHi2Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)A: Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2) A(H2);B: Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1513 ms, then was removed.R-3
/nd9h37qera3. Ids:Title#nD4Yi6af15855Kg5 A#eK8wc86af15858t6 B#5wwPXPd6af158587 X#92aL6af15858R994 X1#BsnyxG6af15858G6 X1a#39U6af15858aOwh3 Z#u6af15858HNpUXy1Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)Title(H1) A(H2) B(H2) Z(H2) X(H2) X1(H3) X1a(H4)Title(H1) Z(H2) X(H2) X1(H3) X1a(H4) A(H2) B(H2)Title(H1) Z(H2) X(H2) X1(H3) X1a(H4) A(H2) B(H2)Title(H1) Z(H2) X(H2) X1(H3) X1a(H4) A(H2) B(H2)Title(H1) Z(H2) X(H2) X1(H3) X1a(H4) A(H2) B(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1512 ms, then was removed.R-4
/abbeaacqq00. Ids:Title#jEY6af1586fDq6f3 A#6af15872LLoB4jo0 B#b6af15872thkvxz1 X#Yabpgi6af1587236 X1#5A6af158725s32V2 X1a#tK9a6af15872FCs4 Z#6H6af158722eDRu2Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) X(H2) X1(H3) X1a(H4) A(H2) B(H2) Z(H2)Title(H1) A(H2) B(H2) X(H3) X1(H4) X1a(H5) Z(H2)Title(H1) X(H3) X1(H4) X1a(H5) A(H2) B(H2) Z(H2)Title(H1) X(H3) X1(H4) X1a(H5) A(H2) B(H2) Z(H2)Title(H1) X(H3) X1(H4) X1a(H5) A(H2) B(H2) Z(H2)Title(H1) X(H3) X1(H4) X1a(H5) A(H2) B(H2) Z(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1512 ms, then was removed.R-4b
/bvja4xea1mi. Ids:Title#Wep2F6af1588blz5 A#hIL6af1588d0m2e3 B#Ok6af1588dXks6S2 X#3U86af1588dpBq73 X1#MOlh6af1588dFNN4 X1a#LSxfppr6af1588d7 Z#LBFf6af1588dLTz4Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) A(H2) B(H2) X(H3) X1(H4) X1a(H5) Z(H2)Title(H1) B(H2) X(H3) X1(H4) X1a(H5) Z(H2) A(H2)Title(H1) B(H2) X(H3) X1(H4) X1a(H5) Z(H2) A(H2)Title(H1) B(H2) X(H3) X1(H4) X1a(H5) Z(H2) A(H2)Title(H1) B(H2) X(H3) X1(H4) X1a(H5) Z(H2) A(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1510 ms, then was removed.R-5
/bnh2j8jxe6u. Ids:Title#MI6af158a5fzLBi2 A#4iYKPak6af158a87 B#u6af158a8R9YnLQ1 X#wdim6af158a8PQH4 X1#PWQXF6af158a8oK5 X1a#W6af158a8yrkYeo1 Z#7LpeSA6af158a8f6Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H2) X(H3) X1(H4) X1a(H5) B(H2) Z(H2)Title(H1) A(H2) X(H3) X1(H4) X1a(H5) B(H2) Z(H2)A: Title(H1) A(H2) X(H3) X(H3) X1(H4) X1a(H5) B(H2) B(H2) Z(H2);B: Title(H1) A(H2) X(H3) X(H3) X1(H4) X1a(H5) B(H2) B(H2) Z(H2)Title(H1) A(H2) X(H3) X1(H4) X1a(H5) B(H2) Z(H2)Title(H1) A(H2) X(H3) X1(H4) X1a(H5) B(H2) Z(H2)Title(H1) A(H2) X(H3) X1(H4) X1a(H5) B(H2) Z(H2)Title(H1) A(H2) X(H3) X1(H4) X1a(H5) B(H2) Z(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1513 ms, then was removed.L-1
/hbr01079j5z. Ids:Title#QNG3BK6af158c0s6 A#eb6af158c3Wqev02 B#wXRco6af158c3X15 X#AhdWMz6af158c3c6 X1#6af158c3fOAKlKP0 X1a#LGZ6af158c3QdAa3 Z#bwUM6af158c3wMH4Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1509 ms, then was removed.L-1b
/q76woushuh8. Ids:Title#aq7ox6af158d9ng5 A#e0jyps6af158dce6 B#0Pjd6af158dch1P4 X#rArwV6af158dcUy5 X1#11e6af158dcG7Ut3 X1a#kBCT6af158dcg2C4 Z#h6af158dclhHdFq1Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)Title(H1) B(H2) X(H2) X1(H3) X1a(H4) Z(H2) A(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1512 ms, then was removed.L-2
/oohyn67dfee. Ids:Title#6GVdx6af158f1Zl5 A#Gj5zWun6af158f47 B#J6af158f4tSGO581Title(H1) A(H2) B(H2)Title(H1) B(H2) A(H2)Title(H1) A(H2) B(H2)Title(H1) B(H2) A(H2)Title(H1) B(H2) A(H2)Title(H1) B(H2) A(H2)Title(H1) B(H2) A(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1509 ms, then was removed.L-2m
/tr88lebttyb. Ids:Title#GGlN6af1590aji84 A#aGM6af1590cTdsc3 B#Sw6af1590cyX3C62Title(H1) A(H2) B(H2)Title(H1) B(H2) A(H2)Title(H1) A(H2) B(H2)Title(H1) B(H2) A(H2)Title(H1) B(H2) A(H2)Title(H1) B(H2) A(H2)Title(H1) B(H2) A(H2)PEER-present: merged true, reload A true, reload B true. SentinelQQint0crossed A to B in 1511 ms, then was removed.L-3
/5dg0oij4ft4. Ids:Title#gDYj7pc6af159227 A#4t4Tv6af15924iN5 B#ay1WpG6af15924d6 X#Fodsk6af15924UW5 X1#Zt6af15924RPinu2 X1a#5hU1O7D6af159247 Z#l36af15924ZH3Lf2Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H3) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H3) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H3) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H3) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H3) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)PEER-present: merged true, reload A true, reload B true. SentinelQQint0crossed A to B in 1512 ms, then was removed.L-3b
/x8pliqujp6z. Ids:Title#xRCwXF06af159397 A#YH36af1593b6KUy3 B#ndKuTr6af1593bb6 X#t4oap06af1593bl6 X1#EUtq9Q6af1593bU6 X1a#6af1593bBoVnPFg0 Z#a6af1593buC19rz1Title(H1) A(H2) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) A(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) A(H3) B(H2) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) A(H3) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) A(H3) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) A(H3) X(H2) X1(H3) X1a(H4) Z(H2)Title(H1) B(H2) A(H3) X(H2) X1(H3) X1a(H4) Z(H2)PEER-present: merged false, reload A false, reload B false. SentinelQQint0crossed A to B in 1510 ms, then was removed.Limits
navigator.onLinefalse.out/L-1-A-error.png(local folder).run510.ts,lib.tsandout/run-2026-11-09T05-20-33-274Z.log, in the local folderNotes/local-docs/2026-11-09-v230-team/sse-510/. No repo file changed.HMarzban commentedon Nov 9, 2026
Design proposal, 2026-11-09
This replaces the harness-only proposal of 2026-11-06 for every case that ran on a real pad. Real-pad data: the "Real-pad reproduction, 2026-11-09" comment. Commit
d31ed9033.What the shipped repair changes
CM1 and CM2 were ruled on 2026-11-06, and
745f4c04eshipped (1) the Y-level repair, (2) markup after the insert and (e) the count. So "today" now means (1)+(2)+(e).collab:duplicate-heading-id. R-3, R-4 and every lost edit leave no duplicate, so (e) never counts them. Flip rule 2 cannot measure a lost edit.Step 1. The lost-edit rule (real pad)
y-tiptap gives new Yjs items to the shorter run of a move. Typing in that run while the peers are apart is lost.
PEER-with the mover offline. L-1b did, in both full runs.Step 2. Coverage table
The "Today" column is the real pad. The (d) column is a prediction from the planner and the real-pad rows. The (3), (4) and (5) columns are the 2026-11-06 harness results; they were not re-run.
Title X X1 X1a A B Z; B refusedA B Z X: later request winsMod-Alt-3is not a TOC move, so (d) does not refuse itEvery real-pad row converged, and kept one
H1Title with its start id.Step 3. Cost of each option
planTocMoveand at drag start. It refuses whileproviderStatusis'offline'. ReadproviderStatus, nevernavigator.onLine(webapp §Collab Provider Status).'error'already locks moves.isTocMoveLocked.HeadingIdRepaircalls that predicate and returns with no retry. On the reconnecting peer, the status stays'offline'untilonSynced:shouldRestoreSavedOnReconnectneedsisSynced, which is false after a disconnect (read from code). If the merge lands first, that peer would skip its own repair.AGENTS.md:154.Step 4. Decisions
providerStatusis'offline'.isTocMoveLocked, so the repair still runs.apps/webapp/src/components/TipTap/CLAUDE.md§Heading Schema, with one added clause.apps/webapp/CLAUDE.md§TOC And Heading Actions.apps/hocuspocus.server/CLAUDE.md§Documented hazards we accept. The defect lives in the client move path, so the editor file stays the better home.Code waits for a
Maintainer ruling, <date>comment.HMarzban commentedon Nov 9, 2026
Maintainer ruling, 2026-11-09
745f4c04e. Also refuse a TOC move whileproviderStatusis'offline'.AGENTS.md:154(follow Google Docs, Word and Notion). Notion allows offline editing and names no move limit. So no checked peer refuses offline moves. Do not "fix" this back to peer parity.apps/webapp/src/components/TipTap/CLAUDE.md§Heading Schema gets the recommended clause. Once (d) ships, it says that a TOC move is refused while offline, and why.Build issue: #714