Skip to content

feat(autodiscovery): align matching rule validation across all plugins#7867

Merged
olblak merged 2 commits into
updatecli:mainfrom
railgun-0402:aligned-autodiscovery-matching-rule-behavior-across-all-plugins
Mar 7, 2026
Merged

feat(autodiscovery): align matching rule validation across all plugins#7867
olblak merged 2 commits into
updatecli:mainfrom
railgun-0402:aligned-autodiscovery-matching-rule-behavior-across-all-plugins

Conversation

@railgun-0402

Copy link
Copy Markdown
Contributor

Fix #7628

  • Add Validate() method to MatchingRules in all 17 autodiscovery plugins that were missing it (argocd, cargo, dockerfile, dockercompose, fleet, flux, githubaction, golang, helm,
    ko, kubernetes, maven, npm, nomad, precommit, updatecli, woodpecker)
  • Call Validate() in each plugin's New() for both Ignore and Only rules, so invalid specs fail fast with a clear error
  • Add TestMatchingRulesValidate to each plugin's test file to prevent regressions

Test

Test plan

  • go test ./pkg/plugins/autodiscovery/... -run TestMatchingRulesValidate — all pass
  • go build ./pkg/plugins/autodiscovery/... — no errors
  • Existing tests unaffected (pre-existing golang/TestDiscoverManifests failure is unrelated to this PR)

Related

Additional Information

Behavior

A matching rule with no selectors defined (all fields empty/zero) is now rejected with an explicit error:

invalid ignore spec: rule 1 has no valid fields (path or images must be specified)

Previously, such rules were silently accepted and resulted in 0 discoveries.

@olblak olblak requested a review from Copilot March 5, 2026 16:37
@olblak

olblak commented Mar 5, 2026

Copy link
Copy Markdown
Member

Thanks for the pull request. that's a big contribution

@olblak olblak added enhancement New feature or request autodiscovery All things related to the autodiscovery feature labels Mar 5, 2026

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@olblak olblak requested a review from Copilot March 5, 2026 17:47

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@olblak olblak requested a review from Copilot March 5, 2026 19:56

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.

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/plugins/autodiscovery/golang/matchingRule.go
Comment thread pkg/plugins/autodiscovery/maven/matchingRule.go
Comment thread pkg/plugins/autodiscovery/woodpecker/matchingRule_test.go
@olblak

olblak commented Mar 7, 2026

Copy link
Copy Markdown
Member

Thank you for the pull request, that was a long but needed one

@olblak olblak merged commit 6574832 into updatecli:main Mar 7, 2026
7 checks passed
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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking: Align autodiscovery matching rule behavior across plugins

3 participants