feat(models): type notification payloads per notification kind - #222
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ab6464b. Configure here.
naruto11eth
left a comment
There was a problem hiding this comment.
Approved.
quick thing: the old permissive Notification class is still in account.py:171 (with its now-unused Any import) - exports and parsing all moved to the new union, so that's two incompatible models for the same concept, and it's the one Bugbot thread still open.
Also actually curious: maker_base_fee/taker_base_fee are Optional here where both the ts twin and clob-v2 have them always present - is this intentional?

Ports DEV-459 to the Python SDK, mirroring the modeling already merged in ts-sdk.
Notificationis now a discriminated union of ten per-kind models on a newNotificationTypeIntEnum, each with a typed payload model instead ofpayload: Any.owneruses a newApiKeyNewType.Linear: DEV-459
Note
Medium Risk
Breaking API change for consumers that relied on untyped
payloadorownerasstr; stricter parsing may reject malformed API data that previously passed.Overview
Replaces the loose
Notificationmodel (type: int,payload: Any) with a discriminated union of ten per-kind notification classes, keyed by a newNotificationTypeIntEnum, each with a typed payload (orders, markets, payouts, comments, auto-redeem, etc.).Notificationmoves fromaccount.pyintonotifications.py;owneris now anApiKeyNewTypeinstead of a plain string. Public exports and tests are updated so parsing/validation fails on unknown notification types and integration checks assertNotificationTypeon live responses.Reviewed by Cursor Bugbot for commit 54d5bc7. Bugbot is set up for automated code reviews on this repo. Configure here.