Commit 6f5b7a9
fix: production panic regressions (#943)
* Fix stale DAG causal iteration after node splits
* Fix richtext cursor updates at fragment tails
* Add list import regression for split tracking
* Recover document locks after panic poisoning
* Add unpoisoned lock helpers across core internals
* Fail fast on poisoned core locks
* Return errors for snapshot encoding edge cases
* Fix loom lock helper usage
* Fix three March-2026 import panics (kim, mads, pr929 fixtures)
Three production blobs in loro-debug reliably panic inside doc.import on
loro-crdt@1.10.6:
- DagCausalIter assertion at dag/iter.rs: when a peer has multiple node
segments in the target span and the later segment's deps fall outside
the span, both segments reach the initial stack with zero in-degree and
LIFO pops the higher counter first. Fix: in DagCausalIter::new, after
out_degrees and succ are built, synthesize per-peer ordering edges so
the lower counter must drain before the higher one is released.
- OnceCell::set(..).unwrap() double-set at oplog/loro_dag.rs:917 during
ensure_vv_for on a diamond dep (#929): a shared ancestor
gets pushed onto the iterative-DFS stack by multiple paths and the
second pop tries to initialize an already-filled cell. Fix: skip nodes
whose vv is already Some at the top of the loop and swallow the Err
from the final set as a defensive measure.
- list_state Index-out-of-range panic for the mads-bootstrap fixture:
the ListDiffCalculator cold-starts its RichtextTracker via
new_with_unknown() and never learns about the snapshot's real list
content. During replay the tracker's per-change checkouts temporarily
retreat some snapshot ops, so a new op's fugue anchor lands inside the
unknown prefix. CrdtRope::get_diff() then emits Retain(N) where N is
larger than ListState.len(). Fix: change ContainerState::apply_diff
(and DocState::apply_diff, init_with_states_and_version) to return
LoroResult<()>; ListState::apply_diff pre-validates the delta against
current length and returns LoroError::internal(..) on mismatch so
doc.import surfaces the error instead of panicking. Root cause in the
tracker cold-start path still needs follow-up.
Regression tests for all three live in crates/loro/tests/march_2026_panics.rs
with the captured production blobs in fixtures_march_2026/. Additional
targeted unit tests in dag/iter.rs and oplog/loro_dag.rs cover the
smallest synthetic DAG shapes that triggered each bug.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Make internal locks fail fast
* chore: rm fixtures
* chore: changeset
* Fix awareness doctest lock usage
* Fix loom RwLock wrapper
* Update repository agent guidelines
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c8d0d60 commit 6f5b7a9
43 files changed
Lines changed: 1772 additions & 881 deletions
File tree
- .changeset
- crates
- loro-internal
- src
- container/richtext
- tracker
- dag
- diff_calc
- encoding
- handler
- jsonpath
- oplog
- state
- container_store
- utils
- tests
- loro-wasm/src
- loro/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
11 | 32 | | |
12 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
13 | 41 | | |
14 | | - | |
15 | | - | |
| 42 | + | |
16 | 43 | | |
17 | | - | |
18 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
19 | 49 | | |
20 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
21 | 60 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
31 | 65 | | |
32 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
33 | 73 | | |
34 | | - | |
35 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
36 | 77 | | |
37 | 78 | | |
38 | 79 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments