Skip to content

feat(atlas): source-boundary-safe embed splitting (#12403) - #12625

Merged
dezren39 merged 2 commits into
mainfrom
xaltha/atlas-boundary-chunks-12403
Nov 22, 2026
Merged

dezren39 merged 2 commits into
mainfrom
xaltha/atlas-boundary-chunks-12403

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Slice 1 of #12403: the splitting primitive. New pure module
atlas_core::boundary (pkgs/atlas-search/crates/atlas-core/src/boundary.rs)
with split_by_boundaries(source, segments):

  • Chunks carry exact byte offsets and effective sensitivity, never cross
    a declared classification boundary, and never duplicate text across
    one as overlap.
  • Gaps (undeclared text), overlapping declarations, and uncertain
    segments fail closed to one secret-bearing chunk marked uncertain.
  • Chunks always partition the source exactly, so a boundary revision
    changes only the chunks it overlaps — every other chunk keeps its
    exact byte range and text, so its classification and vector stay
    valid (design §3, research(atlas): boundary-drift measurement — how much a paragraph's vector/rank moves with different embedding neighbors #6038).
  • Fixture tests: transcript turns, embedded secret, code/log units,
    only-affected-chunks-change on boundary revision. Proptests (256
    cases each): exact partition, no-crossing, fail-closed,
    order-independence. The record-composition test checks the split
    against the feat(atlas): add per-embed classification records #12408 per-embed record API.

Acceptance status against #12403:

  • Chunk/embed boundaries never cross known source-native
    classification boundaries; overlap does not copy text across them.
  • Uncertain or unisolatable mixed content is handled at the most
    restrictive classification.
  • Fixture tests cover transcript turns, project text with embedded
    secret, and source-native code/log boundaries; unchanged embeds
    retain vectors and decisions (split-level; staging still to wire).
  • Classification attaches to exact offsets/embed IDs and content
    or boundary changes invalidate only affected classifications —
    split side done; staging (stage) and promotion (aggregate)
    wiring is the next slice, not this one.

Refs #12403 (does not close it: staging/promotion wiring remains).

Evidence

Ran on the laptop at 4257477777 (branch
xaltha/atlas-boundary-chunks-12403, base 16ffdfdf), via
fleet-build-lock:

cd pkgs/atlas-search && cargo test -p atlas-core --lib boundary
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 147 filtered out

Before the fix commit, the no-crossing proptest failed on a
degenerate empty declaration (proptest minimal input: source
" a ", segments [(0,4,Shareable,true),(3,3,Shareable,false)]);
an empty declaration covers no bytes and creates no boundary, so the
oracle now quantifies only over segments covering at least one byte
(commit 4257477777).

git diff --check clean. New module only plus one pub mod line;
no behaviour change to any existing path (staging keeps its current
behaviour until the wiring slice).

Merge Danger

Low. Additive only: one new module exercised by its own tests, one
pub mod boundary; line in lib.rs. No existing function, schema,
or test changed. Revertible without breaking anything that was there
before.

Next slice: wire declared boundaries into staging (stage) and
promotion (aggregate) so embeds are produced from boundary-safe
chunks with per-embed records.


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

New pure module atlas_core::boundary with split_by_boundaries: chunks
carry exact byte offsets and effective sensitivity, never cross a
declared classification boundary, never duplicate text across one as
overlap, and fail closed to secret-bearing (marked uncertain) for gaps,
overlapping declarations, and uncertain segments. Fixture tests cover
transcript turns, embedded secrets, code/log units, and
only-affected-chunks-change on boundary revision; proptests cover
exact partition, no-crossing, fail-closed, and order-independence.
Record composition is checked against the #12408 per-embed record API.

Staging/promotion wiring is the next slice, not this one.

Refs #12403
An empty classification segment covers no bytes and creates no
boundary (the splitter drops it), but the proptest oracle treated
its single point as straddled by any chunk containing it:
source "  a ", segments [(0,4,Shareable,true),(3,3,Shareable,false)]
failed no_chunk_crosses_a_declared_segment_edge. Quantify only over
segments covering at least one byte.
@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 16:23
@coderabbitai

coderabbitai Bot commented Nov 22, 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 7 seconds.

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: 27932607-a13f-43a7-a4ae-5f758cbe751e
Commits

Reviewing files that changed from the base of the PR and between 6605f71 and 4257477.

Files selected for processing: 2

  • pkgs/atlas-search/crates/atlas-core/src/boundary.rs
  • pkgs/atlas-search/crates/atlas-core/src/lib.rs
  • 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 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T16:26:04.323711Z 4257477 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4257477777

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +124 to +125
let snapped_start = floor_char_boundary(source, start);
let snapped_end = ceil_char_boundary(source, end);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drop empty segments before snapping UTF-8 boundaries

When a zero-width declaration falls inside a multibyte character, snapping its edges outward turns it into a nonempty segment before the empty-range filter runs. For example, source "aéb" with a certain shareable segment 0..4 and an empty personal segment 2..2 produces three chunks, marking é secret-bearing and uncertain. This contradicts the documented behavior that empty declarations cover no bytes and create no boundary, and unnecessarily invalidates an otherwise unchanged chunk and its classification. Drop empty ranges before expanding their edges.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@/tmp/thread-reply-12625.md

@dezren39
dezren39 merged commit d5bfa05 into main Nov 22, 2026
2 checks passed
@dezren39
dezren39 deleted the xaltha/atlas-boundary-chunks-12403 branch November 22, 2026 16:44
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant