feat(tii)!: interpret the full complex param-type model#18
Conversation
Rework `ParamType` to interpret every shape `tx3c` emits into the TII params schema, per the canonical model in the SDK spec's `api-surface/args.md`. - Replace the flat `Enum` with a `ParamKind` + `ParamType` dataclass carrying element/field types (`inner`/`elements`/`fields`/`cases`/`schema`). Adds `UNIT`, `UTXO`, `ANY_ASSET`, `TUPLE`, `MAP`, `RECORD`, `VARIANT`, and `UNKNOWN` kinds. - Match built-in scalar `$ref`s by trailing name so both the canonical `…/tii#/$defs/<Name>` and legacy `…/core#<Name>` forms resolve (previously the `tii#` form degraded to a typeless custom). - `param_type_from_schema` never raises; unrecognized shapes become `UNKNOWN`. - Drop the latent `string`→ADDRESS default. - Resolve `#/components/schemas/<Name>` refs against the TII components table, threaded through `Protocol.invoke`. - `Protocol.invoke` now also exposes party (Address) and environment-schema params, matching the reference SDK. BREAKING CHANGE: `ParamType` changes from a `str` `Enum` to a dataclass; use the new `ParamKind` enum for the kind discriminant. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…er invoke path Behavior-preserving readability pass over the complex param-type interpreter, mirroring the rust-sdk (#41) and go-sdk (#14) changes. - Split param_type_from_schema into a thin dispatcher plus _ref_type / _array_type / _object_type helpers (joining the existing _variant_case / _core_kind_from_ref). Same fallbacks, recursion, and kind map. - Remove InvalidParamTypeError: the interpreter no longer raises it once it became never-failing, leaving it dead. InvalidParamsSchemaError stays (protocol.py still raises it). - Add test_invoke_interprets_complex_params + the shared complex.tii fixture to cover the Protocol.invoke path the unit tests can't reach: components threading, party->Address, environment params, and a resolved component-$ref Record and Variant. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Pushed a behavior-preserving readability pass (1afc17d) — the same review we applied to rust-sdk #41 and go-sdk #14, against the four code-quality dimensions. No change to the kind map; all existing tests still pass. 1. Module cohesion — already good, no change. Unlike rust (where the interpreter was buried in 2. Function decomposition. 3. Dead-code removal. Once the interpreter became never-failing it stopped raising 4. Integration coverage.
|
Summary
Reworks
ParamTypeto interpret every shapetx3cemits into the TII params schema, per the canonical model in the SDK spec'sapi-surface/args.md. The python-sdk slice of a cross-fleet complex-type parity effort (rust/go/python/web).Changes
strEnum→ParamKind+ParamTypedataclass carrying element/field types (inner/elements/fields/cases/schema); addsUNIT/UTXO/ANY_ASSET/TUPLE/MAP/RECORD/VARIANT/UNKNOWN.$refmatching acrosstii#/$defs/and legacycore#forms (previously thetii#form degraded to a typeless custom); drops the latentstring→ADDRESS default.UNKNOWN; resolves#/components/schemas/<Name>refs (threaded throughProtocol.invoke).Protocol.invokenow also exposes party (Address) and environment-schema params, matching the reference SDK.Tests
pytest— 62 pass (newtest_param_type.pyover the full canonical table incl. both ref forms, nested compounds, component resolution, never-raise fallbacks; existing tii suite green).ruffclean.Validated against the shared fixture
sdk-spec/test-vectors/complex-types/complex.tiivia the fullProtocol.invokepath (parties + env + tx params + component resolution).Breaking change
ParamTypechanges from astrEnumto a dataclass; the kind discriminant moves to the newParamKindenum. Needs a version bump persdk-spec/release-policy.md.🤖 Generated with Claude Code