Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/atlas-search/book/concepts/embeddings.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The corpus was embedded by a Python pipeline. If the Rust embedder produced vect

The reference is a fixture file, `fixtures/embed-probes.json`: 11 probes covering ordinary prose, a query-prefixed probe, a single character, Japanese text, an empty input, three real corpus chunks referenced by chunk id only, and a long probe past 512 tokens that exists specifically to catch the tokenizer truncation trap. The fixture records its own provenance: the model and revision above, the ONNX and tokenizer file hashes, ONNX Runtime 1.31.1, and the thread counts.

Gate A is version-matched, and this qualification is load-bearing. The gate reads the runtime version from the loaded library's versioned name and refuses to render a verdict against a different runtime version: it fails as NOT APPLICABLE rather than reporting a parity failure or a pass. A different runtime build — the Nix closure's 1.27.1 is the recorded example — produces deltas around 1e-7 on most components of every probe. That is numerical noise between builds of the same library, but Gate A grants no tolerance, so the honest answer against the wrong runtime is "not measured", not "close enough". The gate test is accordingly ignored in ordinary CI, which lacks the pinned snapshot and runtime; it runs where `ATLAS_MODEL_DIR` and `ATLAS_ORT_LIB` point at the pinned pair.
Gate A is version-matched, and this qualification is load-bearing. The gate reads the runtime version from the loaded library's versioned name and refuses to render a verdict against a different runtime version: it fails as NOT APPLICABLE rather than reporting a parity failure or a pass. A different runtime build — nixpkgs' 1.27.1 is the recorded example; the packaged Nix closure itself carries the vendored 1.31.1 — produces deltas around 1e-7 on most components of every probe. That is numerical noise between builds of the same library, but Gate A grants no tolerance, so the honest answer against the wrong runtime is "not measured", not "close enough". The gate test is accordingly ignored in ordinary CI, which lacks the pinned snapshot and runtime; it runs where `ATLAS_MODEL_DIR` and `ATLAS_ORT_LIB` point at the pinned pair.

One recorded curiosity belongs here because a future maintainer will otherwise "fix" it: the tokenizer's own configuration declares pad token id 1, and one neighbouring implementation pads with 1. The corpus pipeline pads with 0, so atlas-embed hard-codes pad id 0. A recorded diagnostic shows the two choices are bit-identical on this fp32 graph, including on a 1,272-token chunk, because masked positions never reach the CLS row that pooling reads. The proof is about this graph; a different graph voids it.

Expand Down
15 changes: 15 additions & 0 deletions pkgs/atlas-search/crates/atlas-core/src/classification.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
//! Per-item classification records and their composition into an
//! effective classification.
//!
//! A [`ClassificationRecord`] is the persisted,
//! provenance-carrying judgement about one staged item: its
//! sensitivity on the [`Sensitivity`] ladder, an optional
//! exclusion disposition, and who decided it, when, and by what
//! method. Staging persists the records beside the item (see
//! [`crate::stage::chunk_classifications`]).
//! [`EffectiveClassification::compose`] folds an item's records
//! into the single value disclosure and search enforce — the
//! strictest sensitivity wins, and any personal-life exclusion
//! excludes — and [`crate::disclosure`] and [`crate::classify`]
//! build on these types.

use serde_json::{Map, Value as Json};

use crate::filters::Sensitivity;
Expand Down
19 changes: 14 additions & 5 deletions pkgs/atlas-search/crates/atlas-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
//!
//! Vector strategies all live behind the backend:
//! [`VectorBackend::Scan`] (exact `vector_distance_cos` over the
//! allowed set — the current production path and the default),
//! [`VectorBackend::IndexFill`] (ANN index, depth escalates
//! until the pool survives the filter), and
//! allowed set — the monolith backend's own strategy, and its
//! default), [`VectorBackend::IndexFill`] (ANN index, depth
//! escalates until the pool survives the filter), and
//! [`VectorBackend::IndexFixed`] (single fixed-depth fetch).
//! Which index strategy becomes the default is decided at the
//! #5356 cutover from A/B evidence, not here.
//! Which of the index strategies becomes the monolith backend's
//! default is decided at the #5356 cutover from A/B evidence, not
//! here. In the service composition the vector branch is already
//! served from the shard core:
//! [`ShardedBackend`](crate::shards::ShardedBackend) fans out over
//! the shards and delegates FTS, details and everything else to
//! the wrapped monolith backend (#13284).
//!
//! Concurrency note for front-ends (steps 3–4): the library is
//! synchronous; backends are `Send + Sync` behind interior
Expand Down Expand Up @@ -81,6 +86,10 @@ pub use c8_profile::{
C8Link, C8Page, C8Source, LinkEvidence, LinkKind, PageKind, UrlParts, extract_links,
sanitize_url,
};
pub use classification::{
ClassificationDisposition, ClassificationProvenance, ClassificationRecord,
EffectiveClassification,
};
pub use detect::{
DETECTION_LEDGER_SCHEMA, DetectionLedger, DetectionPass, FileStat, LandedState, LandedTable,
Mechanism, PathVerdict, PlainTreeOptions, RowDetectOptions, RowMode, RowStoreSpec,
Expand Down
6 changes: 6 additions & 0 deletions pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ impl ShardConnector for StdConnector {
/// shard in the manifest's `embedding_model` key and checked before
/// fan-out, so vectors embedded by different models are never merged
/// as if they were comparable.
///
/// This is the bare lowercase spelling of the one model; the query
/// path names the same model by its HuggingFace org/name spelling
/// ([`crate::types::DEFAULT_MODEL`]). The two strings never
/// string-equal and are compared only within their own subsystems;
/// no code converts between them (#13284).
pub const EMBEDDING_MODEL_ID: &str = "snowflake-arctic-embed-m-v2.0";

/// A shard's `atlas_manifest` (key/value self-description).
Expand Down
6 changes: 5 additions & 1 deletion pkgs/atlas-search/crates/atlas-core/src/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ pub fn user_tables(conn: &Connection) -> Result<BTreeSet<String>> {

/// Assert a database is exactly a v1 staging DB: `_schema_version = 1`
/// and the exact [`STAGE_V1_TABLES`] table set. This is the invariant
/// the schema oracle checks.
/// the schema oracle checks. One deliberate consequence: a promoted
/// unit's DB no longer satisfies it — promotion stamps a sixth
/// table (`atlas_manifest`) into the unit DB, which is what closes
/// it to further `stage_artifact` writes (see
/// [`crate::aggregate`]'s step 4; #13284).
pub fn check_stage_schema(conn: &Connection) -> Result<()> {
let version = schema_version(conn)?;
if version != STAGE_SCHEMA_VERSION {
Expand Down
7 changes: 7 additions & 0 deletions pkgs/atlas-search/crates/atlas-core/src/turso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
//! mint cache -> turso CLI mint). It never issues writes: every
//! statement this crate builds is a SELECT, and the token it holds
//! is read-only by construction of the resolution chain.
//!
//! The read-only property rests on the chain's sources, not on
//! the Turso Platform API: that API's mint endpoint ignores
//! read-only request bodies (verified 2026-10-31 — it returns
//! claim `a=rw` regardless), so minting goes through the `turso`
//! CLI, whose tokens carry `a=ro`, and the named Bitwarden
//! secrets hold CLI-minted tokens (#13284).

use std::collections::{HashMap, HashSet};
use std::io::Read;
Expand Down
8 changes: 7 additions & 1 deletion pkgs/atlas-search/crates/atlas-core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,13 @@ impl Row {
/// The production vector table (the CLI's `VEC_TABLE`).
pub const DEFAULT_VEC_TABLE: &str = "vec_snowflake_m_v2_768_f32";

/// The production embedder identity (the CLI's `MODEL`).
/// The production embedder identity (the CLI's `MODEL`): the
/// HuggingFace org/name spelling. Shard and staging manifests
/// stamp a different string for the same model —
/// [`EMBEDDING_MODEL_ID`](crate::shards::EMBEDDING_MODEL_ID), the
/// bare lowercase name — and the two spellings are compared only
/// within their own subsystems; no code converts between them
/// (#13284).
pub const DEFAULT_MODEL: &str = "Snowflake/snowflake-arctic-embed-m-v2.0";

/// How the vector branch gathers its pool. The default stays
Expand Down
11 changes: 7 additions & 4 deletions pkgs/atlas-search/crates/atlas-embed/tests/gate_a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ fn gate_a_bit_identity() {

// Version guard (code#6663): bit-identity is a version-matched
// claim. The fixtures were recorded under the provenance runtime
// (onnxruntime 1.31.1, atlas venv); the nix closure's 1.27.1
// produces ~1e-7 deltas on most components of every probe, which
// reads as a parity failure but is only a version mismatch. Fail
// loudly as NOT APPLICABLE instead of printing a parity table.
// (onnxruntime 1.31.1, atlas venv); a different runtime — e.g.
// nixpkgs' 1.27.1 — produces ~1e-7 deltas on most components of
// every probe, which reads as a parity failure but is only a
// version mismatch. (The packaged nix closure carries the
// vendored 1.31.1, code#6765, so its library passes this guard.)
// Fail loudly as NOT APPLICABLE instead of printing a parity
// table.
match loaded_ort_version(&ort_lib) {
Some(v) if v != fixture.provenance.onnxruntime_version => panic!(
"Gate A NOT APPLICABLE: fixtures were recorded under ONNX Runtime {} \
Expand Down
7 changes: 5 additions & 2 deletions pkgs/atlas-search/eval/boundary_drift_6038.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
- Original window W0 = prev + target + next (blank-line joined), the
production chunk shape.
- Perturbations per target:
* boundary_shift — drop W0's first sentence; append the first
sentence of the paragraph after `next` when one exists.
* boundary_shift — drop the first sentence of the previous
paragraph only (the target paragraph stays byte-identical and
the blank-line window shape is preserved); append the first
sentence of the paragraph after `next` to the end of `next`
when one exists.
* neighbor_replace_prev / neighbor_replace_next — replace that
neighbor with the target paragraph of another sampled message
(deterministic donor offsets +7 / +13).
Expand Down
12 changes: 7 additions & 5 deletions pkgs/atlas-search/fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ fixture alone.

Bit-identity is a **version-matched** claim (code#6663): the gate
must load the ONNX Runtime version named in the provenance
(1.31.1, the atlas venv build). A different runtime — e.g. the nix
closure's 1.27.1 — produces ~1e-7 deltas on most components of every
probe from kernel/fusion differences alone; the gate detects that
case and fails as NOT APPLICABLE rather than reporting a parity
verdict. Align the runtime or re-record the fixtures (below) —
(1.31.1, the atlas venv build). A different runtime — e.g.
nixpkgs' 1.27.1 — produces ~1e-7 deltas on most components of
every probe from kernel/fusion differences alone; the gate
detects that case and fails as NOT APPLICABLE rather than
reporting a parity verdict. (The packaged nix closure is not a
different runtime: it carries the vendored 1.31.1 build,
code#6765.) Align the runtime or re-record the fixtures (below) —
never read cross-version deltas as parity evidence.

## Regenerating
Expand Down