Skip to content

Split SegmentEntry into appendable and non-appendable part - #8047

Merged
generall merged 4 commits into
devfrom
read-only-segments
Feb 5, 2026
Merged

generall merged 4 commits into
devfrom
read-only-segments

Conversation

@monoid

@monoid monoid commented Feb 3, 2026 •

Copy link
Copy Markdown
Contributor

Add NonAppendableSegmentEntry for operations that can be applied to non-appendable segments, and make the SegmentEntry its subtrait.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@monoid monoid self-assigned this Feb 3, 2026
@monoid
monoid marked this pull request as ready for review February 3, 2026 14:07
@coderabbitai

coderabbitai Bot commented Feb 3, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR splits the previous single SegmentEntry trait into an immutable base trait NonAppendableSegmentEntry (read-only accessors, search/rescore APIs, versioning, point_version, is_proxy) and a mutable extension trait SegmentEntry (reintroduces mutating methods). Implementations were reorganized to implement NonAppendableSegmentEntry for read paths and SegmentEntry for mutating surfaces; many call sites, locks, and tests were updated to accept or import NonAppendableSegmentEntry. Public re-exports were updated to expose both traits. No algorithmic control-flow changes are introduced beyond the API/trait surface reorganization.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • timvisee
  • agourlay
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: introducing NonAppendableSegmentEntry and restructuring SegmentEntry as a subtrait for appendable operations.
Description check ✅ Passed The description clearly explains the feature submission, confirms testing and code quality standards were followed, and relates directly to the changeset modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch read-only-segments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@monoid
monoid force-pushed the read-only-segments branch from 51d9311 to 4493f63 Compare February 3, 2026 15:28
Add `ImmutableSegmentEntry` for operations that can be applied to
immutable segments, and make the `SegmentEntry` as it subtrait.
@monoid
monoid force-pushed the read-only-segments branch from 4493f63 to 4de0281 Compare February 3, 2026 16:42
It differs semantically from `ImmutableSegmentEntry` by allowing point
deletion.  Move point deletion to the trait too.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@lib/segment/src/segment/entry.rs`:
- Around line 39-40: Update the doc comment that references the old trait name
"ImmutableSegmentEntry" to use the current trait name
"NonAppendableSegmentEntry" so the comment matches the code; search for
occurrences of ImmutableSegmentEntry in the comment block above the
implementation (the doc that begins "This is a basic implementation of
`ImmutableSegmentEntry`") and replace them with `NonAppendableSegmentEntry`,
keeping the rest of the text intact and preserving backticks/formatting.

Comment thread lib/segment/src/segment/entry.rs Outdated
Comment on lines +39 to +40
/// This is a basic implementation of `ImmutableSegmentEntry`, meaning that it implements the _actual_ operations with data and
/// not any kind of proxy or wrapping.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update doc comment to the new trait name.
It still says ImmutableSegmentEntry, but the trait is now NonAppendableSegmentEntry.

Suggested fix
-/// This is a basic implementation of `ImmutableSegmentEntry`, meaning that it implements the _actual_ operations with data and
+/// This is a basic implementation of `NonAppendableSegmentEntry`, meaning that it implements the _actual_ operations with data and
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// This is a basic implementation of `ImmutableSegmentEntry`, meaning that it implements the _actual_ operations with data and
/// not any kind of proxy or wrapping.
/// This is a basic implementation of `NonAppendableSegmentEntry`, meaning that it implements the _actual_ operations with data and
/// not any kind of proxy or wrapping.
🤖 Prompt for AI Agents
In `@lib/segment/src/segment/entry.rs` around lines 39 - 40, Update the doc
comment that references the old trait name "ImmutableSegmentEntry" to use the
current trait name "NonAppendableSegmentEntry" so the comment matches the code;
search for occurrences of ImmutableSegmentEntry in the comment block above the
implementation (the doc that begins "This is a basic implementation of
`ImmutableSegmentEntry`") and replace them with `NonAppendableSegmentEntry`,
keeping the rest of the text intact and preserving backticks/formatting.

@timvisee timvisee changed the title Split SegmentEntry into mutable and immutable part Split SegmentEntry into appendable and non-appendable part Feb 4, 2026
@generall
generall merged commit 5679912 into dev Feb 5, 2026
16 of 19 checks passed
@generall
generall deleted the read-only-segments branch February 5, 2026 14:47
generall added a commit that referenced this pull request Feb 9, 2026
* Split `SegmentEntry`

Add `ImmutableSegmentEntry` for operations that can be applied to
immutable segments, and make the `SegmentEntry` as it subtrait.

* Rename to `NonAppendableSegmentEntry`

It differs semantically from `ImmutableSegmentEntry` by allowing point
deletion.  Move point deletion to the trait too.

* Fix docstring

* use NonAppendableSegmentEntry where possible

---------

Co-authored-by: Andrey Vasnetsov <[email protected]>
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* Split `SegmentEntry`

Add `ImmutableSegmentEntry` for operations that can be applied to
immutable segments, and make the `SegmentEntry` as it subtrait.

* Rename to `NonAppendableSegmentEntry`

It differs semantically from `ImmutableSegmentEntry` by allowing point
deletion.  Move point deletion to the trait too.

* Fix docstring

* use NonAppendableSegmentEntry where possible

---------

Co-authored-by: Andrey Vasnetsov <[email protected]>
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.

3 participants