Skip to content

[RAG Retrieval] Add deterministic semantic and hybrid retrieval - #8

Merged
rica-v3 merged 1 commit into
issue-1-generic-ragfrom
issue-4-hybrid-retrieval
Aug 25, 2026
Merged

[RAG Retrieval] Add deterministic semantic and hybrid retrieval#8
rica-v3 merged 1 commit into
issue-1-generic-ragfrom
issue-4-hybrid-retrieval

Conversation

@rica-v3

@rica-v3 rica-v3 commented Aug 25, 2026

Copy link
Copy Markdown
Member

Summary

  • add bounded semantic retrieval and deterministic rank-only hybrid fusion over caller-owned collaborators
  • extract and publish the unchanged v1 projection integrity algorithms for shared current-state validation
  • filter stale revisions, deduplicate exact identities, map branch failures truthfully, and keep results score-free
  • document the complete independent host flow for authorization, source revalidation, citations, users, and agents
  • preserve an empty package-root facade and a dependency-free/provider-neutral seven-module distribution

Verification

  • 139 unit tests on Python 3.11 and 3.14
  • Ruff lint and format checks
  • strict mypy on both interpreters
  • compileall on both interpreters
  • wheel/sdist artifact verification, clean installs, isolated imports, and sdist rebuild
  • 7/7 module-index parity, exact 12-edge acyclic graph, no private crossings
  • executable documentation example and local Markdown link/anchor checks
  • final main-agent 139-test run and git diff --check

Closes #4

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new, dependency-free retrieval layer to generic-rag, implementing bounded semantic retrieval and deterministic rank-only hybrid fusion over caller-owned collaborators, while also extracting shared deterministic projection integrity algorithms into a dedicated module.

Changes:

  • Introduces generic_rag.retrieval with retrieve_semantic and retrieve_hybrid, including strict contract validation, stale/current filtering, deduplication, deterministic tie-breaking, and score-free hybrid fusion (RRF with offset 60).
  • Extracts projection integrity derivation/validation into generic_rag.projection_integrity and wires projection/retrieval to use it.
  • Updates public docs, module index, packaging boundary tests, and adds comprehensive behavioral + golden tests for retrieval and integrity.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_retrieval.py New end-to-end behavioral matrix for semantic + hybrid retrieval, determinism, validation, dedup, truncation, and failure/stale precedence.
tests/test_retrieval_contracts.py Extends contract tests to cover the new RetrievalLimits type and invariants.
tests/test_projection_integrity.py New golden/validation tests for extracted v1 integrity algorithms and workflow parity with projection.
tests/test_package_boundaries.py Updates module inventory, dependency graph, and export assertions for the new modules.
tests/support/verify_artifacts.py Ensures built artifacts include the two new production modules.
src/generic_rag/retrieval.py Implements bounded semantic retrieval and deterministic hybrid fusion with strict validation and content-free failure mapping.
src/generic_rag/projection.py Replaces inlined integrity logic with calls to generic_rag.projection_integrity.
src/generic_rag/projection_integrity.py New shared module owning deterministic v1 digest/ID/token derivation and checkpoint validation.
src/generic_rag/contracts.py Adds RetrievalLimits contract type and exports it via __all__.
README.md Updates package overview and guidance to include retrieval and links to the retrieval guide.
PYTHON_MODULE_INDEX.md Expands indexed production units to 7 and documents responsibilities/dependencies for new modules.
docs/security-and-privacy.md Documents retrieval-specific trust boundary, caller obligations, and collaborator data exposure.
docs/retrieval.md New retrieval guide with an independent-consumer example and full host flow requirements.
docs/projection.md Links projection lifecycle to retrieval usage and documents the extracted integrity helpers.
docs/lifecycle.md Updates lifecycle guidance to include retrieval call scope and host operational ownership.
docs/api.md Updates public API reference to include retrieval workflows and projection integrity helpers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rica-v3
rica-v3 merged commit 0d5861e into issue-1-generic-rag Aug 25, 2026
5 checks passed
@rica-v3
rica-v3 deleted the issue-4-hybrid-retrieval branch August 25, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants