Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 23, 2025

Recreates PR #26 with co-author attribution for bowling233.

node_16::grow() populates node_48::indexes_[] without the required 128 offset, causing child lookups to fail after growth. All other node_48 operations consistently use indexes_[128 + partial_key] for byte-to-index mapping.

Changes

  • include/art/node_16.hpp: Add 128 offset when populating node_48::indexes_[] during growth

    // Before
    new_node->indexes_[(uint8_t) this->keys_[i]] = i;
    
    // After
    new_node->indexes_[128 + (uint8_t) this->keys_[i]] = i;
  • test/node_16.cpp: Add test case that grows node_16 to node_48 and verifies child accessibility and iterator navigation

  • .gitignore: Exclude _codeql_detected_source_root

Impact

Without this fix, children inserted before growth become unreachable, iterator navigation returns incorrect keys, and data is effectively corrupted after any node_16→node_48 transition.

Related to PR #20.

Co-authored-by: bowling233 [email protected]

Original prompt

recreate PR 26 but this time make sure you add co-author bowling233 <[email protected]>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

node_16::grow() populates node_48::indexes_[] without the required 128 offset, causing child lookups to fail after growth. All other node_48 operations use indexes_[128 + partial_key] for consistent byte-to-index mapping.

Changes:
- include/art/node_16.hpp: Add 128 offset when populating node_48::indexes_[] during growth
- test/node_16.cpp: Add test case that grows node_16 to node_48 and verifies child accessibility and iterator navigation
- .gitignore: Exclude _codeql_detected_source_root

Impact:
Without this fix:
- Children inserted before growth become unreachable
- Iterator navigation returns incorrect keys
- Data effectively corrupted after any node_16→node_48 transition

Related to PR #20.

Co-authored-by: bowling233 <[email protected]>
Copilot AI changed the title [WIP] Recreate PR 26 and add co-author Fix node_16::grow() missing 128 offset in node_48 index population Nov 23, 2025
Copilot AI requested a review from rafaelkallis November 23, 2025 18:51
@rafaelkallis rafaelkallis marked this pull request as ready for review November 23, 2025 20:22
Copilot AI review requested due to automatic review settings November 23, 2025 20:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug in node_16::grow() that caused data corruption when a node_16 transitions to node_48. The fix ensures children remain accessible after node growth by correctly applying the 128 offset required by node_48's indexes_[] array, which maps signed char partial keys (-128 to 127) to array indices (0 to 255).

Key Changes:

  • Fixed node_16::grow() to use indexes_[128 + partial_key] instead of indexes_[partial_key], making it consistent with all other node_48 operations
  • Added comprehensive test case that verifies children remain accessible after growth and that iteration (next_partial_key/prev_partial_key) works correctly
  • Updated .gitignore to exclude CodeQL temporary file

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
include/art/node_16.hpp Adds 128 offset when populating node_48's indexes_ array during node growth, fixing the data corruption bug
test/node_16.cpp Adds test case that verifies children accessibility and iteration after node_16→node_48 growth, but has a SUBCASE placement bug causing memory safety issues
.gitignore Excludes CodeQL-generated temporary file _codeql_detected_source_root

Copy link
Owner

@rafaelkallis rafaelkallis left a comment

Choose a reason for hiding this comment

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

lgtm

@rafaelkallis rafaelkallis merged commit 3e8bada into main Nov 24, 2025
2 checks passed
@rafaelkallis rafaelkallis deleted the copilot/recreate-pr-26-with-coauthor branch November 24, 2025 08:06
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