[P1] I03: Implement authorization-filtered PostgreSQL lexical retrieval #19

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

Backlog ID: I03 | Priority: P1 | Phase: M3 — Canonical ingestion and lexical search

Outcome and scope

Add LexicalSearch using a measured English/Malay baseline, parameterized queries and equivalent policy-owned search filters. Exercise it internally before vector publication is available.

Dependencies and gates

Engineering prerequisites: #18 (I02), #10 (F05)

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

Starting points

crates/storage-postgres/src/lexical/; crates/retrieval/; migrations/; tests/integration/lexical_search.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

  • Authorized scope is applied inside SQL before returning candidates; absent/broken scope never becomes an unfiltered query.
  • Exact identifiers, punctuation, Unicode and mixed-language questions have documented behavior using representative fixtures.
  • Return bounded IDs/scores for canonical authorization; no protected text, counts or snippets escape prematurely.
  • User-facing queries include only READY versions; internal lexical tests do not publish lexical-only documents before I04 verifies the vector index.

Verification

Real-PostgreSQL contract tests cover cross-org/compartment/need-to-know denial, query injection, missing scope, exact identifiers and quarantined/partial versions.

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-AUTH-005–006; FR-DATA-003–004; FR-RAG-002; architecture §§6–7

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:** I03 | **Priority:** P1 | **Phase:** M3 — Canonical ingestion and lexical search ## Outcome and scope Add LexicalSearch using a measured English/Malay baseline, parameterized queries and equivalent policy-owned search filters. Exercise it internally before vector publication is available. ## Dependencies and gates **Engineering prerequisites:** #18 (I02), #10 (F05) Synthetic-data development may proceed. Production use remains subject to the decision gates in the SRS. ## Starting points crates/storage-postgres/src/lexical/; crates/retrieval/; migrations/; tests/integration/lexical_search.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 - [ ] Authorized scope is applied inside SQL before returning candidates; absent/broken scope never becomes an unfiltered query. - [ ] Exact identifiers, punctuation, Unicode and mixed-language questions have documented behavior using representative fixtures. - [ ] Return bounded IDs/scores for canonical authorization; no protected text, counts or snippets escape prematurely. - [ ] User-facing queries include only READY versions; internal lexical tests do not publish lexical-only documents before I04 verifies the vector index. ## Verification Real-PostgreSQL contract tests cover cross-org/compartment/need-to-know denial, query injection, missing scope, exact identifiers and quarantined/partial versions. 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-AUTH-005–006; FR-DATA-003–004; FR-RAG-002; architecture §§6–7 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#19
No description provided.