Skip to content

SDK drift: MatchedMarketClusterEdge / MatchedEventClusterEdge are typed interfaces in TypeScript but untyped Dict[str, Any] in Python #657

@realfishsam

Description

@realfishsam

SDK Drift Report

Category: Model / type drift

TypeScript location: sdks/typescript/pmxt/models.ts lines 944–957 — MatchedMarketClusterEdge and MatchedEventClusterEdge interfaces

Python location: sdks/python/pmxt/models.pyraw_matches field typed as Optional[List[Dict[str, Any]]]


What the drift is

TypeScript defines fully-typed interfaces for the edge objects within a matched cluster:

// sdks/typescript/pmxt/models.ts lines 944-957
export interface MatchedMarketClusterEdge {
  marketAId: string;
  marketBId: string;
  score: number;
  // ... other typed fields
}

export interface MatchedEventClusterEdge extends MatchedMarketClusterEdge {
  eventAId: string;
  eventBId: string;
}

Python represents the same data as a completely untyped list of dicts:

# sdks/python/pmxt/models.py
@dataclass
class MatchedMarketCluster:
    ...
    raw_matches: Optional[List[Dict[str, Any]]] = None  # untyped

There are no MatchedMarketClusterEdge or MatchedEventClusterEdge dataclasses in the Python SDK.


Why it matters

  • Python callers lose all static type-checking on edge fields; typos and missing-field bugs are not caught by type checkers (mypy, pyright).
  • IDE autocompletion does not work for edge object fields in Python.
  • The field is also named differently: raw_matches in Python vs the typed collection of MatchedMarketClusterEdge objects in TypeScript — meaning the field name carries an implicit "this is unstructured data" warning that is absent in TypeScript.

Expected behaviour

Python should define MatchedMarketClusterEdge and MatchedEventClusterEdge dataclasses (or TypedDicts) mirroring the TypeScript interfaces, and the raw_matches field should be typed accordingly (e.g. Optional[List[MatchedMarketClusterEdge]]).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions