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
Replace the guarded orderBookResolvers.get(...)! push path with an explicit queue initializer.
Add a regression test so Baozi websocket resolver queueing does not reintroduce the non-null assertion pattern.
Fix the Python exchange generator's underscore handling so polymarket_us is exported as PolymarketUS; this keeps the existing exchange drift gate green.
Preserve the generated SDK fetchOrderBook special handling for params-without-limit and historical range responses.
Refresh API reference output from the existing generator.
Verification
npm --workspace=pmxt-core test -- --runTestsByPath test/pipeline/baozi-websocket-resolvers.test.ts --runInBand
Three fixes bundled in one PR: (1) eliminates a non-null assertion (!) on a Map.get() in the Baozi WebSocket order book resolver queue by extracting a getOrderBookQueue helper method, (2) fixes the Python exchange generator so polymarket_us produces the class name PolymarketUS instead of Polymarket_us, and (3) adds hardcoded fetchOrderBook overrides in both SDK client generators to handle the params-without-limit positional arg gap and OrderBook[] historical range responses.
Blast Radius
Baozi exchange: WebSocket order book watching path only. The getOrderBookQueue refactor is semantically identical to the old code but removes the ! assertion. No behavior change.
Python SDK: Polymarket_us class renamed to PolymarketUS in _exchanges.py and __init__.py. This is a breaking change for existing Python users of pmxt.Polymarket_us().
SDK generators (both TS + Python): fetchOrderBook now has a hardcoded override in the generator to handle OrderBook | OrderBook[] return type and params-without-limit gap. The generated client files already match.
API_REFERENCE.md (both SDKs): Regenerated from current BaseExchange.ts -- includes incidental changes like testDummyMethod -> close and FetchOrderBookParams type documentation.
Test Results
Build: NOT RUN (permission issue in sandbox)
Unit tests: NOT RUN (permission issue in sandbox)
Findings
Breaking change: Polymarket_us -> PolymarketUS (sdks/python/pmxt/_exchanges.py:368, init.py:20,146) -- Any Python user doing pmxt.Polymarket_us() will get an ImportError after upgrading. The sidecar routing key (exchange_name="polymarket_us") is unaffected. Given this exchange is relatively new (added recently via 5c000a8), the blast radius may be small, but it is technically a semver-breaking rename. Consider whether a deprecation alias is warranted.
any[] in fetchOrderBook TS generator (sdks/typescript/scripts/generate-client-methods.js:389) -- The hardcoded override uses const args: any[] = []. This is consistent with the existing pattern used by all other generated methods (line 327), so it is not a new regression, but worth noting.
Incidental API_REFERENCE changes bundled in commit 3 -- The testDummyMethod -> close change and TradesParams description removal are side effects of re-running the API reference generator against the current BaseExchange.ts. These are legitimate but unrelated to the PR title. Not blocking.
Regression test reads source file from disk (core/test/pipeline/baozi-websocket-resolvers.test.ts:6-11) -- The test reads the websocket.ts file as a string and regex-matches against it. This is a pattern lint test, not a runtime test. It will correctly fail if someone reintroduces the ! pattern. Acceptable approach for this kind of guardrail.
PMXT Pipeline Check
Field propagation (3-layer): N/A (no new unified type fields)
OpenAPI sync: N/A (no BaseExchange.ts changes)
Type safety: OK (no new any beyond existing generator pattern)
Semver Impact
minor (or arguably major due to finding #1) -- The PolymarketUS rename breaks the public Python API. If Polymarket_us was ever documented or used by consumers, this is a major change. If it was always considered a generator bug that shipped before anyone used it, minor is defensible.
Risk
Tests were not run due to sandbox permission restrictions. The PR author's verification commands should be run before merge.
The Polymarket_us -> PolymarketUS rename is a public API break for the Python SDK. Assess whether any users depend on the old name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #261
Changes
orderBookResolvers.get(...)!push path with an explicit queue initializer.polymarket_usis exported asPolymarketUS; this keeps the existing exchange drift gate green.fetchOrderBookspecial handling for params-without-limit and historical range responses.Verification
npm --workspace=pmxt-core test -- --runTestsByPath test/pipeline/baozi-websocket-resolvers.test.ts --runInBandnpx tsc -p core/tsconfig.json --noEmitnode core/scripts/check-exchange-drift.jsnode sdks/typescript/scripts/generate-client-methods.js; git diff --exit-code sdks/typescript/pmxt/client.tsnode sdks/python/scripts/generate-client-methods.js; git diff --exit-code sdks/python/pmxt/client.pypython -m py_compile sdks/python/pmxt/_exchanges.py sdks/python/pmxt/__init__.py sdks/python/pmxt/client.pygit diff --check