fix(lambda): accept a durable update without ParentId and reword its consistency errors (#8249)

* fix(lambda): accept a durable update without ParentId and word its consistency errors like AWS
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-13 22:33:13 -04:00
1 parent 55a7d95146
commit f0de926e02
2 files changed
+97 -10

No files matched your search

@@ -200,15 +200,15 @@ final class DurableCheckpointApplier {
throw invalid("Invalid operation id.");
}
DurableOperation existing = operations.get(update.id());
if (existing != null) {
requireConsistent(existing, update);
}
if (update.parentId() != null) {
DurableOperation parent = operations.get(update.parentId());
if (parent == null || parent.getType() != DurableOperationType.CONTEXT) {
throw invalid("Invalid parent operation id.");
}
}
if (existing != null) {
requireConsistent(existing, update);
}
requireErrorSize(update);
if (update.type() == DurableOperationType.CHAINED_INVOKE) {
if (utf8Length(update.payload()) > MAX_CHAINED_INVOKE_PAYLOAD_BYTES) {
@@ -495,19 +495,24 @@ final class DurableCheckpointApplier {
private static void requireConsistent(DurableOperation existing, DurableOperationUpdate update) {
if (existing.getType() != update.type()) {
throw invalid("Inconsistent operation type.");
throw inconsistent("Type");
}
if (update.subType() != null && !Objects.equals(existing.getSubType(), update.subType())) {
throw invalid("Inconsistent operation subtype.");
throw inconsistent("SubType");
}
if (update.name() != null && !Objects.equals(existing.getName(), update.name())) {
throw invalid("Inconsistent operation name.");
throw inconsistent("Name");
}
if (!Objects.equals(existing.getParentId(), update.parentId())) {
throw invalid("Inconsistent parent operation id.");
if (update.parentId() != null && !Objects.equals(existing.getParentId(), update.parentId())) {
throw inconsistent("ParentId");
}
}
private static AwsException inconsistent(String field) {
return invalid(field + " value in OperationUpdate is inconsistent with existing operation. "
+ "Check for non-determinism.");
}
private static Map<String, Object> resultOrError(DurableOperation operation, boolean failed) {
Map<String, Object> details = new LinkedHashMap<>();
if (failed) {