Skip to content

feat(atlas-search): resolve chunk occurrences by canonical hash (#3125 slice 3) - #13450

Merged
dezren39 merged 2 commits into
mainfrom
code-f/3125-provenance-slice-3
Nov 23, 2026
Merged

dezren39 merged 2 commits into
mainfrom
code-f/3125-provenance-slice-3

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Read side of the chunk_occurrences provenance registry that slice 2 (#13216, aggregate.rs) writes: lookup_by_hash fans out over the scan shards the caller's TierCeiling admits, keyed by canonical SHA-256 content hash (not per-shard chunk id). get-chunk attaches the resolved rows as an occurrences array (absent when empty, same shape rule as notes). Monolith/local backends keep their shape via the trait default (empty).

Moves #3125 rule 3 one step: registry rows become readable through get-chunk.

Evidence

  • cargo test -p atlas-core --test occurrences: 4 passed (lookup fan-out + legacy-skip, get-chunk surfacing, ceiling gating, per-row sensitivity) — includes occurrence_rows_are_filtered_by_their_own_chunk_sensitivity_not_just_shard_tier
  • cargo test -p atlas-core --test disclosure: 19 passed — includes get_chunk_occurrence_lookup_uses_the_effective_ceiling
  • cargo test -p atlas-core --test aggregate --test occurrences --test disclosure --lib: 169 lib + 4 + 19 + 7 passed
  • cargo test -p atlas-search: 43 passed
  • Failing-first: both new tests fail on the pre-fix code (restored temporarily from a backup, then reverted), pass after
  • Oracle: SHA-256 of fixture text ecead345a7a4b99b26d42d2e839838ee261516fe54136d287847852a0ffe4f9f; fixtures assert lookup returns every admitted shard row for that hash
  • Tier policy: shard fan-out via set.select (same ladder as vector fan-out); each occurrence row further gated by its own chunk sensitivity against the caller ceiling (fail-closed to SecretBearing on unknown labels); pre-registry shards skipped, real shard errors fail

Review fixes (Codex P1s)

Both Codex P1 findings addressed in 2ec9a09d444:

  • Caller ceiling into occurrence resolution — run_get_chunk_with_context takes grant: Sensitivity; the explicit-id chunk gate keeps its documented form (context.permits under LocalOwner, Python parity), while derived payloads (occurrence provenance, neighbor expansion) use context.effective_ceiling(grant). Server passes the job ceiling, CLI passes context.ceiling().
  • Per-referenced-chunk sensitivity — lookup_by_hash joins chunk_occurrences to chunks and filters each row by c.sensitivity against the caller ceiling; both the tier ceiling and the full Sensitivity ceiling are threaded through the trait, Box<T> impl and ShardedBackend.

Merge Danger

Low. Additive: one new module (occurrences.rs), one trait method with a default (empty), one ShardedBackend override, one optional get-chunk field. No schema change, no migration. Risk: a slow/failing shard now fails the get-chunk occurrences lookup the same way it fails vector search — intended (partial provenance is as wrong as partial search).

Closes part of #3125

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-23T16:27:55Z",
    "session_id": "ses_e5df6d41c99ffecEDTR9A7JlCT",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/code-worktrees/3125-s3",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/code-worktrees/3125-s3",
      "repo": "developing-today/code",
      "branch": "code-f/3125-provenance-slice-3",
      "sha": "8001f3222d1c7359298ede6508bebce3af5f4c91"
    },
    "auth_subject": "oc-code-07",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

…slice 3)

Read side of the chunk_occurrences provenance registry slice 2
(aggregate.rs) writes: lookup_by_hash fans out over the shards the
caller's TierCeiling admits, keyed by canonical SHA-256 (content
identity, not per-shard chunk id). Pre-registry shards are skipped;
real shard errors fail the lookup. get-chunk attaches the resolved
rows as an occurrences array (absent when empty, like notes);
monolith/local backends keep their shape via the trait default.

Closes part of #3125
@coderabbitai

coderabbitai Bot commented Nov 23, 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 3 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: 26d2c85a-b792-43d6-9433-1253a4db8ea6
Commits

Reviewing files that changed from the base of the PR and between b25edb1 and 2ec9a09.

Files selected for processing: 9

  • pkgs/atlas-search/crates/atlas-core/src/backend.rs
  • pkgs/atlas-search/crates/atlas-core/src/lib.rs
  • pkgs/atlas-search/crates/atlas-core/src/occurrences.rs
  • pkgs/atlas-search/crates/atlas-core/src/search.rs
  • pkgs/atlas-search/crates/atlas-core/src/shards/scan.rs
  • pkgs/atlas-search/crates/atlas-core/tests/disclosure.rs
  • pkgs/atlas-search/crates/atlas-core/tests/occurrences.rs
  • pkgs/atlas-search/crates/atlas-search/src/main.rs
  • pkgs/atlas-search/crates/atlas-search/src/server.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 23, 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-23T16:31:17.188816Z 8001f32 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: 8001f3222d

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

…row sensitivity (#3125 slice 3)

Addresses both Codex P1 findings on #13450.

P1-1 (grant ignored on occurrence provenance): get-chunk stays an
explicit-id tool — the chunk gate remains context.permits(...) under
LocalOwner, preserving the documented Python parity — while the
caller's Sensitivity is now threaded through
run_get_chunk_with_context as `grant`. Every derived payload
(occurrence provenance, neighbor expansion) uses
context.effective_ceiling(grant), so a personal-capped caller no
longer receives secret-tier source locators, and a personal-only
service no longer requests a secret-tier fan-out.

P1-2 (occurrence rows only shard-tier filtered): lookup_by_hash now
joins chunk_occurrences to chunks and checks each row's own
sensitivity against the caller ceiling, fail-closed to
SecretBearing on an unrecognized label. personal and local-only both
map to Tier::Internal, so the per-row check is what actually
separates them inside one admitted shard.

Tests (failing before the fix, green after):
- occurrence_rows_are_filtered_by_their_own_chunk_sensitivity_not_just_shard_tier
- get_chunk_occurrence_lookup_uses_the_effective_ceiling
@dezren39
dezren39 merged commit 7e7af3f into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the code-f/3125-provenance-slice-3 branch November 23, 2026 20:52
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