Skip to content

[MOD-13847] Swap C numeric range tree with Rust implementation#8306

Merged
LukeMathWalker merged 9 commits intomasterfrom
numeric-range-tree-3-swap
Feb 27, 2026
Merged

[MOD-13847] Swap C numeric range tree with Rust implementation#8306
LukeMathWalker merged 9 commits intomasterfrom
numeric-range-tree-3-swap

Conversation

@LukeMathWalker
Copy link
Collaborator

@LukeMathWalker LukeMathWalker commented Feb 8, 2026

Describe the changes in the pull request

Replace the existing C implementation with the Rust one.
Stacked on #8401.

Which additional issues this PR fixes

  1. MOD-...
  2. #...

Main objects this PR modified

  1. ...

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

If a release note is required (bug fix / new feature / enhancement), describe the user impact of this PR in the title.


Note

High Risk
High risk because it swaps the core numeric/geo indexing data structure, iterator creation, and ForkGC apply/compaction paths, which can affect query correctness, memory accounting, and GC safety under concurrency.

Overview
Replaces the C NumericRangeTree implementation with the Rust-backed FFI version across indexing, querying, debug commands, memory accounting, and garbage collection.

Numeric query execution now asks Rust to both find matching ranges and build per-range iterators via new CreateNumericRangeIterators, and ForkGC now streams per-node GC entries from the child and applies them in the parent with NumericRangeTree_ApplyGcEntry, followed by NumericRangeTree_CompactIfSparse instead of the previous empty-leaf trimming logic.

Updates tests and debug outputs to match the new tree structure/ordering and memory sizing (NumericRangeTree_BaseSize, NumericRangeTree_GetInvertedIndexesSize), and removes the old C++ numeric range tree test suite (test_cpp_range.cpp).

Written by Cursor Bugbot for commit 4bfc792. This will update automatically on new commits. Configure here.

@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from 5ab7173 to a95aa68 Compare February 9, 2026 14:11
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch 2 times, most recently from 69d255a to 2d66944 Compare February 9, 2026 14:18
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from a95aa68 to b514f01 Compare February 9, 2026 14:18
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from b514f01 to c629c5b Compare February 9, 2026 14:59
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch from 2d66944 to 1fa3b06 Compare February 9, 2026 14:59
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from c629c5b to 5c61e20 Compare February 9, 2026 15:03
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch 2 times, most recently from 4f38267 to e873c7f Compare February 10, 2026 09:24
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch 2 times, most recently from 151e4d1 to d9136d3 Compare February 10, 2026 10:57
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch from e873c7f to 0aa6d28 Compare February 10, 2026 10:57
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from d9136d3 to 609478b Compare February 10, 2026 12:18
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch from 0aa6d28 to 5ec972a Compare February 10, 2026 12:18
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from 609478b to ba9c5b1 Compare February 10, 2026 12:19
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch from 5ec972a to 5de5df1 Compare February 10, 2026 12:19
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from ba9c5b1 to d93c532 Compare February 10, 2026 12:36
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch from 5de5df1 to 494fed2 Compare February 10, 2026 12:36
@LukeMathWalker LukeMathWalker marked this pull request as ready for review February 10, 2026 13:07
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 86.25000% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.38%. Comparing base (bf50d19) to head (4bfc792).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/fork_gc.c 76.25% 19 Missing ⚠️
src/debug_commands.c 83.33% 1 Missing ⚠️
..._rs/c_entrypoint/numeric_range_tree_ffi/src/lib.rs 0.00% 1 Missing ⚠️
...ch_rs/rqe_iterators_test_utils/src/test_context.rs 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8306      +/-   ##
==========================================
- Coverage   82.89%   82.38%   -0.52%     
==========================================
  Files         433      440       +7     
  Lines       60961    60839     -122     
  Branches    18662    18998     +336     
==========================================
- Hits        50535    50122     -413     
- Misses      10239    10528     +289     
- Partials      187      189       +2     
Flag Coverage Δ
flow 83.64% <68.57%> (-0.26%) ⬇️
unit 51.60% <80.00%> (-0.36%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-2-ffi branch from 494fed2 to 4c0ce4b Compare February 11, 2026 11:19
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from d93c532 to a75af40 Compare February 11, 2026 11:19
@gdesmott gdesmott enabled auto-merge February 27, 2026 07:52
@gdesmott gdesmott added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 27, 2026
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-3-swap branch from 22864e6 to 2c7647d Compare February 27, 2026 10:30
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

/// Resolve a [`NodeIndex`] to a mutable reference to the node.
pub fn node_mut(&mut self, idx: NodeIndex) -> &mut NumericRangeNode {
&mut self.nodes[idx]
}
Copy link

Choose a reason for hiding this comment

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

Public node_mut lacks feature gate unlike range_mut

Low Severity

The new node_mut method is unconditionally pub, but it's only used externally in test code (rqe_iterators_test_utils). The companion range_mut method on NumericRangeNode was deliberately feature-gated behind test-utils (as requested in PR discussion), with pub(crate) in production and pub for tests. node_mut exposes mutable access to arbitrary tree nodes without the same gating, making the internal tree structure unnecessarily accessible to downstream crates in production builds.

Additional Locations (1)

Fix in Cursor Fix in Web

gdesmott
gdesmott previously approved these changes Feb 27, 2026
@LukeMathWalker LukeMathWalker added this pull request to the merge queue Feb 27, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 27, 2026
@LukeMathWalker
Copy link
Collaborator Author

If I have to fix conflicts one more time... 😭

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@LukeMathWalker LukeMathWalker added this pull request to the merge queue Feb 27, 2026
Merged via the queue into master with commit 13923a6 Feb 27, 2026
69 of 70 checks passed
@LukeMathWalker LukeMathWalker deleted the numeric-range-tree-3-swap branch February 27, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants