Skip to content

fix(collaboration): per-file Y.Map storage + server-side sync#2031

Draft
caio-pizzol wants to merge 6 commits intomainfrom
caio/sd-1918-fix-liveblocks-message-too-large-for-large-documents
Draft

fix(collaboration): per-file Y.Map storage + server-side sync#2031
caio-pizzol wants to merge 6 commits intomainfrom
caio/sd-1918-fix-liveblocks-message-too-large-for-large-documents

Conversation

@caio-pizzol
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Feb 15, 2026

Remove the `excludeSyncedContent` flag from the public API. Files
already synced via y-prosemirror XmlFragment (word/document.xml) are
now always excluded from Y.Map storage during collaboration — no
configuration needed.
@caio-pizzol caio-pizzol force-pushed the caio/sd-1918-fix-liveblocks-message-too-large-for-large-documents branch from 8f54e2f to c4a7c51 Compare February 16, 2026 00:46
@caio-pizzol caio-pizzol changed the title fix(collaboration): per-file Y.Map storage with excludeSyncedContent fix(collaboration): per-file Y.Map storage + server-side sync Feb 16, 2026
Without this, updateYdocDocxData only wrote files returned by
exportDocx({ getUpdatedDocs: true }) — which excludes static assets
like themes, fontTable, and docProps. Joining clients would read from
the incomplete docxFiles map and lose those files on export.

Now seeds docxFiles with ALL legacy entries before writing changed
files, and deletes the old meta.docx to free up space in the Y.Doc.
Update collaboration test suite to match the new per-file docxFilesMap
format. Tests now verify: per-file writes, CRDT-synced file exclusion,
docxReady flag, legacy migration with meta.docx deletion, and
Y.Array/iterable normalization.
Rename collab-server.js → hocuspocus-server.js and liveblocks-proxy.js →
liveblocks-server.js for consistency. Add dev:collab:hocuspocus and
dev:collab:liveblocks scripts to both root and superdoc package.json.
Remove standalone collab-server script.
@github-actions
Copy link
Contributor

⚠️ AI Risk Review — potential issues found

  • Migration logic deletes metaMap.docx before copying files: readExistingDocxFiles returns empty object when docxFilesMap.size > 0, so existingFiles is empty, migration condition fails, but metaMap.delete('docx') still runs
  • pollForMetaMapData checks docxFilesMap.size > 0 first, but empty map (size=0) is falsy in JavaScript - should check docxReady flag first to avoid race conditions
  • initializeMetaMap doesn't add word/document.xml placeholder to new format, breaking schema initialization for joining clients
  • Migration condition !isNewFormat && Object.keys(existingFiles).length > 0 will always be false when docxFilesMap has been created but is empty, preventing any migration from running

Via L3 deep analysis · critical risk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments