Skip to content

Conversation

@meistermeier
Copy link
Contributor

@meistermeier meistermeier commented Aug 19, 2025

Deprecate the method in favour of a version-agnostic replacement. The withEnterpriseEdition pulls in the former neo4j:4.4 default image / LTS version without users noting the implicit change from their defined image version.
A Neo4jContainer("neo4j:5.26").withEnterpriseEdition() becomes neo4j:4.4-enterprise and let's say that this is at least a surprise, even though it's explicitly mentioned in the documentation.

Also upgrade the test images to be used to 5.26 (latest LTS version) where possible.

@meistermeier meistermeier requested a review from a team as a code owner August 19, 2025 16:25
}

setDockerImageName(DEFAULT_IMAGE_NAME.withTag(ENTERPRISE_TAG).asCanonicalNameString());
setDockerImageName(DockerImageName.parse(getDockerImageName() + ENTERPRISE_SUFFIX).asCanonicalNameString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will break existing users. Why not improve the exception's message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a technical, formal perspective I would say, that you are right.
But (of course) I would consider this as a bug that came as a left-over when we've removed the default constructor that fell back to the default image name.
I think that nobody would expect working with a neo4j:5.26 image to get ported back to the previous major version (4.4) when enabling enterprise per API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a) how many users are on 4.4 still And expect the enterprise version of it when they actually want 5.26 or basically anything else, it's a bug
b) If we omit one hardcoded version (like it it seems with the default image), that one has to go for consistency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to propose something else:
Be explicit in breaking the current behavior (by removing withEnterpriseEdition() in its current form, which indeed is a crazy confusing method implementation), and maybe have a new method, that gets the version (tag?) as an argument.

How does that sound?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will play with this. Thanks for the feedback.

This will not only update the test image but also clean up
usage of `withEnterpriseEdition` to just append
the `-enterprise` suffix instead of pulling in the former neo4j:4.4 default image
without users noting the implicit change from their defined image version.
@meistermeier
Copy link
Contributor Author

Updated the PR do work with main after the JUnit upgrade.
I also revisited the comment above and looked at the documentation where we clearly state that it's only for 4.4. As a consequence I reverted this portion in the PR.

@kiview
Copy link
Member

kiview commented Sep 26, 2025

@meistermeier I'm probably missing something since I was out of the game for some time, but isn't the only thing this PR effectively does now, is bumping the image in the tests (without effective changes to the module behavior besides an internal refactoring)?

Or asked differently, which usage was failing before, that would work now? (which we could add as a new test accordingly)

@meistermeier
Copy link
Contributor Author

You're pretty much spot-on now... The test (and minor renaming) is all that's left. But it's an improvement for the test suite nevertheless because it targets (mostly) everywhere the latest LTS. But for now it's the only thing I can add if the breaking API with a real improvement does not get accepted.

@meistermeier meistermeier changed the title Update Neo4j default image to 5.26 (LTS). Update Neo4j default image in tests to 5.26 (LTS). Sep 26, 2025
@michael-simons
Copy link
Contributor

@kiview the image in tests was bumped to unsure a consistent behaviour for both the community and enterprise edition.

Deprecate the existing withEnterpriseEdition method and adjust the documentation accordingly.
@meistermeier
Copy link
Contributor Author

Naming is so hard, so I came up with withEnterpriseImage for now. I am happy for better suggestions. Just tried to keep the with... pattern but 🤷
There is no reason for me to use something like withEnterpriseEdition(someparam) because:

  • The tag was already enforced by the constructor
  • The acceptance is done by the acceptance file

@meistermeier meistermeier changed the title Update Neo4j default image in tests to 5.26 (LTS). Deprecate withEnterpriseEdition due to version pinning Sep 26, 2025
@kiview kiview requested a review from Copilot September 29, 2025 08:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR deprecates the withEnterpriseEdition() method in favor of a new withEnterpriseImage() method to address version pinning issues. The deprecated method was implicitly changing user-specified Neo4j image versions to 4.4-enterprise, which could surprise users who expected their chosen version to be preserved.

Key changes:

  • Added a version-agnostic withEnterpriseImage() method that appends "-enterprise" to the user's specified image version
  • Deprecated withEnterpriseEdition() method with appropriate warnings about its version-forcing behavior
  • Updated test suite to use Neo4j 5.26 (latest LTS) instead of the previous 4.4 version

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
Neo4jContainer.java Added new withEnterpriseImage() method and deprecated withEnterpriseEdition() with version pinning fixes
Neo4jContainerTest.java Updated test cases to use Neo4j 5.26 and the new withEnterpriseImage() method
neo4j.md Updated documentation to reflect the deprecation and recommend the new method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

kiview
kiview previously approved these changes Sep 29, 2025
Copy link
Member

@kiview kiview left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meistermeier I think that is a nice hack to deprecate the problematic old method and add the new desired behavior, without ~breaking existing users.

LGTM, any objections @eddumelendez ?

The versions need to be set explicitly to avoid
the wrong version for testing when using the test constant.
@meistermeier
Copy link
Contributor Author

Thanks for the review @kiview, PR updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants