Skip to content

feat: use dynamic target version in lint check messages#9

Merged
lburgazzoli merged 1 commit intoopendatahub-io:mainfrom
lburgazzoli:target-versions
Feb 16, 2026
Merged

feat: use dynamic target version in lint check messages#9
lburgazzoli merged 1 commit intoopendatahub-io:mainfrom
lburgazzoli:target-versions

Conversation

@lburgazzoli
Copy link
Copy Markdown
Member

@lburgazzoli lburgazzoli commented Feb 16, 2026

Replace hardcoded "RHOAI 3.x" in lint check condition messages with the
actual target version (e.g. "RHOAI 3.0", "RHOAI 3.3") derived from the
--target-version flag.

  • Add version.MajorMinorLabel() helper to format semver as "major.minor"
  • Embed full check.Target in ComponentRequest and WorkloadRequest so
    validation callbacks can access target version info
  • Update validate.Removal() to auto-inject target version label
  • Update all lint checks to use dynamic version in runtime messages
  • Static check names/descriptions kept as-is (set at construction time)

Co-authored-by: Cursor cursoragent@cursor.com

Description

How Has This Been Tested?

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Summary by CodeRabbit

  • Refactor
    • Diagnostic and validation messages now display explicit target version labels (e.g., "RHOAI 3.0") instead of generic placeholders (e.g., "3.x"), improving clarity about which components, services, and workloads are impacted or ready for upgrades. Tests and messaging across checks were aligned to the new, version-specific wording.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 16, 2026

Warning

Rate limit exceeded

@lburgazzoli has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Dynamic major.minor version labels were added (MajorMinorLabel) and propagated into many checks; target context was embedded in request structs and version labels threaded through helper signatures, replacing hardcoded "3.x" strings with formatted target-version labels.

Changes

Cohort / File(s) Summary
Version Utility Functions
pkg/util/version/helpers.go, pkg/util/version/helpers_test.go
Added MajorMinorLabel(*semver.Version) string and tests to format semantic versions as "major.minor" and handle nil.
Core Validation Framework
pkg/lint/check/validate/component.go, pkg/lint/check/validate/workload.go
Embedded Target check.Target into request structs and removed direct Client/IO/Debug fields; constructors now populate Target so validators can access TargetVersion and client through the embedded Target.
Global message parameterization
multiple components & checks pkg/lint/checks/..., pkg/lint/checks/..._test.go
Replaced many hardcoded "RHOAI 3.x" occurrences with formatted placeholders using version.MajorMinorLabel(req.TargetVersion) (local tv), updating tests to expect concrete labels like "RHOAI 3.0" or "3.1".
KServe workload plumbing
pkg/lint/checks/workloads/kserve/impacted.go, pkg/lint/checks/workloads/kserve/impacted_support.go, pkg/lint/checks/workloads/kserve/inferenceservice_config.go
Threaded a targetVersionLabel/tv parameter through multiple helper functions and condition builders, updating signatures and calls so generated conditions include the dynamic version label.
Workload checks updates
pkg/lint/checks/workloads/notebook/impacted.go, pkg/lint/checks/workloads/ray/impacted_support.go, pkg/lint/checks/workloads/ray/impacted_test.go, pkg/lint/checks/workloads/codeflare/impacted.go, pkg/lint/checks/workloads/datasciencepipelines/*
Introduced tv/targetVersionLabel and updated messages and some method signatures to include the target version label for removal/ready messages. Tests adjusted accordingly.
Dependency & service checks
pkg/lint/checks/dependencies/openshift/openshift.go, pkg/lint/checks/dependencies/servicemeshoperator/..., pkg/lint/checks/services/servicemesh/servicemesh.go, corresponding *_test.go files
Added local tv and updated diagnostic messages to include the dynamic RHOAI version label; test expectations updated from "3.x" to specific major.minor labels.
Minor test/message tweaks
pkg/lint/check/condition_test.go, various *_test.go files
Updated expected message strings in tests to reflect dynamic version labels (e.g., "RHOAI 3.0" instead of "3.x").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped from hardcode to label so bright,
Major and minor now snug in the light.
From "3.x" to "3.0" the messages cheer,
Target versions now crystal and clear.
🥕 A tiny rabbit applauds this new sight.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 describes the main change: replacing hardcoded version strings with dynamic target versions in lint check messages throughout the codebase.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 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

@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.

🧹 Nitpick comments (2)
pkg/lint/check/validate/workload.go (1)

20-42: Target duplicates Client, IO, and Debug fields already present on WorkloadRequest.

WorkloadRequest now embeds the full check.Target (which contains Client, IO, Debug) alongside its own Client, IO, and Debug fields. Existing consumers use req.Client etc., so removing them now would be a breaking change, but consider deprecating the standalone fields in favor of req.Target.* to avoid drift.

pkg/lint/checks/components/kserve/serverless.go (1)

59-61: Nit: tv is computed between the jq.Query call and its error-handling switch.

This is functionally fine since MajorMinorLabel is pure and doesn't depend on err/state, but placing tv before the query (or after the switch's error return) would be slightly more conventional — keeping the error-producing call adjacent to its error check.

Replace hardcoded "RHOAI 3.x" in lint check condition messages with the
actual target version (e.g. "RHOAI 3.0", "RHOAI 3.3") derived from the
--target-version flag.

- Add version.MajorMinorLabel() helper to format semver as "major.minor"
- Embed full check.Target in ComponentRequest and WorkloadRequest so
  validation callbacks can access target version info
- Update validate.Removal() to auto-inject target version label
- Update all lint checks to use dynamic version in runtime messages
- Static check names/descriptions kept as-is (set at construction time)

Co-authored-by: Cursor <cursoragent@cursor.com>
@lburgazzoli lburgazzoli merged commit e566a43 into opendatahub-io:main Feb 16, 2026
5 checks passed
@lburgazzoli lburgazzoli deleted the target-versions branch February 16, 2026 11:50
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