Skip to content

feat(atlas-core): cold shard compaction — successor re-pack on partial retirement (#8231) - #17160

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
0407r/8231-shard-compaction
Nov 30, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
0407r/8231-shard-compaction

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Implements #8231 (Atlas cold tier, #6042 follow-on 5): shard compaction per design §8 of doc/2026-11-10T20-06-24Z_design_atlas_cold_tier_shard_format/.

What

Adds compact_shard to pkgs/atlas-search/crates/atlas-core/src/cold_shard.rs, driven by the #6041 retention engine's retirement output for one shard:

  • Partial retirement → successor shard: survivors are re-packed under the §4 rules via the existing pack writer with a new shard_id; the source object is verified and read, never edited in place.
  • Whole-shard retirement → no successor (CompactionOutcome::WholeShardRetired): the caller deletes the object and its cold-catalog row; retired versions are named in the outcome so their hot tombstones (design(atlas): content versioning + retention — versions, rename lineage, newest-resolution, cold rollout, deletion triggers #6026 §4.4) can be confirmed.
  • Only spans still referenced by a surviving version's occurrence list are carried over, and only vectors for those spans; a span shared with a survivor is retained.
  • Retention state carries over (cold_since, retire_not_before unchanged — compaction must not extend a version's path to retirement); the successor's retention trigger wraps the pack trigger with the compaction record (source shard, run id, retired set).
  • Naming a version the shard does not hold, or an empty retirement set, is a Packing error — never a silent no-op.

Tests (oracle: design §8 + the #8231 acceptance)

Four new tests in the writer's suite, all on the shared §7 sample corpus:

  • compaction_partial_retirement_successor_roundtrips — retire (7,1); successor holds exactly the survivors, every survivor reconstructs byte-identically and matches its content hash, the retired-only span and its vector are dropped, the shared span is retained, retention fields unchanged.
  • compaction_whole_shard_retired_has_no_successor.
  • compaction_rejects_unknown_and_empty_retirement.
  • compaction_zstd_successor_roundtrips — same acceptance under the zstd span codec.

Verification: cargo test for atlas-core on this branch via the remote route (run id recorded on #8231); merge on the lane's own read of the diff + that evidence (CI is not a gate).

Lane: 0407-R (charlie ADVANCE 2026-11-30, programmes atlas/id).


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

@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: ba67b45e-7d29-48f9-ae2b-4cd7e5068245

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

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.

0 participants