[P1] R02: Combine hybrid retrieval with canonical authorization before loading text #23

Open
opened 2026-10-21 20:29:28 +02:00 by amiryahaya · 0 comments
Owner

Backlog ID: R02 | Priority: P1 | Phase: M4 — Consistent indexing and hybrid retrieval

Outcome and scope

Orchestrate semantic and lexical search concurrently, fuse ranked IDs using documented reciprocal rank fusion, then revalidate current canonical security attributes before loading text or reranking.

Dependencies and gates

Engineering prerequisites: #19 (I03), #20 (R01), #21 (I04), #10 (F05)

Synthetic-data development may proceed. Production use remains subject to the decision gates in the SRS.

Starting points

crates/retrieval/src/; crates/storage-postgres/; tests/integration/hybrid_retrieval.rs

These are current files or proposed responsibility boundaries; finalize a focused implementation plan before coding. Existing local scaffolding is uncommitted and is not evidence of completion.

Acceptance criteria

  • Vector and lexical requests receive the same immutable current scope; lexical retrieval can overlap query embedding/vector work.
  • Fusion deduplicates stable chunk IDs and has deterministic rank/tie behavior with bounded candidate/context counts.
  • Forged/stale Qdrant payloads, revoked/deleted sources and label/profile mismatch are denied and reconciled; no unauthorized text reaches any model.
  • Dependency/filter errors fail closed according to an explicit contract; no unfiltered or partial unauthorized fallback occurs.

Verification

Real-service integration tests forge vector payloads, change ACLs between retrieval and canonical load, fail one search path, and verify allowed IDs/text and phase timings.

Behavior changes follow Red → Green → Refactor. Run affected Rust shared contract/unit tests and real PostgreSQL/Qdrant/runtime integration tests where applicable; frontend changes run typecheck/build and the relevant browser tests. Record exact commands/results in the implementation PR. Documentation/decision tasks use recorded review evidence.

Requirements and design

FR-RAG-002, 005; FR-AUTH-005–006, 010; architecture §§6.2, 9.1–9.2

Sources: SRS, system design. Local planning context: docs/implementation-plan.md and docs/development-backlog.md (not published by this task).

Security impact: Use synthetic fixtures until approved for operational data. Preserve current authorization, markings, provenance and default-deny behavior; exclude protected payloads/secrets from operational telemetry. No classified-deployment or PQC-compliance claim is implied by closing this issue.

Parent roadmap: #1

**Backlog ID:** R02 | **Priority:** P1 | **Phase:** M4 — Consistent indexing and hybrid retrieval ## Outcome and scope Orchestrate semantic and lexical search concurrently, fuse ranked IDs using documented reciprocal rank fusion, then revalidate current canonical security attributes before loading text or reranking. ## Dependencies and gates **Engineering prerequisites:** #19 (I03), #20 (R01), #21 (I04), #10 (F05) Synthetic-data development may proceed. Production use remains subject to the decision gates in the SRS. ## Starting points crates/retrieval/src/; crates/storage-postgres/; tests/integration/hybrid_retrieval.rs These are current files or proposed responsibility boundaries; finalize a focused implementation plan before coding. Existing local scaffolding is uncommitted and is not evidence of completion. ## Acceptance criteria - [ ] Vector and lexical requests receive the same immutable current scope; lexical retrieval can overlap query embedding/vector work. - [ ] Fusion deduplicates stable chunk IDs and has deterministic rank/tie behavior with bounded candidate/context counts. - [ ] Forged/stale Qdrant payloads, revoked/deleted sources and label/profile mismatch are denied and reconciled; no unauthorized text reaches any model. - [ ] Dependency/filter errors fail closed according to an explicit contract; no unfiltered or partial unauthorized fallback occurs. ## Verification Real-service integration tests forge vector payloads, change ACLs between retrieval and canonical load, fail one search path, and verify allowed IDs/text and phase timings. Behavior changes follow Red → Green → Refactor. Run affected Rust shared contract/unit tests and real PostgreSQL/Qdrant/runtime integration tests where applicable; frontend changes run typecheck/build and the relevant browser tests. Record exact commands/results in the implementation PR. Documentation/decision tasks use recorded review evidence. ## Requirements and design FR-RAG-002, 005; FR-AUTH-005–006, 010; architecture §§6.2, 9.1–9.2 Sources: [SRS](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/SRS.md), [system design](https://forgejo.primatekun.tech/primatekuntech/rag-rust/src/branch/main/docs/architecture.md). Local planning context: `docs/implementation-plan.md` and `docs/development-backlog.md` (not published by this task). **Security impact:** Use synthetic fixtures until approved for operational data. Preserve current authorization, markings, provenance and default-deny behavior; exclude protected payloads/secrets from operational telemetry. No classified-deployment or PQC-compliance claim is implied by closing this issue. **Parent roadmap:** #1
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
primatekuntech/rag-rust#23
No description provided.