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
{{ message }}
Repository navigation
fix: add typed structs and inheritance to Python models.py - #579
Refactors Python SDK models: adds SubscriptionOption, CreateOrderParams, and TxPayload typed structs, types BuiltOrder.params and BuiltOrder.tx more precisely, moves the TypedDict/Callable import to the top of the file, and changes MatchResult/EventMatchResult from __getattr__ delegation to dataclass inheritance from UnifiedMarket/UnifiedEvent.
Router client: sdks/python/pmxt/router.py constructs MatchResult/EventMatchResult via _parse_match_result -- this will break
Findings
CRITICAL: MatchResult constructor breakage. The PR changes MatchResult to inherit from UnifiedMarket, which has ~20 required positional fields (market_id, title, outcomes, volume_24h, liquidity, url). The existing _parse_match_result() in router.py (line 45) constructs MatchResult(market=..., relation=..., confidence=..., ...) -- it does NOT supply the parent UnifiedMarket required fields. This will raise TypeError at runtime for every fetch_market_matches / fetch_matches / compare_market_prices call.
CRITICAL: EventMatchResult constructor breakage. Same problem -- EventMatchResult now inherits from UnifiedEvent which requires id, title, description, slug, markets, url as positional args. The EventMatchResult(event=..., market_matches=...) constructor in router.py line 253 will fail.
Mutation in __post_init__. The setattr(self, field, ...) calls inside __post_init__ mutate the object after construction. Per project rules, this should use immutable patterns. More importantly, it silently overwrites fields that happen to be None -- but None may be a legitimate value for optional fields (e.g., description=None), creating subtle data corruption.
market: UnifiedMarket = None # type: ignore[assignment] -- this sets a required-looking field to None by default while silencing the type checker. If downstream code accesses result.market expecting a real UnifiedMarket, it will get None.
Minor: SubscriptionOption, CreateOrderParams, TxPayload additions are clean and correctly match the TS SDK types. No issues there.
PMXT Pipeline Check
Field propagation: ISSUE (inheritance model duplicates fields and breaks construction)
OpenAPI sync: N/A (no core changes)
Type safety: ISSUE (type: ignore suppression, None defaults for required fields)
Semver Impact
major -- breaks existing MatchResult/EventMatchResult construction API
Risk
router.py is not updated, so all match-related Router calls will crash at runtime. This PR must either (a) update _parse_match_result and EventMatchResult construction in router.py to supply parent fields, or (b) revert the inheritance approach and keep __getattr__ delegation.
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 #467
Fixes #500
Fixes #501
Fixes #497
Fixes #498