Skip to content

Comments

Fix is_legal_ids() to accept negative int64 primary keys#3273

Merged
sre-ci-robot merged 3 commits intomilvus-io:masterfrom
gonzfe05:fix/negative-int64-id-validation-3272
Feb 12, 2026
Merged

Fix is_legal_ids() to accept negative int64 primary keys#3273
sre-ci-robot merged 3 commits intomilvus-io:masterfrom
gonzfe05:fix/negative-int64-id-validation-3272

Conversation

@gonzfe05
Copy link
Contributor

@gonzfe05 gonzfe05 commented Feb 10, 2026

Summary

  • Fix is_legal_ids() in check.py to accept the full signed int64 range [-2^63, 2^63-1] instead of rejecting value < 0
  • Add tests for is_legal_ids() covering negative values, boundary values, and invalid inputs

Problem

INT64 primary keys span the full signed range, but is_legal_ids() rejects negative values (lines 133, 145 of check.py):

if value < 0 or value > sys.maxsize:
    return False

This causes search(ids=...), get(), and query(ids=...) to raise ParamError for valid negative int64 PKs. The Milvus server handles them correctly only the client-side validation is wrong.

Fixes #3272

Test plan

  • New TestIsLegalIds test class with parametrized cases for valid/invalid IDs
  • All 36 tests in test_check.py pass

@sre-ci-robot
Copy link

Welcome @gonzfe05! It looks like this is your first PR to milvus-io/pymilvus 🎉

…s-io#3272

Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
@gonzfe05 gonzfe05 force-pushed the fix/negative-int64-id-validation-3272 branch from 114d6ce to 335a333 Compare February 10, 2026 14:13
@mergify mergify bot added dco-passed and removed needs-dco labels Feb 10, 2026
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.55%. Comparing base (eb7868f) to head (8d08215).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3273      +/-   ##
==========================================
+ Coverage   76.36%   76.55%   +0.18%     
==========================================
  Files          63       63              
  Lines       13321    13322       +1     
==========================================
+ Hits        10173    10199      +26     
+ Misses       3148     3123      -25     

☔ View full report in Codecov by Sentry.
📢 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.

@XuanYang-cn
Copy link
Contributor

@gonzfe05 Please fix the code to pass code checker

Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
@mergify mergify bot added the ci-passed label Feb 12, 2026
Copy link
Contributor

@XuanYang-cn XuanYang-cn left a comment

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gonzfe05, 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

@sre-ci-robot sre-ci-robot merged commit fe02c07 into milvus-io:master Feb 12, 2026
13 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 12, 2026
## Summary

- Fix `is_legal_ids()` in `check.py` to accept the full signed int64
range `[-2^63, 2^63-1]` instead of rejecting `value < 0`
- Add tests for `is_legal_ids()` covering negative values, boundary
values, and invalid inputs

## Problem

INT64 primary keys span the full signed range, but `is_legal_ids()`
rejects negative values (lines 133, 145 of `check.py`):

```python
if value < 0 or value > sys.maxsize:
    return False
```

This causes `search(ids=...)`, `get()`, and `query(ids=...)` to raise
`ParamError` for valid negative int64 PKs. The Milvus server handles
them correctly only the client-side validation is wrong.

Fixes #3272

## Test plan

- [x] New `TestIsLegalIds` test class with parametrized cases for
valid/invalid IDs
- [x] All 36 tests in `test_check.py` pass

---------

Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
(cherry picked from commit fe02c07)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@pymilvus-bot
Copy link
Collaborator

Backport Created
Hi @gonzfe05, Backport PR for 2.6 has been created: #3281

(cc @XuanYang-cn)

sre-ci-robot pushed a commit that referenced this pull request Feb 12, 2026
…ys (#3273) (#3281)

Backport of #3273 to `2.6`.

Signed-off-by: fernando <fernandogonzalez512@hotmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: gonzfe05 <fernandogonzalez512@hotmail.com>
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.

is_legal_ids() rejects negative int64 primary keys

4 participants