Skip to content

[Bug]: Child operation should call ser & des before return the result #406

@wangyb-A

Description

@wangyb-A

Expected Behavior

I would like the the child operatoin to return the deseralized of seralized result on first run. So that the first run and replay will have same result.

Actual Behavior

The first run will return the raw result. The seralized result was checkpointed. So replay will return the deseralized result.

Steps to Reproduce

from typing import Any

from aws_durable_execution_sdk_python.config import ChildConfig
from aws_durable_execution_sdk_python.context import (
    DurableContext,
    StepContext,
    durable_step,
    durable_with_child_context,
)
from aws_durable_execution_sdk_python.execution import durable_execution
from aws_durable_execution_sdk_python.serdes import SerDes, SerDesContext


class UppercaseSerDes(SerDes[str]):
    def serialize(self, value: str, _: SerDesContext) -> str:
        return value.upper()

    def deserialize(self, data: str, _: SerDesContext) -> str:
        return data


@durable_step
def return_input(_step_context: StepContext, value: str) -> str:
    return value


@durable_with_child_context
def serdes_child(ctx: DurableContext, value: str) -> str:
    return ctx.step(return_input(value))


@durable_execution
def handler(event: Any, context: DurableContext) -> str:
    result: str = context.run_in_child_context(
        serdes_child(event),
        name="serdes-child",
        config=ChildConfig(serdes=UppercaseSerDes()),
    )
    return result

SDK Version

1.5.0

Python Version

3.14

Is this a regression?

No

Last Working Version

No response

Additional Context

Please note this might be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    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