Skip to content

atlas-core: core search library (Atlas epic #5350 step 2, #5352) - #5372

Merged
dezren39 merged 1 commit into
mainfrom
atlas-step2-core
Nov 4, 2026
Merged

dezren39 merged 1 commit into
mainfrom
atlas-step2-core

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Step 2 of the Atlas binary/service epic (#5350): the core search library, per #5352 and design §4/§5. Builds on step 1's merged atlas-embed (#5351, Gate A bit-identity).

What

crates/atlas-core — the search pipeline as a library, a semantics-exact port of the production Python atlas_search.py:

  • Pipeline: query embedding via atlas-embed (documents prompt-free; the "query: " prompt is applied at this library boundary) → FTS branch + vector branch → RRF fusion (k=10, pool 100/branch defaults) → envelope (flat / grouped-by-session / get-chunk), rendered byte-equal to the Python's.
  • Sensitivity: ceilings enforced inside branch construction (filter-before-rank), ladder shareable < personal < local-only < secret-bearing, default personal, NULL sensitivity never passes (fail-closed) — mirroring --max-sensitivity exactly.
  • Vector backends, all three: exact scan (vector_distance_cos over the allowed set — production path, default), index fetch-to-fill (depth doubles to a 3200 cap until ≥pool survivors), index fixed-fetch. Which index strategy becomes default is decided at Atlas step 6: golden-parity gate (Gate B) + cutover #5356 from the A/B — nothing hard-defaulted here.
  • Data access: Turso via the HTTPS /v2/pipeline API with the read-only token flow (env → Bitwarden → 20h cache → turso CLI mint); the library never issues writes. Local mode against SQLite publish files: temp-view schema normalization (labels/sensitivity from the file or an attached sibling publish copy), side stores joined by content hash.
  • No atlas-proto crate in this step: the design assigns the shared protocol types to step 4 (Atlas step 4: serve mode — job protocol, worker pool, in-memory temp store #5354), where the serve protocol shapes them; the library's envelope is serde_json::Value until then.

Gate evidence

  • Unit tests (16): RRF rank decompositions reproduce known sums (0.181818 = 1/11+1/11, 0.174242 = 1/12+1/11, …), ceiling clamping, filter shapes, fetch-to-fill depths [pool…3200], Python round() parity for rendered floats.
  • Parity tests (4) against fixtures recorded from the production Python (fixtures/gen_core_fixtures.py → core-expectations.json): all 12 search envelopes and both get-chunk envelopes byte-equal; Turso branch SQL byte-for-byte across 4 filter shapes; allowed_ids / index-fill / index-fixed call sequences exact against a recording transport. The fixture corpus's canary (secret-bearing chunk holding the query's exact vector) is absent at the default ceiling and lands at vector rank 1 under a spelled-out secret-bearing ceiling.
  • Live smoke (crates/atlas-core/examples/live_smoke.rs, read-only, production corpus, scan backend): 6 of 6 diverse questions — Rust fused top-10 identical to the deployed Python CLI's:
question result
how do we back up the database MATCH [40290, 110910, 102986, 58559, 94452, 24260, 115061, 39139, 108014, 40284]
what did we decide about the Muse subscription quota pools MATCH [54313, 54785, 55011, 114946, 18559, 18890, 52908, 97501, 35014, 112809]
nixpkgs update workflow for the fleet MATCH [63806, 19035, 74241, 54060, 33918, 74253, 74208, 64266, 30830, 114264]
how does the atlas search ranking work MATCH [113954, 35707, 30763, 87079, 114248, 102780, 114003, 28331, 38921, 110649]
what happened with the cutter package build failure MATCH [108405, 88116, 100690, 103130, 84195, 99839, 92990, 1251, 66373, 84293]
explain the reflective event archive design MATCH [30074, 37474, 102920, 28247, 95231, 37932, 74000, 30076, 54682, 85821]
  • cargo test --workspace green (atlas-embed untouched), cargo clippy --workspace --all-targets 0 warnings, cargo fmt --check clean.

Notes for steps 3–4

  • The embedder's Session::run takes &mut self: AtlasEmbedder serializes queries on a mutex around ONE resident session (~1.6 GB RSS). Serve mode (Atlas step 4: serve mode — job protocol, worker pool, in-memory temp store #5354) should hold one AtlasEmbedder per process (or a small pool behind the same shape) — never an embedder per request; embedding is the serialization point, branch execution is I/O-parallel.
  • Branch execution in this step is synchronous per call; concurrency/backpressure (≤4 branch executions, 429) is serve mode's worker-pool concern, per the design.
  • dlopen of the ONNX Runtime lib needs libstdc++.so.6 + libz.so.1 on the loader path (observed with the v3 venv's libonnxruntime) — Atlas step 5: nix packaging (pkgs/atlas-search) + amd deploy #5355's nix closure must carry both; noted in the example's docs.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The search pipeline as a library, a semantics-exact port of the
production Python atlas_search.py, building on step 1's
atlas-embed (#5351):

- Filters + sensitivity ceilings (shareable < personal <
  local-only < secret-bearing; default personal; NULL never
  passes — fail-closed), enforced inside branch construction
  (filter-before-rank) on both backends.
- FTS branch + vector branch, RRF fusion k=10, pool 100/branch
  defaults; envelope rendering (flat, grouped, get-chunk)
  byte-equal to the Python's.
- All three vector backends behind the SearchBackend trait:
  exact scan (default; the production path), index fetch-to-fill
  (depth doubles to a 3200 cap until the pool survives the
  filter), index fixed-fetch. The default flips only at #5356
  from A/B evidence.
- Turso over the HTTPS /v2/pipeline API, read-only token flow
  (env -> Bitwarden -> 20h cache -> turso CLI mint); the library
  never issues writes. Local mode against SQLite publish files
  with temp-view schema normalization and vector side stores
  joined by content hash (never chunk_id).
- Query embedding via atlas-embed at the library boundary:
  documents prompt-free, queries get the "query: " prefix;
  the embedder session is &mut self, so AtlasEmbedder serializes
  on a mutex — one resident session per process by design.

Verification (step gate):
- 16 unit tests (RRF decompositions, ceiling clamping,
  filter-before-rank, fetch-to-fill escalation vs a recording
  fake, round6/Python float parity).
- 4 parity tests against fixtures recorded from the production
  Python (gen_core_fixtures.py): all 12 search envelopes and 2
  get-chunk envelopes byte-equal, Turso branch SQL byte-for-byte,
  allowed-ids / index-fill / index-fixed call sequences exact.
- Live smoke (examples/live_smoke.rs, read-only, production
  corpus): 6 of 6 diverse questions — Rust scan-path fused
  top-10 identical to the deployed Python CLI's.
- cargo test --workspace green, clippy 0 warnings, fmt clean.
@dezren39
dezren39 requested a review from a team as a code owner November 4, 2026 09:33
@dezren39
dezren39 merged commit a65000a into main Nov 4, 2026
@dezren39
dezren39 deleted the atlas-step2-core branch November 4, 2026 09:33
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1116b294-4b86-4495-9e76-d7a0465fb254
Commits

Reviewing files that changed from the base of the PR and between e40744f and 51d29a9.

Files ignored due to path filters: 1
  • pkgs/atlas-search/Cargo.lock is excluded by !**/*.lock
Files selected for processing: 18
  • pkgs/atlas-search/Cargo.toml
  • pkgs/atlas-search/crates/atlas-core/Cargo.toml
  • pkgs/atlas-search/crates/atlas-core/examples/live_smoke.rs
  • pkgs/atlas-search/crates/atlas-core/src/backend.rs
  • pkgs/atlas-search/crates/atlas-core/src/embed.rs
  • pkgs/atlas-search/crates/atlas-core/src/error.rs
  • pkgs/atlas-search/crates/atlas-core/src/filters.rs
  • pkgs/atlas-search/crates/atlas-core/src/fusion.rs
  • pkgs/atlas-search/crates/atlas-core/src/lib.rs
  • pkgs/atlas-search/crates/atlas-core/src/local.rs
  • pkgs/atlas-search/crates/atlas-core/src/search.rs
  • pkgs/atlas-search/crates/atlas-core/src/turso.rs
  • pkgs/atlas-search/crates/atlas-core/src/types.rs
  • pkgs/atlas-search/crates/atlas-core/tests/parity.rs
  • pkgs/atlas-search/fixtures/core-expectations.json
  • pkgs/atlas-search/fixtures/fixture_corpus.sql
  • pkgs/atlas-search/fixtures/fixture_spec.json
  • pkgs/atlas-search/fixtures/gen_core_fixtures.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T09:34:29.224353Z 51d29a9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant