Commit cefea74
fix(super-editor): sync custom xml writes through part-sync (IT-1229) (#392)
* fix(super-editor): sync custom xml writes through part-sync
- metadata.* and customXml.parts.* writes routed through the parts
mutation layer so partChanged fires and part-sync publishes
- a shared sandbox-and-diff wrapper commits every package path a custom
xml create/update/remove touches (item, itemProps, item rels, document
rels), not just the item xml
- two-client regression tests cover metadata attach and customXml
create/patch/remove, including the remote client's converted xml
* fix(super-editor): record custom xml tombstones on remote part-sync deletes
Remote part deletions removed the part from convertedXml but never
populated removedCustomXmlPaths, so a collaborator whose original docx
contained the part re-emitted it on export. The consumer now records
tombstones for deleted custom xml storage parts, props parts, and item
rels (including rels-linked props paths), and clears stale tombstones
when a part is re-created remotely.
* fix(super-editor): tombstone absent custom xml parts on late-join and clear bibliography cache
- late joiners prune local custom xml parts absent from an authoritative
parts map (a peer deleted them before this client joined), recording
export tombstones through the same mutateParts mechanism hydration uses
- tombstoning a path now also invalidates converter caches, so deleting
the bibliography storage part clears converter.bibliographyPart and
export cannot resurrect it
* fix(super-editor): record hydration tombstones only after the prune mutation commits
Tombstones (and the bibliography cache clear) were applied before
mutateParts ran; a mutation failure rolled back the part store but left
the converter tombstoned. The prune now collects paths and records them
only after the mutation succeeds.
* fix(super-editor): clear stale custom xml tombstones during hydration
A client that tombstoned a custom xml part (e.g. deleted while offline)
and then rehydrated from an authoritative map containing the recreated
part kept the stale tombstone, so export dropped the recreated part.
Hydration now clears tombstones for present custom xml paths at the same
post-mutation point where absent paths are tombstoned - symmetric to the
live consumer path.
* fix(super-editor): invalidate bibliography cache on remote custom xml writes
Remote writes and hydration cleared stale tombstones but left the
bibliography cache pointing at the old content, so export rebuilt the
part from the stale cache over the collaborator's version. Written and
present custom xml paths now invalidate converter caches, and the part
path predicates agree on casing.
* fix(super-editor): clear hydration tombstones only for parts that hydrated
A key present in the authoritative map whose envelope failed to decode
never lands in convertedXml; clearing its tombstone would let export
copy the stale original zip entry through instead of dropping the part.
* ci: retrigger checks on current head
* fix(super-editor): scope hydration tombstone clearing to hydrated parts and make converter-state application rollback-safe
- hydration only clears a custom xml tombstone when the part actually
hydrated this pass (a decode+op succeeded), not merely because a stale
local copy is present; a failed-to-hydrate authoritative part no longer
resurrects the stale local one on export
- applyConverterState is atomic and runs only after the part-store
mutation durably commits, so a compound rollback cannot leave
removedCustomXmlPaths / bibliographyPart mutated while the store is
restored
* fix: address PR review comments on #392
* fix(super-editor): validate metadata payload before mutating on attach
metadata.attach serialized the payload only in the live path, inside the
part-sync sandbox that runs after the anchor is inserted. A non-serializable
payload (a BigInt or a cyclic object, neither of which the payload type can
rule out) therefore threw while building the envelope, after wrapRangeInAnchor
had already dispatched the anchor transaction, leaving an inline content
control with no matching customXml payload.
Build the envelope during the attach preview as well, so serialization fails
before the operation touches the document. Adds a regression test asserting a
cyclic payload throws without dispatching an anchor transaction.
* refactor(super-editor): serialize only the new entry in the attach preview
The attach preview rebuilt the whole metadata envelope to validate one payload,
re-serializing every existing entry in the namespace before the live path
serialized them again. Serialize just the new entry — existing entries were
already validated when they were written — so the preview stays a fail-fast
check for non-serializable payloads without the per-attach serialization cost.
* test(super-editor): fix concurrent-seed race in collaborator export test
The two-client export test created both collaborative editors on unsynced
ydocs, so both bootstrapped as a new room and both seeded the baseline
package into their parts maps as concurrent Yjs writes. The map-key conflict
on word/_rels/document.xml.rels is resolved by clientID, and with the wrong
random winner the second client's baseline seed discarded the first client's
published rels update, dropping the customXml document relationship from the
export (~50% failure rate; deterministically reproducible by pinning
clientIDs). Real clients receive room state before bootstrapping, see the
capability marker, and hydrate instead of seeding, so the conflict is an
artifact of the test's join order.
Create the second editor only after syncing the first editor's seeded state,
matching the real join flow, and wait for the received document rels content
(the baseline part always exists, so an existence check passed before the
remote update landed).
Ported-From-Source-Repo: superdoc/orbit
Ported-From-Source-Commit: 13119b74e8785850867256c4a8fffb06b41e73c3
Ported-Public-Prefix: superdoc/public1 parent 4ee24ac commit cefea74
12 files changed
Lines changed: 1548 additions & 51 deletions
File tree
- packages/super-editor/src/editors/v1
- core/super-converter
- document-api-adapters/plan-engine
- extensions/collaboration/part-sync
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
| |||
Lines changed: 130 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | 6 | | |
4 | 7 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
41 | 96 | | |
42 | 97 | | |
43 | 98 | | |
| |||
73 | 128 | | |
74 | 129 | | |
75 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
76 | 205 | | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
291 | 311 | | |
292 | 312 | | |
293 | 313 | | |
| |||
Lines changed: 58 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
397 | | - | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | | - | |
405 | 404 | | |
406 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
416 | 442 | | |
417 | | - | |
418 | | - | |
419 | | - | |
| 443 | + | |
| 444 | + | |
420 | 445 | | |
421 | | - | |
422 | | - | |
423 | | - | |
| 446 | + | |
424 | 447 | | |
425 | 448 | | |
426 | 449 | | |
427 | 450 | | |
428 | | - | |
429 | 451 | | |
430 | 452 | | |
431 | 453 | | |
432 | 454 | | |
433 | 455 | | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
443 | 459 | | |
444 | | - | |
445 | | - | |
446 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
447 | 475 | | |
448 | 476 | | |
449 | 477 | | |
| |||
619 | 647 | | |
620 | 648 | | |
621 | 649 | | |
622 | | - | |
| 650 | + | |
623 | 651 | | |
624 | 652 | | |
625 | 653 | | |
| |||
648 | 676 | | |
649 | 677 | | |
650 | 678 | | |
651 | | - | |
652 | | - | |
| 679 | + | |
| 680 | + | |
653 | 681 | | |
654 | 682 | | |
655 | 683 | | |
| |||
0 commit comments