fix(lambda): leave NextMarker out of the last page of durable execution state (#8263)

The invocation event's InitialExecutionState carried "NextMarker": "",
and so did the last page of GetDurableExecutionState. AWS leaves the key
out in both places, and Floci now does the same. A page with operations
left still carries NextMarker.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-13 23:32:26 -04:00
1 parent ea8d875cad
commit 235179313b
4 files changed
+36 -4

No files matched your search

@@ -312,7 +312,7 @@ public class DurableExecutionService implements Resettable {
indexed.add(new Cursored<>(String.format("%010d", i), operations.get(i)));
}
PaginatedResult<DurableOperation> page = paginate(indexed, pageSize(maxItems), marker, "durable-state");
return new StatePage(page.items(), page.nextToken() != null ? page.nextToken() : "");
return new StatePage(page.items(), page.nextToken());
}
/** Stopping a closed execution changes nothing and reports the time it closed. */
@@ -64,7 +64,6 @@ public final class DurableWire {
for (DurableOperation operation : execution.replayedOperations()) {
operations.add(operation(operation, true));
}
state.put("NextMarker", "");
ArrayNode updated = event.putArray("UpdatedOperationIds");
updatedOperationIds.forEach(updated::add);
return event;
@@ -87,11 +87,35 @@ class DurableExecutionServiceTest {
assertEquals("EXECUTION", root.get("Type").asText());
assertEquals("STARTED", root.get("Status").asText());
assertEquals("{\"a\":1}", root.get("ExecutionDetails").get("InputPayload").asText());
assertEquals("", event.get("InitialExecutionState").get("NextMarker").asText());
assertFalse(event.get("InitialExecutionState").has("NextMarker"));
assertEquals(1, event.get("InitialExecutionState").size());
assertEquals(DurableExecutionStatus.SUCCEEDED, service.get(execution.getExecutionArn()).getStatus());
assertEquals("\"done\"", service.get(execution.getExecutionArn()).getResult());
}
@Test
void getStateCarriesAMarkerOnlyWhenOperationsRemain() {
invoker.script(event -> {
String arn = event.get("DurableExecutionArn").asText();
String current = checkpoint(event, token(event), List.of(
step("s1", DurableOperationAction.START, null, null),
step("s2", DurableOperationAction.START, null, null))).checkpointToken();
assertNull(service.getState(arn, current, null, null).nextMarker());
assertNull(service.getState(arn, current, null, 4).nextMarker());
assertNull(service.getState(arn, current, null, 3).nextMarker());
DurableExecutionService.StatePage first = service.getState(arn, current, null, 1);
assertEquals(1, first.operations().size());
assertNotNull(first.nextMarker());
DurableExecutionService.StatePage second = service.getState(arn, current, first.nextMarker(), 2);
assertEquals(2, second.operations().size());
assertNull(second.nextMarker());
return pending();
});
start("exec-1", "{}", false);
}
@Test
void stepCheckpointIsReturnedAsNewStateAndTheResultClosesTheExecution() {
invoker.script(event -> {
@@ -185,7 +185,16 @@ class LambdaDurableProtocolIntegrationTest {
.body("Operations", hasSize(2))
.body("Operations[0].Type", equalTo("EXECUTION"))
.body("Operations[1].Id", equalTo("s1"))
.body("NextMarker", equalTo(""));
.body("$", not(hasKey("NextMarker")));
given()
.urlEncodingEnabled(false)
.when()
.get(DURABLE + "/durable-executions/" + arn + "/state?MaxItems=1&CheckpointToken=" + nextToken)
.then()
.statusCode(200)
.body("Operations", hasSize(1))
.body("NextMarker", notNullValue());
given()
.urlEncodingEnabled(false)