fix: correct order snapshot subscription types - #7
Merged
Merged
Conversation
poly-william
approved these changes
Sep 17, 2026
poly-william
left a comment
Contributor
There was a problem hiding this comment.
Reviewed this exact head. Snapshot typing matches the gateway contract, runtime dispatch is unchanged, and local tests, typing, lint and build passed. Current CI is green.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
Allow
SUBSCRIPTION_TYPE_ORDER_SNAPSHOTin private subscriptions and correct theOrderSnapshotdiscriminator. Add a consumer type fixture to the existing mypy job, cover request types and successful/failed EOF dispatch, and update the README to request snapshots separately from live orders.Runtime dispatch stays the same. Consumers relying on the previous incorrect snapshot literal may need to update their type annotations. README code-block formatting also satisfies the current Ruff check.
Testing
uv run pytest— 131 tests pass.uv run ruff check .anduv run ruff format --check .pass.uv run mypy polymarket_us tests/types/order_snapshot.py— 32 files pass; the consumer fixture produces two expected errors against the original types.uv buildpasses.Checklist
pytest)ruff check .)mypy polymarket_us)Note
Low Risk
Runtime WebSocket handling is unchanged; the main impact is stricter typings that may require consumer annotation updates.
Overview
Fixes WebSocket typing and docs so one-shot order snapshots use
SUBSCRIPTION_TYPE_ORDER_SNAPSHOT, separate from liveSUBSCRIPTION_TYPE_ORDERupdates.OrderSnapshot’ssubscriptionTypeliteral is corrected accordingly, andPrivateSubscriptionTypenow allows subscribing with the snapshot type.CI mypy also type-checks
tests/types/order_snapshot.pyas a consumer fixture. New offline tests assert live vs snapshot subscribe payloads differ and that terminal snapshot frames dispatch toorder_snapshotorerrorwhen anerrorfield is present. The README explains requesting snapshots separately, shows an extra subscribe call, and printseofin the snapshot handler (plus minor example formatting).Reviewed by Cursor Bugbot for commit e3e5ec6. Bugbot is set up for automated code reviews on this repo. Configure here.