fix(search): FT._LIST enumerates both index stores, so a TEXT-only index is no longer invisible (#709) - #726
Conversation
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesFT._LIST dual-store enumeration
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to FT._LIST now includes text-only indexes while returning mixed text/vector indexes only once; the change is covered by passing tests and standard checks, so no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant Client
participant FTList
participant VectorStore
participant TextStore
Client->>FTList: Execute FT._LIST
FTList->>VectorStore: Read names for selected database
FTList->>TextStore: Read names for selected database
FTList-->>Client: Return sorted deduplicated names
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description provides a detailed summary, implementation rationale, issue scope, testing evidence, and performance rationale. It does not use every template heading, but it is substantially complete. Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Docstring CoverageExplanation Docstring coverage is 63.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 8 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4a0aae0 to
43e4f03
Compare
|
Force-pushed That leg builds Worth recording because it is a gap in the usual local sweep: all four clippy legs passed first, including Re-running the full bar now. |
|
Dispatch run The failing test is Fixed test-only in #727, reproduced deterministically on macOS and proven non-vacuous there. Once #727 lands I will rebase this branch and re-dispatch. |
…dex is no longer invisible (#709) An index whose schema carries no VECTOR field lives only in the TextStore. `ft_list` enumerated the vector store alone, so such an index never appeared in FT._LIST — even though FT.INFO and FT.SEARCH both work on it. The doc comment already claimed to return "all index names owned by the caller's currently SELECTed db", which is what it was documented to do and not what it did. FT._LIST is how tools and the Moon Console discover indexes, so a TEXT-only index could not be listed, inspected in a UI, or picked up by anything that enumerates before acting. It also silently broke any harness that used FT._LIST to verify index creation: the one that found this reported "built 0 indexes" after 50 successful FT.CREATEs. The two stores are now unioned by sort-then-dedup rather than a membership scan. That collapses the both-stores duplicate — an index carrying TEXT AND VECTOR fields is registered in both and must appear exactly once — in O(n log n) instead of O(n^2), and it gives the result a stable order that neither store's hashing provides on its own. The text_store reference was added as a PARAMETER rather than reached for locally, so the compiler enumerated all seven call sites instead of letting one hide. Two of them turned out to bind the store under a different name in a branch only the tokio feature set compiles; the default build would have shipped that blind. The sweep the issue asked for came back clean. FT.INFO consults both stores already, FLUSHALL/FLUSHDB index-clearing goes through auto_flush_indexes with both, and the remaining find_matching_index_names_for_db callers either pair the two stores or are deliberately vector-only (auto_hdel_vectors, whose TEXT/TAG/NUMERIC counterpart is a separately documented follow-up). FT._LIST was the only enumerator reading one store. Proven against a pre-fix binary rather than assumed. The lib test is red behaviourally, not by failing to compile: the signature was changed first with the body untouched, giving `left: [both, vec]` against `right: [both, txt, vec]`. The e2e suite fails the same way on main's binary (sha 3f058308 vs e07ee370), and both of its premise guards — FT.INFO and FT.SEARCH working on the TEXT-only index — pass on that same binary, which is exactly the issue's point. The suite then restarts on the same dir, so the TEXT-only index has to come back from its sidecar and re-register. scripts/test-commands.sh gains a TEXT-only row. It drops the index immediately afterwards on purpose: a later assertion checks FT._LIST is empty once testidx is gone, and now that FT._LIST can see TEXT-only indexes, leaving one behind would break a passing assertion. Closes #709 author: Tin Dang
43e4f03 to
76912d4
Compare
Closes #709.
The bug
An index whose schema carries no
VECTORfield lives only in theTextStore.ft_listenumerated the vector store alone:so a TEXT-only index never appeared — even though
FT.INFOandFT.SEARCHboth work on it. The doc comment already claimed to return "all index names owned by the caller's currently SELECTed db", which is what it was documented to do and not what it did.FT._LISTis how tools and the Moon Console discover indexes, so such an index could not be listed, inspected in a UI, or picked up by anything that enumerates before acting. It also silently breaks any harness that usesFT._LISTto verify index creation — the one that found this reported "built 0 indexes" after 50 successfulFT.CREATEs.The fix
Union the two stores by sort-then-dedup rather than a membership scan: that collapses the both-stores duplicate (an index carrying TEXT and VECTOR fields is registered in both and must appear exactly once) in O(n log n) instead of O(n²), and gives the result a stable order that neither store's hashing provides on its own.
The
text_storereference is a parameter, not something reached for locally, so the compiler enumerated all seven call sites instead of letting one hide. Two of them bind the store under a different name in a branch only theruntime-tokiofeature set compiles — the default build would have shipped that blind.The sweep the issue asked for
Came back clean:
FT.INFOs.text_store.get_index_for_dbalongside the vector lookup)FLUSHALL/FLUSHDBauto_flush_indexes(&mut s.vector_store, &mut s.text_store, …)replication/apply.rs:1059spsc_handler.rs:3683auto_hdel_vectorsFT._LISTProving it
Lib test — red behaviourally, not by failing to compile: the signature was changed first with the body untouched.
It guards its own premise, asserting
txtreally is in the text store and really is not in the vector store — otherwise the union would pass with nothing to union in.E2E suite — run against the actual pre-fix binary (sha
3f058308vse07ee370), same failure. Both of its premise guards —FT.INFOandFT.SEARCHworking on the TEXT-only index — pass on that same pre-fix binary, which is precisely the issue's complaint. It then restarts on the same dir, so the TEXT-only index has to come back from its sidecar and re-register.Harness —
scripts/test-commands.shgains a TEXT-only row, and drops the index immediately afterwards on purpose: a later assertion checksFT._LISTis empty oncetestidxis gone, and now thatFT._LISTcan see TEXT-only indexes, leaving one behind would break a passing assertion.Gates
cargo test --lib: 5053 passed, 0 failedcargo test --test ft_list_both_stores_709: passes on the fixed binary, fails on the pre-fix one--all-targets: default /graph/runtime-tokio,jemallocall cleancargo fmt --check: cleanscripts/ci-local.sh+ full hosted dispatch matrix: belowSummary by CodeRabbit
New Features
FT._LISTnow includes both text and vector indexes.Bug Fixes
FT._LIST.Tests