Skip to content

fix(weaviate): delete vectors by document ID#39176

Open
yuya2017 wants to merge 1 commit into
langgenius:mainfrom
yuya2017:agent/fix-weaviate-document-id-deletion
Open

fix(weaviate): delete vectors by document ID#39176
yuya2017 wants to merge 1 commit into
langgenius:mainfrom
yuya2017:agent/fix-weaviate-document-id-deletion

Conversation

@yuya2017

@yuya2017 yuya2017 commented Jul 17, 2026

Copy link
Copy Markdown

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Fixes #39175

GitHub did not allow the external issue author to self-assign #39175, so maintainer assignment is still needed.

This PR fixes an identity mismatch in the Weaviate adapter:

  • New objects now inherit BaseVector._get_uuids() and use the segment doc_id instead of a UUID derived only from page_content.
  • delete_by_ids() deletes by the stored doc_id property instead of treating logical segment IDs as Weaviate object UUIDs.
  • Property-based deletion also removes legacy objects whose UUIDs were derived from content.
  • Regression coverage verifies deletion and prevents identical text from overwriting segments with different IDs.

This also addresses the storage collision described in #36137. Unlike the existing proposal in #36140, it aligns Weaviate with the shared BaseVector identity contract and fixes deletion of both new and legacy objects.

Screenshots

Not applicable; this is a backend vector-store fix.

Validation

  • make test TARGET_TESTS=./api/providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py — 40 passed.
  • Targeted ruff format --check and ruff check for the three changed files — passed.
  • The Weaviate integration test was attempted against an existing local stack, but that stack does not expose gRPC port 50051; the run timed out during batch insertion. The temporary test collection was removed. The regression assertion is included for CI's Docker-backed Weaviate test environment.
  • Targeted Pyrefly reported four existing errors in unchanged lines of weaviate_vector.py; no error points to this diff.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

@yuya2017
yuya2017 marked this pull request as ready for review July 17, 2026 06:11
@yuya2017
yuya2017 requested a review from QuantumGhost as a code owner July 17, 2026 06:11
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Disabled Weaviate document vectors are not deleted by segment ID

1 participant