Skip to content

fix(retrieval): resolve 10 correctness, security, and performance bugs - #816

Merged
AmitoVrito merged 2 commits into
mainfrom
fix/audit-retrieval
Jul 14, 2026
Merged

AmitoVrito merged 2 commits into
mainfrom
fix/audit-retrieval

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Production audit fixes for retrieval, text splitters, and the KG/Cassandra backends.

Closes #780
Closes #781
Closes #782
Closes #783
Closes #784
Closes #785
Closes #786
Closes #787
Closes #788
Closes #789

AmitoVrito and others added 2 commits July 14, 2026 23:24
…784 #785 #786 #787 #788 #789)

Fix a batch of correctness, safety, and performance bugs in the retrieval
and text-splitter stack, each with a regression test:

  #780 InMemoryVectorStore.search returned ALL docs for top_k<=0 because
       np.argpartition(scores,-0)[-0:] is [0:]. Early-return [] instead.
  #781 CharacterTextSplitter/RecursiveCharacterTextSplitter accepted
       chunk_overlap >= chunk_size (raised or silently dropped data);
       validate in __init__.
  #782/#783 FederatedRetriever and WorldModelRAG.query used `top_k or default`,
       conflating top_k=0 with None; use `top_k if top_k is not None else`.
  #784 Neo4jStore.get_neighbors interpolated max_hops into a Cypher
       variable-length pattern unchecked (injection); cast to a bounded int.
  #785 CassandraVectorStore search built LIMIT via f-string; validate/cast
       top_k and pass it as a bound parameter.
  #786 RAGFusionRetriever ran query variants serially; use asyncio.gather.
  #787 HybridSearchRetriever.add_documents replaced the index (data loss) and
       fully sorted BM25 scores; extend the corpus and use heapq.nlargest.
  #788 HybridSearchRetriever.retrieve failed entirely when the vector store
       was down; fall back to BM25-only fusion with a warning.
  #789 WorldModelRAG.ingest embedded one doc per call; batch into a single add.
       Also add astrapy>=1.0 to the [cassandra] extra so the astra ImportError
       message is accurate.

Co-authored-by: Dhruv Garg <[email protected]>
@AmitoVrito
AmitoVrito merged commit 7adac9f into main Jul 14, 2026
11 of 12 checks passed
@AmitoVrito
AmitoVrito deleted the fix/audit-retrieval branch July 14, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment