Skip to content

🐛 pass build tool when using pipe mode#961

Merged
shawn-hurley merged 2 commits intokonveyor:mainfrom
pranavgaikwad:fix/passBuildTool
Nov 11, 2025
Merged

🐛 pass build tool when using pipe mode#961
shawn-hurley merged 2 commits intokonveyor:mainfrom
pranavgaikwad:fix/passBuildTool

Conversation

@pranavgaikwad
Copy link
Copy Markdown
Contributor

@pranavgaikwad pranavgaikwad commented Nov 10, 2025

Summary by CodeRabbit

  • Chores

    • Updated analyzer-lsp dependency to version 0.8.1-alpha.
  • Refactor

    • Deferred client initialization until after project resolution and build tool setup to improve startup ordering and error handling.

Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 10, 2025

Walkthrough

Deferred RPC client creation in the Java external provider: Init no longer returns an RPC client early; RPC-based javaServiceClient is constructed after project resolution and build tool detection. The analyzer-lsp dependency was bumped from v0.7.0-alpha to v0.8.1-alpha, and javaServiceClient now carries buildTool, mvnIndexPath, and mvnSettingsFile.

Changes

Cohort / File(s) Change Summary
Dependency Update
external-providers/java-external-provider/go.mod
Updated github.com/konveyor/analyzer-lsp from v0.7.0-alpha.2.0.20250625194402-05dca9b4ac43 to v0.8.1-alpha.2.0.20251107235035-7470a4a226f4`
RPC Initialization Refactor
external-providers/java-external-provider/pkg/java_external_provider/provider.go
Removed eager RPC-based return in Init; moved RPC client construction to after project resolution and build tool setup; added buildTool, mvnIndexPath, and mvnSettingsFile fields to javaServiceClient; changed lspServerPath handling to a non-fatal assertion and later validation.

Sequence Diagram(s)

sequenceDiagram
  participant Provider as JavaProvider.Init
  participant Resolver as ProjectResolver/BuildTool
  participant RPCConf as RPC Config
  participant JavaClient as javaServiceClient

  rect rgb(230, 245, 255)
    Provider->>Resolver: resolve project & detect buildTool
    Resolver-->>Provider: project info, buildTool, mvn paths
  end

  alt RPC config present
    Provider->>RPCConf: check RPC settings
    RPCConf-->>Provider: RPC config present
    Provider->>JavaClient: construct javaServiceClient(buildTool, mvnIndexPath, mvnSettingsFile, includedPaths, depsLocationCache)
    JavaClient-->>Provider: client ready
  else No RPC config
    Provider->>Provider: continue without RPC client (or error later if required)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Focus areas:
    • Ensure deferred initialization preserves previous behavior and does not introduce race/ordering issues.
    • Verify buildTool, mvnIndexPath, and mvnSettingsFile are correctly populated and used by RPC calls.
    • Confirm lspServerPath validation remains correct and errors are surfaced at appropriate times.

Possibly related PRs

Suggested reviewers

  • pranavgaikwad
  • eemcmullan

Poem

🐰 I hopped through Init with careful cheer,

Deferred my RPC until the build was clear.
Maven paths tucked under my paw so bright,
Client assembled after the resolver's light.
Hop, code, and nibble — all systems right!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: passing build tool information when using pipe mode (RPC). This is directly supported by the refactoring in provider.go that moves RPC initialization after build-tool resolution and adds buildTool to the client.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

Thank you for fixing my bug

…ection being passed

Signed-off-by: Shawn Hurley <shawn@hurley.page>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
external-providers/java-external-provider/pkg/java_external_provider/provider.go (2)

270-270: Handle type assertion failure explicitly.

The blank identifier silently ignores type assertion failures. If lspServerPath is configured with the wrong type, it will be treated as an empty string without any indication of the configuration error.

Consider explicitly checking the type assertion result:

-lspServerPath, _ := config.ProviderSpecificConfig[provider.LspServerPathConfigKey].(string)
+lspServerPath, ok := config.ProviderSpecificConfig[provider.LspServerPathConfigKey].(string)
+if !ok && config.ProviderSpecificConfig[provider.LspServerPathConfigKey] != nil {
+    log.V(5).Info("lspServerPath config value has incorrect type, expected string")
+}

347-349: Clarify error message.

The error message states "invalid lspServerPath provided" but when lspServerPath is an empty string, it may not have been provided at all rather than being invalid.

Consider a more accurate message:

-} else if lspServerPath == "" {
-    return nil, additionalBuiltinConfig, fmt.Errorf("invalid lspServerPath provided, unable to init java provider")
-}
+} else if lspServerPath == "" {
+    return nil, additionalBuiltinConfig, fmt.Errorf("lspServerPath not provided and RPC client not available, unable to init java provider")
+}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb66d7 and fd7ccaa.

📒 Files selected for processing (1)
  • external-providers/java-external-provider/pkg/java_external_provider/provider.go (2 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: jmle
Repo: konveyor/analyzer-lsp PR: 888
File: external-providers/java-external-provider/pkg/java_external_provider/service_client.go:507-521
Timestamp: 2025-08-21T12:42:54.499Z
Learning: In the konveyor/analyzer-lsp Java external provider (external-providers/java-external-provider/pkg/java_external_provider/service_client.go), the maintainers prefer to keep the current JAVA_HOME selection logic in GetJavaHomeForGradle method simple, as they operate in a controlled environment where both Java 8 and Java 17+ are guaranteed to be available, with Java 17+ being a system requirement for running the analyzer.
Learnt from: pranavgaikwad
Repo: konveyor/analyzer-lsp PR: 859
File: external-providers/java-external-provider/pkg/java_external_provider/dependency.go:694-694
Timestamp: 2025-07-30T12:11:45.673Z
Learning: In the Java external provider dependency walker (external-providers/java-external-provider/pkg/java_external_provider/dependency.go), errors from toDependency function calls should be ignored as they are not considered important by the maintainers.
📚 Learning: 2025-07-30T12:11:45.673Z
Learnt from: pranavgaikwad
Repo: konveyor/analyzer-lsp PR: 859
File: external-providers/java-external-provider/pkg/java_external_provider/dependency.go:694-694
Timestamp: 2025-07-30T12:11:45.673Z
Learning: In the Java external provider dependency walker (external-providers/java-external-provider/pkg/java_external_provider/dependency.go), errors from toDependency function calls should be ignored as they are not considered important by the maintainers.

Applied to files:

  • external-providers/java-external-provider/pkg/java_external_provider/provider.go
📚 Learning: 2025-10-21T16:27:59.216Z
Learnt from: shawn-hurley
Repo: konveyor/analyzer-lsp PR: 860
File: provider/server.go:251-259
Timestamp: 2025-10-21T16:27:59.216Z
Learning: In provider/server.go, the Init method uses context.Background() for creating the RPC client via GetProviderRPCClient because this RPC client is stored in the InitConfig and used across multiple subsequent requests (Evaluate, GetDependencies, etc.). The RPC client's lifecycle is managed separately through explicit Stop calls, not tied to the Init request's context.

Applied to files:

  • external-providers/java-external-provider/pkg/java_external_provider/provider.go
📚 Learning: 2025-08-21T12:42:54.499Z
Learnt from: jmle
Repo: konveyor/analyzer-lsp PR: 888
File: external-providers/java-external-provider/pkg/java_external_provider/service_client.go:507-521
Timestamp: 2025-08-21T12:42:54.499Z
Learning: In the konveyor/analyzer-lsp Java external provider (external-providers/java-external-provider/pkg/java_external_provider/service_client.go), the maintainers prefer to keep the current JAVA_HOME selection logic in GetJavaHomeForGradle method simple, as they operate in a controlled environment where both Java 8 and Java 17+ are guaranteed to be available, with Java 17+ being a system requirement for running the analyzer.

Applied to files:

  • external-providers/java-external-provider/pkg/java_external_provider/provider.go
📚 Learning: 2025-08-21T12:39:46.778Z
Learnt from: jmle
Repo: konveyor/analyzer-lsp PR: 888
File: external-providers/java-external-provider/pkg/java_external_provider/provider.go:662-663
Timestamp: 2025-08-21T12:39:46.778Z
Learning: In the konveyor/analyzer-lsp Java provider, when setting JAVA_HOME for Gradle commands using exec.CommandContext, the maintainers prefer not to preserve the existing environment variables (including PATH) and use `cmd.Env = append(cmd.Env, fmt.Sprintf("JAVA_HOME=%s", javaHome))` instead of `cmd.Env = append(os.Environ(), fmt.Sprintf("JAVA_HOME=%s", javaHome))`.

Applied to files:

  • external-providers/java-external-provider/pkg/java_external_provider/provider.go
📚 Learning: 2025-10-21T16:25:40.903Z
Learnt from: shawn-hurley
Repo: konveyor/analyzer-lsp PR: 860
File: lsp/base_service_client/base_service_client.go:212-214
Timestamp: 2025-10-21T16:25:40.903Z
Learning: In `lsp/base_service_client/base_service_client.go`, when an RPC connection is provided via `c.RPC` (not nil), it is treated as already initialized and no handler setup is performed. This is known technical debt that needs to be addressed in the future to ensure LSP notifications like `textDocument/publishDiagnostics` are properly processed.

Applied to files:

  • external-providers/java-external-provider/pkg/java_external_provider/provider.go
🧬 Code graph analysis (1)
external-providers/java-external-provider/pkg/java_external_provider/provider.go (2)
provider/provider.go (2)
  • LspServerPathConfigKey (37-37)
  • InitConfig (123-159)
provider/lib.go (1)
  • GetIncludedPathsFromConfig (381-404)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: test
  • GitHub Check: test (ubuntu-latest, linux, amd64)
  • GitHub Check: test (macos-latest, darwin, amd64)
  • GitHub Check: test (macos-latest, darwin, arm64)
  • GitHub Check: test (windows-latest, windows, amd64)
  • GitHub Check: test (ubuntu-latest, linux, arm64)
  • GitHub Check: benchmark (ubuntu-latest, linux)
  • GitHub Check: benchmark (macos-latest, mac)
  • GitHub Check: benchmark (windows-latest, windows)
🔇 Additional comments (1)
external-providers/java-external-provider/pkg/java_external_provider/provider.go (1)

336-346: LGTM! Build tool information now passed in pipe mode.

The RPC-based service client now correctly includes buildTool, mvnIndexPath, and mvnSettingsFile, making it consistent with the standard initialization path. This addresses the PR objective of passing build tool information when using pipe mode.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants