Skip to content

SDK drift: Python's validate_economics silently auto-derives typed_data from build_response; TypeScript requires it explicitly with no fallback #1704

Description

@realfishsam

Drift

TypeScript's validateEconomics takes typedData as a required positional parameter with no default and no fallback-extraction logic. Python's validate_economics treats typed_data as optional — when omitted (None), it reaches into build_response["typed_data"] and uses that value instead of failing, unlike its sibling required args (route/build_request/build_response), which fail immediately when missing.

TypeScript SDK

sdks/typescript/pmxt/hosted-typed-data.ts:402-407typedData: TypedData is a required positional parameter; the function body has no fallback-extraction logic.

Python SDK

sdks/python/pmxt/_hosted_typeddata.py:256-274:

def validate_economics(
    typed_data: dict[str, Any] | None = None,
    route: str | None = None,
    build_request: dict[str, Any] | None = None,
    build_response: dict[str, Any] | None = None,
) -> None:
    ...
    if typed_data is None:
        candidate = _value(build_response, "typed_data")
        if candidate is _MISSING or candidate is None:
            _economic_fail("typed_data missing")
        typed_data = candidate

Expected

Both SDKs should require the same set of arguments with the same fallback behavior — either TypeScript should support the same build_response-derived fallback, or Python should not silently auto-derive typed_data and should instead require it explicitly like its sibling parameters.

Impact

This is distinct from existing issue #1120 (which is only about nullability/omission being allowed, not about an active fallback-extraction behavior). A Python caller relying on this convenience (passing only route/build_request/build_response and omitting typed_data) has no equivalent call shape in TypeScript at all — porting such code to TypeScript would require an explicit code change, not just a syntax translation.


Found by automated SDK cross-language drift audit

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1: highbugSomething isn't workingeffort: smallpythonPython SDK specificsdk-driftCross-language SDK consistency findings (TypeScript vs Python)sdk-parityConsistency between SDKstype: security

    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