aws / aws/aws-durable-execution-sdk-java

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

Abierto Apto para principiantes
#705 1 comentario 0 reacciones 0 asignados Ver en GitHub
bug needs-triage pkg:sdk
Lenguaje dominante
Java
Estrellas
28
Forks
11
Merge medio
1 d 8 h
PR fusionados (30 d)
47

Descripción

### 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 (`sdk/src/main/java/software/amazon/lambda/durable/util/DurableApiErrorClassifier.java`):
https://github.com/aws/aws-durable-execution-sdk-java/blob/7f1a73ca16308d31a1e5a270e504676caf890e0b/sdk/src/main/java/software/amazon/lambda/durable/util/DurableApiErrorClassifier.java#L51

```java
private static final String INVALID_CHECKPOINT_TOKEN_MESSAGE_PREFIX = "Invalid Checkpoint Token";
```

Used in `classifyException()` via `message.startsWith(INVALID_CHECKPOINT_TOKEN_MESSAGE_PREFIX)`. The Javadoc also documents the wrong string (`4xx + "Invalid Checkpoint Token" → retryable`).

### 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 (7f1a73c)

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en sdk/src/main/java/software/amazon/lambda/durable/util/DurableApiErrorClassifier.java, especialmente en el prefijo INVALID_CHECKPOINT_TOKEN y en classifyException(). Revisa las pruebas unitarias existentes, actualízalas para que usen el mensaje en minúsculas del servicio y verifica que un token de checkpoint obsoleto se clasifique como un fallo de invocación reintentable en lugar de como un fallo de ejecución no reintentable.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
backend
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
88/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.