Upgrade sdk-common-jvm to v4.0.0 (major version bump to 6.0.0)#156
Upgrade sdk-common-jvm to v4.0.0 (major version bump to 6.0.0)#156typotter wants to merge 17 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Upgrades the SDK’s shared dependency (cloud.eppo:sdk-common-jvm) to the new v4 API and updates this repo’s client + tests to match the new generic BaseEppoClient<JsonNode> surface, while removing the previously used “tests” classifier dependency.
Changes:
- Bump
sdk-common-jvmto4.0.0-SNAPSHOTand SDK version to6.0.0-SNAPSHOT. - Update
EppoClientto extendBaseEppoClient<JsonNode>and wire new v4 initialization components. - Replace the old test-jar dependency by copying test helper classes and rewriting
EppoClientTestto use WireMock-based HTTP stubbing.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/cloud/eppo/EppoClient.java | Migrates client to v4 generic BaseEppoClient<JsonNode> construction. |
| src/test/java/cloud/eppo/EppoClientTest.java | Reworks tests to use WireMock stubs instead of the removed HTTP client override. |
| src/test/java/cloud/eppo/helpers/TestUtils.java | Adds local test helper for mocking configuration client responses. |
| src/test/java/cloud/eppo/helpers/TestCaseValue.java | Adds test-only EppoValue wrapper to represent JSON test values. |
| src/test/java/cloud/eppo/helpers/SubjectAssignment.java | Adds test fixture model for subject assignments and optional evaluation details. |
| src/test/java/cloud/eppo/helpers/BanditTestCaseDeserializer.java | Adds JSON deserialization for bandit test vectors. |
| src/test/java/cloud/eppo/helpers/BanditTestCase.java | Adds runner/parsing for bandit test cases. |
| src/test/java/cloud/eppo/helpers/BanditSubjectAssignment.java | Adds bandit test fixture model for per-subject expected outcomes. |
| src/test/java/cloud/eppo/helpers/AssignmentTestCaseDeserializer.java | Adds JSON deserialization for assignment test vectors + evaluation details. |
| src/test/java/cloud/eppo/helpers/AssignmentTestCase.java | Adds runner/parsing/assertion utilities for assignment test cases (incl. details). |
| README.md | Updates documented dependency coordinates to 6.x. |
| build.gradle | Bumps SDK + sdk-common-jvm versions and removes the sdk-common-jvm test-jar dependency. |
Comments suppressed due to low confidence (1)
src/test/java/cloud/eppo/EppoClientTest.java:71
- These stubs read JSON responses from
src/test/resources/shared/ufc/*.json, but that directory/files are not present in this repo checkout. As written,readConfig(...)will throw and tests will fail. The referenced JSON fixtures (flags-v1.json, bandit-flags-v1.json, bandit-models-v1.json) need to be added undersrc/test/resources(or the code updated to point at the actual fixture location).
// If we get the dummy flag API key, return flags-v1.json
String ufcFlagsResponseJson = readConfig("src/test/resources/shared/ufc/flags-v1.json");
mockServer.stubFor(
WireMock.get(
WireMock.urlMatching(
".*flag-config/v1/config\\?.*apiKey=" + DUMMY_FLAG_API_KEY + ".*"))
.willReturn(WireMock.okJson(ufcFlagsResponseJson)));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import cloud.eppo.api.MatchedRule; | ||
| import cloud.eppo.api.RuleCondition; | ||
| import cloud.eppo.api.dto.VariationType; | ||
| import cloud.eppo.ufc.dto.adapters.EppoValueDeserializer; | ||
| import com.fasterxml.jackson.core.JsonParser; |
|
|
||
| import cloud.eppo.api.*; | ||
| import cloud.eppo.ufc.dto.adapters.EppoValueDeserializer; | ||
| import com.fasterxml.jackson.core.JsonParser; |
| public static Stream<Arguments> getAssignmentTestData() { | ||
| File testCaseFolder = new File("src/test/resources/shared/ufc/tests"); | ||
| File[] testCaseFiles = testCaseFolder.listFiles(); | ||
| assertNotNull(testCaseFiles); | ||
| assertTrue(testCaseFiles.length > 0); | ||
| List<Arguments> arguments = new ArrayList<>(); |
| public static Stream<Arguments> getBanditTestData() { | ||
| File testCaseFolder = new File("src/test/resources/shared/ufc/bandit-tests"); | ||
| File[] testCaseFiles = testCaseFolder.listFiles(); | ||
| assertNotNull(testCaseFiles); | ||
| assertTrue(testCaseFiles.length > 0); | ||
| List<Arguments> arguments = new ArrayList<>(); |
| ```groovy | ||
| dependencies { | ||
| implementation 'cloud.eppo:eppo-server-sdk:5.3.3' | ||
| implementation 'cloud.eppo:eppo-server-sdk:6.0.0' | ||
| } |
| import static org.junit.jupiter.api.Assertions.*; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; |
| private String fileName; | ||
|
|
| if (expectedConditions.size() != actualConditions.size()) { | ||
| fail( | ||
| message | ||
| + String.format( | ||
| " (expected %d conditions but got %d)", | ||
| expectedConditions.size(), actualConditions.size())); | ||
| } |
|
🤖 Comment from AI: I reviewed the v4 wiring in |
aarsilv
left a comment
There was a problem hiding this comment.
Approving as we could do red-green-refactor method here but love to hit on the refactor part to consolidate what I think should be common test files
| new JacksonConfigurationParser(), | ||
| new OkHttpEppoClient()); |
| import org.apache.commons.io.FileUtils; | ||
| import org.junit.jupiter.params.provider.Arguments; | ||
|
|
||
| public class AssignmentTestCase { |
There was a problem hiding this comment.
Now that the common v4 is settling for this and android, could we have this in there as well and export them in a non-production artifact way? Would remove a ton of duplication I reckon.
There was a problem hiding this comment.
Agreed — these helpers are duplicated from the android repo. Tracking as followup: move them into sdk-common-jdk as a test artifact so both SDKs consume them.
Research covers stack changes, feature landscape, architecture differences, and pitfalls for upgrading from v3.13.2 to v4.0.0-SNAPSHOT.
…hot repo URL - Replace s01.oss.sonatype.org snapshot URL with central.sonatype.com/repository/maven-snapshots/ - Bump api dependency cloud.eppo:sdk-common-jvm from 3.13.2 to 4.0.0-SNAPSHOT - Bump test helpers from sdk-common-jvm:3.5.4:tests to 4.0.0-SNAPSHOT:tests
- Replace cloud.eppo.ufc.dto.VariationType with cloud.eppo.api.dto.VariationType - Zero cloud.eppo.ufc.dto references remain in any .java file
- Add <JsonNode> generic type parameter to BaseEppoClient class declaration - Remove null at super() position 4 (String param removed in v4) - Append JacksonConfigurationParser and OkHttpEppoClient as new super() args 14 and 15 - Add import for com.fasterxml.jackson.databind.JsonNode
- EppoClient wired to BaseEppoClient<JsonNode> with 15-arg super() - JacksonConfigurationParser and OkHttpEppoClient injected as pluggable deps - compileJava and spotlessCheck both pass
…lvable tests JAR dependency - Copy 8 test helper source files from sdk-common-jdk into helpers/ package - Remove unresolvable testImplementation 'sdk-common-jvm:4.0.0-SNAPSHOT:tests' from build.gradle
- Remove EppoHttpClient mocking, use WireMock request counting for testPolling - Rewrite testConfigurationChangeListener using WireMock scenarios - Rewrite mockHttpError to use WireMock server error stubs - Replace Constants.appendApiPathToHost(TEST_HOST) with TEST_HOST - Delete setBaseClientHttpClientOverrideField reflection method - Fix initBuggyClient to use mock IConfigurationStore instead of null - Extract registerDefaultStubs for WireMock reset between tests - Remove unused imports (CompletableFuture, ExecutionException, TestUtils)
- build.gradle: version 5.3.4 -> 5.4.0-SNAPSHOT - README.md: release example 5.3.3 -> 5.4.0 - README.md: snapshot example 4.0.1-SNAPSHOT -> 5.4.0-SNAPSHOT
- Add 03-02-SUMMARY.md for phase 3 plan 2
Already in .gitignore but was committed before the ignore rule.
Major version bump due to transitive breaking changes in sdk-common-jvm v4 (ufc.dto package moved to api.dto, EppoHttpClient removed).
96575fd to
bc69156
Compare
Summary
cloud.eppo:sdk-common-jvmfrom3.13.2to4.0.0-SNAPSHOTEppoClientto extendBaseEppoClient<JsonNode>(v4 generic API)EppoClientTestto use v4 API surface6.0.0-SNAPSHOT(major bump due to transitive breaking changes)Breaking changes
sdk-common-jvmis declared asapiscope, so its types are transitive to consumers:cloud.eppo.ufc.dto.*package moved tocloud.eppo.api.dto.*cloud.eppo.EppoHttpClientremoved (replaced byOkHttpEppoClient)New public API (additive)
get*AssignmentDetails()methods for all types (boolean, int, double, string, JSON)getBanditActionDetails()unsubscribeFromConfigurationChange()Test plan
./gradlew test)publishToMavenLocalsucceeds