Skip to content

[CFX-4730] Add inert plugin CLI version constraint predicate (PR 1/2) - #814

Draft
ajalon1 wants to merge 1 commit into
mainfrom
aj/cli-version-constraints
Draft

[CFX-4730] Add inert plugin CLI version constraint predicate (PR 1/2)#814
ajalon1 wants to merge 1 commit into
mainfrom
aj/cli-version-constraints

Conversation

@ajalon1

@ajalon1 ajalon1 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

PR 1 of 2 (stacked-to-main chain) for CFX-4730. Adds the inert, independently-testable predicate mechanism for plugin manifest CLI version constraints. Nothing in this PR changes plugin discovery behavior — the new predicate and fields exist but are not wired into any discovery call site yet. That wiring lands in PR 2.

What changed

  • internal/plugin/types.go: added MaxCLIVersion alongside the existing MinCLIVersion on PluginManifest; added a typed PluginSkipReason enum (SkipReasonNameConflict is the zero value, so every existing PluginConflict{Name:…, Path:…} literal keeps its exact meaning) plus Reason/Detail fields on PluginConflict.
  • internal/plugin/cli_version.go (new): compatibleCLIVersion — a pure predicate comparing only the core (major.minor.patch) version of the running CLI against declared minCLIVersion/maxCLIVersion bounds, inclusive on both ends. A malformed declared bound always causes a skip, even when the running CLI version is dev or otherwise unparseable — the dev/unparseable-CLI bypass only applies once the declared bounds are confirmed well-formed. Also adds cliVersionSkip (builds the PluginConflict record) and a currentCLIVersion package-level seam so tests never silently no-op against the literal "dev" build value.
  • internal/plugin/validation.go: comment-only update naming MaxCLIVersion alongside MinCLIVersion as fields intentionally excluded from cross-manifest comparison.
  • internal/plugin/cli_version_test.go (new): table-driven coverage for every relevant spec scenario — no bounds, min-only, max-only inclusive boundary, both bounds, below min, above max, malformed bound (skip regardless of CLI version), dev/unparseable CLI with well-formed bounds (bypass), the joint dev+malformed case (malformed takes precedence), and prerelease CLI version (core-version comparison).

Out of scope (PR 2)

internal/plugin/discover.go call sites, cmd/plugin/discovery.go, LogConflicts/ConflictsForName branching, and docs — this PR is self-contained and does not change plugin discovery behavior.

Ref: https://datarobot.atlassian.net/browse/CFX-4730

Also

Thanks @yuriyhrytsyuk for doing the original work on this!

Add MaxCLIVersion to PluginManifest alongside the existing
MinCLIVersion, and extend PluginConflict with a typed Reason
(PluginSkipReason, zero value SkipReasonNameConflict preserves every
existing literal) and a Detail string, so the existing skip-record
channel can carry version-incompatibility skips in addition to name
conflicts.

Add compatibleCLIVersion, a pure predicate comparing only the core
(major.minor.patch) version of the running CLI against declared
minCLIVersion/maxCLIVersion bounds, inclusive on both ends. A
malformed declared bound always causes a skip, even when the running
CLI version is "dev" or otherwise unparseable — the dev/unparseable
bypass only applies once the declared bounds are confirmed
well-formed. Add cliVersionSkip to build the PluginConflict record
from a manifest, and a currentCLIVersion package-level seam so tests
do not silently no-op against the literal "dev" build value.

Update validation.go comments to also name MaxCLIVersion among the
fields intentionally excluded from cross-manifest comparison.

Neither function is wired into discovery yet: this is the inert,
independently testable predicate mechanism. Discovery call sites,
conflict reporting, and docs land in a follow-up PR.
@datarobot-pr-review-router

Copy link
Copy Markdown

🎫 Jira: CFX-4730 — plugin manifest - CLI version constraints

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.

This was the spec used to implement this; will remove before I merge, just thought it would be useful to share.

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

Labels

go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant