fix: add long peer fuzz and richtext diff catchup#1038
Draft
zxch3n wants to merge 8 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
long_peer_fuzz, a deterministic single-thread multi-peer fuzz runner that does not usecargo fuzz.crates/fuzz/README.md.Root cause
The long peer fuzz found a state-only roundtrip mismatch after checkout. One peer state rendered as
u32[18283][18265]28[128][3], while importing the state-only export renderedu32[18283][18265]28[128][3]12.The richtext checkout diff tracker used an anonymous
unknownspan as the LCA base. In cross-branch checkout, the target can retain old text that the source deleted. Since that anonymous span has no real id/materialized text, the diff can treat text as already represented and omit the insert/delete needed to reach the target state.Fix
For full-history docs, richtext diff tracking now uses an exact empty tracker and catches up CRDT text ops from the covered version to the oplog version before applying checkout diffs.
covered_vvavoids repeating the full catchup when later diffs can extend from already-covered state.DiffCalculatorTrait::start_trackingnow receivesContainerIdx, so richtext can catch up the correct container. Shallow-history tracking still uses the unknown base path.Validation
cargo check -p loro-internalcargo check -p fuzz --bin long_peer_fuzzcargo test -p fuzz --test long_peer_repro state_only_round_trip_with_shallow_deps_does_not_abort -- --nocapturecargo test -p loro state_only_shallow_since_and_updates_till_cover_export_boundariescargo test -p loro-internal shallow_dep_ensure_vv_for_uses_shallow_baselinecargo test -p loro shallow_snapshot_testcargo run -p fuzz --release --bin long_peer_fuzz -- --seed 20260629 --peers 12 --ops 10000 --sync-barrier-every 5000 --check-every 20000 --no-minimize --artifact-dir long_peer_fuzz_artifacts/tmp-10k-after-catchupcargo run -p fuzz --release --bin long_peer_fuzz -- --seed 20260629 --peers 12 --duration-secs 60 --sync-barrier-every 5000 --check-every 20000 --no-minimize --artifact-dir long_peer_fuzz_artifacts/one-minute-final-diff-fixNext: run the same long peer fuzz for 8 hours before marking ready.