Skip to content

SDK drift: relation/confidence explicit-null coercion differs across parseMatchResult/compareMarketPrices/fetchHedges #1698

Description

@realfishsam

Drift

TypeScript coerces an explicit falsy/null relation/confidence value via || to a default. Python's dict.get(key, default) only substitutes the default when the key is absent — so an explicit null on the wire survives unchanged in Python but becomes the default in TypeScript. This affects three sibling Router methods identically.

TypeScript SDK

  • parseMatchResult: sdks/typescript/pmxt/router.ts:107-108
relation: raw.relation || 'identity',
confidence: raw.confidence || 0,
  • compareMarketPrices: sdks/typescript/pmxt/router.ts:510-511 (same pattern)
  • fetchHedges: sdks/typescript/pmxt/router.ts:569-570 (same pattern)

Python SDK

  • _parse_match_result: sdks/python/pmxt/router.py:52-53
relation=raw.get("relation", "identity"),
confidence=raw.get("confidence", 0.0),
  • compareMarketPrices/fetchHedges Python equivalents: sdks/python/pmxt/router.py:509-510 and :590-591 (same pattern)

Expected

Both SDKs should treat an explicit null the same way — either both coerce it to the default, or both preserve it as None/null.

Impact

A server response with "relation": null (or "confidence": null) produces MatchResult(relation='identity', ...) in TypeScript but MatchResult(relation=None, ...) in Python — different observable value for any caller branching on .relation/.confidence. This is a distinct field/method set from existing issues #1535, #1500, and #1517, which cover different fields/methods with the same underlying ||-vs-.get(default) pattern.


Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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