Skip to content

fix(perps): transfer request body spec drift; release 22.1.0 (#547) - #548

Merged
TexasCoding merged 1 commit into
mainfrom
fix/547-spec-drift
Oct 17, 2026
Merged

TexasCoding merged 1 commit into
mainfrom
fix/547-spec-drift

Conversation

@TexasCoding

Copy link
Copy Markdown
Owner

Closes #547

What drifted

Nightly strict contract run 39023301422 failed on two perps request bodies (specs/perps_openapi.yaml):

  • IntraExchangeInstanceTransferRequest gained source_subaccount and destination_subaccount (integer, gte=0, spec default 0; "only supported for event contract to event contract transfers").
  • ApplySubaccountTransferRequest (perps POST /portfolio/margin/subaccounts/transfer) gained exchange_index (ExchangeIndex, gte=0; "Perps subaccount transfers ignore this field").

None of them are in required, so this is a minor release: 22.1.0.

Change

  • kalshi/perps/models/transfers.py: new fields as StrictInt | None = Field(default=None, ge=0) (models stay extra="forbid"). None defaults keep today's wire payloads byte-identical (exclude_none); an explicit 0 is still sent.
  • kalshi/perps/resources/transfers.py: new keyword-only kwargs threaded through sync + async transfer_instance / transfer_subaccount (overloads, implementations, body builders), and included in the request= vs kwargs exclusivity check.
  • tests/perps/test_transfers.py: model serialization (incl. explicit 0), omitted-by-default, negative / bool rejection, sync + async wire tests, request= path.
  • Re-vendored specs/ (OpenAPI 3.34.0 unchanged version; perps/AsyncAPI). Other upstream changes are descriptions, examples, x-rust-* / x-omitempty vendor extensions, and response-side additive-optional fields (perps ExchangeStatus.intra_exchange_transfers_active / exchange_estimated_resume_time / exchange_index_statuses) that only warn and are left for a follow-up. kalshi/_generated regenerated with no diff.
  • Version bump pyproject.toml, kalshi/__init__.py, CHANGELOG.md (## 22.1.0 — 2026-10-17). Not breaking, so no docs/migration.md entry.
  • Contract maps: endpoints and body models were already registered (METHOD_ENDPOINT_MAP, PERPS_BODY_MODEL_MAP); no exclusions added.

Blast radius (manual — GitNexus unavailable)

  • Symbols touched: IntraExchangeInstanceTransferRequest, perps ApplySubaccountTransferRequest, _build_instance_transfer_body, _build_subaccount_transfer_body, TransfersResource.transfer_instance / transfer_subaccount, AsyncTransfersResource.transfer_instance / transfer_subaccount.
  • Callers: only the public perps client.transfers.* methods; no other SDK code builds these models (rg confirmed). The event-contract kalshi.models.subaccounts.ApplySubaccountTransferRequest is a separate class and is untouched.
  • Risk: LOW. Additive optional kwargs with None defaults; existing calls and request bodies are unchanged.

Gates

  • uv run ruff check . — pass
  • uv run mypy kalshi/ — pass
  • uv run pytest tests/ --ignore=tests/integration -q — 4735 passed, 3 skipped
  • uv run pytest tests/test_contracts.py -W error::UserWarning — 856 passed

Add optional source_subaccount/destination_subaccount to
IntraExchangeInstanceTransferRequest and optional exchange_index to the
perps ApplySubaccountTransferRequest, threaded through sync+async
transfers.transfer_instance / transfer_subaccount. Re-vendor specs.
Release 22.1.0 (additive, optional only).

Closes #547
@TexasCoding
TexasCoding merged commit 904be51 into main Oct 17, 2026
6 checks passed
@TexasCoding
TexasCoding deleted the fix/547-spec-drift branch November 1, 2026 12:33
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.

Nightly spec-drift: strict contract tests failing (since 2026-10-17)

1 participant