fix: set original_uuid in ErrorObject when batch send raises exception - #1978
fix: set original_uuid in ErrorObject when batch send raises exception#1978rayensamali wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
|
I have read the CLA Document and I hereby sign the CLA |
# Conflicts: # test/collection/test_batch.py
Set the default in ErrorObject itself rather than at each call site. original_uuid is derivable from object_.uuid at every producer, so a __post_init__ default closes all of them at once: the client-side batching exception path in base.py, plus the server-side batching paths in sync.py and async_.py, which both returned None and are what batch.stream() and data.ingest() use. It also normalises the type. BatchObject.uuid is a str when the caller supplied a UUID but a uuid.UUID when it was generated, so passing it through unchanged made original_uuid's type depend on the failure mode. str() at the single default makes it always a string, matching what grpc_batch.py already produced. Drop the two unit tests that constructed ErrorObject directly and asserted the dataclass kept the kwarg they passed it; they pass with the fix reverted. Assert on original_uuid in the three existing mock tests that already drive the real batching paths instead. Fixes weaviate#942 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sdBfKxiEgEUn1fnWgjYnk
There was a problem hiding this comment.
🟡 Changes recommended
Explicit UUID values are not normalized to strings despite the new API guarantee.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Ensures failed batch objects retain their submitted UUID across batching modes.
Changes:
- Adds fallback UUID population to
ErrorObject. - Adds timeout and streaming regression coverage.
- Documents the corrected behavior.
File summaries
| File | Description |
|---|---|
weaviate/collections/classes/batch.py |
Populates and documents original_uuid. |
mock_tests/test_timeouts.py |
Tests timeout failures. |
mock_tests/test_batch.py |
Tests streaming failures. |
docs/changelog.rst |
Records the fix. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def __post_init__(self) -> None: | ||
| if self.original_uuid is None: | ||
| self.original_uuid = str(self.object_.uuid) |
Fixes #942
When an unexpected exception is raised during batch send,
ErrorObjectwascreated without
original_uuid, leaving it asNoneeven when the sourceobject had a UUID. This fix passes
original_uuid=obj.uuidin the exceptionhandler in
base.py, consistent with how it is set ingrpc_batch.py.Added unit tests in test/collection/test_batch.py to verify original_uuid is preserved.