aws / aws/aws-durable-execution-sdk-python

[Bug]: Invalid checkpoint token misclassified as execution failure (message case mismatch)

Fermée Adaptée aux débutants
#721 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
bug needs-triage pkg:sdk
Langage dominant
Python
Étoiles
53
Forks
25
Merge moyen
1 j 19 h
PR mergées (30 j)
40

Description

### Expected Behavior

When the service rejects a checkpoint call with `InvalidParameterValueException` because the checkpoint token is stale (a newer invocation superseded this one), the SDK should classify the error as an **invocation** failure (retryable). The current invocation ends, and the service starts a fresh invocation with a fresh token. The execution itself continues.

### Actual Behavior

The SDK classifies the error as an **execution** failure (non-retryable). So a stale checkpoint token fails the whole durable execution every time.

### Root Cause

The classifier matches the error message with a case-sensitive prefix check against `"Invalid Checkpoint Token"`. The service emits `"Invalid checkpoint token"` (lowercase `c` and `t`). The prefix check never matches. The error falls through to the generic 4xx branch, which is classified as an execution failure.

Service constant (`DurableExecutionsServiceSharedLib`, `ValidationErrorMessages.java` line 86, internal):

```java
public static final String INVALID_CHECKPOINT_TOKEN = "Invalid checkpoint token";
```

SDK constant (`packages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/exceptions.py`):
https://github.com/aws/aws-durable-execution-sdk-python/blob/8742ad9c9535e1de042963963c6b439f656894ce/packages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/exceptions.py#L16

```python
INVALID_CHECKPOINT_TOKEN_PREFIX: str = "Invalid Checkpoint Token"
```

Used by `_classify_error_category()` via `(error.get("Message") or "").startswith(INVALID_CHECKPOINT_TOKEN_PREFIX)`.

Test that encodes the wrong string: `tests/exceptions_test.py` (`"Invalid Checkpoint Token: token expired"`).

### Steps to Reproduce

1. Have the service return a 4xx `InvalidParameterValueException` whose message starts with `Invalid checkpoint token` (the real service message).
2. Pass it through the SDK error classifier.
3. Observe it is classified as an execution (non-retryable) error rather than an invocation (retryable) error.

The existing unit tests do not catch this. They construct the error with the message `"Invalid Checkpoint Token: token expired"`, which matches the SDK constant rather than the service constant.

### Proposed Fix

1. Change the SDK constant to `"Invalid checkpoint token"` so it matches the service.
2. Consider a case-insensitive comparison to protect against future drift.
3. Update the unit tests to use the real service message.

### Related

Same defect exists in all three SDKs; each gets its own issue.
- JS: aws/aws-durable-execution-sdk-js
- Python: aws/aws-durable-execution-sdk-python
- Java: aws/aws-durable-execution-sdk-java

### SDK Version

main (8742ad9)

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par packages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/exceptions.py et tests/exceptions_test.py, puis exécutez les tests du classifieur en utilisant la casse réelle des messages du service. C’est terminé lorsque l’erreur de checkpoint obsolète est classée comme un échec d’invocation et que les tests n’encodent plus le message qui ne correspond pas.

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

Évaluation

Stack technique
python
Domaine
api
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
88/100

Recevez les nouvelles issues par e-mail

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