Skip to content

[MOD-16055] Remove unused Rust FFI exports - #11785

Merged
gdesmott merged 2 commits into
masterfrom
gdesmott-remove-unused-ffi-exports
Oct 7, 2026
Merged

gdesmott merged 2 commits into
masterfrom
gdesmott-remove-unused-ffi-exports

Conversation

@gdesmott

@gdesmott gdesmott commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

  1. Current: Query node evaluation now lives in Rust, so a number of Rust functions exported to C (iterator constructors, offset helpers, Term_Free, TrieMap_IterateRange and several inverted index accessors) no longer have any caller in C, C++ tests or Rust.
  2. Change: Remove those exports, their generated header declarations, and the test mocks and FFI tests that existed only for them.
  3. Outcome: Internal-only. It shrinks the C-facing FFI surface and the generated headers, so the remaining exports are the ones C still uses.

Stacked on #11206.

Which additional issues this PR fixes

  1. MOD-16055

Main objects this PR modified

  1. iterators_ffi: drops the unused iterator constructors (geo range, missing, wildcard, optional, unsorted id list, metric sorted by score).
  2. inverted_index_ffi: drops unused IndexReader_*, IndexBlock_LastId, GC marker and entry count accessors.
  3. query_eval_ffi / query_term_ffi / triemap_ffi: drop queryNeedsOffsets, scorerNeedsOffsets, Term_Free and TrieMap_IterateRange.

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

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@gdesmott
gdesmott force-pushed the MOD-14886-query-eval-tag-node branch from 203817d to fa73884 Compare October 5, 2026 14:44
@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from 733bb17 to 7ba9606 Compare October 5, 2026 14:44
@gdesmott
gdesmott force-pushed the MOD-14886-query-eval-tag-node branch from fa73884 to 315cc7c Compare October 5, 2026 15:05
@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from 7ba9606 to 7c68d8a Compare October 5, 2026 15:05
@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.92%. Comparing base (d014291) to head (509076e).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11785      +/-   ##
==========================================
+ Coverage   83.81%   83.92%   +0.10%     
==========================================
  Files         651      672      +21     
  Lines       85792    86306     +514     
  Branches    40037    40748     +711     
==========================================
+ Hits        71908    72430     +522     
+ Misses      13520    13504      -16     
- Partials      364      372       +8     
Flag Coverage Δ
flow 84.47% <ø> (-0.11%) ⬇️
unit 59.47% <ø> (+0.45%) ⬆️

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

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

@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from 7c68d8a to ffccfe8 Compare October 6, 2026 10:25
@gdesmott
gdesmott force-pushed the MOD-14886-query-eval-tag-node branch from 315cc7c to faba382 Compare October 6, 2026 10:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T14:08:38.807598Z 509076e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from ffccfe8 to 7342444 Compare October 6, 2026 10:33
@gdesmott
gdesmott force-pushed the MOD-14886-query-eval-tag-node branch from faba382 to 62e9592 Compare October 6, 2026 10:33
@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from 7342444 to 6522146 Compare October 6, 2026 12:00
@gdesmott
gdesmott force-pushed the MOD-14886-query-eval-tag-node branch 2 times, most recently from 1e802eb to 0a70eea Compare October 6, 2026 12:21
@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from 6522146 to 0a544f5 Compare October 6, 2026 12:21
Base automatically changed from MOD-14886-query-eval-tag-node to master October 6, 2026 13:59
Now that query node evaluation is done in Rust, nothing calls these
constructors from C, C++ tests or Rust:

- NewGeoRangeIterator
- NewInvIndIterator_MissingQuery
- NewInvIndIterator_WildcardQuery
- NewMetricIteratorSortedByScore
- NewOptionalIterator
- NewUnsortedIdListIterator
- NewWildcardIterator
Nothing calls these anymore:

- query_eval_ffi: queryNeedsOffsets, scorerNeedsOffsets
- query_term_ffi: Term_Free (terms are owned and dropped by Rust)
- triemap_ffi: TrieMap_IterateRange
- inverted_index_ffi: GcScanDelta_LastBlockIdx, IndexBlock_LastId,
  IndexReader_Flags, IndexReader_HasMulti, IndexReader_IsIndex,
  IndexReader_NeedsRevalidation, IndexReader_NumericFilter,
  IndexReader_NumEstimated, IndexReader_Reset, IndexReader_SkipTo,
  InvertedIndex_GcMarker, InvertedIndex_GcMarkerInc,
  InvertedIndex_NumEntries

Drop them together with what only they needed: the Term_Free test
mocks, the TrieMap_IterateRange FFI test, the unused C
TrieMapRangeCallback typedef and the query_types dependency of
query_eval_ffi.
@gdesmott
gdesmott force-pushed the gdesmott-remove-unused-ffi-exports branch from 0a544f5 to 509076e Compare October 6, 2026 14:02
@gdesmott
gdesmott enabled auto-merge October 6, 2026 14:24
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

@JonasKruckenberg JonasKruckenberg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hell yeah, love deleting

@gdesmott
gdesmott disabled auto-merge October 7, 2026 09:54
@gdesmott
gdesmott added this pull request to the merge queue Oct 7, 2026
Merged via the queue into master with commit 8610b77 Oct 7, 2026
61 checks passed
@gdesmott
gdesmott deleted the gdesmott-remove-unused-ffi-exports branch October 7, 2026 10:30
aradalvand added a commit to aradalvand/RediSearch that referenced this pull request Oct 14, 2026
Master moved tag node evaluation into Rust (MOD-14886, RediSearch#11206), deleting the C
tag evaluator that `Query_EvalTagLexRangeNode` and `tagRangeIterCb` lived
alongside, and removed `TrieMap_IterateRange` as an unused FFI export
(MOD-16055, RediSearch#11785). So the C evaluator this branch added had no home and its
only FFI dependency was gone.

Rather than reinstate the FFI, the walk moves to Rust next to the prefix and
wildcard expansions it mirrors. `trie_rs` kept the Rust range iterator; only the
C-facing wrapper went away, so `eval_lex_range` reads the bounds from the node,
normalizes each one, and walks `TrieMap::range_iter` straight from
`query_eval::nodes::tag`.

That also drops the parts of this branch that only existed to reach the trie
from C: `TagIndex_IterateRangeValues`, `TagIndex_GetIteratorFromTrieMapValue`
and its cpptest, the `TrieMapRangeCallback` typedef, and the triemap_ffi range
module, header entry and test. `src/tag_index.{c,h}`, `test_cpp_tagindex.cpp`
and the whole `triemap_ffi` crate are now identical to master again.

Two details the port had to carry over rather than inherit:

- Bound normalization. `tag_strtolower` is gone, and `RSTokenMut::normalize_tag`
  replaced it for tokens. A bound is a plain string, not a token, so
  `normalize_bound` applies the same two passes, `string_utils::tag::unescape`
  then `tolower_bytes` unless the field is CASESENSITIVE. Reading through
  `CStr::to_bytes` keeps the up-to-NUL truncation the C path had.
- No deadline is installed on the range walk. A pattern walk visits keys it does
  not match, so it needs one; a range descent yields only matching keys, so the
  expansion cap bounds the work and the pipeline owns the deadline, as for every
  other node.

The conflict in the generated `parser.c` is resolved by regenerating it from the
merged `parser.y`; Lemon reports 0 conflicts.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019EcxECuDqmECKPNVsNfXKb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants