You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the v2.2.0 spec-drift hardening (#157). The WS contract map is now exhaustive and test_contract_map_completeness hard-fails on the WS side. The REST side leaves 42 SDK response/request models unmapped, with the test warn-only.
This is the same regression class that hid Balance.balance_dollars for five review rounds in v2.1.0 — an unmapped model is invisible to drift checks, so additive spec changes slide through silently.
Unmapped models
Reproduce with pytest tests/test_contracts.py::TestSpecDrift::test_contract_map_completeness -W error::Warning.
Add a ContractEntry to kalshi/_contract_map.py for each model, with the matching spec_schema lookup name from specs/openapi.yaml.
The V2 orders family clusters around the *OrderV2* request/response pairs and is the largest sub-batch (~12 entries). Suitable for a self-contained first PR.
From the v2.2.0 spec-drift hardening (#157). The WS contract map is now exhaustive and
test_contract_map_completenesshard-fails on the WS side. The REST side leaves 42 SDK response/request models unmapped, with the test warn-only.This is the same regression class that hid
Balance.balance_dollarsfor five review rounds in v2.1.0 — an unmapped model is invisible to drift checks, so additive spec changes slide through silently.Unmapped models
Reproduce with
pytest tests/test_contracts.py::TestSpecDrift::test_contract_map_completeness -W error::Warning.kalshi.models.markets(4):BidAskDistribution,Candlestick,OrderbookLevel,PriceDistributionkalshi.models.orders(19):AmendOrderRequest,AmendOrderV2Request,AmendOrderV2Response,BatchCancelOrdersRequest,BatchCancelOrdersRequestOrder,BatchCancelOrdersV2Request,BatchCancelOrdersV2RequestOrder,BatchCancelOrdersV2Response,BatchCancelOrdersV2ResponseEntry,BatchCreateOrdersRequest,BatchCreateOrdersV2Request,BatchCreateOrdersV2Response,BatchCreateOrdersV2ResponseEntry,CancelOrderV2Response,CreateOrderV2Request,CreateOrderV2Response,DecreaseOrderRequest,DecreaseOrderV2Request,DecreaseOrderV2Responsekalshi.models.events(2):MarketMetadata,SettlementSourcekalshi.models.exchange(4):DailySchedule,MaintenanceWindow,Schedule,WeeklySchedulekalshi.models.portfolio(4):Deposit,IndexedBalance,PositionsResponse,Withdrawalkalshi.models.series(3):EventCandlesticks,ForecastPercentilesPoint,PercentilePointkalshi.models.multivariate(6):AssociatedEvent,CreateMarketInMultivariateEventCollectionRequest,CreateMarketResponse,LookupPoint,LookupTickersForMarketInMultivariateEventCollectionRequest,LookupTickersResponseWork
ContractEntrytokalshi/_contract_map.pyfor each model, with the matchingspec_schemalookup name fromspecs/openapi.yaml.*OrderV2*request/response pairs and is the largest sub-batch (~12 entries). Suitable for a self-contained first PR.test_additive_driftandtest_required_drift.test_additive_driftis hard-fail post-Harden response-side spec drift: promote additive warnings to hard-fail #157, so any new spec field surfaces immediately.test_contract_map_completenessfromwarnings.warntopytest.failso the next unmapped model fails CI.Acceptance
len(CONTRACT_MAP)increases from 49 to ~91 (final number depends on whether nested sub-models get folded into their parent entries).pytest tests/test_contracts.py -W error::Warning -k test_contract_map_completenesspasses.warnings.warn(...)is replaced withpytest.fail(...).test_additive_drift(any new failures must be addressed before flipping the gate).Related
CONTRACT_MAPand promotetest_contract_map_completeness(REST) to hard-fail."