Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic errors in TreeNode.DeepCopy #821

Merged
merged 14 commits into from
Mar 22, 2024
Merged

Conversation

raararaara
Copy link
Contributor

@raararaara raararaara commented Mar 12, 2024

What this PR does / why we need it:

Fix logic errors in TreeNode.DeepCopy

This PR addresses the following logic errors in TreeNode.DeepCopy:

  1. Missing insPrevID and insNextID - resolved in Fix errors when editing Tree due to missing insPrevID in CRDTTree yorkie-js-sdk#756 and ported accordingly.
  2. Incorrect calculation of IndexTreeNode.Length - including tombstone nodes in length calculation.

This commit fixes these issues, and corresponding test cases have been added.

Which issue(s) this PR fixes:

Address #754
Related to yorkie-team/yorkie-js-sdk#756

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 50.81%. Comparing base (c86999d) to head (a0b856e).
Report is 2 commits behind head on main.

Files Patch % Lines
pkg/document/crdt/tree.go 62.50% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #821      +/-   ##
==========================================
+ Coverage   50.71%   50.81%   +0.09%     
==========================================
  Files          70       70              
  Lines       10213    10226      +13     
==========================================
+ Hits         5180     5196      +16     
+ Misses       4512     4504       -8     
- Partials      521      526       +5     

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

@raararaara raararaara force-pushed the fix-missing-insprevId branch from 390e470 to 566957e Compare March 15, 2024 06:56
@raararaara raararaara marked this pull request as ready for review March 15, 2024 08:37
@raararaara raararaara requested a review from hackerwins March 15, 2024 08:37
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.
I left simple questions.

@hackerwins hackerwins changed the title Fix errors when editing Tree due to missing insPrevID in CRDTTree Fix logic errors in TreeNode.DeepCopy Mar 22, 2024
@raararaara raararaara requested a review from hackerwins March 22, 2024 08:22
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

@hackerwins hackerwins merged commit e1a6474 into main Mar 22, 2024
4 checks passed
@hackerwins hackerwins deleted the fix-missing-insprevId branch March 22, 2024 08:25
hackerwins added a commit that referenced this pull request Mar 22, 2024
This commit addresses the following logic errors in TreeNode.DeepCopy:

1. Missing insPrevID and insNextID - resolved in Fix errors when editing
   Tree due to missing insPrevID in CRDTTree yorkie-js-sdk#756 and ported
   accordingly.
2. Incorrect calculation of IndexTreeNode.Length - including tombstone
   nodes in length calculation.

This commit fixes these issues, and corresponding test cases have been
added.

---------

Co-authored-by: Youngteac Hong <[email protected]>
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