Repository navigation
fix(collab): build-before-delete on replace (#342) + fail-loud content write when Redis off (#344) - #33
Merged
Conversation
… content write when Redis off (docmost#344) Two pre-existing content-write defects on the collaboration path, both found while tracing docmost#282 and both able to lose or silently drop a page's content. docmost#342 — a content `replace` emptied the Yjs fragment BEFORE building the new document from the request body. If `TiptapTransformer.toYdoc` threw (a body that passed `jsonToNode` but the Yjs transformer rejects), the connection's closing store persisted the emptied fragment: the page was WIPED while the request also failed. Build the new state first, then delete+apply — a conversion failure now aborts before any mutation and the original content survives. Shared by the ordinary `updatePageContent` handler and the docmost#282 conditional write. docmost#344 — custom collab events route only through the RedisSync extension, so with COLLAB_DISABLE_REDIS (single-node standalone) `handleYjsEvent('updatePageContent')` returned undefined and `PageService.update` ignored it: a REST/`/v1` content write returned 200 while persisting nothing. Fail that one un-routable write loudly instead. Narrowest boundary: the supported standalone mode still boots, interactive editing (direct Hocuspocus path) is untouched, and the docmost#282 seams keep their fail-closed `undefined` contract. Tests: build-before-delete leaves the fragment intact on a throwing toYdoc; the gateway guard throws for updatePageContent with Redis off, stays quiet for best-effort events, and routes normally with Redis on. UPSTREAM_MODIFICATIONS.md seams #2/#3 updated. Co-Authored-By: Claude Opus 4.8 <[email protected]>
PMQ9
force-pushed
the
fix/343-empty-content-and-collab-writes
branch
from
September 17, 2026 03:03
a9702f3 to
97f21d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two pre-existing content-write defects on the collaboration path, both surfaced while tracing docmost#282 (ADR 0019). Fork half of the paired fix; the super-repo PR (cccvu/wiki-v2) carries docmost#343 + the submodule bump.
docmost#342 — a
replacecould WIPE the page on a build failureapplyContentOperationemptied the Yjs fragment before building the new document from the request body. IfTiptapTransformer.toYdocthrew (content that passedjsonToNodebut the Yjs transformer rejects), the connection's closingdisconnect()store persisted the emptied fragment — the page was wiped while the request also failed.Fix: build the new state first (
toYdoc+encodeStateAsUpdate), then delete+apply. A conversion failure now aborts before any mutation, so the original content survives and the closing store re-persists it unchanged. Shared by the ordinaryupdatePageContenthandler and the docmost#282 conditional write.docmost#344 — content writes silently no-op with
COLLAB_DISABLE_REDISCustom collab events route only through the RedisSync extension, so in single-node standalone mode
handleYjsEvent('updatePageContent')returnedundefinedandPageService.updateignored it: a REST//v1content write returned 200 while persisting nothing.Fix (narrowest boundary):
handleYjsEventthrows forupdatePageContentwhen Redis is disabled. The supported standalone mode still boots, interactive editing (direct Hocuspocus path) is untouched, and the docmost#282 seams keep their fail-closedundefinedcontract. Investigation confirmedCOLLAB_DISABLE_REDIS(isStandalone) is a legitimate upstream mode, so it is preserved rather than removed.Tests
conditional-content-handler.spec.ts: a throwingtoYdocleaves the fragment intact (page not wiped) and still disconnects; the normal replace still deletes+applies.collaboration.gateway.redis.spec.ts(new): guard throws forupdatePageContentwith Redis off, stays quiet for a best-effort event, routes normally with Redis on.UPSTREAM_MODIFICATIONS.mdseams chore(wiki-v2): promote #57 platform-admin entry seam onto the durable branch #2/feat(authz): Layer C — fail-closed global route guard + route-inventory fitness test (cccvu/wiki-v2#13) #3 updated; boundary check + import-boundary specs green.🤖 Generated with Claude Code