Add Qdrant vector index with authorization-filtered search (R01, #20) #65

Merged
amiryahaya merged 12 commits from feat/20-qdrant-index into main 2026-10-27 14:14:21 +01:00
Owner

Closes #20 (R01).

What

  • crates/retrieval: VectorIndex contract (upsert, delete_chunks, delete_version, search), an in-memory reference index and one shared suite run_contract, behind feature test-support.
  • New crates/storage-qdrant (qdrant-client =1.20.0, gRPC, default features off):
    • profile- and dimension-bound collections chunks_<encoded profile>_<dim> with an atomically switched alias chunks_current;
    • payload with an ACL schema and an authorization filter built from AuthorizedSearchScope, mirroring policy.rs and lexical.rs;
    • loopback-only plain http, https otherwise, no URL userinfo, API key redacted and marked sensitive.
  • CI downloads the pinned Qdrant v1.20.0 musl release (SHA256 b03a6461…df52c, fails closed before extracting), binds it to 127.0.0.1, runs scripts/test-qdrant.sh, and stops it in an if: always() step. The gnu build needs glibc 2.38, but the job image has 2.36.
  • Docs: docs/operations/vector-index.md; crypto inventory entry updated; compose.yaml Qdrant bumped to v1.20.0.

Coverage

Workspace line coverage 94.84% (minimum 80%); storage-qdrant 97.0% (scripts/coverage.sh rust with the Postgres and Qdrant suites).

Review

Dual-pass: Ponytail (no Must fix) and an Opus correctness review. Its Critical (CI binary) and Important (inventory, profile-binding ruling) findings are fixed. The Ponytail re-check of the fixes is clean. Live suites (14 behavior + 1 shared contract) pass on Qdrant v1.20.0.

Known limits (see the guide)

  • Equal-score order at the limit is unspecified.
  • A handle serves its own collection; callers reconnect to follow an activation.
  • Profile and tokenizer are bound at connect; queries and points carry only vectors, so #25 and #23 must pass vectors made under the handle's contract.
  • A point missing marking fields is permissive in Qdrant; only writes that bypass payload_of can make one. R02/#23 rechecks.
  • No outbox writer (#21), no embedder (#25), no TLS profile (K02).

Checks not run locally

cargo audit (local 0.21.2 cannot read the advisory DB; CI's 0.22.2 is the check). The first CI run is the first proof of the musl binary in the job container; it was run under amd64 emulation locally.

🤖 Generated with Claude Code

Closes #20 (R01). ## What - `crates/retrieval`: `VectorIndex` contract (`upsert`, `delete_chunks`, `delete_version`, `search`), an in-memory reference index and one shared suite `run_contract`, behind feature `test-support`. - New `crates/storage-qdrant` (qdrant-client `=1.20.0`, gRPC, default features off): - profile- and dimension-bound collections `chunks_<encoded profile>_<dim>` with an atomically switched alias `chunks_current`; - payload with an ACL schema and an authorization filter built from `AuthorizedSearchScope`, mirroring `policy.rs` and `lexical.rs`; - loopback-only plain `http`, `https` otherwise, no URL userinfo, API key redacted and marked sensitive. - CI downloads the pinned Qdrant v1.20.0 **musl** release (SHA256 `b03a6461…df52c`, fails closed before extracting), binds it to 127.0.0.1, runs `scripts/test-qdrant.sh`, and stops it in an `if: always()` step. The gnu build needs glibc 2.38, but the job image has 2.36. - Docs: `docs/operations/vector-index.md`; crypto inventory entry updated; `compose.yaml` Qdrant bumped to v1.20.0. ## Coverage Workspace line coverage **94.84%** (minimum 80%); `storage-qdrant` **97.0%** (`scripts/coverage.sh rust` with the Postgres and Qdrant suites). ## Review Dual-pass: Ponytail (no Must fix) and an Opus correctness review. Its Critical (CI binary) and Important (inventory, profile-binding ruling) findings are fixed. The Ponytail re-check of the fixes is clean. Live suites (14 behavior + 1 shared contract) pass on Qdrant v1.20.0. ## Known limits (see the guide) - Equal-score order at the limit is unspecified. - A handle serves its own collection; callers reconnect to follow an activation. - Profile and tokenizer are bound at connect; queries and points carry only vectors, so #25 and #23 must pass vectors made under the handle's contract. - A point missing marking fields is permissive in Qdrant; only writes that bypass `payload_of` can make one. R02/#23 rechecks. - No outbox writer (#21), no embedder (#25), no TLS profile (K02). ## Checks not run locally `cargo audit` (local 0.21.2 cannot read the advisory DB; CI's 0.22.2 is the check). The first CI run is the first proof of the musl binary in the job container; it was run under amd64 emulation locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pure, server-free parts of the Qdrant adapter. qdrant-client pinned to =1.12.1
without default features.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fix(ci,qdrant): musl Qdrant binary in CI, crypto inventory, shared batch check, normalized URL (#20)
Some checks failed
CI / Web checks (pull_request) Successful in 40s
CI / Rust checks (pull_request) Failing after 37m31s
9fde161dc0
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ci: free the plain debug build before the instrumented coverage build
All checks were successful
CI / Web checks (pull_request) Successful in 1m12s
CI / Rust checks (pull_request) Successful in 47m27s
4e83216a07
The Rust job ran out of disk (ENOSPC, linker bus error) during cargo llvm-cov once the
Qdrant client's dependencies were added. llvm-cov uses target/llvm-cov-target, so
target/debug can go.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.