trustgraph/tests/unit
Sunny 6c9a545a06
feat: add cross-encoder reranking to Document-RAG with two-limit control (#878) (#1011)
Wire the FlashRank reranker subsystem from #1005 into Document-RAG: after
vector retrieval, over-fetch a wider candidate pool, rerank with the
cross-encoder, and keep the top doc_limit chunks for synthesis.

Per maintainer review, the fetch and select sizes are two caller-controlled
limits rather than one internal heuristic:

- doc_limit:   chunks selected into the synthesis prompt (unchanged meaning).
- fetch_limit: candidate pool pulled from the vector store before reranking.
  0 = derive (OVERFETCH_FACTOR x doc_limit); values below doc_limit are
  raised to it. Lets the caller control how hard the reranker has to work.

Details:
- schema: DocumentRagQuery.fetch_limit (additive, backward compatible).
- document_rag.py / rag.py: fetch_limit resolved in the processor (mirrors
  doc_limit); the core applies the heuristic default and derives synthesis
  provenance from the chunk-selection focus when reranking ran.
- provenance: tg:ChunkSelection focus stage (mirrors tg:EdgeSelection).
- request translator + client SDKs + CLI: fetch-limit / --fetch-limit,
  threaded exactly like doc_limit and the GraphRAG limits.
- tests: no-op identity, over-fetch/narrow, explicit fetch_limit, heuristic
  default, floor-at-doc_limit, provenance lineage, cross-repo topic wiring.

Reranking is skipped byte-identically when no reranker role is wired.
Requires the companion trustgraph-templates change wiring the reranker
topics into the document-rag flow (mirrors #279 for GraphRAG).
2026-07-02 09:50:13 +01:00
..
test_agent feat: workspace-based multi-tenancy, replacing user as tenancy axis (#840) 2026-04-21 23:23:01 +01:00
test_api fix: library API get/update document round-trip bugs (#893) (#928) 2026-05-16 11:32:51 +01:00
test_base feat: replace LLM edge scoring with cross-encoder reranker in GraphRAG (#1005) 2026-06-30 14:36:37 +01:00
test_bootstrap feat: make bootstrapper initialiser timeouts configurable (#999) 2026-06-30 09:37:22 +01:00
test_chunking Per-flow librarian clients and per-workspace response queues (#865) 2026-05-06 12:01:01 +01:00
test_cli feat: workspace-based multi-tenancy, replacing user as tenancy axis (#840) 2026-04-21 23:23:01 +01:00
test_clients feat: workspace-based multi-tenancy, replacing user as tenancy axis (#840) 2026-04-21 23:23:01 +01:00
test_concurrency Update rev-gateway for IAM integration (#940) 2026-05-19 21:45:43 +01:00
test_config Structure data mvp (#452) 2025-08-07 20:47:20 +01:00
test_cores feat: complete knowledge core storage — named graphs, provenance, source material (#973) 2026-06-03 10:46:52 +01:00
test_decoding fix: reject invalid PDF decoder input (#977) 2026-06-09 16:37:39 +01:00
test_direct feat: workspace-based multi-tenancy, replacing user as tenancy axis (#840) 2026-04-21 23:23:01 +01:00
test_embeddings Fix HF embeddings tests (#967) 2026-06-01 12:35:09 +01:00
test_extract Fix ontology selector defaults, add bypass mode, enforce domain/range (#929) 2026-05-16 15:13:38 +01:00
test_gateway feat: global usernames and rename workspace to default_workspace (#1001) 2026-06-25 16:34:31 +01:00
test_iam feat: global usernames and rename workspace to default_workspace (#1001) 2026-06-25 16:34:31 +01:00
test_knowledge_graph feat: workspace-based multi-tenancy, replacing user as tenancy axis (#840) 2026-04-21 23:23:01 +01:00
test_librarian Per-workspace queue routing for workspace-scoped services (#862) 2026-05-04 10:30:03 +01:00
test_provenance feat: replace LLM edge scoring with cross-encoder reranker in GraphRAG (#1005) 2026-06-30 14:36:37 +01:00
test_pubsub Test fixes for Kafka (#834) 2026-04-18 23:06:01 +01:00
test_query fix: update row query tests to mock async_execute_paged and async_scan (#979) 2026-06-09 16:29:32 +01:00
test_rdf Pub/sub abstraction: decouple from Pulsar (#751) 2026-04-01 20:16:53 +01:00
test_reliability feat: data store replication configuration and TLS upgrade (#975) 2026-06-04 11:49:29 +01:00
test_retrieval feat: add cross-encoder reranking to Document-RAG with two-limit control (#878) (#1011) 2026-07-02 09:50:13 +01:00
test_rev_gateway Update rev-gateway for IAM integration (#940) 2026-05-19 21:45:43 +01:00
test_storage Make all Cassandra and Qdrant I/O async-safe with proper concurrency controls (#916) 2026-05-14 16:00:54 +01:00
test_structured_data Make all Cassandra and Qdrant I/O async-safe with proper concurrency controls (#916) 2026-05-14 16:00:54 +01:00
test_tables feat: complete knowledge core storage — named graphs, provenance, source material (#973) 2026-06-03 10:46:52 +01:00
test_text_completion Fixed document-rag workspace problem (#866) 2026-05-06 14:55:21 +01:00
test_translators feat: complete knowledge core storage — named graphs, provenance, source material (#973) 2026-06-03 10:46:52 +01:00
__init__.py Test suite executed from CI pipeline (#433) 2025-07-14 14:57:44 +01:00
test_prompt_manager.py fix: avoid swallowing prompt manager interrupts 2026-05-26 10:37:21 -04:00
test_prompt_manager_edge_cases.py Update to enable knowledge extraction using the agent framework (#439) 2025-07-21 14:31:57 +01:00
test_python_api_client.py Merge pull request #955 from jmolz/fix-socket-client-bare-excepts 2026-05-27 13:16:33 +01:00