Skip to content

[Backport 3.0] fix: join batch insert/upsert size-mismatch error message into a string (#3957) - #3958

Merged
sre-ci-robot merged 1 commit into
milvus-io:3.0from
pymilvus-bot:backport-3957-to-3.0-1795771335-13088
Nov 27, 2026
Merged

sre-ci-robot merged 1 commit into
milvus-io:3.0from
pymilvus-bot:backport-3957-to-3.0-1795771335-13088

Conversation

@pymilvus-bot

Copy link
Copy Markdown
Collaborator

Backport of #3957 to 3.0.

…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>
@mergify

mergify Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@XuanYang-cn XuanYang-cn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@sre-ci-robot

Copy link
Copy Markdown

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.87%. Comparing base (3a7b97e) to head (ad81204).
⚠️ Report is 1 commits behind head on 3.0.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify Bot added the ci-passed label Nov 27, 2026
@sre-ci-robot
sre-ci-robot merged commit 60ff1ae into milvus-io:3.0 Nov 27, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants