test: add API version management tests #581
Merged
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.
Summary
Add comprehensive unit tests to verify the API version management infrastructure works correctly across all API categories.
Closes SDK-100
Background
After reviewing the codebase, the API version management infrastructure is already in place:
db_control,db_data,inference,oauth,admin) has its ownAPI_VERSIONconstantsetup_openapi_client()correctly sets theX-Pinecone-API-VersionheaderThis PR adds tests to verify this infrastructure continues to work correctly.
Test Coverage
The new tests verify:
Module API versions - Each generated module has the correct version:
db_control,db_data→2026-01.alpha(for FTS support)inference,oauth,admin→2025-10(stable)Header setting -
setup_openapi_client()correctly sets/omits the version headerClient imports - Index, Inference, and Admin classes import the correct API versions
gRPC compatibility - gRPC uses the shared
API_VERSIONfromopenapi_supportTest Results
Note
Low Risk
Low risk: adds unit tests only, but they hard-code version strings and could become brittle when API versions roll.
Overview
Adds a new unit test suite (
tests/unit/utils/test_api_version_management.py) to enforce API version selection across SDK surfaces.The tests assert each generated OpenAPI module exposes the expected
API_VERSION(alpha fordb_control/db_data, stable forinference/oauth/admin), verifysetup_openapi_client()sets/omits theX-Pinecone-API-Versionheader based on theapi_versionargument, and confirm key wrappers (Index/Inference/Admin) plus the shared gRPCopenapi_support.api_version.API_VERSIONreference the expected version.Written by Cursor Bugbot for commit 3983f3c. This will update automatically on new commits. Configure here.