Skip to content

fix(local): keep cosine re-upserts idempotent - #1453

Open
DeepanshuPal wants to merge 1 commit into
qdrant:devfrom
DeepanshuPal:fix/cosine-upsert-idempotence
Open

DeepanshuPal wants to merge 1 commit into
qdrant:devfrom
DeepanshuPal:fix/cosine-upsert-idempotence

Conversation

@DeepanshuPal

Copy link
Copy Markdown

Fixes #1411. Local inserts normalize after converting dense vectors to float32, but updates normalized the original Python values before storage. Converting updates first keeps repeated cosine upserts stable and matches the insert path. Tests: python -m pytest qdrant_client/local/tests/test_vectors.py tests/test_in_memory.py -q (9 passed); ruff check qdrant_client/local/local_collection.py tests/test_in_memory.py.

@netlify

netlify Bot commented Sep 19, 2026

Copy link
Copy Markdown

Deploy Preview for poetic-froyo-8baba7 ready!

Name Link
🔨 Latest commit baf0bea
🔍 Latest deploy log https://app.netlify.com/projects/poetic-froyo-8baba7/deploys/6aae29af73a8bc00082e09f5
😎 Deploy Preview https://deploy-preview-1453--poetic-froyo-8baba7.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c7311153-09f5-4159-84c0-ffd6c25c1dde

📥 Commits

Reviewing files that changed from the base of the PR and between 589a87a and baf0bea.

📒 Files selected for processing (2)
  • qdrant_client/local/local_collection.py
  • tests/test_in_memory.py

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The local _update_point path now converts dense vectors to float32 before cosine normalization and storage. This aligns updated vectors with the existing add and named-vector paths. A new in-memory test verifies that re-upserting an identical cosine vector returns the same stored vector.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: joein

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. 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 clearly summarizes the main change: fixing idempotent cosine vector re-upserts in local mode.
Description check ✅ Passed The description directly explains the float32 conversion fix, its purpose, linked issue, and validation results.
Linked Issues check ✅ Passed The changes satisfy #1411. _update_point now converts dense vectors to np.float32 before cosine normalization and storage. This matches the insert path. The new `test_reupserting_identical_cosine_…
Out of Scope Changes check ✅ Passed The reviewed changes are limited to the local dense-vector update path and a focused in-memory regression test. Both changes directly support #1411 and its precision-alignment requirements. No unrelat…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

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