From a13f97d616348bad9e0aff764cb35291b1818301 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Wed, 22 Jul 2026 22:49:20 +0000 Subject: [PATCH] test: add child custom-serdes case (3-14) Adds the 3-14 ChildCustomSerdes conformance case, completing the child suite (3-1..3-18). The handler uses the SDK's real custom serdes API and is KNOWN to fail on the current Python SDK (custom serdes not applied: expected 'HELLO CHILD', got 'hello child'). The red conformance (child) job is the intended divergence signal, to be resolved by an SDK fix rather than a test change. --- .../handlers/child/child_custom_serdes.py | 41 +++++++++++++++++++ .../template_child.yaml | 15 +++++++ 2 files changed, 56 insertions(+) create mode 100644 packages/aws-durable-execution-sdk-python-conformance-tests/handlers/child/child_custom_serdes.py diff --git a/packages/aws-durable-execution-sdk-python-conformance-tests/handlers/child/child_custom_serdes.py b/packages/aws-durable-execution-sdk-python-conformance-tests/handlers/child/child_custom_serdes.py new file mode 100644 index 00000000..f8bf272c --- /dev/null +++ b/packages/aws-durable-execution-sdk-python-conformance-tests/handlers/child/child_custom_serdes.py @@ -0,0 +1,41 @@ +"""3-14: Child context with custom serdes (succeed).""" + +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 diff --git a/packages/aws-durable-execution-sdk-python-conformance-tests/template_child.yaml b/packages/aws-durable-execution-sdk-python-conformance-tests/template_child.yaml index b76e21c8..5cd41742 100644 --- a/packages/aws-durable-execution-sdk-python-conformance-tests/template_child.yaml +++ b/packages/aws-durable-execution-sdk-python-conformance-tests/template_child.yaml @@ -250,6 +250,21 @@ Resources: DurableConfig: RetentionPeriodInDays: 7 ExecutionTimeout: 300 + ChildCustomSerdes: + Type: AWS::Serverless::Function + TestingMetadata: + TestDescription: ["3-14"] + Properties: + CodeUri: lambda-build/ + Handler: child.child_custom_serdes.handler + Description: Child context with custom serdes (succeed) + Role: + Fn::GetAtt: + - DurableFunctionRole + - Arn + DurableConfig: + RetentionPeriodInDays: 7 + ExecutionTimeout: 300 ChildErrorNoStep: Type: AWS::Serverless::Function TestingMetadata: