Skip to content

Validate dry_run update mode#675

Open
sueun-dev wants to merge 1 commit into
pinecone-io:mainfrom
sueun-dev:fix-update-dry-run-id-validation-current
Open

Validate dry_run update mode#675
sueun-dev wants to merge 1 commit into
pinecone-io:mainfrom
sueun-dev:fix-update-dry-run-id-validation-current

Conversation

@sueun-dev
Copy link
Copy Markdown

@sueun-dev sueun-dev commented Jun 4, 2026

This fixes dry_run=True being sent with ID-based vector updates.

What changed:

  • Reject dry_run=True when id is used in sync REST, async REST, and gRPC update paths.
  • Clarify the update docstrings so dry_run is described as filter-only.
  • Add unit coverage for sync, async, and gRPC validation.

Why:
The update proto documents dry_run as returning the count of records that match the filter. ID-based updates do not have supported dry-run semantics, so the SDK should fail before sending that request.

Checked:

  • On current origin/main, idx.update(id="vec1", set_metadata={...}, dry_run=True) sends {"id": "vec1", ..., "dryRun": true} instead of raising.
  • On this branch, the same call raises ValidationError before 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/unit run on macOS/Python 3.12 still has unrelated failures in test_socket_options for missing socket.TCP_KEEPIDLE; the same socket checks fail on current origin/main in 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 rejects dry_run=True when an id is used, across sync REST (Index), async REST (AsyncIndex), and gRPC (GrpcIndex). The SDK raises ValidationError with "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_run now 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant