Validate dry_run update mode#675
Open
sueun-dev wants to merge 1 commit into
Open
Conversation
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.
This fixes
dry_run=Truebeing sent with ID-based vector updates.What changed:
dry_run=Truewhenidis used in sync REST, async REST, and gRPC update paths.dry_runis described as filter-only.Why:
The update proto documents
dry_runas returning the count of records that match thefilter. ID-based updates do not have supported dry-run semantics, so the SDK should fail before sending that request.Checked:
origin/main,idx.update(id="vec1", set_metadata={...}, dry_run=True)sends{"id": "vec1", ..., "dryRun": true}instead of raising.ValidationErrorbefore any API call.PROTOC=$PWD/.venv/bin/protoc .venv/bin/python -m pytest tests/unit/test_index_update.py tests/unit/test_async_index_operations.py tests/unit/test_grpc_index.py -q(143 passed).venv/bin/ruff check .(All checks passed!)PROTOC=$PWD/.venv/bin/protoc .venv/bin/python -m pytest tests/unit -q -k "not test_async_transport_calls_module_level_compute_backoff and not test_linux_keepalive_params and not test_darwin_keepalive_params"(4601 passed, 30 skipped, 3 deselected, 1 xfailed)Note: a full local
tests/unitrun on macOS/Python 3.12 still has unrelated failures intest_socket_optionsfor missingsocket.TCP_KEEPIDLE; the same socket checks fail on currentorigin/mainin this environment.Note
Low Risk
Small, consistent input validation across three update entry points; filter-based dry-run is unchanged and tests were added.
Overview
update()now rejectsdry_run=Truewhen anidis used, across sync REST (Index), async REST (AsyncIndex), and gRPC (GrpcIndex). The SDK raisesValidationErrorwith "dry_run is only supported for filter-based updates" before any request is sent, instead of posting payloads like{"id": "...", "dryRun": true}.Docstrings for
dry_runnow state it applies only to filter-based updates. Unit tests cover the new validation on sync, async, and gRPC paths; filter-based dry-run behavior is unchanged.Reviewed by Cursor Bugbot for commit 7cfc474. Bugbot is set up for automated code reviews on this repo. Configure here.