loro-crdt 1.14.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.14.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 76cc0f9: Make `importBatch` atomic and never leave the document detached.
8
+
9
+ `importBatch` force-detaches the document so each blob only touches the OpLog, then
10
+ reattaches with a single checkout at the end. Two exits skipped that reattach and
11
+ stranded the document in detached mode, where later imports stop being reflected in
12
+ the state, local edits branch off a stale version, and every later `attach()` re-runs
13
+ the same failing checkout:
14
+
15
+ - The closing checkout was `expect`ed to succeed. Remote ops that decode fine but are
16
+ rejected by state validation (for example a list insert past the end of the list)
17
+ only reach that validation here, because the blobs were imported while detached, so
18
+ a malformed blob turned into a panic — a `RuntimeError: unreachable` trap in WASM —
19
+ after the document had already been left detached.
20
+ - Any other panic while decoding or applying a blob unwound past the reattach.
21
+
22
+ The batch now runs inside an OpLog rollback scope. If the closing checkout cannot
23
+ apply the accumulated changes, the whole batch is rolled back and `importBatch`
24
+ returns the state-apply error with the document still attached and unchanged, instead
25
+ of trapping. A panic inside the batch reattaches before it is re-raised.
26
+
27
+ The pending-changes rollback journal now snapshots each touched slot as it was when
28
+ the scope began, instead of undoing individual mutations. The previous two-phase undo
29
+ resurrected changes that the same import both parked and unlocked — routine across a
30
+ batch — leaving pending entries that referenced container registrations the rollback
31
+ had already discarded, and pre-batch pending changes unlocked by a rolled-back batch
32
+ are now re-parked instead of silently dropped.
33
+
34
+ `importBatch` of out-of-order updates is also considerably faster: the import preflight
35
+ no longer rescans the whole pending set once per blob, which made such a batch
36
+ quadratic. Draining 12000 out-of-order updates in one `importBatch` goes from ~3.4s to
37
+ ~0.45s, with peak memory unchanged. In-order batches and single `import` calls are
38
+ unaffected.
39
+
3
40
  ## 1.14.0
4
41
 
5
42
  ### Minor Changes