Skip to content

[Testing]: Local checkpoint server accepts a SubType the service rejects #836

Open

Description

@yaythomas

Context

  1. Python SDK 3.0 lets a caller set sub_type on 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.
  2. The CheckpointDurableExecution API model constrains SubType to 1 to 32 characters matching [a-zA-Z0-9-_]+. A request with any other value fails with HTTP 400 ValidationException. The SDK treats a 4xx checkpoint failure as unrecoverable, so the execution fails.
  3. The local checkpoint server in aws-durable-execution-sdk-python-testing applies no constraint to SubType. checkpoint/validators/checkpoint.py checks only that the subtype does not change between updates of one operation.
  4. So a test using StepConfig(sub_type="order charge") or ChildConfig(sub_type="x" * 33) passes under DurableFunctionTestRunner and 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 ValidationException with 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 invalid sub_type ends the execution FAILED with the SDK's unrecoverable checkpoint error, as it does in AWS.

Related

#749, #452, #466.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triageIssue needs triagepkg:testingPackage: aws-durable-execution-sdk-python-testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions