Repository navigation
[Testing]: Local checkpoint server accepts a SubType the service rejects #836
Copy link
Copy link
Open
Labels
bugneeds-triageIssue needs triageIssue needs triagepkg:testingPackage: aws-durable-execution-sdk-python-testingPackage: aws-durable-execution-sdk-python-testing
Description
Context
- Python SDK 3.0 lets a caller set
sub_typeon a step, callback, or child context ([Feature]: Custom subtype for step, callback, and child context operations #749). The SDK does not validate the value, matching the JS SDK. It writes the value into the checkpoint as given. - The
CheckpointDurableExecutionAPI model constrainsSubTypeto 1 to 32 characters matching[a-zA-Z0-9-_]+. A request with any other value fails with HTTP 400ValidationException. The SDK treats a 4xx checkpoint failure as unrecoverable, so the execution fails. - The local checkpoint server in
aws-durable-execution-sdk-python-testingapplies no constraint toSubType.checkpoint/validators/checkpoint.pychecks only that the subtype does not change between updates of one operation. - So a test using
StepConfig(sub_type="order charge")orChildConfig(sub_type="x" * 33)passes underDurableFunctionTestRunnerand fails in AWS. The emulator image and the SAM CLI local runner share this server, so they have the same gap.
The JS testing SDK closed this in aws/aws-durable-execution-sdk-js#939 for SubType, then generalized it to every constrained member in aws/aws-durable-execution-sdk-js#996.
Proposed change
Validate each update's SubType before any update is applied, matching the API response a caller gets from the service:
- Constraint: 1 to 32 characters, full match against
[a-zA-Z0-9-_]+. - Error: a
ValidationExceptionwith HTTP status 400. The message names the failing value and the update by its 1-based position:
1 validation error detected: Value 'order charge' at 'updates.1.member.subType' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9-_]+
With several errors:N validation errors detected: ...; ... - Reject the whole request before applying any update, so the checkpoint token stays valid.
Scope
This issue covers SubType only, because it is the one member a caller now controls directly. Model checks for the other constrained members (Id, ParentId, Name, payload sizes), as aws/aws-durable-execution-sdk-js#996 did, belong under #452. If one PR for all of it is preferred, fold this into #452.
Acceptance
- Unit tests on the validator: accepted values at both length bounds; rejected values for each constraint (empty, 33 characters, space, non-ASCII); two bad updates produce two errors in position order.
- One e2e test through
DurableFunctionTestRunner: a step with an invalidsub_typeends the executionFAILEDwith the SDK's unrecoverable checkpoint error, as it does in AWS.
Related
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugneeds-triageIssue needs triageIssue needs triagepkg:testingPackage: aws-durable-execution-sdk-python-testingPackage: aws-durable-execution-sdk-python-testing
Activity