Skip to content

SOLR-18234 | Move packagemanager under CLI and stop test-framework from depending on CLI - #5018

Open
jaykay12 wants to merge 26 commits into
apache:mainfrom
jaykay12:SOLR-18234-solr-cli-detangle-core
Open

jaykay12 wants to merge 26 commits into
apache:mainfrom
jaykay12:SOLR-18234-solr-cli-detangle-core

Conversation

@jaykay12

@jaykay12 jaykay12 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Description

Context: #4663 (comment)

This is a pre-requisite change needed before we attempt: CLI module movement outside core.

Solution

Used Cursor help in formulating the approach, code is reviewed & vetted by me.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

Checklist

Please review the following and check all that apply:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title.
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide
  • I have added a changelog entry for my change

@dsmiley dsmiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for remembering to carry this forward!

Comment thread solr/core/src/java/org/apache/solr/packagemanager/UserIO.java Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice change

Comment thread solr/test-framework/build.gradle
Comment thread solr/core/src/java/org/apache/solr/cli/SolrCLI.java

/** Console-facing output for package manager operations */
@FunctionalInterface
public interface UserIO {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ToolRuntime (in CLI) implements this, i see. What implements this within solr core?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Disclaimer - Reply via Cursor

Packagemanager uses UserIO directly; it doesn’t implement console output.

PackageManager / RepositoryManager take a UserIO and call print / printSuccess / printError. PackageUtils uses the color constants on the interface. That is how we dropped the CLI dependency.

Implementations:

CLI: ToolRuntime (passed in from PackageTool)
tests: UserIO.NONE
There is no production core path that constructs PackageManager outside the CLI, so core doesn’t need its own console impl.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's weird! If UserIO is only implemented in the CLI package yet it's defined outside of that package... it's weird; no? Why are those parts of PackageManager that use UserIO located in PackageManager when they could be in some CLI side place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That’s a fair point - it does look inverted.

PackageManager still owns the operation flow today, so the print calls sit next to that logic.
UserIO is only a sink so those calls don’t import org.apache.solr.cli: CLI passes ToolRuntime, and tests use NONE.

I’d be happy to move the user-facing output into PackageTool and leave PackageManager as throw/return. That’s a larger split than this PR was aiming for; I was treating this change as just cutting the CLI dependency.

Can I take that up in a follow-up PR, if that's okay to you.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you could just move the packagemanager package to org.apache.solr.cli.packagemanager and then you wouldn't need the UserIO idea. That's a simpler change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion - this is much cleaner.

I’ve moved packagemanager to org.apache.solr.cli.packagemanager and dropped UserIO, so it can use ToolRuntime again. That should also make the later CLI module extraction simpler.

Appreciate you taking the time to steer this. ✨

@jaykay12
jaykay12 requested a review from dsmiley October 4, 2026 20:40
@jaykay12 jaykay12 changed the title SOLR-18234 | Stop PackageManager and test-framework from depending on CLI SOLR-18234 | Move packagemanager under CLI and stop test-framework from depending on CLI Oct 5, 2026

@jaykay12 jaykay12 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

self-review ✅

@dsmiley can you please retrigger the workflows, i will keep an eye on the crave tests.

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.

2 participants