From 346f072af672dbf5368ab8d88d70b3d17fbcfbb3 Mon Sep 17 00:00:00 2001 From: "hln33+github-actions[bot]" Date: Fri, 25 Sep 2026 22:24:24 +0000 Subject: [PATCH 1/3] chore: release version 2.3.0 --- conformance-tests/pom.xml | 2 +- coverage-report/pom.xml | 2 +- examples/pom.xml | 2 +- insight-plugin/pom.xml | 2 +- otel-plugin/pom.xml | 2 +- pom.xml | 2 +- sdk-integration-tests/pom.xml | 2 +- sdk-testing/pom.xml | 2 +- sdk/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conformance-tests/pom.xml b/conformance-tests/pom.xml index 1ede184b9..00f2c7079 100644 --- a/conformance-tests/pom.xml +++ b/conformance-tests/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-conformance-tests diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml index 48300f209..4e37a3bfa 100644 --- a/coverage-report/pom.xml +++ b/coverage-report/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-coverage-report diff --git a/examples/pom.xml b/examples/pom.xml index 18654cf8e..17dacd69f 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-examples diff --git a/insight-plugin/pom.xml b/insight-plugin/pom.xml index f04cfb22e..0f670e15b 100644 --- a/insight-plugin/pom.xml +++ b/insight-plugin/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-plugin-insight diff --git a/otel-plugin/pom.xml b/otel-plugin/pom.xml index f5e218a1e..5432938e7 100644 --- a/otel-plugin/pom.xml +++ b/otel-plugin/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-plugin-otel diff --git a/pom.xml b/pom.xml index bb78588a5..4c23a71c8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 pom AWS Lambda Durable Execution SDK diff --git a/sdk-integration-tests/pom.xml b/sdk-integration-tests/pom.xml index e213bac09..ec07cef68 100644 --- a/sdk-integration-tests/pom.xml +++ b/sdk-integration-tests/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-integration-tests diff --git a/sdk-testing/pom.xml b/sdk-testing/pom.xml index cf6870017..73e854fb8 100644 --- a/sdk-testing/pom.xml +++ b/sdk-testing/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java-testing diff --git a/sdk/pom.xml b/sdk/pom.xml index b86276f01..53f55e562 100644 --- a/sdk/pom.xml +++ b/sdk/pom.xml @@ -7,7 +7,7 @@ software.amazon.lambda.durable aws-durable-execution-sdk-java-parent - 2.2.1-SNAPSHOT + 2.3.0 aws-durable-execution-sdk-java From beafebfd1b14fc149292335710613b597219bc35 Mon Sep 17 00:00:00 2001 From: Frank Chen <65260095+zhongkechen@users.noreply.github.com> Date: Wed, 14 Oct 2026 17:00:10 +0000 Subject: [PATCH 2/3] Pin the Java formatter independently of the Spotless plugin Keep Spotless 3.10.4 while explicitly retaining the established Palantir 2.98.0 formatting rules. The plugin default changed to 2.102.0, which otherwise rewrites existing switch-expression layouts across multiple modules. --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index d57477e76..113865d9b 100644 --- a/pom.xml +++ b/pom.xml @@ -141,6 +141,7 @@ + 2.98.0 true From f2cd1c2e261b2ea62d7c4132ddffe7efffe0b115 Mon Sep 17 00:00:00 2001 From: Frank Chen <65260095+zhongkechen@users.noreply.github.com> Date: Wed, 14 Oct 2026 18:01:17 +0000 Subject: [PATCH 3/3] Format existing Java sources with the updated default formatter Remove the temporary Palantir version pin and apply Spotless 3.10.4 with its default Palantir 2.102.0 only to files reported by the normal checks. Java non-whitespace content, javac tokens, and ASTs are unchanged. --- .../durable/otel/XRayContextExtractor.java | 11 ++- .../durable/OtelViewRegistrationTest.java | 15 ++-- .../ExecutionRootDeliveryFailureTest.java | 22 +++-- .../otel/ExecutionRootLifecycleTest.java | 15 ++-- .../otel/HandlerMdcIntegrationTest.java | 11 ++- .../otel/InvocationEndFailureTest.java | 39 ++++----- .../otel/InvocationOutcomeBoundaryTest.java | 22 +++-- .../durable/otel/MdcFailureBoundaryTest.java | 28 +++---- .../otel/MdcFatalInitializationTest.java | 27 +++--- .../otel/MdcWorkerReuseBoundaryTest.java | 26 +++--- pom.xml | 1 - .../ContinuationEndCleanupOrderTest.java | 13 ++- .../testing/cloud/HistoryEventProcessor.java | 84 +++++++++---------- .../durable/testing/local/EventProcessor.java | 19 ++--- .../execution/ExecutionManagerTest.java | 13 ++- 15 files changed, 161 insertions(+), 185 deletions(-) diff --git a/otel-plugin/src/main/java/software/amazon/lambda/durable/otel/XRayContextExtractor.java b/otel-plugin/src/main/java/software/amazon/lambda/durable/otel/XRayContextExtractor.java index a42b5ee5c..05a1110ab 100644 --- a/otel-plugin/src/main/java/software/amazon/lambda/durable/otel/XRayContextExtractor.java +++ b/otel-plugin/src/main/java/software/amazon/lambda/durable/otel/XRayContextExtractor.java @@ -84,12 +84,11 @@ public ExtractedContext extract() { } // Only Sampled=1 and Sampled=0 are authoritative; anything else (missing or unusable) is undecided. - var sampling = - switch (sampled == null ? "" : sampled) { - case "1" -> ExtractedContext.Sampling.SAMPLED; - case "0" -> ExtractedContext.Sampling.NOT_SAMPLED; - default -> ExtractedContext.Sampling.UNDECIDED; - }; + var sampling = switch (sampled == null ? "" : sampled) { + case "1" -> ExtractedContext.Sampling.SAMPLED; + case "0" -> ExtractedContext.Sampling.NOT_SAMPLED; + default -> ExtractedContext.Sampling.UNDECIDED; + }; return new ExtractedContext(traceId, parentSpanId, sampling); } diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/OtelViewRegistrationTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/OtelViewRegistrationTest.java index f0748172c..b90217c37 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/OtelViewRegistrationTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/OtelViewRegistrationTest.java @@ -88,14 +88,13 @@ void rejectsBothViewsBeforeEmissionAndLeavesContextUntouched(String path, boolea var second = plugin(!reversed, exporter); var providers = List.of(new ExecutionOtelPluginProvider(), new InvocationOtelPluginProvider()); var names = reversed ? "otel-execution,otel-invocation" : "otel-invocation,otel-execution"; - var plugins = - switch (path) { - case "dynamic" -> DynamicPluginLoader.loadConfiguredPlugins(names, providers, List.of()); - case "mixed" -> - DynamicPluginLoader.loadConfiguredPlugins( - reversed ? "otel-execution" : "otel-invocation", providers, List.of(second)); - default -> List.of(first, second); - }; + var plugins = switch (path) { + case "dynamic" -> DynamicPluginLoader.loadConfiguredPlugins(names, providers, List.of()); + case "mixed" -> + DynamicPluginLoader.loadConfiguredPlugins( + reversed ? "otel-execution" : "otel-invocation", providers, List.of(second)); + default -> List.of(first, second); + }; var ambient = Span.wrap(SpanContext.create( "12345678901234567890123456789012", "1234567890123456", diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootDeliveryFailureTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootDeliveryFailureTest.java index e4cc31f84..835267fbf 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootDeliveryFailureTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootDeliveryFailureTest.java @@ -212,19 +212,17 @@ static Stream preparationEndFailures() { @MethodSource("preparationEndFailures") void preparationAndEndFailuresRetainCallerIdentityAndCleanupDiagnostics( boolean executionView, String preparationKind, String endKind) { - Throwable original = - switch (preparationKind) { - case "vm", "wrapped-vm" -> new InternalError("preparation fatal"); - case "death" -> new ThreadDeath(); - default -> new IllegalStateException("preparation ordinary"); - }; + Throwable original = switch (preparationKind) { + case "vm", "wrapped-vm" -> new InternalError("preparation fatal"); + case "death" -> new ThreadDeath(); + default -> new IllegalStateException("preparation ordinary"); + }; Throwable preparation = preparationKind.equals("wrapped-vm") ? new CompletionException(original) : original; - Error cleanup = - switch (endKind) { - case "vm" -> new InternalError("End fatal"); - case "death" -> new ThreadDeath(); - default -> new AssertionError("End error"); - }; + Error cleanup = switch (endKind) { + case "vm" -> new InternalError("End fatal"); + case "death" -> new ThreadDeath(); + default -> new AssertionError("End error"); + }; var ends = new AtomicInteger(); var seen = new AtomicReference(); var serDes = new SerDes() { diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootLifecycleTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootLifecycleTest.java index 02779a68c..3cb14b92d 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootLifecycleTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/ExecutionRootLifecycleTest.java @@ -161,14 +161,13 @@ private static InvocationEndInfo end(boolean first) { "death,ordinary" }) void flushPreservesTheExistingEndFailurePriority(String rootKind, String flushKind) { - Throwable rootFailure = - switch (rootKind) { - case "linkage" -> new LinkageError("root linkage"); - case "assertion" -> new AssertionError("root assertion"); - case "vm" -> new InternalError("root fatal"); - case "death" -> new ThreadDeath(); - default -> new IllegalStateException("root ordinary"); - }; + Throwable rootFailure = switch (rootKind) { + case "linkage" -> new LinkageError("root linkage"); + case "assertion" -> new AssertionError("root assertion"); + case "vm" -> new InternalError("root fatal"); + case "death" -> new ThreadDeath(); + default -> new IllegalStateException("root ordinary"); + }; Throwable flushFailure = flushKind.equals("fatal") ? new InternalError("flush fatal") : new IllegalArgumentException("flush ordinary"); diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/HandlerMdcIntegrationTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/HandlerMdcIntegrationTest.java index 7fe9f18cf..1369254cd 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/HandlerMdcIntegrationTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/HandlerMdcIntegrationTest.java @@ -68,12 +68,11 @@ private static void runWithoutPlugins(ExecutorService executor, String outcome) return "done"; }, config); - var expected = - switch (outcome) { - case "failure", "inputFailure" -> ExecutionStatus.FAILED; - case "suspension" -> ExecutionStatus.PENDING; - default -> ExecutionStatus.SUCCEEDED; - }; + var expected = switch (outcome) { + case "failure", "inputFailure" -> ExecutionStatus.FAILED; + case "suspension" -> ExecutionStatus.PENDING; + default -> ExecutionStatus.SUCCEEDED; + }; assertEquals(expected, runner.run("input").getStatus()); } diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationEndFailureTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationEndFailureTest.java index cff654b99..d44a73a91 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationEndFailureTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationEndFailureTest.java @@ -34,13 +34,12 @@ class InvocationEndFailureTest { @SuppressWarnings("removal") void restoresContextWhenInvocationEndFails(boolean executionView, String phase, String failureKind) throws Exception { - Throwable failure = - switch (failureKind) { - case "exception" -> new IllegalStateException("telemetry failed"); - case "linkage" -> new NoClassDefFoundError("incompatible telemetry dependency"); - case "fatal" -> new InternalError("fatal telemetry failure"); - default -> new ThreadDeath(); - }; + Throwable failure = switch (failureKind) { + case "exception" -> new IllegalStateException("telemetry failed"); + case "linkage" -> new NoClassDefFoundError("incompatible telemetry dependency"); + case "fatal" -> new InternalError("fatal telemetry failure"); + default -> new ThreadDeath(); + }; var processor = new FailingProcessor(phase, failure); var builder = SdkTracerProvider.builder().addSpanProcessor(processor); var config = OtelPluginConfig.builder() @@ -92,20 +91,18 @@ public void onInvocationEnd(InvocationEndInfo info) { @MethodSource("combinedFailures") void preservesCombinedFinalizationAndScopeFailures(boolean executionView, String phase, String pair) throws Exception { - Throwable primary = - switch (pair.split("-")[0]) { - case "fatal" -> new InternalError("primary finalization"); - case "assert" -> new AssertionError("primary finalization"); - case "linkage" -> new NoClassDefFoundError("primary finalization"); - default -> new IllegalStateException("primary finalization"); - }; - Throwable cleanup = - switch (pair.split("-")[1]) { - case "fatal" -> new InternalError("scope cleanup"); - case "assert" -> new AssertionError("scope cleanup"); - case "same" -> primary; - default -> new IllegalStateException("scope cleanup"); - }; + Throwable primary = switch (pair.split("-")[0]) { + case "fatal" -> new InternalError("primary finalization"); + case "assert" -> new AssertionError("primary finalization"); + case "linkage" -> new NoClassDefFoundError("primary finalization"); + default -> new IllegalStateException("primary finalization"); + }; + Throwable cleanup = switch (pair.split("-")[1]) { + case "fatal" -> new InternalError("scope cleanup"); + case "assert" -> new AssertionError("scope cleanup"); + case "same" -> primary; + default -> new IllegalStateException("scope cleanup"); + }; var cleanupWins = List.of("runtime-fatal", "assert-fatal", "runtime-assert", "linkage-assert") .contains(pair); var expected = cleanupWins ? cleanup : primary; diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationOutcomeBoundaryTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationOutcomeBoundaryTest.java index f663951ab..2572d41ab 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationOutcomeBoundaryTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/InvocationOutcomeBoundaryTest.java @@ -433,19 +433,17 @@ public void onInvocationEnd(InvocationEndInfo info) { }) void preparationAndEndFailuresRetainPrimaryAndFatalIdentity( String preparationKind, String endKind, boolean serializeFailure, boolean inline) throws Exception { - Throwable original = - switch (preparationKind) { - case "vm", "wrapped" -> new InternalError("preparation fatal"); - case "death" -> new ThreadDeath(); - default -> new IllegalStateException("preparation failure"); - }; + Throwable original = switch (preparationKind) { + case "vm", "wrapped" -> new InternalError("preparation fatal"); + case "death" -> new ThreadDeath(); + default -> new IllegalStateException("preparation failure"); + }; var delivery = preparationKind.equals("wrapped") ? new CompletionException(original) : original; - Error endFailure = - switch (endKind) { - case "vm" -> new InternalError("end fatal"); - case "death" -> new ThreadDeath(); - default -> new AssertionError("end failure"); - }; + Error endFailure = switch (endKind) { + case "vm" -> new InternalError("end fatal"); + case "death" -> new ThreadDeath(); + default -> new AssertionError("end failure"); + }; var expected = preparationKind.equals("ordinary") && endKind.equals("vm") ? endFailure : original; var suppressed = expected == endFailure ? original : endFailure; var ends = new CopyOnWriteArrayList(); diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFailureBoundaryTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFailureBoundaryTest.java index 93cce8a8a..47daaf182 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFailureBoundaryTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFailureBoundaryTest.java @@ -91,13 +91,12 @@ void workerMdcRestorationFailureCannotStrandTheInvocation(boolean ambientMdc, bo var original = MDC.getMDCAdapter(); var injected = new AtomicBoolean(); var plugin = new RecordingPlugin(); - Throwable failure = - switch (failureKind) { - case "fatal" -> new InternalError("worker MDC restoration failed"); - case "assertion" -> new AssertionError("worker MDC restoration failed"); - case "linkage" -> new NoClassDefFoundError("worker MDC restoration failed"); - default -> new IllegalStateException("worker MDC restoration failed"); - }; + Throwable failure = switch (failureKind) { + case "fatal" -> new InternalError("worker MDC restoration failed"); + case "assertion" -> new AssertionError("worker MDC restoration failed"); + case "linkage" -> new NoClassDefFoundError("worker MDC restoration failed"); + default -> new IllegalStateException("worker MDC restoration failed"); + }; var ownerFailure = new AtomicReference(); var observed = new CountDownLatch(1); var workers = Executors.newSingleThreadExecutor(task -> { @@ -164,14 +163,13 @@ static Stream postEndFatalCases() { void postEndFatalReachesCallerAndWorkerWithoutChangingEnd( boolean inline, boolean suspend, boolean death, String wrapper) throws Exception { Error fatal = death ? new ThreadDeath() : new InternalError("post-End restore fatal"); - Throwable failure = - switch (wrapper) { - case "completion" -> new CompletionException(fatal); - case "execution" -> new ExecutionException(fatal); - case "reflection" -> new InvocationTargetException(fatal); - case "proxy" -> new UndeclaredThrowableException(fatal); - default -> fatal; - }; + Throwable failure = switch (wrapper) { + case "completion" -> new CompletionException(fatal); + case "execution" -> new ExecutionException(fatal); + case "reflection" -> new InvocationTargetException(fatal); + case "proxy" -> new UndeclaredThrowableException(fatal); + default -> fatal; + }; exercisePostEndFailure(inline, suspend, failure, fatal, null); } diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFatalInitializationTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFatalInitializationTest.java index 615a4be86..475e0f73d 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFatalInitializationTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcFatalInitializationTest.java @@ -44,27 +44,24 @@ class MdcFatalInitializationTest { void fatalCaptureSettlesCallerThenEscapesOwnerBeforeAnyHook(String mode, boolean death, String wrapper) throws Exception { Error fatal = death ? new ThreadDeath() : new InternalError("fatal capture"); - Throwable failure = - switch (wrapper) { - case "completion" -> new CompletionException(fatal); - case "nested" -> new CompletionException(new ExecutionException(fatal)); - case "reflection" -> new InvocationTargetException(fatal); - case "proxy" -> new UndeclaredThrowableException(fatal); - default -> fatal; - }; + Throwable failure = switch (wrapper) { + case "completion" -> new CompletionException(fatal); + case "nested" -> new CompletionException(new ExecutionException(fatal)); + case "reflection" -> new InvocationTargetException(fatal); + case "proxy" -> new UndeclaredThrowableException(fatal); + default -> fatal; + }; runCapture(mode, failure, fatal); } @ParameterizedTest @MethodSource("ordinaryCases") void nonfatalInitializationKeepsItsDurableFailurePolicy(String mode, String kind) throws Exception { - Throwable failure = - switch (kind) { - case "assertion" -> new AssertionError("ordinary capture"); - case "application-cause" -> - new IllegalStateException("ordinary capture", new InternalError("diagnostic")); - default -> new IllegalStateException("ordinary capture"); - }; + Throwable failure = switch (kind) { + case "assertion" -> new AssertionError("ordinary capture"); + case "application-cause" -> new IllegalStateException("ordinary capture", new InternalError("diagnostic")); + default -> new IllegalStateException("ordinary capture"); + }; runCapture(mode, failure, null); } diff --git a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcWorkerReuseBoundaryTest.java b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcWorkerReuseBoundaryTest.java index 60d7224c6..7072ddfe8 100644 --- a/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcWorkerReuseBoundaryTest.java +++ b/otel-plugin/src/test/java/software/amazon/lambda/durable/otel/MdcWorkerReuseBoundaryTest.java @@ -80,20 +80,18 @@ private static void exercise(String markerPhase, boolean suspend, String kind, E var failed = new AtomicBoolean(); var clearTried = new AtomicBoolean(); var restoreFailure = new IllegalStateException("restore failed"); - Error clearFatal = - switch (kind) { - case "vm", "wrapped-vm" -> new InternalError("fallback fatal"); - case "death", "wrapped-death" -> new ThreadDeath(); - default -> null; - }; - Throwable clearFailure = - switch (kind) { - case "ordinary" -> new IllegalArgumentException("clear failed"); - case "assertion" -> new AssertionError("clear failed"); - case "same" -> restoreFailure; - case "wrapped-vm", "wrapped-death" -> new CompletionException(new ExecutionException(clearFatal)); - default -> clearFatal; - }; + Error clearFatal = switch (kind) { + case "vm", "wrapped-vm" -> new InternalError("fallback fatal"); + case "death", "wrapped-death" -> new ThreadDeath(); + default -> null; + }; + Throwable clearFailure = switch (kind) { + case "ordinary" -> new IllegalArgumentException("clear failed"); + case "assertion" -> new AssertionError("clear failed"); + case "same" -> restoreFailure; + case "wrapped-vm", "wrapped-death" -> new CompletionException(new ExecutionException(clearFatal)); + default -> clearFatal; + }; Error expectedFatal = selectedFatal != null ? selectedFatal : clearFatal; var escaped = new CountDownLatch(1); var failedWorker = new AtomicReference(); diff --git a/pom.xml b/pom.xml index 113865d9b..d57477e76 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,6 @@ - 2.98.0 true diff --git a/sdk-integration-tests/src/test/java/software/amazon/lambda/durable/ContinuationEndCleanupOrderTest.java b/sdk-integration-tests/src/test/java/software/amazon/lambda/durable/ContinuationEndCleanupOrderTest.java index 23a4784eb..de8b5c5e0 100644 --- a/sdk-integration-tests/src/test/java/software/amazon/lambda/durable/ContinuationEndCleanupOrderTest.java +++ b/sdk-integration-tests/src/test/java/software/amazon/lambda/durable/ContinuationEndCleanupOrderTest.java @@ -48,13 +48,12 @@ static Stream cleanupCases() { void continuationFailureMustWakeBodyBeforeEndWaitsForCleanup(String mode, String kind) throws Exception { boolean rejection = kind.equals("reject"); boolean withPlugin = true; - Throwable failure = - switch (kind) { - case "reject" -> new RejectedExecutionException("resumed worker rejected"); - case "vm" -> new InternalError("resumed state fatal"); - case "death" -> new ThreadDeath(); - default -> new IllegalArgumentException("resumed state cannot deserialize"); - }; + Throwable failure = switch (kind) { + case "reject" -> new RejectedExecutionException("resumed worker rejected"); + case "vm" -> new InternalError("resumed state fatal"); + case "death" -> new ThreadDeath(); + default -> new IllegalArgumentException("resumed state cannot deserialize"); + }; var injectionThread = new AtomicReference(); var handlerThread = new AtomicReference(); var callerThread = new AtomicReference(); diff --git a/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/cloud/HistoryEventProcessor.java b/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/cloud/HistoryEventProcessor.java index e0de1dc0e..be5973eea 100644 --- a/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/cloud/HistoryEventProcessor.java +++ b/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/cloud/HistoryEventProcessor.java @@ -320,50 +320,48 @@ private Operation createCallbackOperation(String id, String name, OperationStatu private Operation createInvokeOperation(String id, Event event) { var builder = ChainedInvokeDetails.builder(); - OperationStatus status = - switch (event.eventType()) { - case CHAINED_INVOKE_STARTED -> OperationStatus.STARTED; - case CHAINED_INVOKE_SUCCEEDED -> { - var details = event.callbackSucceededDetails(); - if (details != null - && details.result() != null - && details.result().payload() != null) { - builder.result(details.result().payload()); - } - yield OperationStatus.SUCCEEDED; - } - case CHAINED_INVOKE_FAILED -> { - var details = event.callbackFailedDetails(); - if (details != null - && details.error() != null - && details.error().payload() != null) { - builder.error(details.error().payload()); - } - yield OperationStatus.FAILED; - } - case CHAINED_INVOKE_STOPPED -> { - var details = event.chainedInvokeStoppedDetails(); - if (details != null - && details.error() != null - && details.error().payload() != null) { - builder.error(details.error().payload()); - } + OperationStatus status = switch (event.eventType()) { + case CHAINED_INVOKE_STARTED -> OperationStatus.STARTED; + case CHAINED_INVOKE_SUCCEEDED -> { + var details = event.callbackSucceededDetails(); + if (details != null + && details.result() != null + && details.result().payload() != null) { + builder.result(details.result().payload()); + } + yield OperationStatus.SUCCEEDED; + } + case CHAINED_INVOKE_FAILED -> { + var details = event.callbackFailedDetails(); + if (details != null + && details.error() != null + && details.error().payload() != null) { + builder.error(details.error().payload()); + } + yield OperationStatus.FAILED; + } + case CHAINED_INVOKE_STOPPED -> { + var details = event.chainedInvokeStoppedDetails(); + if (details != null + && details.error() != null + && details.error().payload() != null) { + builder.error(details.error().payload()); + } - yield OperationStatus.STOPPED; - } - case CHAINED_INVOKE_TIMED_OUT -> { - var details = event.chainedInvokeTimedOutDetails(); - if (details != null - && details.error() != null - && details.error().payload() != null) { - builder.error(details.error().payload()); - } - yield OperationStatus.TIMED_OUT; - } - default -> - throw new UnsupportedOperationException( - "Unknown chained invocation operation: " + event.eventType()); - }; + yield OperationStatus.STOPPED; + } + case CHAINED_INVOKE_TIMED_OUT -> { + var details = event.chainedInvokeTimedOutDetails(); + if (details != null + && details.error() != null + && details.error().payload() != null) { + builder.error(details.error().payload()); + } + yield OperationStatus.TIMED_OUT; + } + default -> + throw new UnsupportedOperationException("Unknown chained invocation operation: " + event.eventType()); + }; return Operation.builder() .id(id) diff --git a/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/local/EventProcessor.java b/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/local/EventProcessor.java index bdd50f31d..98043e00b 100644 --- a/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/local/EventProcessor.java +++ b/sdk-testing/src/main/java/software/amazon/lambda/durable/testing/local/EventProcessor.java @@ -23,16 +23,15 @@ void processUpdate(OperationUpdate update, Operation operation) { .name(update.name()) .parentId(operation.parentId()); - Event event = - switch (update.type()) { - case STEP -> buildStepEvent(builder, update, operation); - case WAIT -> buildWaitEvent(builder, update, operation); - case CHAINED_INVOKE -> buildInvokeEvent(builder, update, operation); - case EXECUTION -> buildExecutionEvent(builder, update); - case CALLBACK -> buildCallbackEvent(builder, update); - case CONTEXT -> buildContextEvent(builder, update); - default -> throw new IllegalArgumentException("Unsupported operation type: " + update.type()); - }; + Event event = switch (update.type()) { + case STEP -> buildStepEvent(builder, update, operation); + case WAIT -> buildWaitEvent(builder, update, operation); + case CHAINED_INVOKE -> buildInvokeEvent(builder, update, operation); + case EXECUTION -> buildExecutionEvent(builder, update); + case CALLBACK -> buildCallbackEvent(builder, update); + case CONTEXT -> buildContextEvent(builder, update); + default -> throw new IllegalArgumentException("Unsupported operation type: " + update.type()); + }; allEvents.add(event); } diff --git a/sdk/src/test/java/software/amazon/lambda/durable/execution/ExecutionManagerTest.java b/sdk/src/test/java/software/amazon/lambda/durable/execution/ExecutionManagerTest.java index 872a69181..afecc8ddb 100644 --- a/sdk/src/test/java/software/amazon/lambda/durable/execution/ExecutionManagerTest.java +++ b/sdk/src/test/java/software/amazon/lambda/durable/execution/ExecutionManagerTest.java @@ -68,13 +68,12 @@ void bodySelectedBeforeManagerTerminationRetainsItsOutcome(String kind) { try (var manager = createManager(List.of(executionOp()))) { var body = new CompletableFuture(); var selected = manager.runUntilCompleteOrSuspend(body); - Throwable failure = - switch (kind) { - case "ordinary" -> new IllegalArgumentException("body failure"); - case "vm" -> new InternalError("body fatal"); - case "death" -> new ThreadDeath(); - default -> null; - }; + Throwable failure = switch (kind) { + case "ordinary" -> new IllegalArgumentException("body failure"); + case "vm" -> new InternalError("body fatal"); + case "death" -> new ThreadDeath(); + default -> null; + }; if (failure == null) body.complete("body success"); else body.completeExceptionally(failure); var later = new UnrecoverableDurableExecutionException(