Skip to content

Fix brute force Rust index dataset lifetime#2083

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
yan-zaretskiy:fix-brute-force-rust
May 14, 2026
Merged

Fix brute force Rust index dataset lifetime#2083
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
yan-zaretskiy:fix-brute-force-rust

Conversation

@yan-zaretskiy

Copy link
Copy Markdown
Contributor
  • Keep the consumed ManagedTensor alive inside brute_force::Index so the C++ side's dataset view does not point at freed device memory.
  • Remove the flaky test marker dependency.

- Keep the consumed ManagedTensor alive inside brute_force::Index so the C++ side's dataset view does not point at freed device memory.
- Remove the flaky test marker dependency.
@yan-zaretskiy yan-zaretskiy self-assigned this May 14, 2026
@yan-zaretskiy yan-zaretskiy added the bug Something isn't working label May 14, 2026
@yan-zaretskiy yan-zaretskiy requested a review from a team as a code owner May 14, 2026 16:42
@yan-zaretskiy yan-zaretskiy added non-breaking Introduces a non-breaking change Rust labels May 14, 2026
@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 611f55ee-da79-4825-9a9b-b49103d50c84

📥 Commits

Reviewing files that changed from the base of the PR and between 86b9038 and fe13522.

📒 Files selected for processing (2)
  • rust/cuvs/Cargo.toml
  • rust/cuvs/src/brute_force.rs
💤 Files with no reviewable changes (1)
  • rust/cuvs/Cargo.toml

📝 Walkthrough

Summary by CodeRabbit

Bug Fixes

  • Fixed dataset memory management in brute-force index operations to prevent potential crashes
  • Ensured indexed datasets remain available for the lifetime of index operations

Tests

  • Stabilized previously flaky brute-force search tests for more reliable test results

Walkthrough

The PR fixes a dataset lifetime issue in the brute-force index by storing the indexed dataset within the Index struct and removes the flaky test infrastructure by converting a test from #[flaky] to a standard test.

Changes

Index Lifetime Management and Flaky Test Removal

Layer / File(s) Summary
Index struct refactoring and lifetime management
rust/cuvs/src/brute_force.rs
Index struct changes from a tuple struct to a named struct with inner field for the C++ handle and _dataset field storing an optional ManagedTensor. The build() method assigns the built index to inner and persists the input dataset in _dataset, whereas previously the dataset was dropped after build. Methods new(), search(), and Drop are updated to use the inner field instead of tuple-struct field access.
Remove flaky test infrastructure
rust/cuvs/Cargo.toml, rust/cuvs/src/brute_force.rs
mark-flaky-tests = "1" dependency is removed from Cargo.toml. The mark_flaky_tests::flaky import is removed from the test module, and the L2 search test annotation is changed from #[flaky] to #[test].

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing the lifetime management of the dataset in the brute force Rust index.
Description check ✅ Passed The description accurately relates to the changeset, explaining both the dataset lifetime fix and the removal of the flaky test marker dependency.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 unit tests (beta)
  • Create PR with unit tests

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

@cjnolet

cjnolet commented May 14, 2026

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot rapids-bot Bot merged commit a6dd904 into NVIDIA:main May 14, 2026
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change Rust

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants