🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

chore: refactor maven autodiscovery manifest template - #10989

Merged
olblak merged 6 commits into
updatecli:mainfrom
olblak:fix/maven-autodiscovery-templates
Oct 23, 2026
Merged

olblak merged 6 commits into
updatecli:mainfrom
olblak:fix/maven-autodiscovery-templates

Conversation

@olblak

@olblak olblak commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

This pullrequest is a refactoring in preparation of upcoming maven pullrequest

Test

To test this pull request, you can run the following commands:

cd pkg/plugins/autodiscovery/maven
go test

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.
  • I have tested this pull request manually with a custom Updatecli build and it works as expected.

Tradeoff

Potential improvement

Summary by CodeRabbit

  • Bug Fixes
    • Maven dependency and parent POM manifests now apply configured version filters consistently.
    • Maven projects without repositories can be discovered without adding a repository section to their manifests.
    • A manifest that cannot be rendered is skipped, while discovery continues for other dependencies or parent POMs, so one rendering issue does not prevent other results from being found.

The versionfilter of the generated source was only written when the
pom.xml or settings.xml declares repositories. Without them, the source
uses Maven Central and bumped to the latest version, whatever the
version filter, major versions included.

Signed-off-by: Olblak <me@olblak.com>
The dependency and parent pom crawlers declared the same anonymous
template parameters, computed the source version filter the same way and
parsed the constant manifest template for every dependency. Share a named
manifestTemplateParams type and a renderManifest method computing the
version filter, and parse the template once. The generated manifests are
unchanged.

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added resource-mavenrepository Resource of kind Maven Repository autodiscovery All things related to the autodiscovery feature labels Oct 22, 2026
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1fa6676d-e7f3-42f7-8043-10b2f2fec490
📥 Commits

Reviewing files that changed from the base of the PR and between 558eb91 and cb3e4d6.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dcd0e58e-cdd3-4a43-829f-a35e27ef1f22
📥 Commits

Reviewing files that changed from the base of the PR and between a681921 and 369dbd8.

📒 Files selected for processing: 3
  • pkg/plugins/autodiscovery/maven/dependency.go
  • pkg/plugins/autodiscovery/maven/dependencyParentPom.go
  • pkg/plugins/autodiscovery/maven/manifestTemplate.go
🚧 Files skipped from review as they are similar to previous changes: 2
  • pkg/plugins/autodiscovery/maven/dependency.go
  • pkg/plugins/autodiscovery/maven/dependencyParentPom.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Maven dependency and parent-POM manifest generation now uses a shared renderer for template execution and version-filter parameters. A new test checks discovery for a Maven project without repositories.

Changes: Maven manifest rendering

Layer / File(s) Summary
Shared template rendering
pkg/plugins/autodiscovery/maven/manifestTemplate.go
The renderer parses the template once, sets version-filter values, and returns template parsing or execution errors. The template’s extra end was removed.
Discovery integration and test
pkg/plugins/autodiscovery/maven/dependency.go, pkg/plugins/autodiscovery/maven/dependencyParentPom.go, pkg/plugins/autodiscovery/maven/main_test.go, pkg/plugins/autodiscovery/maven/testdata/norepository/pom.xml
Dependency and parent-POM generation delegate rendering to m.renderManifest and skip entries when rendering fails. The test checks that discovery without repositories produces one manifest, omits the repositories field, and retains the configured version filter.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: kevinleturc

Merge Risk: ⚪ Minimal · up to 369db

No concrete merge-blocking risk was established for this refactoring.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the Maven autodiscovery manifest-template refactoring.
Description check Passed The description includes the change summary, test command, checklist, tradeoff, and potential-improvement sections. It does not include the expected issue reference or test results, but it is otherwis…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the change summary, test command, checklist, tradeoff, and potential-improvement sections. It does not include the expected issue reference or test results, but it is otherwise sufficiently complete.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

Refactors Maven autodiscovery manifest rendering to centralize template execution and improve handling of repository-less projects ahead of upcoming Maven-related changes.

Changes:

  • Parse the manifest Go template once and reuse it (instead of parsing per dependency/parent POM).
  • Centralize manifest rendering (including version filter adjustments) into renderManifest.
  • Add test coverage and testdata for discovery when no repositories are configured.
File Description
pkg/​plugins/​autodiscovery/​maven/​manifestTemplate.go Introduces shared parsed template, parameter struct, and a single render function.
pkg/​plugins/​autodiscovery/​maven/​dependency.go Switches dependency manifest generation to the shared renderer.
pkg/​plugins/​autodiscovery/​maven/​dependencyParentPom.go Switches parent POM manifest generation to the shared renderer.
pkg/​plugins/​autodiscovery/​maven/​main_test.go Adds coverage for discovery without repositories and version filter application.
pkg/​plugins/​autodiscovery/​maven/​testdata/​norepository/​pom.xml Adds a repository-less POM fixture for testing.

Review effort: Lite

@olblak
olblak enabled auto-merge (squash) October 23, 2026 10:50
@olblak
olblak merged commit ece79c5 into updatecli:main Oct 23, 2026
8 checks passed
@olblak olblak added the cleanup label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autodiscovery All things related to the autodiscovery feature cleanup resource-mavenrepository Resource of kind Maven Repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants