Skip to content

fix: resolve conflict scan origins to the item that contains them - #61

Open
iasakura wants to merge 1 commit into
y-crdt:mainfrom
iasakura:fix/conflict-scan-run-granularity
Open

fix: resolve conflict scan origins to the item that contains them#61
iasakura wants to merge 1 commit into
y-crdt:mainfrom
iasakura:fix/conflict-scan-run-granularity

Conversation

@iasakura

Copy link
Copy Markdown
Contributor

The set membership tests in find_conflict_left always failed when the id being looked up pointed to an element other than the first one of its item. As test_insert_beside_multi_element_item_converges shows, when an origin_left_id points to such an element the scan can return a wrong insertion point, and replicas diverge depending on the order the updates were applied in.

This PR looks up the id of the item holding that id before testing membership. The lookup needs the client's node list, which this function does not have, so it comes in as the head_of parameter: DocStore passes get_node_index and read::resolve passes locate.

The loop also stops in a different place than yjs and yrs: where both of them break out, this scan keeps walking. Although that does not look like it affects convergence, I changed it to match yjs and yrs, as it only adds iterations with no benefit.

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.97%. Comparing base (70873e4) to head (cab1585).
⚠️ Report is 2 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #61       +/-   ##
===========================================
+ Coverage   15.29%   78.97%   +63.68%     
===========================================
  Files           1       59       +58     
  Lines         582    10841    +10259     
===========================================
+ Hits           89     8562     +8473     
- Misses        493     2279     +1786     
Flag Coverage Δ
node-binding-test 15.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@iasakura
iasakura force-pushed the fix/conflict-scan-run-granularity branch from 3cca291 to cab1585 Compare July 29, 2026 18:26
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.

2 participants