Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Feb 2, 2026

Summary

This PR re-enables CI linting and unit tests for the FTS branch by updating the SDK to work with the new alpha API model structure. The alpha API introduces a significant architectural change from the old "spec-based" API to a new "schema + deployment" structure.

Problem

The FTS branch introduced a new alpha API with breaking model structure changes:

  • IndexModel now uses schema and deployment instead of dimension, metric, spec, and vector_type
  • CreateIndexRequest now requires schema and deployment fields
  • Various model imports changed (e.g., BackupModelSchemaSchema)
  • Read capacity configuration structure flattened

These changes caused mypy type errors and unit test failures, leading to CI being temporarily skipped for PRs targeting the FTS branch.

Solution

Backward Compatibility Layer

The SDK maintains backward compatibility by translating legacy API calls to the new alpha API format:

# Users can still use the familiar legacy API
pc.create_index(
    name="my-index",
    dimension=1536,
    metric="cosine",
    spec=ServerlessSpec(cloud="aws", region="us-east-1")
)

# SDK internally translates to the new alpha API structure:
# CreateIndexRequest(
#     name="my-index",
#     schema=Schema(fields={"_values": SchemaFields(type="dense_vector", dimension=1536, metric="cosine")}),
#     deployment={"deployment_type": "serverless", "cloud": "aws", "region": "us-east-1"}
# )

Key Changes

  1. Request Factory (request_factory.py):

    • create_index_request now translates legacy spec/dimension/metric to schema/deployment
    • __parse_read_capacity updated for flattened alpha API structure
    • Proper Schema OpenAPI object construction (not just dicts)
  2. Model Import Updates:

    • BackupModelSchemaSchema across multiple files
    • Fixed attribute access patterns using getattr() for IndexModel dynamic attributes
  3. gRPC Utils (grpc/utils.py):

    • Updated namespace description parsing to use new schema structure instead of indexed_fields
  4. Test Fixtures:

    • All unit tests updated to use alpha API structure
    • Added proper skip conditions for asyncio tests requiring pinecone[asyncio]
  5. CI Configuration:

    • Removed if: github.base_ref != 'fts' conditions from on-pr.yaml
    • Updated mypy.ini to ignore optional dependency stubs (pandas, protobuf, dateutil)

Breaking Changes

None - all changes maintain backward compatibility through the SDK's compatibility layer.

Test Plan

  • uv run pytest tests/unit passes (630 passed, 8 skipped)
  • uv run mypy pinecone shows only pre-existing issues (9 errors related to optional dependencies)
  • CI linting passes
  • CI unit tests pass

Related

Made with Cursor


Note

Medium Risk
Medium risk because it changes index create/configure request construction and gRPC namespace parsing to match the new alpha API shapes, which can affect control-plane behavior if mappings are wrong; CI gating changes increase coverage but may surface new failures.

Overview
Re-enables PR lint/unit/integration workflows for fts by removing branch-based skips, and relaxes mypy for optional deps (pandas, google.protobuf, dateutil).

Updates the DB control-plane client to translate legacy spec/dimension/metric requests into alpha schema+deployment (including new schema object construction and flattened dedicated read-capacity scaling), adjusts configure_index to send deployment/read_capacity and to reject unsupported embed, and adds safer getattr access for status/tags.

Updates gRPC namespace parsing to populate schema instead of indexed_fields, and refreshes unit tests/fixtures to the alpha response/request shapes (plus skipping asyncio index tests when asyncio deps aren’t installed).

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

Update the SDK to work with the new alpha API model structure that uses
schema + deployment instead of the legacy spec-based approach.

Key changes:
- Update request_factory.py to translate legacy API calls to new format
- Fix model imports (BackupModelSchema -> Schema)
- Update attribute access patterns for IndexModel dynamic attributes
- Fix gRPC utils for new namespace schema structure
- Update all unit test fixtures to use alpha API structure
- Add proper skip conditions for asyncio tests
- Remove fts branch skip conditions from on-pr.yaml

Resolves: SDK-116
Co-authored-by: Cursor <cursoragent@cursor.com>
@jhamon jhamon added the python Pull requests that update Python code label Feb 2, 2026
- Add type validation for 'manual' dict in __parse_read_capacity
- Extract __schema_dict_to_openapi_schema helper to reduce duplication
- Extract _parse_proto_schema_to_openapi helper in grpc/utils.py

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

fields[field_name] = BackupModelSchemaFields(filterable=True)
serverless_args["schema"] = BackupModelSchema(fields=fields)

index_spec = IndexSpec(serverless=ServerlessSpecModel(**serverless_args))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legacy spec fields silently dropped during translation

Medium Severity

The _translate_legacy_request method silently drops several fields when converting legacy specs to the alpha API format. For ServerlessSpec, the read_capacity and schema fields are ignored. For PodSpec, the metadata_config and source_collection fields are ignored. For dict-based specs, the same fields are dropped. Users passing these fields receive no error or warning, but their configuration is quietly discarded. The PR claims backward compatibility, but this silent data loss could cause unexpected behavior for users relying on these features.

Additional Locations (1)

Fix in Cursor Fix in Web

# If not a dict, create with default filterable=True
fields[field_name] = BackupModelSchemaFields(filterable=True)
# If not a dict, create with default type=string
fields[field_name] = OpenAPISchemaFields(type="string")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated field processing logic in __parse_schema

Medium Severity

The field configuration processing logic is duplicated within __parse_schema. Lines 197-207 (fields wrapper case) and lines 218-228 (direct mapping case) contain nearly identical code for creating OpenAPISchemaFields objects. This could be extracted into a helper method like _process_field_config(field_name, field_config) to eliminate the duplication.

Fix in Cursor Fix in Web

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

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants