From 4111127df4ca84676d30e58b7e2b95fffb7b6603 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Mon, 23 Nov 2026 08:16:57 -0600 Subject: [PATCH] docs(atlas): correct the #13284 library disagreement record Eleven Atlas library-internal disagreements from the book survey (#13251), each verified first-hand against main: - types::DEFAULT_MODEL and shards::EMBEDDING_MODEL_ID now cross-name each other's spelling for the one model (point 1). - atlas-core's crate doc names the ShardedBackend composition instead of framing the monolith Scan as the production path (point 8). - classification.rs gains the module doc it was missing and its types are re-exported at the crate root like every sibling module's (point 9). - turso.rs names the basis of its read-only-by-construction claim: the Platform API cannot mint read-only tokens, the CLI mint path can (point 7). - stage::check_stage_schema names the deliberate promotion-stamp consequence of the exact table-set invariant (point 10). - The stale "nix closure's 1.27.1" example is corrected in fixtures/README.md, gate_a.rs and the embeddings book chapter: the packaged closure carries the vendored 1.31.1 (code#6765); nixpkgs' 1.27.1 is the different-runtime example (point 4). - boundary_drift_6038.py's docstring now describes the corrected boundary_shift construction its code runs (point 11). Points 2, 3, 5 and 6 are dispositioned on #13284 with evidence: already recorded accurately in the book and code docs, or owned by another issue (#10147 for the content_hash producer pin). Comment and documentation changes only; no behaviour change. --- pkgs/atlas-search/book/concepts/embeddings.md | 2 +- .../crates/atlas-core/src/classification.rs | 15 +++++++++++++++ .../atlas-search/crates/atlas-core/src/lib.rs | 19 ++++++++++++++----- .../crates/atlas-core/src/shards/mod.rs | 6 ++++++ .../crates/atlas-core/src/stage.rs | 6 +++++- .../crates/atlas-core/src/turso.rs | 7 +++++++ .../crates/atlas-core/src/types.rs | 8 +++++++- .../crates/atlas-embed/tests/gate_a.rs | 11 +++++++---- pkgs/atlas-search/eval/boundary_drift_6038.py | 7 +++++-- pkgs/atlas-search/fixtures/README.md | 12 +++++++----- 10 files changed, 74 insertions(+), 19 deletions(-) diff --git a/pkgs/atlas-search/book/concepts/embeddings.md b/pkgs/atlas-search/book/concepts/embeddings.md index 629df2a5a8..0b2f827df8 100644 --- a/pkgs/atlas-search/book/concepts/embeddings.md +++ b/pkgs/atlas-search/book/concepts/embeddings.md @@ -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. diff --git a/pkgs/atlas-search/crates/atlas-core/src/classification.rs b/pkgs/atlas-search/crates/atlas-core/src/classification.rs index 8274bdcbb9..7f72962500 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/classification.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/classification.rs @@ -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; diff --git a/pkgs/atlas-search/crates/atlas-core/src/lib.rs b/pkgs/atlas-search/crates/atlas-core/src/lib.rs index 9062d7075e..7006920074 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/lib.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/lib.rs @@ -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 @@ -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, diff --git a/pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs b/pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs index 41fdf5242c..e9240f8204 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/shards/mod.rs @@ -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). diff --git a/pkgs/atlas-search/crates/atlas-core/src/stage.rs b/pkgs/atlas-search/crates/atlas-core/src/stage.rs index 263269678c..3bcc4a9aa9 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/stage.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/stage.rs @@ -201,7 +201,11 @@ pub fn user_tables(conn: &Connection) -> Result> { /// 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 { diff --git a/pkgs/atlas-search/crates/atlas-core/src/turso.rs b/pkgs/atlas-search/crates/atlas-core/src/turso.rs index b2bfd02f76..cdba2d333f 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/turso.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/turso.rs @@ -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; diff --git a/pkgs/atlas-search/crates/atlas-core/src/types.rs b/pkgs/atlas-search/crates/atlas-core/src/types.rs index bde6e748d7..d4e4a5fe83 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/types.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/types.rs @@ -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 diff --git a/pkgs/atlas-search/crates/atlas-embed/tests/gate_a.rs b/pkgs/atlas-search/crates/atlas-embed/tests/gate_a.rs index 6ef46f0fd4..48a84a7a6f 100644 --- a/pkgs/atlas-search/crates/atlas-embed/tests/gate_a.rs +++ b/pkgs/atlas-search/crates/atlas-embed/tests/gate_a.rs @@ -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 {} \ diff --git a/pkgs/atlas-search/eval/boundary_drift_6038.py b/pkgs/atlas-search/eval/boundary_drift_6038.py index 9138a64cd0..4f6d6c0c24 100644 --- a/pkgs/atlas-search/eval/boundary_drift_6038.py +++ b/pkgs/atlas-search/eval/boundary_drift_6038.py @@ -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). diff --git a/pkgs/atlas-search/fixtures/README.md b/pkgs/atlas-search/fixtures/README.md index deeb85b32e..88951d5b9e 100644 --- a/pkgs/atlas-search/fixtures/README.md +++ b/pkgs/atlas-search/fixtures/README.md @@ -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