You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(index): raise ValidationError for invalid _id field in upsert_records
## Purpose
Two silent validation gaps caused confusing HTTP 400 errors from the backend:
1. Records with both `_id` and `id` were silently stripped instead of rejected.
2. Non-string `_id` values (e.g. `{"_id": 123}`) passed SDK validation but returned HTTP 400.
## Solution
In the normalization loop of `Index.upsert_records` and `AsyncIndex.upsert_records`:
- Changed the silent `del r["id"]` to raise `ValidationError` when both `_id` and `id`
are present, matching the backend's `InvalidArgument` behavior.
- Added a type check after normalization: raises `ValidationError` if the resolved `_id`
is not a `str`, catching integer and None IDs before the network call.
Updated unit tests (sync + async) and added integration-level validation tests.
0 commit comments