<#1332 fix: serialize optional None task defaults>...
# flyte-github
a
#1332 fix: serialize optional None task defaults Pull request opened by rbavery What/Why Task parameters annotated as optional with a
None
default are currently omitted from uploaded
default_inputs
. After registration, remote clients consequently treat those parameters as required even though their Python signatures allow omission. This conflicts with the documented task contract: parameters with Python defaults can be omitted and their defaults are part of the task input schema, and an
Optional[...]
input or any input with a default is not required
. During deployment, Flyte analyzes and serializes task parameter metadata into a
TaskTemplate
, so the
None
default must survive this conversion. Minimal reproducer Run from the Flyte SDK repository root. On
main
, this raises the same error observed when launching the RasterFlow integration workflow:
ValueError: Missing required inputs: intermediate_storage_uri, storage_uri
. It completes successfully on this branch. uvx --from uv==0.9.21 uv run python - <<"PY" import asyncio from flyte._internal.runtime.convert import ( convert_from_native_to_inputs, convert_upload_default_inputs, ) from flyte._internal.runtime.types_serde import transform_native_to_typed_interface from flyte.models import NativeInterface from flyte.types import guess_interface def task( intermediate_storage_uri: str | None = None, storage_uri: str | None = None, ) -> None: pass async def main() -> None: local_interface = NativeInterface.from_callable(task) uploaded_defaults = await convert_upload_default_inputs(local_interface) remote_interface = guess_interface( transform_native_to_typed_interface(local_interface), uploaded_defaults, ) await convert_from_native_to_inputs(remote_interface) asyncio.run(main()) PY How Serialize every declared default except
inspect.Parameter.empty
. Extend the existing default-input conversion test to verify that an optional
None
default is uploaded as the union
NONE
literal. flyteorg/flyte-sdk