Skip to content

Split IdTracker trait into IdTrackerRead and IdTracker - #8826

Merged
generall merged 1 commit into
devfrom
split-id-tracker-read-trait
Apr 29, 2026
Merged

generall merged 1 commit into
devfrom
split-id-tracker-read-trait

Conversation

@generall

Copy link
Copy Markdown
Member

Summary

  • Split the IdTracker trait so read-only methods live on a new IdTrackerRead trait, with the mutating IdTracker trait extending it.
  • Updated impl blocks for IdTrackerEnum, ImmutableIdTracker, InMemoryIdTracker, and MutableIdTracker accordingly.
  • Updated all call sites across segment/collection (libs, tests, benches) to import IdTrackerRead where read methods are used; dropped now-unused IdTracker imports.

Test plan

  • cargo clippy --workspace --all-targets passes clean
  • cargo +nightly fmt --all -- --check passes
  • CI green

🤖 Generated with Claude Code

Read-only methods now live on a separate IdTrackerRead trait, with the
mutating IdTracker trait extending it. This lets read-only call sites
depend only on the read API.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@generall
generall requested a review from xzfc April 28, 2026 14:21
@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef1ff317-0874-49b7-aeac-2b7b0f273b48

📥 Commits

Reviewing files that changed from the base of the PR and between 31e7334 and 4da6b74.

📒 Files selected for processing (39)
  • lib/collection/src/collection_manager/optimizers/vacuum_optimizer.rs
  • lib/segment/benches/hnsw_incremental_build.rs
  • lib/segment/benches/vector_search.rs
  • lib/segment/src/id_tracker/id_tracker_base/mod.rs
  • lib/segment/src/id_tracker/id_tracker_base/tracker_enum.rs
  • lib/segment/src/id_tracker/id_tracker_base/trait_def.rs
  • lib/segment/src/id_tracker/immutable_id_tracker.rs
  • lib/segment/src/id_tracker/in_memory_id_tracker.rs
  • lib/segment/src/id_tracker/mutable_id_tracker/mod.rs
  • lib/segment/src/id_tracker/mutable_id_tracker/tests.rs
  • lib/segment/src/index/field_index/index_selector.rs
  • lib/segment/src/index/hnsw_index/hnsw.rs
  • lib/segment/src/index/plain_payload_index.rs
  • lib/segment/src/index/plain_vector_index.rs
  • lib/segment/src/index/query_optimization/condition_converter.rs
  • lib/segment/src/index/sparse_index/sparse_vector_index.rs
  • lib/segment/src/index/struct_payload_index.rs
  • lib/segment/src/payload_storage/query_checker.rs
  • lib/segment/src/segment/entry.rs
  • lib/segment/src/segment/facet.rs
  • lib/segment/src/segment/order_by.rs
  • lib/segment/src/segment/sampling.rs
  • lib/segment/src/segment/scroll.rs
  • lib/segment/src/segment/search.rs
  • lib/segment/src/segment/segment_ops.rs
  • lib/segment/src/segment/vector_name_ops.rs
  • lib/segment/src/segment/vectors.rs
  • lib/segment/src/segment_constructor/segment_builder.rs
  • lib/segment/src/segment_constructor/segment_constructor_base.rs
  • lib/segment/src/vector_storage/dense/dense_vector_storage.rs
  • lib/segment/src/vector_storage/tests/async_raw_scorer.rs
  • lib/segment/src/vector_storage/tests/custom_query_scorer_equivalency.rs
  • lib/segment/src/vector_storage/tests/test_appendable_dense_vector_storage.rs
  • lib/segment/src/vector_storage/tests/test_appendable_multi_dense_vector_storage.rs
  • lib/segment/src/vector_storage/tests/test_appendable_sparse_vector_storage.rs
  • lib/segment/tests/integration/multivector_hnsw_test.rs
  • lib/segment/tests/integration/payload_index_test.rs
  • lib/segment/tests/integration/segment_builder_test.rs
  • lib/segment/tests/integration/sparse_vector_index_search_tests.rs

📝 Walkthrough

Walkthrough

This PR refactors the IdTracker trait API by introducing a new IdTrackerRead trait that contains read-only methods (point_mappings, internal_version, internal_id, external_id). The IdTracker trait is updated to extend IdTrackerRead and retains only mutable operations. All concrete implementations (IdTrackerEnum, ImmutableIdTracker, InMemoryIdTracker, MutableIdTracker) are restructured to implement both traits with appropriate method groupings. The IdTrackerRead trait is re-exported from the id_tracker_base module. Approximately 40+ downstream files are updated to import IdTrackerRead instead of or alongside IdTracker based on their actual usage patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

release:1.17.2

Suggested reviewers

  • xzfc
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Split IdTracker trait into IdTrackerRead and IdTracker' clearly and concisely describes the main change in the changeset—the refactoring of the IdTracker trait.
Description check ✅ Passed The description provides a clear summary of the changes, including the trait split, updated implementations, and updated call sites, along with a test plan.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch split-id-tracker-read-trait

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

Comment on lines +97 to +101
fn files(&self) -> Vec<PathBuf>;

fn immutable_files(&self) -> Vec<PathBuf> {
Vec::new()
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps files/immutable_files also can be in IdTrackerRead.

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.

I am not sure yet, will decide later

@generall
generall merged commit c1597ac into dev Apr 29, 2026
20 of 21 checks passed
@generall
generall deleted the split-id-tracker-read-trait branch April 29, 2026 07:20
timvisee pushed a commit that referenced this pull request May 8, 2026
Read-only methods now live on a separate IdTrackerRead trait, with the
mutating IdTracker trait extending it. This lets read-only call sites
depend only on the read API.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 21, 2026
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.

2 participants