Uh oh!
There was an error while loading. Please reload this page.
Bind Python temporal and UUID arguments to their native Go types - #71809
Draft
jason810496 wants to merge 2 commits into
Draft
Bind Python temporal and UUID arguments to their native Go types#71809jason810496 wants to merge 2 commits into
jason810496 wants to merge 2 commits into
Conversation
This was referenced Aug 19, 2026
jason810496force-pushed
the
feature/go-sdk/temporal-uuid-arg-binding
branch
2 times, most recently
from
August 20, 2026 05:58
1806c30 to
19dcff1CompareA Dag author who annotates a stub parameter `datetime`, `timedelta` or `UUID` means a moment, a span or an identifier -- not the string those become on the wire. Without this the Go task receives that string and has to parse it itself, re-deriving a contract the annotation already stated, and getting it wrong in ways the runtime could have caught. The annotation is what pydantic turns into the JSON-schema `format` the argument spec carries, so it is also what decides which Go type can receive the value: `date-time`/`date`/`time` fill a time.Time, `duration` a time.Duration, `uuid` a uuid.UUID. Reading it as the contract means a Go parameter the declared Python type cannot fill now fails before the task body runs rather than binding something the author never meant -- including a plain int declared as a time.Duration, which would otherwise be read as a count of nanoseconds. These values are rewritten into a spelling encoding/json can read by one walk over the target type, so a duration is reached wherever it sits: the argument itself, a slice element, a map value or a struct field. A single walk is what keeps those cases consistent; reaching only the top level would leave a `list[timedelta]` or a struct's `timedelta` field failing against a schema that describes them perfectly well.
jason810496force-pushed
the
feature/go-sdk/temporal-uuid-arg-binding
branch
from
August 21, 2026 03:16
b3a0bf5 to
e3abe8cComparecontainsNativeSeen omitted uuidType, so containers of uuid.UUID (slices, maps, struct fields) skipped format validation entirely — a schema declaring the wrong format on a nested UUID was silently accepted. Add uuidType to the identity check and add an early return in normalizeNative for native types that are self-decoding (uuid.UUID via TextUnmarshaler) so they do not fall through to the container-recursion switch. Cache containsNative and nativeStructFields results in sync.Maps keyed by reflect.Type — both depend only on static type information but were recomputed from scratch on every Resolve call. Restore a test case for anyOf(string, null) → *string that was inadvertently dropped when the nullable matrix cases were changed to exercise temporal types.
jason810496force-pushed
the
feature/go-sdk/temporal-uuid-arg-binding
branch
from
August 21, 2026 06:14
e3abe8c to
0342c29Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Stub annotations already carry temporal and UUID formats, but Go tasks receive the values as strings and must parse them again.
What
Bind each JSON Schema
formatto its native Go type:formatdatetime,pendulum.DateTimedate-timetime.Timedatedatetime.Time(midnight)timetimetime.Time(zero date)timedelta,pendulum.Durationdurationtime.DurationUUIDuuiduuid.UUIDstringand customUnmarshalJSONtypes as escape hatches.Values cross runtimes in JSON form. The example currently passes formatted strings; native Python
datetime,timedelta, andUUIDcall arguments require the separate #71536 Core change.Was generative AI tooling used to co-author this PR?
Drafted-by: Codex (GPT-5) (no human review before posting)