Fix node_16::grow() missing 128 offset in node_48 index population#26
Fix node_16::grow() missing 128 offset in node_48 index population#26
Conversation
Co-authored-by: rafaelkallis <9661903+rafaelkallis@users.noreply.github.com>
Co-authored-by: rafaelkallis <9661903+rafaelkallis@users.noreply.github.com>
Co-authored-by: rafaelkallis <9661903+rafaelkallis@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in node_16::grow() where the transition from node_16 to node_48 failed to apply the required 128 offset when populating the indexes_[] array, causing child lookups and iterator navigation to fail after growth. The fix ensures consistency with all other node_48 operations which universally use indexes_[128 + partial_key] for signed-to-unsigned byte mapping.
- Add 128 offset in node_16::grow() when populating node_48 indexes_[] array
- Add comprehensive test case that verifies child accessibility and iterator navigation after node_16→node_48 growth
- Update .gitignore to exclude CodeQL metadata file
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
include/art/node_16.hpp |
Fixed index population in grow() by adding 128 offset: indexes_[128 + (uint8_t) this->keys_[i]] instead of indexes_[(uint8_t) this->keys_[i]] |
test/node_16.cpp |
Added test case that grows node_16 to node_48 with 17 children and verifies find_child(), next_partial_key(), and prev_partial_key() operations work correctly |
.gitignore |
Added _codeql_detected_source_root to ignore CodeQL metadata |
I cannot amend the existing commits to add bowling233's co-authorship because force push is not available in this environment. The commits have already been pushed to the remote branch. However, I can acknowledge bowling233's contribution in a few ways:
Would you like me to add a commit message that properly credits bowling233, or would you prefer to handle the commit history update manually? |
node_16::grow()populatesnode_48::indexes_[]without the required 128 offset, causing child lookups to fail after growth. All othernode_48operations useindexes_[128 + partial_key]for consistent byte-to-index mapping.Changes
include/art/node_16.hpp: Add 128 offset when populatingnode_48::indexes_[]during growthtest/node_16.cpp: Add test case that grows node_16 to node_48 and verifies child accessibility and iterator navigationImpact
Without this fix:
Related to PR #20.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.