Skip to content

test: add API version management tests - #581

Merged
jhamon merged 1 commit into
ftsfrom
jhamon/sdk-100-api-version-management-infrastructure
Jan 28, 2026
Merged

jhamon merged 1 commit into
ftsfrom
jhamon/sdk-100-api-version-management-infrastructure

Conversation

@jhamon

@jhamon jhamon commented Jan 28, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • Each generated module (db_control, db_data, inference, oauth, admin) has its own API_VERSION constant
  • Client classes import their module-specific version
  • setup_openapi_client() correctly sets the X-Pinecone-API-Version header

This PR adds tests to verify this infrastructure continues to work correctly.

Test Coverage

The new tests verify:

  1. 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)
  2. Header setting - setup_openapi_client() correctly sets/omits the version header

  3. Client imports - Index, Inference, and Admin classes import the correct API versions

  4. gRPC compatibility - gRPC uses the shared API_VERSION from openapi_support

Test Results

tests/unit/utils/test_api_version_management.py - 12 passed
tests/unit/utils/test_setup_openapi_client.py - 4 passed

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 for db_control/db_data, stable for inference/oauth/admin), verify setup_openapi_client() sets/omits the X-Pinecone-API-Version header based on the api_version argument, and confirm key wrappers (Index/Inference/Admin) plus the shared gRPC openapi_support.api_version.API_VERSION reference the expected version.

Written by Cursor Bugbot for commit 3983f3c. This will update automatically on new commits. Configure here.

Verify that:
- Each generated module has the correct API_VERSION constant
  - db_control, db_data → 2026-01.alpha (for FTS)
  - inference, oauth, admin → 2025-10 (stable)
- setup_openapi_client correctly sets X-Pinecone-API-Version header
- Index, Inference, Admin classes import correct versions
- gRPC client uses shared API_VERSION

Closes SDK-100
@jhamon jhamon added enhancement New feature or request python Pull requests that update Python code labels Jan 28, 2026
@jhamon
jhamon marked this pull request as ready for review January 28, 2026 17:37
@jhamon
jhamon merged commit 42dad99 into fts Jan 28, 2026
7 checks passed
@jhamon
jhamon deleted the jhamon/sdk-100-api-version-management-infrastructure branch January 28, 2026 17:37
jhamon added a commit that referenced this pull request Oct 23, 2026
…-to guides (#795)

* gnhf 1: Fixed #581: I removed both links to the private, closed issue #250 from the restore-job warnings in docs/how-to/indexes/backups-and-restore.md and kept the warning prose. Commit as `docs(indexes): drop private issue links from restore-job warnings` with `Fixes #581`.

* gnhf 2: I corrected the six #615 property examples (backups, backup_schedules, restore_jobs on Pinecone and AsyncPinecone) so each one reads every page instead of one. Commit as `docs(client): walk every page in backup, schedule and restore-job property examples` with `Refs #615`.

* gnhf 3: I fixed the five strict cross-reference problems (a-e) owned by this area. Commit as `docs(client): qualify ambiguous and private cross-references in control-plane docstrings`.

* gnhf 4: I added the #650 Raises line ':exc:`PineconeTypeError`: If *param* is not a ``str``.' to 25 control-plane methods in both the sync and async versions (indexes, backups, backup schedules, collections, restore jobs, inference model lookup, create_index_from_backup). Commit as `docs(client): document PineconeTypeError for non-str names and IDs in control-plane methods` with `Refs #650`.

* gnhf 5: I did an accuracy and concision pass on docs/how-to/indexes/backups-and-restore.md, checking its claims against the SDK code and svc-global-apis. The page went from 511 lines to about 335; backend internals and validation specifics are gone, and every user-actionable caution is kept. Commit as `docs(indexes): tighten and verify the backups and restore how-to`.

* gnhf 6: I did an accuracy and concision pass on docs/how-to/collections.md and the Collections/AsyncCollections docstrings, checking claims against svc-global-apis and pc-cps, and fixed a wrong claim about deleting a collection's source index. Commit as `docs(collections): correct source-index deletion rule and tighten the collections how-to`.

* gnhf 7: I did an accuracy and concision pass on docs/how-to/inference/embeddings.md, checking its claims against the SDK code and svc-global-apis, fixed a wrong claim about which ModelInfo fields are None on a reranking model, and moved the storage example to a schema-based document index. Commit as `docs(inference): verify and tighten the embeddings how-to`.

* gnhf 8: I did an accuracy and concision pass on docs/how-to/inference/reranking.md, checking its claims against the SDK code and the inference-server rerank handler; the two-stage pipeline example now uses a schema-based document index instead of the legacy index.query path. Commit as `docs(inference): verify and tighten the reranking how-to`.

* gnhf 9: I did an accuracy and concision pass on docs/how-to/indexes/pod.md, checking it against the SDK code and svc-global-apis. That fixed a wrong claim about deleting a pod index, removed a stale verbatim server error and some irrelevant specifics, and cut the page from 179 to about 125 lines. Commit as `docs(indexes): verify and tighten the pod-based indexes how-to`.

* gnhf 10: I did an accuracy and concision pass on docs/how-to/indexes/serverless.md, checking it against the SDK code and svc-global-apis, and fixed a wrong claim that idx.dimension and idx.metric are gone. Commit as `docs(indexes): verify and tighten the serverless indexes how-to`.

* gnhf 11: I did an accuracy and concision pass on the inference docstrings: Inference and AsyncInference, the inference response models (ModelInfo, RerankResult, RankedDocument, EmbeddingsList, SparseEmbedding) and the model list. I fixed ModelInfo's wrong claim about which fields are embed-only and moved the embed storage example to a document index; every check passed. Commit as `docs(inference): verify and tighten the inference docstrings`.

* gnhf 12: I did an accuracy and concision pass on the Backups/AsyncBackups and RestoreJobs/AsyncRestoreJobs docstrings and the BackupModel/RestoreJobModel attributes, and fixed a wrong failed-backup status: the server reports "InitializationFailed", not "Failed". All checks passed. Commit as `docs(backups): verify and tighten the backups and restore-job docstrings`.

* gnhf 13: I did a verified accuracy and concision pass on BackupSchedules/AsyncBackupSchedules and the schedule models, and corrected three server-behavior claims: history rows on 2026-07 never report "Scheduled", re-enabling does not start a backup immediately, and the long-name failure warning was unsupported. Commit as `docs(backups): verify and tighten the backup-schedule docstrings`.

* gnhf 14: I did an accuracy and concision pass on the Indexes/AsyncIndexes docstrings. It removed stale limits and specifics, merged the duplicate PineconeTypeError entry in configure, removed every em dash from docstring prose, and linked the legacy Records API methods with roles. Every check passed. Commit as `docs(indexes): verify and tighten the Indexes and AsyncIndexes docstrings`.

* no-mistakes(review): Narrow backup-schedule negative docstring check to removed claim

* no-mistakes(document): Drop stale immediate-backup claim from migration guide

* docs: scope the collection restore claim by API version

Earlier API versions restore a collection by creating a new pod index
from it; 2026-07 rejects that, and this SDK raises before sending
source_collection on any version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant