Skip to content

Make component/capability variants more generic#3696

Open
dgoodwin wants to merge 2 commits into
openshift:mainfrom
dgoodwin:generic-component-variants
Open

Make component/capability variants more generic#3696
dgoodwin wants to merge 2 commits into
openshift:mainfrom
dgoodwin:generic-component-variants

Conversation

@dgoodwin

@dgoodwin dgoodwin commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This shouldn't be tied to being a spot check job. Many spot check jobs
will start out running quite often as part of their feature gate
promotion logic.

Summary by CodeRabbit

  • Bug Fixes
    • Updated variant handling for periodic jobs to use clearer, generic Component and Capability labels.
    • Improved validation for spotcheck-* jobs to require both component and capability variant information.
    • Adjusted job-tier assignment and ownership detection to rely on job-name patterns, ensuring consistent variant categorization across suites.

This shouldn't be tied to being a spot check job. Many spot check jobs
will start out running quite often as part of their feature gate
promotion logic.
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 96f7b559-c971-481a-bf56-0e34ef9455b6

📥 Commits

Reviewing files that changed from the base of the PR and between 3ef6c80 and ede5daf.

📒 Files selected for processing (1)
  • pkg/variantregistry/ocp.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/variantregistry/ocp.go

Walkthrough

Variant component and capability keys replace spot-check keys in variant generation, validation, tests, and snapshot data. spotcheck-30d tiering is assigned directly from job-name patterns.

Changes

Component/capability variant migration

Layer / File(s) Summary
Variant generation and tiering
pkg/variantregistry/ocp.go
IdentifyVariants now populates VariantComponent and VariantCapability, and setJobTier assigns spotcheck-30d from job-name patterns instead of precomputed spot-check variants.
Validation path
pkg/variantregistry/ocp.go, pkg/variantregistry/snapshot.go
validateComponentCapabilityVariants replaces the spot-check validator, and spotcheck-* jobs must include both Component and Capability values.
Snapshot records
pkg/variantregistry/snapshot.yaml
Snapshot entries rename SpotCheckComponent/SpotCheckCapability to Component/Capability across the updated records.
Variant sync tests
pkg/variantregistry/ocp_test.go
Expected variants in the sync tests use VariantComponent and VariantCapability keys.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 20 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (20 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: generalizing component/capability variant handling beyond spot-check jobs.
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.
Go Error Handling ✅ Passed PASS: The modified variantregistry paths add/propagate errors cleanly; I found no new ignored errors, panics, or nil-deref risks in the changed sections.
Sql Injection Prevention ✅ Passed New SQL uses placeholders for buildID/release/date params; added formatting only covers internal identifiers/constants, not user input.
Excessive Css In React Should Use Styles ✅ Passed PASS: The PR only touches Go/YAML variant-registry files, not React components or JSX/TSX, so the CSS-style check is not applicable.
Test Coverage For New Features ✅ Passed Updated TestVariantSyncer and TestVariantsSnapshot exercise the new component/capability mapping, tier overrides, and validation paths.
Single Responsibility And Clear Naming ✅ Passed PASS: The refactor keeps variantregistry cohesive, and the new helpers/keys (setComponentAndCapability, validateComponentCapabilityVariants, VariantComponent/Capability) are specific and sing...
Feature Documentation ✅ Passed No relevant docs/features entry covers variant registry; the only feature doc is for job-analysis-symptoms, so this change didn’t leave feature docs stale.
Stable And Deterministic Test Names ✅ Passed No dynamic or unstable test titles were introduced; the touched tests use static job-fixture strings, and this package has no Ginkgo Describe/It titles.
Test Structure And Quality ✅ Passed Touched tests are plain table-driven Go tests, not Ginkgo; the change only renames expected variant keys and adds no cluster ops, waits, or cleanup concerns.
Microshift Test Compatibility ✅ Passed PASS: The PR only refactors variant registry data and unit tests; no new Ginkgo e2e specs or MicroShift-sensitive APIs/features were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only changes variant-registry code, YAML, and a Go unit test; no new Ginkgo e2e tests or SNO-unsafe assumptions are present.
Topology-Aware Scheduling Compatibility ✅ Passed Changes are limited to variant registry classification/validation and YAML data; no manifests, controllers, or scheduling rules were added.
Ote Binary Stdout Contract ✅ Passed Changed code only refactors variant classification/validation; no main/init/TestMain/suite stdout writes or klog/stdout setup were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR only updates variant-registry unit tests/snapshots; no new Ginkgo e2e tests, IPv4 literals, net parsing, or external network calls were added.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token constant-time issues found in the changed files.
Container-Privileges ✅ Passed No touched container/K8s manifests or privilege settings were present; the PR only changes variant registry code and YAML data.
No-Sensitive-Data-In-Logs ✅ Passed The diff only refactors variant mapping; it adds no new logging or sensitive fields in the changed lines.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot requested review from smg247 and xueqzhan June 25, 2026 12:31
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoodwin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 25, 2026

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

🧹 Nitpick comments (1)
pkg/variantregistry/ocp.go (1)

763-782: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep ownership and spot-check tier patterns in one place.

The -cpu-partitioning / -etcd-scaling substrings are now duplicated between setComponentAndCapability and setJobTier. If a future pattern is added to only one list, validation can fail spotcheck-* jobs or silently miss component ownership. Consider a shared pattern table with component, capability, and optional jobTier.

Also applies to: 807-810

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/variantregistry/ocp.go` around lines 763 - 782, The pattern definitions
for ownership/capability matching are duplicated between
setComponentAndCapability and setJobTier, which can drift and break spotcheck
job handling. Refactor the existing pattern handling in those functions to use
one shared table keyed by jobNameLower substrings, and include component,
capability, and an optional jobTier so both VariantComponent/VariantCapability
and tier assignment stay in sync. Make sure the shared symbols used by both
paths are updated consistently instead of maintaining separate substring lists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/variantregistry/ocp.go`:
- Around line 763-782: The pattern definitions for ownership/capability matching
are duplicated between setComponentAndCapability and setJobTier, which can drift
and break spotcheck job handling. Refactor the existing pattern handling in
those functions to use one shared table keyed by jobNameLower substrings, and
include component, capability, and an optional jobTier so both
VariantComponent/VariantCapability and tier assignment stay in sync. Make sure
the shared symbols used by both paths are updated consistently instead of
maintaining separate substring lists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: f041e435-89e5-4db1-858d-f3cf5ccaed66

📥 Commits

Reviewing files that changed from the base of the PR and between 21c8aa7 and 3ef6c80.

📒 Files selected for processing (4)
  • pkg/variantregistry/ocp.go
  • pkg/variantregistry/ocp_test.go
  • pkg/variantregistry/snapshot.go
  • pkg/variantregistry/snapshot.yaml

@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 25, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

@dgoodwin: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

if strings.HasPrefix(variants[VariantJobTier], "spotcheck-") {
if variants[VariantSpotCheckComponent] == "" || variants[VariantSpotCheckCapability] == "" {
return fmt.Errorf("job %q has JobTier=%s but is missing SpotCheckComponent or SpotCheckCapability", jobName, variants[VariantJobTier])
if variants[VariantComponent] == "" || variants[VariantCapability] == "" {

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.

to @stbenjam point on slack, Capability should probably obsolete Procedure. I don't want to play with that just yet as it's used in views, thus part of the tracked regression data we have triaged.

I'd like to do a followup replacing Procedure in the sippy postgres whitelist with Component + Capability. I can't think of a reason we need Procedure in sippy postgres/classic right now. This would help limit the combo explosion, though I'm unclear how relevant that is now with Matthew's work.

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

Overall the changes look good to me. I just have one clarifying question to help me understand better.

VariantLayeredProduct = "LayeredProduct"
VariantOS = "OS"
VariantComponent = "Component" // jobs with an owning component, used to flag regressions if a tailored job is not passing
VariantCapability = "Capability" // jobs with an owning capability, used to flag regressions if a tailored job is not passing

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.

Is this capability the same as the CR capability? Or are we overloading this term?

Is the long-term expectation that many/most jobs will have the component and capability set, even in the absence of the spot-check job tier for the job?

Comment on lines +813 to +819
// Check componentCapabilityPatterns first for tier overrides (e.g. spotcheck).
for _, p := range componentCapabilityPatterns {
if p.jobTier != "" && allSubstringsMatch(jobNameLower, p.substrings) {
variants[VariantJobTier] = p.jobTier
return
}
}

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.

nit: Since setComponentAndCapability already ran and set VariantComponent/VariantCapability, this could skip the redundant substring matching and use the already-computed result:

if variants[VariantComponent] != "" {
  for _, p := range componentCapabilityPatterns {
    if p.jobTier != "" && p.component == variants[VariantComponent] && p.capability == variants[VariantCapability] {
      variants[VariantJobTier] = p.jobTier
      return
    }
  }
}

This makes the dependency on setter ordering explicit. It's already the case, just not visible in the code.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants