Skip to content

feat(spec): FCM IM cap, DLP programs, cover market lifecycle — 22.19.0 (#594) - #595

Merged
TexasCoding merged 5 commits into
mainfrom
fix/594-spec-drift-fcm-im-cap
Dec 2, 2026
Merged

TexasCoding merged 5 commits into
mainfrom
fix/594-spec-drift-fcm-im-cap

Conversation

@TexasCoding

@TexasCoding TexasCoding commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Closes #594

Reconciles the nightly spec-drift failure on main (OpenAPI 3.39.0; AsyncAPI, perps, and SCM specs also changed). Additive only — releases as 22.19.0 (minor). No breaking changes.

The failing run was https://github.com/TexasCoding/kalshi-python-sdk/actions/runs/46783195129 (TestWsSpecDrift::test_batch_communications_channel_removed and test_every_spec_endpoint_is_mapped[perps]; after the local spec sync, test_every_spec_endpoint_is_mapped[core] and SCM response drift on ObligationEntry / CorporateActionPaymentDetail also failed). Those tests now pass.

Spec changes → SDK

  • Perps FCM IM cap (sync + async): fcm.get_im_cap(), update_im_cap(*, im_cap=), delete_im_cap() — GET/PUT/DELETE /margin/fcm/im_cap. GetFCMIMCapResponse.im_cap and current_im are optional DollarDecimal (wire names im_cap / current_im, no _dollars suffix; both absent when unset or unavailable). PUT body is UpdateFCMIMCapRequest (extra="forbid"); returns no body. PUT/DELETE are never retried.
  • Core incentive_programs.dlp_programs() (sync + async) — GET /dlp_programs. Public. Returns GetDlpProgramsResponse with bidding_periods and incentivized_series (null/missing lists parse as []).
  • Core Settlement.value_dollars (DollarDecimal | None). value (integer cents) is deprecated and kept.
  • Klear optional ObligationEntry.obligation_type and optional CorporateActionPaymentDetail.withholding_fp / withholding_rate_bps / withholding_reason, with server_omits_despite_required exclusions so older payloads still parse.
  • WebSocket cover_market_lifecycle channel and subscribe_cover_market_lifecycle(). Payload CoverMarketLifecycleMessage (same msg shape as market_lifecycle_v2). market_lifecycle_v2 also carries milestone_updated (MilestoneUpdatedMessage: milestone_id, last_updated_ts_us, free-form milestone dict). AsyncAPI 16 → 17 channels; 14 typed subscribe_*.
  • Description-only wording (perps exchange_status snapshot note, SCM obligation/withholding docs, "on-request" → "cover") needed no code.

Blast radius (manual; GitNexus not installed)

  • All new response fields are optional; existing payloads parse unchanged.
  • Request model UpdateFCMIMCapRequest is new and extra="forbid"; no existing request body changes.
  • PUT/DELETE retry policy is unchanged (RETRYABLE_METHODS remains GET/HEAD/OPTIONS).
  • Existing market_lifecycle_v2 subscribers may now also receive typed milestone_updated messages through the SDK dispatcher (additive; previously this type was not in the spec).
  • Settlement.value is unchanged. value_dollars is a new optional field.
  • Public exports add the new FCM, DLP, and WS models next to their existing neighbors.

CI note (out of #594 scope; kept)

After this PR opened, pull_request workflows did not queue (close/reopen and an empty retrigger commit 4fe0cd6 also did not). workflow_dispatch still worked. I added a one-line workflow_dispatch: trigger to .github/workflows/ci.yml (922e6b6) so the required checks could be dispatched by hand. A later pull_request synchronize then did queue, and CI is green. The empty retrigger commit is included in this squash only as history and has no file changes. Reverting the workflow_dispatch line would risk another stuck PR, so it is kept. It is additive and harmless (CI still runs on PR/main as before, and can also be started manually).

Gates

  • uv run ruff check . ✅
  • uv run mypy kalshi/ ✅
  • uv run pytest tests/ --ignore=tests/integration -q ✅ 5577 passed, 3 skipped
  • uv run pytest tests/test_contracts.py -W error::UserWarning ✅ 1030 passed
  • CI on this PR ✅ test (3.12), test (3.13), drift-check

Add perps FCM account-level IM cap (GET/PUT/DELETE /margin/fcm/im_cap),
core GET /dlp_programs, Settlement.value_dollars, Klear obligation_type
and withholding fields, WebSocket cover_market_lifecycle plus
milestone_updated on market_lifecycle_v2. Additive only; PUT/DELETE
remain non-retried.
Minor bump for the additive OpenAPI 3.39.0 spec-drift work.
@TexasCoding

Copy link
Copy Markdown
Owner Author

Re-opening this PR to retrigger GitHub Actions; workflows did not queue on the initial open.

@TexasCoding TexasCoding closed this Dec 2, 2026
@TexasCoding TexasCoding reopened this Dec 2, 2026
Workflows did not queue on the initial PR open or reopen.
pull_request events are not queuing CI or Spec Drift Detection
on this repo (confirmed on #595 and #596). workflow_dispatch still
works and is needed to land #594.
@TexasCoding

Copy link
Copy Markdown
Owner Author

GitHub is not queuing pull_request workflows on this repo right now (also confirmed on a fresh PR #596). workflow_dispatch still works, so I added that trigger to ci.yml and will dispatch CI and Spec Drift Detection on this head SHA so the required checks can run.

@TexasCoding
TexasCoding merged commit d1ca274 into main Dec 2, 2026
11 checks passed
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-12-02)

1 participant