Skip to content

fix: harden diff calc for shallow text histories#974

Open
lodyai[bot] wants to merge 3 commits intomainfrom
feat/diff-text-lca-review
Open

fix: harden diff calc for shallow text histories#974
lodyai[bot] wants to merge 3 commits intomainfrom
feat/diff-text-lca-review

Conversation

@lodyai
Copy link
Copy Markdown
Contributor

@lodyai lodyai Bot commented Apr 30, 2026

Summary

  • Add an LCA-aware diff_calc fuzz target plus focused regression coverage for shallow text, state-only, tracker, and LCA cases.
  • Fix shallow text tracker seeding and partial-delete handling when only part of a CRDT id span is active.
  • Clamp shallow snapshot/LCA traversal around trimmed history, and include target state delta in state-only shallow snapshot exports to avoid replaying text ops in an invalid context.

Performance

Quick Criterion comparison against origin/main after rebasing:

  • import_regression/text_split_checkout_1024: origin/main 4.3524 ms, branch 4.5337 ms, about +4.2% median.
  • import_regression/list_checkout_4096x1024: origin/main 4.7133 ms, branch 4.9708 ms, about +5.5% median.

This was a short run with 10 samples, 1s warmup, and 3s measurement time, so treat it as directional. The list case intervals overlap; this does not look like a large regression, but the text checkout path is a little slower in this sample.

Validation

  • cargo fmt --all --check
  • cargo test -p fuzz diff_calc --test test -- --nocapture
  • cargo fuzz run diff_calc fuzz/artifacts/diff_calc/*
  • cargo fuzz run diff_calc ~/loro-fuzz/corpus/diff_calc -- -max_total_time=18000: 304119 runs in 18001s, no crash. This long run was before the final conflict-free rebase; post-rebase focused tests were rerun.
  • cargo test -p loro state_only -- --nocapture
  • cargo test -p loro-internal common_ancestor --lib -- --nocapture
  • cargo test -p fuzz one_doc_tree_move_before_cycle_error_is_ignored --test test -- --nocapture
  • cargo check -p loro-internal

@lodyai lodyai Bot force-pushed the feat/diff-text-lca-review branch 2 times, most recently from 3fe34d7 to ece7e91 Compare April 30, 2026 09:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

WASM Size Report

  • Original size: 3125.98 KB
  • Gzipped size: 1004.43 KB
  • Brotli size: 699.01 KB

@lodyai lodyai Bot force-pushed the feat/diff-text-lca-review branch from ece7e91 to 6ca863b Compare April 30, 2026 13:29
@lodyai lodyai Bot force-pushed the feat/diff-text-lca-review branch from 6ca863b to f91a3f9 Compare April 30, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant