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(linked chunk): in LinkedChunk::ritems_from, skip as long as we're on the right chunk #4426

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Dec 17, 2024

The previous code would skip based on the position's index, but not the position's chunk. It could be that the position's chunk is different from the first items chunk, as shown in the example, where the linked chunk ends with a gap; in this case, the position's index would be 0, while the first chunk found while iterating backwards had 3 items. As a result, items 'd' and 'e' would be skipped incorrectly.

The fix is to take into account the chunk id when skipping over items.

… on the right chunk

The previous code would skip based on the position's index, but not the
position's chunk. It could be that the position's chunk is different
from the first items chunk, as shown in the example, where the linked
chunk ends with a gap; in this case, the position's index would be 0,
while the first chunk found while iterating backwards had 3 items. As a
result, items 'd' and 'e' would be skipped incorrectly.

The fix is to take into account the chunk id when skipping over items.
@bnjbvr bnjbvr requested a review from a team as a code owner December 17, 2024 16:23
@bnjbvr bnjbvr requested review from poljar and removed request for a team December 17, 2024 16:23
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Oh sh*t, good catch!

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.40%. Comparing base (0ca35d6) to head (a7e36e7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4426   +/-   ##
=======================================
  Coverage   85.39%   85.40%           
=======================================
  Files         283      283           
  Lines       31472    31473    +1     
=======================================
+ Hits        26877    26880    +3     
+ Misses       4595     4593    -2     

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

@bnjbvr bnjbvr merged commit 5d8ad3a into main Dec 17, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/fix-ritems branch December 17, 2024 16:48
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