Skip to content

Fix feature gate filename parsing for major version segmentation#3291

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
stbenjam:fg-loader
Feb 23, 2026
Merged

Fix feature gate filename parsing for major version segmentation#3291
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
stbenjam:fg-loader

Conversation

@stbenjam
Copy link
Member

@stbenjam stbenjam commented Feb 23, 2026

openshift/api#2637 introduced major version segmentation for feature
gates, changing filenames from featureGate-{topology}-{featureSet}.yaml
to featureGate-{majorStart}-{majorEnd}-{topology}-{featureSet}.yaml.
The parser was extracting the version range components as
topology/featureSet, causing all 4.22 files to collide on the same
composite key and fail with "ON CONFLICT DO UPDATE command cannot
affect row a second time".

Fix by taking the last two dash-separated segments as topology and
featureSet, which works for both old and new filename formats.

Note: the new files include annotations that could be used instead of
filename parsing: release.openshift.io/feature-set for the feature set,
include.release.openshift.io/* for the topology (e.g. ibm-cloud-managed
maps to Hypershift, self-managed-high-availability maps to
SelfManagedHA). The old format (4.21 and earlier) lacks the feature-set
annotation but does have the topology include annotation. A future
improvement could switch to annotation-based parsing for better
reliability, but for now this unbreaks the loader.

Summary by CodeRabbit

  • New Features

    • Enhanced feature-gate configuration loading to support both legacy and new versioned file naming formats while preserving backward compatibility.
  • Tests

    • Added comprehensive tests covering multiple filename formats and invalid cases to ensure correct parsing and robustness.

@openshift-ci-robot
Copy link

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
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between ed1a8e2 and 8fbd0b9.

📒 Files selected for processing (2)
  • pkg/dataloader/featuregateloader/featuregateloader.go
  • pkg/dataloader/featuregateloader/featuregateloader_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/dataloader/featuregateloader/featuregateloader.go
  • pkg/dataloader/featuregateloader/featuregateloader_test.go

Walkthrough

parseFeatureGateFilename was updated to accept both the old format (featureGate-{topology}-{featureSet}.yaml) and a versioned format with extra numeric segment(s) before topology (e.g., featureGate-{majorStart}-{majorEnd}-{topology}-{featureSet}.yaml). Tests added covering valid and invalid filename cases.

Changes

Cohort / File(s) Summary
Feature Gate Filename Parsing
pkg/dataloader/featuregateloader/featuregateloader.go, pkg/dataloader/featuregateloader/featuregateloader_test.go
Updated parseFeatureGateFilename to extract topology and featureSet from the last two path segments so it handles both old and versioned filename formats. Added table-driven tests covering multiple valid formats and invalid cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing feature gate filename parsing to handle major version segmentation in filenames.
Go Error Handling ✅ Passed The pull request demonstrates proper Go error handling patterns with no ignored errors, consistent error context using errors.Wrapf() or fmt.Errorf() with %w, appropriate bounds checking in parseFeatureGateFilename(), and correct filepath.Walk callback error propagation.
Sql Injection Prevention ✅ Passed The pull request uses GORM's ORM layer with automatic parameterization. The parseFeatureGateFilename function only performs string parsing; extracted values are safely passed as struct fields to GORM's CreateInBatches, which prevents SQL injection by design.
Excessive Css In React Should Use Styles ✅ Passed This custom check is not applicable to the provided pull request. The PR exclusively modifies Go backend code (featuregateloader.go and featuregateloader_test.go) related to feature gate filename parsing. While the repository does contain JavaScript/React files in the sippy-ng/ directory, the changes in this PR do not touch any React components, JSX files, or CSS-related code. Since the check specifically targets React components with inline CSS styling, and the PR contains only Go backend code, there is nothing to evaluate against this check's criteria.
Single Responsibility And Clear Naming ✅ Passed The PR maintains Single Responsibility Principle with focused package responsibility for parsing feature gate filenames and Clear Naming with explicit action-oriented function names describing their purpose.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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

@openshift-ci openshift-ci bot requested review from dgoodwin and smg247 February 23, 2026 21:49
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 23, 2026
openshift/api#2637 introduced major version segmentation for feature
gates, changing filenames from featureGate-{topology}-{featureSet}.yaml
to featureGate-{majorStart}-{majorEnd}-{topology}-{featureSet}.yaml.
The parser was extracting the version range components as
topology/featureSet, causing all 4.22 files to collide on the same
composite key and fail with "ON CONFLICT DO UPDATE command cannot
affect row a second time".

Fix by taking the last two dash-separated segments as topology and
featureSet, which works for both old and new filename formats.

Note: the new files include annotations that could be used instead of
filename parsing: release.openshift.io/feature-set for the feature set,
include.release.openshift.io/* for the topology (e.g. ibm-cloud-managed
maps to Hypershift, self-managed-high-availability maps to
SelfManagedHA). The old format (4.21 and earlier) lacks the feature-set
annotation but does have the topology include annotation. A future
improvement could switch to annotation-based parsing for better
reliability, but for now this unbreaks the loader.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 23, 2026

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

@neisw
Copy link
Contributor

neisw commented Feb 23, 2026

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 23, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 23, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neisw, stbenjam

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-merge-bot openshift-merge-bot bot merged commit 7a82fa5 into openshift:main Feb 23, 2026
8 checks passed
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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants