Skip to content

[pull] main from temporalio:main - #189

Merged
pull[bot] merged 1 commit into
TheTechOddBug:mainfrom
temporalio:main
Aug 6, 2026
Merged

[pull] main from temporalio:main#189
pull[bot] merged 1 commit into
TheTechOddBug:mainfrom
temporalio:main

Conversation

@pull

@pull pull Bot commented Aug 6, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* fix(contrib/pydantic): reuse TypeAdapters across payloads

PydanticJSONPlainPayloadConverter.from_payload constructed a fresh
pydantic TypeAdapter for every payload, rebuilding the core schema each
time for non-class hints such as discriminated unions and generic
collections.

Cache adapters per converter instance, keyed on hashable type hints;
unhashable hints keep constructing fresh adapters. The cache is
unbounded by default and configurable via the new keyword-only
max_cached_type_adapters option on PydanticJSONPlainPayloadConverter
and PydanticPayloadConverter (positive bounds with LRU eviction, zero
disables caching, negative raises ValueError).

Fixes #1695

* fix(contrib/pydantic): default type adapter cache bound to 1024

Bound the per-converter type adapter cache to 1024 entries by default
with LRU eviction, capping worst-case memory even with runtime-generated
hints while never evicting for typical static hint sets. None remains
available for an unbounded cache and zero still disables caching.

* test(contrib/pydantic): cover re-imported class cache isolation

The workflow sandbox re-imports user modules, producing distinct class
objects with identical names. Verify each gets its own cache slot and
validates to its own world's class, even when one converter is shared.

* fix(contrib/pydantic): avoid double hash on cached decode path

Address review: try the cache directly instead of pre-hashing every
hint. On TypeError, hash the hint once only to distinguish an
unhashable hint (bypass the cache with a fresh adapter) from a
TypeError raised during adapter construction (re-raise), keeping
adapter errors unsuppressed.
@pull pull Bot locked and limited conversation to collaborators Aug 6, 2026
@pull pull Bot added the ⤵️ pull label Aug 6, 2026
@pull
pull Bot merged commit 069bf54 into TheTechOddBug:main Aug 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant