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

Ouverte
#836 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

  • #851 par @OKAN-SOFTWARE — fermée sans fusion

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
70/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
backend, testing

Piste de recherche

Start with checkpoint/validators/checkpoint.py, where the issue says subtype updates are checked, and trace where updates are validated before application. Add validator tests for the stated length, character, and error ordering cases, then add an end-to-end case through DurableFunctionTestRunner. Done means invalid subtypes return the described HTTP 400 ValidationException before any update is applied, and the runner reports the execution as FAILED.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug needs-decision not-ready parity pkg:testing

Context

  1. Python SDK 3.0 lets a caller set sub_type on a step, callback, or child context (#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.

Langage dominant
Python
Étoiles
58
Forks
32
Merge moyen
1 j 6 h
PR mergées (30 j)
80

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de aws/aws-durable-execution-sdk-python

Toutes les issues de aws/aws-durable-execution-sdk-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.