From ec4e9595ce580424581b7b84cec8fe103802159b Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 10:05:11 -0600 Subject: [PATCH 1/7] Demo: Boot 3 + Jackson 3 version mismatch (PR #189) Adds a bootCompatTest suite to conductor-client-spring that resolves the starter against a Spring Boot BOM via enforcedPlatform, the way a real Boot app does, and a CI matrix that runs it three ways: - Boot 3.5.12 + Jackson 3.1.7: fails at startup (annotations 2.19.4 lacks JsonSerializeAs) - Boot 3.5.13 + Jackson 3.1.7: passes (annotations 2.21) - Boot 3.5.16 + Jackson 3.2.3: starts, worker fails (Boot forces Kotlin 1.9.25; jackson-module-kotlin 3.2 needs kotlin.time.Instant) Throwaway branch for demonstration; not meant to merge. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/boot3-compat-demo.yml | 91 +++++++++++++++++++ conductor-client-spring/build.gradle | 39 ++++++++ .../spring/compat/Boot3StartupTest.java | 40 ++++++++ .../client/spring/compat/Boot3WorkerTest.java | 61 +++++++++++++ 4 files changed, 231 insertions(+) create mode 100644 .github/workflows/boot3-compat-demo.yml create mode 100644 conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3StartupTest.java create mode 100644 conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3WorkerTest.java diff --git a/.github/workflows/boot3-compat-demo.yml b/.github/workflows/boot3-compat-demo.yml new file mode 100644 index 000000000..bda6a4b80 --- /dev/null +++ b/.github/workflows/boot3-compat-demo.yml @@ -0,0 +1,91 @@ +# Demo for PR #189 (Jackson 3). In a Spring Boot 3 app, Boot's BOM picks the +# jackson-annotations and Kotlin versions, while the SDK picks the Jackson 3 engine. +# When the engine needs newer ones than Boot supplies, the app fails with NoClassDefFoundError. +name: Boot 3 compatibility demo + +on: + push: + branches: + - demo/boot3-jackson-annotations + +jobs: + boot3-compat: + name: Boot ${{ matrix.boot }} + Jackson ${{ matrix.jackson || '3.1.7 (PR default)' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - boot: '3.5.12' + jackson: '' + expect: fail + why: 'annotations 2.19 < 2.21 needed by Jackson 3.1.7, so the app fails to start' + - boot: '3.5.13' + jackson: '' + expect: pass + why: 'annotations 2.21 is what Jackson 3.1.7 needs' + - boot: '3.5.16' + jackson: '3.2.3' + expect: fail + why: 'Kotlin 1.9 forced by Boot (first of two blockers; annotations 2.21 < 2.22 is the second)' + env: + COMPAT_ARGS: -PcompatBootVersion=${{ matrix.boot }} ${{ matrix.jackson && format('-PcompatJacksonVersion={0}', matrix.jackson) || '' }} + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Zulu JDK 21 + uses: actions/setup-java@v5 + with: + distribution: "zulu" + java-version: "21" + + - name: Show resolved versions + id: versions + run: | + resolved() { + local out + out=$(./gradlew -q :conductor-client-spring:dependencyInsight \ + --configuration bootCompatTestRuntimeClasspath --dependency "$1" $COMPAT_ARGS) + echo "$out" | awk 'NR==1 {print $1}' | awk -F: '{print $NF}' + } + annotations=$(resolved com.fasterxml.jackson.core:jackson-annotations) + engine=$(resolved tools.jackson.core:jackson-databind) + kotlin=$(resolved org.jetbrains.kotlin:kotlin-stdlib) + echo "jackson-annotations=$annotations jackson-databind=$engine kotlin-stdlib=$kotlin" + { + echo "annotations=$annotations" + echo "engine=$engine" + echo "kotlin=$kotlin" + } >> "$GITHUB_OUTPUT" + + - name: Run Boot 3 compatibility tests + id: tests + run: ./gradlew :conductor-client-spring:bootCompatTest $COMPAT_ARGS + + - name: Summary + if: always() + env: + BOOT: ${{ matrix.boot }} + EXPECT: ${{ matrix.expect }} + WHY: ${{ matrix.why }} + OUTCOME: ${{ steps.tests.outcome }} + ANNOTATIONS: ${{ steps.versions.outputs.annotations }} + ENGINE: ${{ steps.versions.outputs.engine }} + KOTLIN: ${{ steps.versions.outputs.kotlin }} + run: | + actual=$([ "$OUTCOME" = success ] && echo pass || echo fail) + verdict=$([ "$actual" = "$EXPECT" ] && echo "as predicted" || echo "UNEXPECTED") + errors=$(grep -rhoE 'NoClassDefFoundError: [A-Za-z0-9/_$]+' \ + conductor-client-spring/build/test-results/bootCompatTest/ 2>/dev/null | sort -u | paste -sd ',' - || true) + { + echo "### Boot $BOOT: $actual ($verdict)" + echo + echo "| Boot | Jackson engine | jackson-annotations | Kotlin | Expected | Actual | Error |" + echo "|---|---|---|---|---|---|---|" + echo "| $BOOT | $ENGINE | $ANNOTATIONS | $KOTLIN | $EXPECT | $actual | ${errors:-none} |" + echo + echo "Why: $WHY" + } >> "$GITHUB_STEP_SUMMARY" + cat "$GITHUB_STEP_SUMMARY" diff --git a/conductor-client-spring/build.gradle b/conductor-client-spring/build.gradle index 4fda65695..34e6452db 100644 --- a/conductor-client-spring/build.gradle +++ b/conductor-client-spring/build.gradle @@ -32,3 +32,42 @@ java { test { useJUnitPlatform() } + +// Runs the starter on the dependency versions a real Spring Boot app resolves. +// enforcedPlatform makes Boot's BOM win, like spring-boot-starter-parent does, +// so jackson-annotations comes from Boot rather than from our Jackson 3 BOM. +// -PcompatBootVersion=3.5.12 Boot BOM to resolve against +// -PcompatJacksonVersion=3.2.3 optional: force a different Jackson 3 engine +def compatBoot = findProperty('compatBootVersion') ?: '3.5.13' +def compatJackson = findProperty('compatJacksonVersion') + +testing { + suites { + bootCompatTest(JvmTestSuite) { + useJUnitJupiter() + dependencies { + implementation project() + implementation enforcedPlatform("org.springframework.boot:spring-boot-dependencies:${compatBoot}") + implementation 'org.springframework.boot:spring-boot-starter-test' + if (compatJackson) { + ['tools.jackson.core:jackson-databind', + 'tools.jackson.core:jackson-core', + 'tools.jackson.module:jackson-module-kotlin'].each { coord -> + implementation(coord) { version { strictly compatJackson } } + } + } + } + targets.all { + testTask.configure { + // Fresh JVM per test class so each one reports the root + // NoClassDefFoundError, not "Could not initialize class". + forkEvery = 1 + testLogging { + events 'passed', 'failed' + exceptionFormat 'full' + } + } + } + } + } +} diff --git a/conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3StartupTest.java b/conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3StartupTest.java new file mode 100644 index 000000000..2853fa108 --- /dev/null +++ b/conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3StartupTest.java @@ -0,0 +1,40 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.netflix.conductor.client.spring.compat; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfigurations; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +import com.netflix.conductor.client.http.ConductorClient; +import com.netflix.conductor.client.spring.ConductorClientAutoConfiguration; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Does a Boot app using the starter start up? ConductorClient builds its Jackson + * mapper in its constructor, so an incompatible jackson-annotations jar fails here. + */ +class Boot3StartupTest { + + @Test + void applicationContextStarts() { + new ApplicationContextRunner() + .withConfiguration(AutoConfigurations.of(ConductorClientAutoConfiguration.class)) + .withPropertyValues("conductor.client.base-path=http://localhost:8080/api") + .run(context -> { + assertThat(context).hasNotFailed(); + assertThat(context).hasSingleBean(ConductorClient.class); + }); + } +} diff --git a/conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3WorkerTest.java b/conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3WorkerTest.java new file mode 100644 index 000000000..bbc1adfe2 --- /dev/null +++ b/conductor-client-spring/src/bootCompatTest/java/com/netflix/conductor/client/spring/compat/Boot3WorkerTest.java @@ -0,0 +1,61 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.netflix.conductor.client.spring.compat; + +import java.util.Map; + +import org.junit.jupiter.api.Test; + +import com.netflix.conductor.common.metadata.tasks.Task; +import com.netflix.conductor.common.metadata.tasks.TaskResult; +import com.netflix.conductor.sdk.workflow.executor.task.AnnotatedWorker; +import com.netflix.conductor.sdk.workflow.task.InputParam; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Can a worker do its job? Task input is bound to a POJO and the returned POJO is + * converted back to output data, both through the SDK's Jackson mapper. + */ +class Boot3WorkerTest { + + public static class Person { + public String name; + } + + public static class Greeting { + public String greeting; + } + + public static class Greeter { + public Greeting greet(@InputParam("person") Person person) { + Greeting result = new Greeting(); + result.greeting = "Hello " + person.name; + return result; + } + } + + @Test + void annotatedWorkerRoundTrip() throws Exception { + AnnotatedWorker worker = new AnnotatedWorker( + "greet", Greeter.class.getMethod("greet", Person.class), new Greeter()); + Task task = new Task(); + task.setStatus(Task.Status.IN_PROGRESS); + task.setInputData(Map.of("person", Map.of("name", "Ada"))); + + TaskResult result = worker.execute(task); + + assertThat(result.getStatus()).isEqualTo(TaskResult.Status.COMPLETED); + assertThat(result.getOutputData()).containsEntry("greeting", "Hello Ada"); + } +} From c249b8969b441d53ddf2b63df7f1295f377ae5fd Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 10:10:12 -0600 Subject: [PATCH 2/7] Explain incompatible Jackson classpaths at startup ObjectMapperProvider now converts one small bean right after building the mapper, so a missing Jackson, annotations or Kotlin class fails at startup instead of on the first task. A LinkageError is rethrown as an IllegalStateException that names the missing class, the jackson-databind, jackson-annotations and kotlin-stdlib versions found, and the Spring Boot 3 fix (Boot 3.5.13+, or jackson-bom.version=2.21.x). The demo workflow summary now shows that message for failing jobs. With the self-check, the Boot 3.5.16 + Jackson 3.2.3 job fails at startup too. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/boot3-compat-demo.yml | 13 +- .../common/config/ObjectMapperProvider.java | 119 ++++++++++++++++-- 2 files changed, 118 insertions(+), 14 deletions(-) diff --git a/.github/workflows/boot3-compat-demo.yml b/.github/workflows/boot3-compat-demo.yml index bda6a4b80..eb0e4899e 100644 --- a/.github/workflows/boot3-compat-demo.yml +++ b/.github/workflows/boot3-compat-demo.yml @@ -77,8 +77,11 @@ jobs: run: | actual=$([ "$OUTCOME" = success ] && echo pass || echo fail) verdict=$([ "$actual" = "$EXPECT" ] && echo "as predicted" || echo "UNEXPECTED") - errors=$(grep -rhoE 'NoClassDefFoundError: [A-Za-z0-9/_$]+' \ - conductor-client-spring/build/test-results/bootCompatTest/ 2>/dev/null | sort -u | paste -sd ',' - || true) + results=conductor-client-spring/build/test-results/bootCompatTest/ + errors=$(grep -rhoE 'NoClassDefFoundError: [A-Za-z0-9/_$]+' "$results" 2>/dev/null \ + | sort -u | paste -sd ',' - || true) + sdk_message=$(grep -rhoE 'Conductor SDK could not start Jackson[^<&"]*' "$results" 2>/dev/null \ + | sort -u | head -1 || true) { echo "### Boot $BOOT: $actual ($verdict)" echo @@ -87,5 +90,11 @@ jobs: echo "| $BOOT | $ENGINE | $ANNOTATIONS | $KOTLIN | $EXPECT | $actual | ${errors:-none} |" echo echo "Why: $WHY" + if [ -n "$sdk_message" ]; then + echo + echo "What the user sees:" + echo + echo "> $sdk_message" + fi } >> "$GITHUB_STEP_SUMMARY" cat "$GITHUB_STEP_SUMMARY" diff --git a/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java b/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java index 1ba5e26bf..a8558f4b6 100644 --- a/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java +++ b/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java @@ -12,6 +12,9 @@ */ package com.netflix.conductor.common.config; +import java.io.InputStream; +import java.util.Properties; + import com.fasterxml.jackson.annotation.JsonInclude; import tools.jackson.databind.DeserializationFeature; import tools.jackson.databind.ObjectMapper; @@ -22,6 +25,10 @@ public class ObjectMapperProvider { + // Keep in sync with jacksonBom in versions.gradle: the jackson-annotations release that + // the Jackson 3 engine was built against. + private static final String MIN_JACKSON_ANNOTATIONS = "2.21"; + private static final ObjectMapper objectMapper = _getObjectMapper(); public ObjectMapper getObjectMapper() { @@ -39,17 +46,105 @@ public ObjectMapper getObjectMapper() { * payload format seen by the server and stored task/workflow documents. */ private static ObjectMapper _getObjectMapper() { - return JsonMapper.builder() - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES) - .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) - .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) - .enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS) - .changeDefaultPropertyInclusion( - value -> - JsonInclude.Value.construct( - JsonInclude.Include.NON_NULL, JsonInclude.Include.ALWAYS)) - .addModule(new KotlinModule.Builder().build()) - .build(); + try { + ObjectMapper mapper = + JsonMapper.builder() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES) + .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + .enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS) + .changeDefaultPropertyInclusion( + value -> + JsonInclude.Value.construct( + JsonInclude.Include.NON_NULL, + JsonInclude.Include.ALWAYS)) + .addModule(new KotlinModule.Builder().build()) + .build(); + selfCheck(mapper); + return mapper; + } catch (RuntimeException | LinkageError e) { + LinkageError missing = findLinkageError(e); + if (missing == null) { + throw e; + } + throw new IllegalStateException(incompatibleJacksonMessage(missing), e); + } + } + + /** + * Some classes Jackson needs are only loaded the first time it inspects a bean, so convert + * one here. An incompatible classpath then fails at startup, not on the first task. + */ + private static void selfCheck(ObjectMapper mapper) { + SelfCheck value = new SelfCheck(); + value.value = "ok"; + mapper.readValue(mapper.writeValueAsString(value), SelfCheck.class); + } + + public static class SelfCheck { + public String value; + } + + private static LinkageError findLinkageError(Throwable t) { + for (Throwable cause = t; cause != null; cause = cause.getCause()) { + if (cause instanceof LinkageError linkageError) { + return linkageError; + } + } + return null; + } + + private static String incompatibleJacksonMessage(LinkageError e) { + String missing = String.valueOf(e.getMessage()); + String hint; + if (missing.startsWith("com/fasterxml/jackson/annotation/")) { + hint = "jackson-annotations is older than this Jackson version needs."; + } else if (missing.startsWith("kotlin/")) { + hint = "kotlin-stdlib is older than this Jackson version needs."; + } else { + hint = "A Jackson dependency is older than this Jackson version needs."; + } + return "Conductor SDK could not start Jackson: missing class " + + missing + + ". " + + hint + + " Found jackson-databind " + + mavenVersion("tools.jackson.core", "jackson-databind") + + ", jackson-annotations " + + mavenVersion("com.fasterxml.jackson.core", "jackson-annotations") + + ", kotlin-stdlib " + + kotlinVersion() + + ". A dependency BOM most likely forced an older version; in a Spring Boot 3 app," + + " Boot's BOM manages jackson-annotations and Kotlin. This SDK needs" + + " jackson-annotations " + + MIN_JACKSON_ANNOTATIONS + + " or later: use Spring Boot 3.5.13 or later, or set the jackson-bom.version" + + " property to " + + MIN_JACKSON_ANNOTATIONS + + ".x."; + } + + private static String mavenVersion(String group, String artifact) { + String path = "META-INF/maven/" + group + "/" + artifact + "/pom.properties"; + try (InputStream in = ObjectMapperProvider.class.getClassLoader().getResourceAsStream(path)) { + if (in == null) { + return "unknown"; + } + Properties properties = new Properties(); + properties.load(in); + return properties.getProperty("version", "unknown"); + } catch (Exception | LinkageError ignored) { + return "unknown"; + } + } + + private static String kotlinVersion() { + try { + String version = Class.forName("kotlin.Unit").getPackage().getImplementationVersion(); + return version == null ? "unknown" : version; + } catch (Exception | LinkageError ignored) { + return "not on classpath"; + } } } From 546dc4c7a07f4a93e044f876566f90ac7e17f463 Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 10:10:12 -0600 Subject: [PATCH 3/7] Document the Spring Boot 3 floor for Jackson 3 Spring Boot 3.5.12 and earlier pin jackson-annotations below 2.21, which Jackson 3.1 needs. Document Boot 3.5.13+ (or the jackson-bom.version override) in the Boot 3 starter README, add a troubleshooting row for the startup error, and note next to jacksonBom that Jackson 3.2+ drops Boot 3. Co-Authored-By: Claude Opus 5.5 --- README.md | 1 + conductor-client-spring/README.md | 20 +++++++++++++++++++- versions.gradle | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 580147832..b1ad7c429 100644 --- a/README.md +++ b/README.md @@ -204,6 +204,7 @@ For worker patterns, workflow definitions, and testing, continue with the [core | Task remains `SCHEDULED` | A worker is polling the exact task type and has enough threads. | | Authentication failure | `CONDUCTOR_AUTH_KEY` and `CONDUCTOR_AUTH_SECRET` are set for the target server. | | AI agent cannot call a model | The server—not only the client process—has a configured LLM provider and model. | +| `Conductor SDK could not start Jackson` at startup | On Spring Boot 3, use 3.5.13+ or set `jackson-bom.version` to 2.21.x; see [older Spring Boot 3 versions](conductor-client-spring/README.md#older-spring-boot-3-versions). | ## Support and project policies diff --git a/conductor-client-spring/README.md b/conductor-client-spring/README.md index 023b860e0..6e8e1923b 100644 --- a/conductor-client-spring/README.md +++ b/conductor-client-spring/README.md @@ -2,7 +2,7 @@ Spring Boot 3 auto-configuration for the Conductor core client, workflow SDK, and Java workers. -**Prerequisites:** Java 21+, Spring Boot 3, and a running [OSS or Orkes Conductor server](../docs/connection-authentication.md). For Spring Boot 4, use [the Boot 4 module](../conductor-client-spring-boot4/README.md). +**Prerequisites:** Java 21+, Spring Boot 3.5.13+ (see [Older Spring Boot 3 versions](#older-spring-boot-3-versions)), and a running [OSS or Orkes Conductor server](../docs/connection-authentication.md). For Spring Boot 4, use [the Boot 4 module](../conductor-client-spring-boot4/README.md). ## Install @@ -20,6 +20,24 @@ implementation 'org.conductoross:conductor-client-spring:' ``` +### Older Spring Boot 3 versions + +The SDK uses Jackson 3, which needs `com.fasterxml.jackson.core:jackson-annotations` 2.21 or later. Spring Boot's dependency management picks that version for your app, and Spring Boot 3.5.12 and earlier pick an older one. The app then fails at startup with `Conductor SDK could not start Jackson: missing class com/fasterxml/jackson/annotation/...`. + +Upgrade to Spring Boot 3.5.13 or later, or override Boot's Jackson version: + +```xml + + + 2.21.4 + +``` + +```groovy +// Gradle, with the io.spring.dependency-management plugin +ext['jackson-bom.version'] = '2.21.4' +``` + ## Configure ```properties diff --git a/versions.gradle b/versions.gradle index 7f4f144f6..811e9a1e6 100644 --- a/versions.gradle +++ b/versions.gradle @@ -2,6 +2,10 @@ ext { versions = [ okHttp : '4.12.0', guava : '33.6.0-jre', + // Spring Boot 3 apps get jackson-annotations (max 2.21, Boot 3.5.13+) and Kotlin + // (1.9) from Boot's BOM. Jackson 3.2+ needs annotations 2.22 and Kotlin 2.x, so + // moving past 3.1.x drops Boot 3 support. Keep MIN_JACKSON_ANNOTATIONS in + // ObjectMapperProvider in sync. jacksonBom : '3.1.7', archaius : '0.7.12', slf4j : '1.7.36', From c656bab1df6337886aec59d554d69375f22a182a Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 10:33:56 -0600 Subject: [PATCH 4/7] Run bootCompatTest in the normal build check now depends on bootCompatTest, so ./gradlew build runs it against the default Boot 3.5.13 BOM (the oldest supported Boot 3). The CI test report also picks up its results. Demo only: ci.yml also runs on pushes to demo/boot3-jackson-annotations so the build can be seen running the suite. Remove that trigger before merging. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 4 +++- conductor-client-spring/build.gradle | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecca05d7a..eb336ec7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,8 @@ on: push: branches: - main + # Demo only: shows bootCompatTest running in the normal build. Remove before merging. + - demo/boot3-jackson-annotations pull_request: branches: - main @@ -148,7 +150,7 @@ jobs: if: always() uses: mikepenz/action-junit-report@v6 with: - report_paths: '**/build/test-results/test/TEST-*.xml' + report_paths: '**/build/test-results/{test,bootCompatTest}/TEST-*.xml' - name: Check Tests Status if: steps.tests.outcome == 'failure' diff --git a/conductor-client-spring/build.gradle b/conductor-client-spring/build.gradle index 34e6452db..eac3d0bba 100644 --- a/conductor-client-spring/build.gradle +++ b/conductor-client-spring/build.gradle @@ -71,3 +71,6 @@ testing { } } } + +// Run the suite (on the default, oldest supported Boot 3) in every build. +tasks.named('check') { dependsOn testing.suites.bootCompatTest } From 54f8bd613885d32e9b1787b3f9b328e751ae225b Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 10:51:59 -0600 Subject: [PATCH 5/7] Demo: worker input/output changes between SDK 6.0.2 and Jackson 3 Adds demo/worker-compat, a standalone Gradle build with ordinary worker code compiled against a chosen conductor-client version, and a CI matrix that runs it against the released 6.0.2 (Jackson 2) and against this branch (published to a job-local Maven repo). Each test asserts the 6.0.2 behavior: enum with custom toString(), getter- only list, final field, Duration, Jackson 2 @JsonNaming/@JsonSerialize, and a Jackson 2 JsonNode in the output. Outputs are checked on the JSON that TaskClient.updateTask() sends to a fake server. Locally: 8/8 pass on 6.0.2, 8/8 fail on this branch. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/worker-compat-demo.yml | 70 ++++++ demo/worker-compat/build.gradle | 37 +++ demo/worker-compat/settings.gradle | 2 + .../java/workercompat/WorkerCompatTest.java | 230 ++++++++++++++++++ 4 files changed, 339 insertions(+) create mode 100644 .github/workflows/worker-compat-demo.yml create mode 100644 demo/worker-compat/build.gradle create mode 100644 demo/worker-compat/settings.gradle create mode 100644 demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java diff --git a/.github/workflows/worker-compat-demo.yml b/.github/workflows/worker-compat-demo.yml new file mode 100644 index 000000000..370210681 --- /dev/null +++ b/.github/workflows/worker-compat-demo.yml @@ -0,0 +1,70 @@ +# Demo for PR #189 (Jackson 3), issues 2 and 3: the same worker code against the released +# Jackson 2 SDK (6.0.2) and against this branch. Each test asserts the 6.0.2 behavior, so a +# red test on this branch is a change worker authors would see after upgrading. +name: Worker compatibility demo + +on: + push: + branches: + - demo/boot3-jackson-annotations + +jobs: + worker-compat: + name: ${{ matrix.label }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - label: SDK 6.0.2 (released, Jackson 2) + sdk: '6.0.2' + build: false + - label: SDK from this branch (Jackson 3) + sdk: '0.0.0-pr189-demo' + build: true + env: + DEMO_M2: ${{ github.workspace }}/build/demo-m2 + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Zulu JDK 21 + uses: actions/setup-java@v5 + with: + distribution: "zulu" + java-version: "21" + + - name: Publish this branch's SDK to a local Maven repo + if: matrix.build + run: ./gradlew :conductor-client:publishToMavenLocal -Pversion=${{ matrix.sdk }} -Dmaven.repo.local="$DEMO_M2" + + - name: Run worker tests + id: tests + run: ./gradlew -p demo/worker-compat test -PsdkVersion=${{ matrix.sdk }} -Dmaven.repo.local="$DEMO_M2" + + - name: Summary + if: always() + env: + LABEL: ${{ matrix.label }} + run: | + python3 - <<'EOF' >> "$GITHUB_STEP_SUMMARY" + import glob, os, xml.etree.ElementTree as ET + rows = [] + for path in glob.glob('demo/worker-compat/build/test-results/test/*.xml'): + for case in ET.parse(path).getroot().iter('testcase'): + failure = case.find('failure') + detail = '' + if failure is not None: + detail = ' '.join((failure.get('message') or '').split())[:160] + detail = detail.replace('|', '\\|') + rows.append((case.get('name'), failure is None, detail)) + rows.sort() + print(f"### {os.environ['LABEL']}") + print() + print("| Behavior (as in SDK 6.0.2) | Result | What happened instead |") + print("|---|---|---|") + for name, ok, detail in rows: + print(f"| {name} | {'✅' if ok else '❌'} | {detail} |") + EOF + cat "$GITHUB_STEP_SUMMARY" diff --git a/demo/worker-compat/build.gradle b/demo/worker-compat/build.gradle new file mode 100644 index 000000000..cf95fcb8b --- /dev/null +++ b/demo/worker-compat/build.gradle @@ -0,0 +1,37 @@ +// Worker code compiled against a chosen conductor-client release. +// -PsdkVersion=6.0.2 released SDK (Jackson 2), from Maven Central +// -PsdkVersion=0.0.0-pr189-demo this branch, published with publishToMavenLocal +plugins { + id 'java' +} + +def sdkVersion = findProperty('sdkVersion') ?: '6.0.2' + +repositories { + mavenLocal() + mavenCentral() +} + +java { + sourceCompatibility = 21 + targetCompatibility = 21 +} + +dependencies { + testImplementation "org.conductoross:conductor-client:${sdkVersion}" + // The worker app's own Jackson 2, e.g. from Spring Boot 3 or a REST client. + testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.18.6' + + testImplementation platform('org.junit:junit-bom:5.11.4') + testImplementation 'org.junit.jupiter:junit-jupiter' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testImplementation 'org.assertj:assertj-core:3.26.3' +} + +test { + useJUnitPlatform() + testLogging { + events 'passed', 'failed' + exceptionFormat 'short' + } +} diff --git a/demo/worker-compat/settings.gradle b/demo/worker-compat/settings.gradle new file mode 100644 index 000000000..2bb91554f --- /dev/null +++ b/demo/worker-compat/settings.gradle @@ -0,0 +1,2 @@ +// Standalone build: depends on a published conductor-client, like a user's project. +rootProject.name = 'worker-compat' diff --git a/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java b/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java new file mode 100644 index 000000000..6a3b40d6d --- /dev/null +++ b/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java @@ -0,0 +1,230 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package workercompat; + +import java.net.InetSocketAddress; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import com.netflix.conductor.client.http.ConductorClient; +import com.netflix.conductor.client.http.TaskClient; +import com.netflix.conductor.common.metadata.tasks.Task; +import com.netflix.conductor.common.metadata.tasks.TaskResult; +import com.netflix.conductor.sdk.workflow.executor.task.AnnotatedWorker; +import com.netflix.conductor.sdk.workflow.task.InputParam; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.sun.net.httpserver.HttpServer; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +/** + * Ordinary worker code. Every test asserts what the Jackson 2 SDK (6.0.2) does, so it passes on + * 6.0.2 and shows what changes for the same code on the Jackson 3 SDK. + * + *

Inputs are checked on the object the worker method receives. Outputs are checked on the JSON + * that TaskClient.updateTask() actually sends, captured by a fake server. + */ +class WorkerCompatTest { + + // ---- Worker types, as a user would write them ---- + + public enum Tier { + GOLD, + SILVER; + + @Override + public String toString() { + return name().toLowerCase(); + } + } + + public static class Order { + public Tier tier; + public final String region = null; + private final List items = new ArrayList<>(); + + public List getItems() { + return items; + } + } + + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) + public static class Customer { + public String customerId; + } + + public static class Shipment { + public Tier tier = Tier.GOLD; + public Duration timeout = Duration.ofSeconds(90); + + @JsonSerialize(using = ToStringSerializer.class) + public long trackingId = 42; + } + + public static class Workers { + Order order; + Customer customer; + + public void takeOrder(@InputParam("order") Order order) { + this.order = order; + } + + public void takeCustomer(@InputParam("customer") Customer customer) { + this.customer = customer; + } + + public Shipment ship() { + return new Shipment(); + } + + // A worker that returns a REST response it parsed with its own Jackson 2. + public Map callApi() throws Exception { + Map output = new HashMap<>(); + output.put("response", new ObjectMapper().readTree("{\"status\":\"ok\",\"count\":1}")); + return output; + } + } + + // ---- Fake Conductor server that records task updates ---- + + private HttpServer server; + private final List requestBodies = new ArrayList<>(); + private final Workers workers = new Workers(); + + @BeforeEach + void startServer() throws Exception { + server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0); + server.createContext("/", exchange -> { + requestBodies.add(new String(exchange.getRequestBody().readAllBytes(), StandardCharsets.UTF_8)); + exchange.sendResponseHeaders(200, -1); + exchange.close(); + }); + server.start(); + } + + @AfterEach + void stopServer() { + server.stop(0); + } + + // ---- Issue 2: inputs ---- + + @Test + @DisplayName("Issue 2 input: enum with custom toString() binds from \"GOLD\"") + void enumBindsFromName() { + run("takeOrder", Map.of("order", Map.of("tier", "GOLD"))); + assertThat(workers.order.tier).isEqualTo(Tier.GOLD); + } + + @Test + @DisplayName("Issue 2 input: getter-only list is filled") + void getterOnlyListIsFilled() { + run("takeOrder", Map.of("order", Map.of("items", List.of("a", "b")))); + assertThat(workers.order.getItems()).containsExactly("a", "b"); + } + + @Test + @DisplayName("Issue 2 input: final field is set") + void finalFieldIsSet() { + run("takeOrder", Map.of("order", Map.of("region", "eu"))); + assertThat(workers.order.region).isEqualTo("eu"); + } + + @Test + @DisplayName("Issue 2 input: Jackson 2 @JsonNaming is applied (user code change needed on Jackson 3)") + void jackson2JsonNamingIsApplied() { + run("takeCustomer", Map.of("customer", Map.of("customer_id", "c1"))); + assertThat(workers.customer.customerId).isEqualTo("c1"); + } + + // ---- Issue 2: outputs ---- + + @Test + @DisplayName("Issue 2 output: enum is sent by name (\"GOLD\")") + void enumIsSentByName() { + assertThat(sentOutput("ship").get("tier").asText()).isEqualTo("GOLD"); + } + + @Test + @DisplayName("Issue 2 output: Duration is sent as a number of seconds (90.0)") + void durationIsSentAsNumber() { + JsonNode timeout = sentOutput("ship").get("timeout"); + assertThat(timeout.isNumber()).as("timeout sent as %s", timeout).isTrue(); + assertThat(timeout.asDouble()).isEqualTo(90.0); + } + + @Test + @DisplayName("Issue 2 output: Jackson 2 @JsonSerialize is applied (user code change needed on Jackson 3)") + void jackson2JsonSerializeIsApplied() { + JsonNode trackingId = sentOutput("ship").get("trackingId"); + assertThat(trackingId.isTextual()).as("trackingId sent as %s", trackingId).isTrue(); + } + + // ---- Issue 3 ---- + + @Test + @DisplayName("Issue 3 output: Jackson 2 JsonNode is sent as its JSON") + void jackson2JsonNodeIsSentAsJson() throws Exception { + assertThat(sentOutput("callApi").get("response")) + .isEqualTo(new ObjectMapper().readTree("{\"status\":\"ok\",\"count\":1}")); + } + + // ---- Helpers ---- + + private TaskResult run(String method, Map input) { + try { + var workerMethod = java.util.Arrays.stream(Workers.class.getMethods()) + .filter(m -> m.getName().equals(method)) + .findFirst() + .orElseThrow(); + Task task = new Task(); + task.setTaskId("task-1"); + task.setWorkflowInstanceId("wf-1"); + task.setStatus(Task.Status.IN_PROGRESS); + task.setInputData(new HashMap<>(input)); + return new AnnotatedWorker(method, workerMethod, workers).execute(task); + } catch (Exception e) { + return fail("worker failed: " + e + (e.getCause() != null ? " / cause: " + e.getCause() : "")); + } + } + + /** Runs the worker, sends its result with TaskClient, and returns the outputData the server got. */ + private JsonNode sentOutput(String method) { + TaskResult result = run(method, Map.of()); + ConductorClient client = ConductorClient.builder() + .basePath("http://127.0.0.1:" + server.getAddress().getPort() + "/api") + .build(); + new TaskClient(client).updateTask(result); + try { + return new ObjectMapper().readTree(requestBodies.get(requestBodies.size() - 1)).get("outputData"); + } catch (Exception e) { + return fail("could not read request body: " + e); + } + } +} From ad997eb09a7f7eab0635700fa5fc3cbcc2d59bd5 Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 11:07:33 -0600 Subject: [PATCH 6/7] Restore Jackson 2 worker input/output behavior on Jackson 3 Jackson 3 changed defaults that reshape worker inputs and outputs. The SDK mapper now restores the Jackson 2 behavior: - enums read and written by name, not toString() - getter-only collections filled on input (USE_GETTERS_AS_SETTERS) - final fields set on input (ALLOW_FINAL_FIELDS_AS_MUTATORS) - Duration written as a number of seconds It also writes a Jackson 2 JsonNode (for example a REST client response a worker puts in its output) as the JSON it holds. Jackson 3 would otherwise serialize its getters. The serializer is only registered when Jackson 2 is on the classpath. Jackson 2 databind annotations (@JsonNaming, @JsonSerialize) on user classes are still ignored by Jackson 3; users add the Jackson 3 ones. conductor-client: 995 tests pass. Co-Authored-By: Claude Opus 5.5 --- .../common/config/ObjectMapperProvider.java | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java b/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java index a8558f4b6..276264d75 100644 --- a/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java +++ b/conductor-client/src/main/java/com/netflix/conductor/common/config/ObjectMapperProvider.java @@ -16,11 +16,17 @@ import java.util.Properties; import com.fasterxml.jackson.annotation.JsonInclude; +import tools.jackson.core.JsonGenerator; import tools.jackson.databind.DeserializationFeature; +import tools.jackson.databind.MapperFeature; import tools.jackson.databind.ObjectMapper; +import tools.jackson.databind.SerializationContext; import tools.jackson.databind.SerializationFeature; +import tools.jackson.databind.ValueSerializer; import tools.jackson.databind.cfg.DateTimeFeature; +import tools.jackson.databind.cfg.EnumFeature; import tools.jackson.databind.json.JsonMapper; +import tools.jackson.databind.module.SimpleModule; import tools.jackson.module.kotlin.KotlinModule; public class ObjectMapperProvider { @@ -44,23 +50,37 @@ public ObjectMapper getObjectMapper() { *

WRITE_DATES_AS_TIMESTAMPS is enabled to keep the numeric date encoding that Jackson 2 * produced with JavaTimeModule. Jackson 3 defaults to ISO-8601 strings, which would change the * payload format seen by the server and stored task/workflow documents. + * + *

The enum, duration, getter-as-setter and final-field settings restore other Jackson 2 + * defaults, so worker inputs and outputs keep the shape they had with SDK 6.x. */ private static ObjectMapper _getObjectMapper() { try { - ObjectMapper mapper = + JsonMapper.Builder builder = JsonMapper.builder() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES) .disable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES) .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) .enable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(DateTimeFeature.WRITE_DURATIONS_AS_TIMESTAMPS) + .disable( + EnumFeature.READ_ENUMS_USING_TO_STRING, + EnumFeature.WRITE_ENUMS_USING_TO_STRING) + .enable( + MapperFeature.USE_GETTERS_AS_SETTERS, + MapperFeature.ALLOW_FINAL_FIELDS_AS_MUTATORS) .changeDefaultPropertyInclusion( value -> JsonInclude.Value.construct( JsonInclude.Include.NON_NULL, JsonInclude.Include.ALWAYS)) - .addModule(new KotlinModule.Builder().build()) - .build(); + .addModule(new KotlinModule.Builder().build()); + SimpleModule jackson2JsonNode = jackson2JsonNodeModule(); + if (jackson2JsonNode != null) { + builder.addModule(jackson2JsonNode); + } + ObjectMapper mapper = builder.build(); selfCheck(mapper); return mapper; } catch (RuntimeException | LinkageError e) { @@ -86,6 +106,34 @@ public static class SelfCheck { public String value; } + /** + * Workers often put a Jackson 2 JsonNode (for example a REST client response) into task output. + * Jackson 3 does not know that type and would write its getters, so write the JSON it holds. + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + private static SimpleModule jackson2JsonNodeModule() { + Class nodeType; + try { + nodeType = + Class.forName( + "com.fasterxml.jackson.databind.JsonNode", + false, + ObjectMapperProvider.class.getClassLoader()); + } catch (ClassNotFoundException | LinkageError e) { + return null; + } + SimpleModule module = new SimpleModule("conductor-jackson2-json-node"); + module.addSerializer((Class) nodeType, new Jackson2JsonNodeSerializer()); + return module; + } + + private static class Jackson2JsonNodeSerializer extends ValueSerializer { + @Override + public void serialize(Object value, JsonGenerator gen, SerializationContext ctxt) { + ctxt.writeValue(gen, JsonMapper.shared().readTree(value.toString())); + } + } + private static LinkageError findLinkageError(Throwable t) { for (Throwable cause = t; cause != null; cause = cause.getCause()) { if (cause instanceof LinkageError linkageError) { From 32b50a359504879fdae3f4ff4260ed30bf6f2758 Mon Sep 17 00:00:00 2001 From: Chris Hagglund Date: Wed, 25 Nov 2026 11:07:33 -0600 Subject: [PATCH 7/7] Demo: four worker-compat setups, before and after fixes The worker demo matrix now runs the same tests in four setups: 1. SDK 6.0.2 (Jackson 2), the baseline: 8/8 2. PR 189 as submitted, built from db7b12a: 0/8 3. PR 189 + SDK fixes (this branch): 6/8, only the two Jackson 2 annotation tests fail 4. PR 189 + SDK fixes + migrated user code: 8/8 The two classes with Jackson 2 annotations move to src/userCode/{jackson2,migrated}, picked with -PuserCode. The migrated variant adds the Jackson 3 annotations next to the Jackson 2 ones, which also passes on 6.0.2. The summary shows each setup's result against its predicted pass count. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/worker-compat-demo.yml | 64 +++++++++++++++---- demo/worker-compat/build.gradle | 18 +++++- .../src/test/java/workercompat/Tier.java | 23 +++++++ .../java/workercompat/WorkerCompatTest.java | 31 +-------- .../jackson2/java/workercompat/Customer.java | 22 +++++++ .../jackson2/java/workercompat/Shipment.java | 27 ++++++++ .../migrated/java/workercompat/Customer.java | 25 ++++++++ .../migrated/java/workercompat/Shipment.java | 30 +++++++++ 8 files changed, 198 insertions(+), 42 deletions(-) create mode 100644 demo/worker-compat/src/test/java/workercompat/Tier.java create mode 100644 demo/worker-compat/src/userCode/jackson2/java/workercompat/Customer.java create mode 100644 demo/worker-compat/src/userCode/jackson2/java/workercompat/Shipment.java create mode 100644 demo/worker-compat/src/userCode/migrated/java/workercompat/Customer.java create mode 100644 demo/worker-compat/src/userCode/migrated/java/workercompat/Shipment.java diff --git a/.github/workflows/worker-compat-demo.yml b/.github/workflows/worker-compat-demo.yml index 370210681..613797dba 100644 --- a/.github/workflows/worker-compat-demo.yml +++ b/.github/workflows/worker-compat-demo.yml @@ -1,6 +1,9 @@ -# Demo for PR #189 (Jackson 3), issues 2 and 3: the same worker code against the released -# Jackson 2 SDK (6.0.2) and against this branch. Each test asserts the 6.0.2 behavior, so a -# red test on this branch is a change worker authors would see after upgrading. +# Demo for PR #189 (Jackson 3), issues 2 and 3: the same worker tests in four setups. Each test +# asserts the SDK 6.0.2 (Jackson 2) behavior, so a red test is a change a worker author would see. +# 1. SDK 6.0.2 -> baseline +# 2. PR #189 as submitted (db7b12a) -> what users get today from the PR +# 3. PR + SDK fixes (this branch) -> what the SDK alone can restore +# 4. PR + SDK fixes + migrated user code -> after users add Jackson 3 annotations name: Worker compatibility demo on: @@ -16,12 +19,26 @@ jobs: fail-fast: false matrix: include: - - label: SDK 6.0.2 (released, Jackson 2) + - label: 1. SDK 6.0.2 (released, Jackson 2) sdk: '6.0.2' - build: false - - label: SDK from this branch (Jackson 3) - sdk: '0.0.0-pr189-demo' - build: true + sdk_source: none + user_code: jackson2 + expect_pass: 8 + - label: 2. PR 189 as submitted (Jackson 3) + sdk: '0.0.0-pr189-asis' + sdk_source: db7b12ae0bb6764b0f023eabebf3a34444fb9e48 + user_code: jackson2 + expect_pass: 0 + - label: 3. PR 189 + SDK fixes + sdk: '0.0.0-pr189-fixed' + sdk_source: this-branch + user_code: jackson2 + expect_pass: 6 + - label: 4. PR 189 + SDK fixes + migrated user code + sdk: '0.0.0-pr189-fixed' + sdk_source: this-branch + user_code: migrated + expect_pass: 8 env: DEMO_M2: ${{ github.workspace }}/build/demo-m2 @@ -29,24 +46,40 @@ jobs: - name: Checkout uses: actions/checkout@v6 + - name: Checkout the PR as submitted + if: matrix.sdk_source != 'none' && matrix.sdk_source != 'this-branch' + uses: actions/checkout@v6 + with: + ref: ${{ matrix.sdk_source }} + path: sdk-src + - name: Set up Zulu JDK 21 uses: actions/setup-java@v5 with: distribution: "zulu" java-version: "21" - - name: Publish this branch's SDK to a local Maven repo - if: matrix.build - run: ./gradlew :conductor-client:publishToMavenLocal -Pversion=${{ matrix.sdk }} -Dmaven.repo.local="$DEMO_M2" + - name: Publish the SDK under test to a local Maven repo + if: matrix.sdk_source != 'none' + run: | + dir=$([ "${{ matrix.sdk_source }}" = this-branch ] && echo . || echo sdk-src) + cd "$dir" + ./gradlew :conductor-client:publishToMavenLocal -Pversion=${{ matrix.sdk }} -Dmaven.repo.local="$DEMO_M2" - name: Run worker tests id: tests - run: ./gradlew -p demo/worker-compat test -PsdkVersion=${{ matrix.sdk }} -Dmaven.repo.local="$DEMO_M2" + run: > + ./gradlew -p demo/worker-compat test + -PsdkVersion=${{ matrix.sdk }} + -PuserCode=${{ matrix.user_code }} + -Dmaven.repo.local="$DEMO_M2" - name: Summary if: always() env: LABEL: ${{ matrix.label }} + USER_CODE: ${{ matrix.user_code }} + EXPECT_PASS: ${{ matrix.expect_pass }} run: | python3 - <<'EOF' >> "$GITHUB_STEP_SUMMARY" import glob, os, xml.etree.ElementTree as ET @@ -60,7 +93,12 @@ jobs: detail = detail.replace('|', '\\|') rows.append((case.get('name'), failure is None, detail)) rows.sort() - print(f"### {os.environ['LABEL']}") + passed = sum(1 for _, ok, _ in rows if ok) + expected = int(os.environ['EXPECT_PASS']) + verdict = 'as predicted' if passed == expected else f'UNEXPECTED, predicted {expected}' + print(f"### {os.environ['LABEL']}: {passed}/{len(rows)} pass ({verdict})") + print() + print(f"User code: `src/userCode/{os.environ['USER_CODE']}`") print() print("| Behavior (as in SDK 6.0.2) | Result | What happened instead |") print("|---|---|---|") diff --git a/demo/worker-compat/build.gradle b/demo/worker-compat/build.gradle index cf95fcb8b..9c301c308 100644 --- a/demo/worker-compat/build.gradle +++ b/demo/worker-compat/build.gradle @@ -1,11 +1,22 @@ // Worker code compiled against a chosen conductor-client release. // -PsdkVersion=6.0.2 released SDK (Jackson 2), from Maven Central -// -PsdkVersion=0.0.0-pr189-demo this branch, published with publishToMavenLocal +// -PsdkVersion=0.0.0-pr189-... an SDK published with publishToMavenLocal +// -PuserCode=jackson2|migrated user classes as written for 6.x, or with Jackson 3 +// annotations added (src/userCode//java) plugins { id 'java' } def sdkVersion = findProperty('sdkVersion') ?: '6.0.2' +def userCode = findProperty('userCode') ?: 'jackson2' + +sourceSets { + test { + java { + srcDir "src/userCode/${userCode}/java" + } + } +} repositories { mavenLocal() @@ -21,6 +32,11 @@ dependencies { testImplementation "org.conductoross:conductor-client:${sdkVersion}" // The worker app's own Jackson 2, e.g. from Spring Boot 3 or a REST client. testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.18.6' + if (userCode == 'migrated') { + // Jackson 3 annotations only need to compile. At runtime on SDK 6.x they are absent, + // and the JVM ignores annotations whose classes are missing. + testCompileOnly 'tools.jackson.core:jackson-databind:3.1.7' + } testImplementation platform('org.junit:junit-bom:5.11.4') testImplementation 'org.junit.jupiter:junit-jupiter' diff --git a/demo/worker-compat/src/test/java/workercompat/Tier.java b/demo/worker-compat/src/test/java/workercompat/Tier.java new file mode 100644 index 000000000..a251a5528 --- /dev/null +++ b/demo/worker-compat/src/test/java/workercompat/Tier.java @@ -0,0 +1,23 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package workercompat; + +public enum Tier { + GOLD, + SILVER; + + @Override + public String toString() { + return name().toLowerCase(); + } +} diff --git a/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java b/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java index 6a3b40d6d..696eb0c61 100644 --- a/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java +++ b/demo/worker-compat/src/test/java/workercompat/WorkerCompatTest.java @@ -14,7 +14,6 @@ import java.net.InetSocketAddress; import java.nio.charset.StandardCharsets; -import java.time.Duration; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -34,10 +33,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.PropertyNamingStrategies; -import com.fasterxml.jackson.databind.annotation.JsonNaming; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.sun.net.httpserver.HttpServer; import static org.assertj.core.api.Assertions.assertThat; @@ -49,21 +44,14 @@ * *

Inputs are checked on the object the worker method receives. Outputs are checked on the JSON * that TaskClient.updateTask() actually sends, captured by a fake server. + * + *

Customer and Shipment carry Jackson 2 annotations and come from src/userCode/{jackson2,migrated}, + * picked with -PuserCode. Tier is in Tier.java. */ class WorkerCompatTest { // ---- Worker types, as a user would write them ---- - public enum Tier { - GOLD, - SILVER; - - @Override - public String toString() { - return name().toLowerCase(); - } - } - public static class Order { public Tier tier; public final String region = null; @@ -74,19 +62,6 @@ public List getItems() { } } - @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) - public static class Customer { - public String customerId; - } - - public static class Shipment { - public Tier tier = Tier.GOLD; - public Duration timeout = Duration.ofSeconds(90); - - @JsonSerialize(using = ToStringSerializer.class) - public long trackingId = 42; - } - public static class Workers { Order order; Customer customer; diff --git a/demo/worker-compat/src/userCode/jackson2/java/workercompat/Customer.java b/demo/worker-compat/src/userCode/jackson2/java/workercompat/Customer.java new file mode 100644 index 000000000..62015fb10 --- /dev/null +++ b/demo/worker-compat/src/userCode/jackson2/java/workercompat/Customer.java @@ -0,0 +1,22 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package workercompat; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +/** User code as written for SDK 6.x: Jackson 2 annotation only. */ +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class Customer { + public String customerId; +} diff --git a/demo/worker-compat/src/userCode/jackson2/java/workercompat/Shipment.java b/demo/worker-compat/src/userCode/jackson2/java/workercompat/Shipment.java new file mode 100644 index 000000000..e58c07620 --- /dev/null +++ b/demo/worker-compat/src/userCode/jackson2/java/workercompat/Shipment.java @@ -0,0 +1,27 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package workercompat; + +import java.time.Duration; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +/** User code as written for SDK 6.x: Jackson 2 annotation only. */ +public class Shipment { + public Tier tier = Tier.GOLD; + public Duration timeout = Duration.ofSeconds(90); + + @JsonSerialize(using = ToStringSerializer.class) + public long trackingId = 42; +} diff --git a/demo/worker-compat/src/userCode/migrated/java/workercompat/Customer.java b/demo/worker-compat/src/userCode/migrated/java/workercompat/Customer.java new file mode 100644 index 000000000..89606a426 --- /dev/null +++ b/demo/worker-compat/src/userCode/migrated/java/workercompat/Customer.java @@ -0,0 +1,25 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package workercompat; + +/** + * User code migrated for the Jackson 3 SDK: the Jackson 3 annotation is added next to the + * Jackson 2 one. Each Jackson reads only its own, so this works on SDK 6.x and on Jackson 3. + */ +@com.fasterxml.jackson.databind.annotation.JsonNaming( + com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy.class) +@tools.jackson.databind.annotation.JsonNaming( + tools.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy.class) +public class Customer { + public String customerId; +} diff --git a/demo/worker-compat/src/userCode/migrated/java/workercompat/Shipment.java b/demo/worker-compat/src/userCode/migrated/java/workercompat/Shipment.java new file mode 100644 index 000000000..f1209ffd5 --- /dev/null +++ b/demo/worker-compat/src/userCode/migrated/java/workercompat/Shipment.java @@ -0,0 +1,30 @@ +/* + * Copyright 2026 Conductor Authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package workercompat; + +import java.time.Duration; + +/** + * User code migrated for the Jackson 3 SDK: the Jackson 3 annotation is added next to the + * Jackson 2 one. Each Jackson reads only its own, so this works on SDK 6.x and on Jackson 3. + */ +public class Shipment { + public Tier tier = Tier.GOLD; + public Duration timeout = Duration.ofSeconds(90); + + @com.fasterxml.jackson.databind.annotation.JsonSerialize( + using = com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class) + @tools.jackson.databind.annotation.JsonSerialize( + using = tools.jackson.databind.ser.std.ToStringSerializer.class) + public long trackingId = 42; +}