Repository navigation
[Backport 3.0] fix: join batch insert/upsert size-mismatch error message into a string (#3957) - #3958
Merged
sre-ci-robot merged 1 commit intoNov 27, 2026
Conversation
…ng (milvus-io#3957) ## Summary Fixes milvus-io#3843. `Prepare._parse_batch_request` (used by `batch_insert_param` and `batch_upsert_param`) raised a `ParamError` whose `message` was built from three f-strings separated by commas: ```python raise ParamError( message=( f"Field data size misaligned for field [{entity.get('name')}] ", f"got size=[{latest_field_size}] ", f"alignment size=[{pre_field_size}]", ) ) ``` Because of the commas, this is a 3-tuple literal, not implicit string concatenation, so `message` ended up a `tuple` instead of a `str`: ``` ParamError: (code=1, message=('Field data size misaligned for field [b] ', 'got size=[2] ', 'alignment size=[3]')) ``` Removed the commas so the adjacent f-strings concatenate into a single string: ``` ParamError: (code=1, message=Field data size misaligned for field [vector] got size=[2] alignment size=[3]) ``` The existing test for this path (`test_field_size_mismatch`) only asserted `pytest.raises(ParamError, match="misaligned")`, which matches against `str(exception)` and passed even with the tuple bug — that's why it went unnoticed. Strengthened it to assert `message` is a `str` with the exact expected text, so this can't silently regress. ## Validation - `pytest tests/unit/prepare/test_data.py -v -k field_size_mismatch`: passes with the new string-equality assertion. - `pytest tests/unit -q`: 5987 passed, 2 skipped, 4 failed — the 4 failures are pre-existing and unrelated (Windows symlink-permission tests in `test_volume_upload_policy.py` and a git-metadata check in `test_check.py`), reproducible on `master` before this change. - `black pymilvus tests --check --diff` and `ruff check pymilvus tests`: both clean on the changed files. Signed-off-by: Ayush <ayushkc078@gmail.com> (cherry picked from commit dad5283) Signed-off-by: pymilvus-bot <pymilvus-bot@users.noreply.github.com>
|
This pull request is merged. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pymilvus-bot, XuanYang-cn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.0 #3958 +/- ##
=======================================
Coverage 94.87% 94.87%
=======================================
Files 81 81
Lines 17417 17417
=======================================
Hits 16524 16524
Misses 893 893 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #3957 to
3.0.