Skip to content

Conversation

@pranavgaikwad
Copy link
Contributor

@pranavgaikwad pranavgaikwad commented Nov 21, 2025

Requires konveyor/analyzer-lsp#975

Summary by CodeRabbit

  • Chores
    • Updated several dependencies to newer patch and alpha versions for improved stability.
  • Improvements
    • Provider initialization now runs earlier so external providers are prepared before analysis, improving reliability of rule-driven checks and reducing setup errors.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

Updated Go module dependency versions and moved protobuf to indirect; parseRules now returns provider condition maps and NewPipeAnalyzer calls each provider's Prepare(ctx, conditions) before initializing the engine.

Changes

Cohort / File(s) Change Summary
Go module updates
kai_analyzer_rpc/go.mod
Bumped dependencies (e.g., github.com/go-logr/logr v1.4.2→v1.4.3, github.com/konveyor/analyzer-lsp → v0.9.0-alpha..., Swaggest packages bumped); google.golang.org/protobuf moved to indirect.
Provider conditions integration
kai_analyzer_rpc/pkg/service/pipe_analyzer.go
parseRules signature expanded to return map[string][]provider.ConditionsByCap; callers updated. NewPipeAnalyzer iterates providerConditions and invokes Prepare(ctx, conditions) on matching providers before engine initialization; errors now propagate. Minor error message case changes.

Sequence Diagram

sequenceDiagram
    participant NewPipeAnalyzer
    participant parseRules
    participant ProviderClient as Provider
    participant Engine

    NewPipeAnalyzer->>parseRules: load discovery & violation rules
    parseRules-->>NewPipeAnalyzer: discoveryRulesets, violationRulesets, neededProviders, providerConditions

    rect rgb(235,245,255)
    Note over NewPipeAnalyzer,ProviderClient: prepare providers with returned conditions
    loop for each provider in providerConditions
        NewPipeAnalyzer->>ProviderClient: Prepare(ctx, conditions)
        ProviderClient-->>NewPipeAnalyzer: ok / error
    end
    end

    NewPipeAnalyzer->>Engine: initialize engine with prepared providers
    Engine-->>NewPipeAnalyzer: ready / error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check all call sites updated for the new parseRules return value.
  • Verify correct mapping/lookup between provider names and providerConditions.
  • Confirm Prepare(ctx, ...) error handling and propagation.
  • Review go.mod changes for potential transitive dependency impacts (protobuf indirectness).

Poem

🐇 I sniffed the rules at morning light,

Collected conditions, snug and tight.
I tapped each provider, "Ready, please,"
They hummed, then slept with gentle ease.
Hop—engine wakes; the world feels right.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding calls to Prepare() on each provider during initialization, which is the core functionality introduced in the pipe_analyzer.go modifications.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb93f0f and a373e8f.

⛔ Files ignored due to path filters (1)
  • kai_analyzer_rpc/go.sum is excluded by !**/*.sum
📒 Files selected for processing (1)
  • kai_analyzer_rpc/go.mod (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • kai_analyzer_rpc/go.mod
⏰ 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). (6)
  • GitHub Check: Run e2e test (macos-13, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (ubuntu-22.04-arm, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (ubuntu-24.04, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (windows-latest, cmd, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (macos-latest, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Check Types on PR Runner (ubuntu-latest, 3.12, x64)

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.

@snyk-io
Copy link

snyk-io bot commented Nov 21, 2025

Snyk checks have failed. 14 issues have been found so far.

Status Scanner Critical High Medium Low Total (14)
Open Source Security 0 1 7 1 9 issues
Licenses 0 0 5 0 5 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
kai_analyzer_rpc/pkg/service/pipe_analyzer.go (1)

69-113: Consider improving diagnosability around Prepare failures

Wiring providerConditions through and only calling Prepare for providers that both have conditions and appear in neededProviders looks sound. However, if Prepare fails, the plain return nil, err loses which provider caused the failure; wrapping it with the provider key would make debugging much easier, e.g.:

if err := neededProviders[k].Prepare(ctx, v); err != nil {
    return nil, fmt.Errorf("prepare provider %q: %w", k, err)
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2dedaf1 and 2b95ceb.

⛔ Files ignored due to path filters (1)
  • kai_analyzer_rpc/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • kai_analyzer_rpc/go.mod (1 hunks)
  • kai_analyzer_rpc/pkg/service/pipe_analyzer.go (5 hunks)
⏰ 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). (6)
  • GitHub Check: Run e2e test (macos-13, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (macos-latest, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (ubuntu-24.04, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (ubuntu-22.04-arm, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (windows-latest, cmd, ChatOpenAI, kai-test-generation)
  • GitHub Check: Check Types on PR Runner (ubuntu-latest, 3.12, x64)
🔇 Additional comments (3)
kai_analyzer_rpc/pkg/service/pipe_analyzer.go (2)

33-45: Provider config validation matches stated constraints

The updated checks and error messages correctly enforce that providers must have a non-empty Address, no BinaryPath, and a non-empty PipeName, which aligns with the “existing provider via pipe” requirement. No issues spotted here.


147-167: providerConditions aggregation and new parseRules return look correct

The new providerConditions map is safely initialized, and merging provConditions via append per provider correctly accumulates conditions across all rule files without nil-map issues. The updated return tuple (discoveryRulesets, violationRulesets, neededProviders, providerConditions, err) is consistent with the caller at Line 69.

Also applies to: 205-205

kai_analyzer_rpc/go.mod (1)

54-54: No issues found; protobuf dependency placement is correct.

The verification confirms that google.golang.org/protobuf v1.36.6 has zero direct usage in the kai_analyzer_rpc codebase. No imports, package references, or protobuf types appear in any of the 13 Go files. The dependency is correctly marked as // indirect because it is a transitive dependency pulled in by grpc and genproto packages, not directly consumed by kai_analyzer_rpc code.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@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 (1)
kai_analyzer_rpc/pkg/service/pipe_analyzer.go (1)

155-162: Add logging to Prepare() calls for consistency with ProviderInit pattern.

The Prepare() method is available in the current analyzer-lsp dependency version (v0.9.0-alpha.1.0.20251121202139-b3f742caf596), so the dependency concern is resolved. However, the code lacks logging for the Prepare() calls, whereas ProviderInit calls (lines 120-132) include informational logging. For consistent observability, consider adding log statements around the Prepare() invocations:

 	// Call Prepare() on all providers with the provider conditions
 	for k, v := range providerConditions {
 		if _, ok := neededProviders[k]; ok {
+			l.Info("preparing provider", "provider", k)
 			if err := neededProviders[k].Prepare(ctx, v); err != nil {
 				return nil, err
 			}
+			l.Info("provider prepared", "provider", k)
 		}
 	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b95ceb and fb93f0f.

⛔ Files ignored due to path filters (1)
  • kai_analyzer_rpc/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • kai_analyzer_rpc/go.mod (3 hunks)
  • kai_analyzer_rpc/pkg/service/pipe_analyzer.go (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • kai_analyzer_rpc/go.mod
⏰ 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). (7)
  • GitHub Check: Run e2e test (windows-latest, cmd, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (macos-13, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (ubuntu-24.04, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (ubuntu-22.04-arm, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Run e2e test (macos-latest, bash, ChatOpenAI, kai-test-generation)
  • GitHub Check: Trunk Check Runner
  • GitHub Check: Check Types on PR Runner (ubuntu-latest, 3.12, x64)
🔇 Additional comments (3)
kai_analyzer_rpc/pkg/service/pipe_analyzer.go (3)

62-62: LGTM: Error message formatting improvements.

The lowercase error messages now follow Go conventions where error strings should not be capitalized unless they begin with proper nouns or acronyms.

Also applies to: 66-66


96-96: LGTM: parseRules call updated to capture provider conditions.

The function call correctly captures the new providerConditions return value, which is subsequently used to invoke Prepare() on each provider.


197-217: LGTM: Provider conditions collection and aggregation logic is sound.

The implementation correctly:

  1. Extends the function signature to return provider conditions
  2. Aggregates conditions from multiple rule files by provider name
  3. Handles error cases with appropriate nil returns
  4. Returns the collected conditions to the caller

The aggregation logic (lines 212-217) properly accumulates conditions across rule files, ensuring each provider receives all its conditions from all loaded rules.

Also applies to: 255-255

Signed-off-by: Pranav Gaikwad <[email protected]>
Copy link
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.

Once CI is green good to go!

@pranavgaikwad pranavgaikwad merged commit 98d35c0 into konveyor:main Nov 24, 2025
14 of 16 checks passed
pranavgaikwad added a commit to konveyor/editor-extensions that referenced this pull request Nov 24, 2025
Requires konveyor/kai#899


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Improved document symbol resolution and navigation with enhanced error
handling.
* Refined definition lookup to better support multiple result types,
providing more reliable "Go to Definition" functionality.

* **Chores**
* Updated provider initialization configuration for internal
compatibility.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Pranav Gaikwad <[email protected]>
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