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

Offen
#836 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

  • #851 von @OKAN-SOFTWARE — ohne Merge geschlossen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend, testing

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Python
Sterne
58
Forks
32
Ø Merge
1 T. 6 Std.
Gemergte PRs (30 T.)
80

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus aws/aws-durable-execution-sdk-python

Alle Issues in aws/aws-durable-execution-sdk-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.