with one click
remove-feature
// Remove unsupported sugar features from stabilized OpenShift spec versions
// Remove unsupported sugar features from stabilized OpenShift spec versions
| name | remove-feature |
| description | Remove unsupported sugar features from stabilized OpenShift spec versions |
Automates the removal of sugar features from stabilized OpenShift spec versions:
translate.gotranslate.gotranslate_test.gomax version in internal/doc/butane.yaml for doc transforms./generate to regenerate spec documentation./test to validate all changes_exp)translate.gointernal/doc/butane.yaml# Interactive mode - will ask for details
/remove-feature
# Specify the version and feature
/remove-feature --distro openshift --version v4_22 --feature grub
# With tracking reference
/remove-feature --distro openshift --version v4_22 --feature grub --ref MCO-630
If not provided via arguments, ask the user:
openshift)v4_22)grub)MCO-630, #515)Run these checks:
# Verify target directory exists and is NOT experimental
ls -la config/{distro}/{version}/
# Verify version does NOT end with _exp
# CRITICAL: Only remove features from stabilized specs
# Check git status
git status --porcelain
Stop if:
_exp (experimental specs should be modified differently)Read the target files to locate the feature:
# Read translate.go to find feature function
cat config/{distro}/{version}/translate.go
# Read translate_test.go to find test cases
cat config/{distro}/{version}/translate_test.go
# Read butane.yaml to find doc transform entries
cat internal/doc/butane.yaml
Identify:
ts = translateUserGrubCfg(&cfg, &ts))func translateUserGrubCfg(...))// Test Grub config test struct)replacement: "Unsupported" and max versionStop if the feature code is not found in translate.go - it may have already been removed or never existed in this version.
File: config/{distro}/{version}/translate.go
Read the file and find the function call within the main ToMachineConfig{Version}Unvalidated() function.
Remove the line calling the feature's translation function. For example:
// REMOVE THIS LINE:
ts = translateUserGrubCfg(&cfg, &ts)
Use the Edit tool:
oldString: "\tts = translateUserGrubCfg(&cfg, &ts)\n"
newString: ""
File: config/{distro}/{version}/translate.go
Remove the entire function definition. The function is typically at the end of the file.
For the GRUB removal pattern, remove the entire translateUserGrubCfg function:
// REMOVE THIS ENTIRE BLOCK:
// fcos config generates a user.cfg file using append; however, OpenShift config
// does not support append (since MCO does not support it). Let change the file to use contents
func translateUserGrubCfg(config *types.Config, ts *translate.TranslationSet) translate.TranslationSet {
// ... function body ...
}
Use the Edit tool to remove from the comment above the function through the closing brace.
After removing the function, check if any imports are now unused. Common imports that may become dead:
If imports are dead, remove them. Run ./test later to catch any remaining issues.
File: config/{distro}/{version}/translate_test.go
Read the file and identify the test case block for the removed feature. Test cases are typically marked with a comment like // Test Grub config and consist of a struct literal in the test table.
Remove the entire test case struct. For GRUB removal, this includes:
// Test Grub config)Use the Edit tool to remove the entire block. Be careful to:
} and for loop)File: internal/doc/butane.yaml
Find the doc transform entries for the removed feature. These have the pattern:
transforms:
- regex: ".*"
replacement: "Unsupported"
if:
- variant: openshift
max: {PREVIOUS_VERSION}
Determine the new max version:
v4_22, derive 4.22.0max should be the previous stabilized version (e.g., 4.21.0)max to the new version: 4.22.0Update ALL occurrences for the feature. For GRUB, there are 4 entries:
grub itselfgrub.usersgrub.users.namegrub.users.password_hashUse the Edit tool for each occurrence:
oldString: "max: 4.21.0"
newString: "max: 4.22.0"
IMPORTANT: Only update max values within the feature's section. Verify the surrounding context (field names) to avoid changing unrelated transforms.
Alternatively, if all occurrences have the same old value, use replaceAll with enough context to scope the changes correctly.
Run the documentation generator:
./generate
Expected outcome: The docs/config-openshift-{version}.md file is updated, with the removed feature's fields now showing "Unsupported" instead of their original descriptions.
Verify the change:
git diff docs/config-openshift-{version}.md
The diff should show lines like:
-* **_grub_** (object): describes the desired GRUB bootloader configuration.
+* **_grub_** (object): Unsupported
If ./generate fails, check the butane.yaml changes for syntax errors.
./test
Expected outcome: All tests pass.
If tests fail:
Provide a comprehensive summary:
Feature "{feature}" removed from {distro}/{version}
Files Modified:
- config/{distro}/{version}/translate.go (-N lines)
- config/{distro}/{version}/translate_test.go (-N lines)
- internal/doc/butane.yaml (N version bumps)
- docs/config-{distro}-{version}.md (regenerated, N fields -> "Unsupported")
Tests: PASSED
Docs: REGENERATED
Suggested commit message:
{distro}/{version}: Remove {feature_description}
{reason for removal, e.g., "Support is still missing in the MCO."}
See: {reference_link}
See: #{github_issue}
This skill automates the following steps:
translate.gotranslate.gotranslate_test.gomax version in internal/doc/butane.yaml for all feature fields./generate./testvalidate.go, that must be handled separately/remove-feature --distro openshift --version v4_22 --feature grub --ref MCO-630
Validating prerequisites...
ā
Target directory exists: config/openshift/v4_22
ā
Version is stabilized (not experimental)
ā
Git working directory is clean
Identifying feature code...
ā
Found function call: ts = translateUserGrubCfg(&cfg, &ts)
ā
Found function definition: translateUserGrubCfg (21 lines)
ā
Found test case: // Test Grub config (83 lines)
ā
Found 4 butane.yaml transform entries (max: 4.21.0)
Phase 1: Remove translation code
ā
Removed function call from translate.go
ā
Removed function definition from translate.go (-22 lines)
Phase 2: Remove test cases
ā
Removed test case from translate_test.go (-83 lines)
Phase 3: Update doc descriptors
ā
Bumped max: 4.21.0 ā 4.22.0 for grub (4 entries)
Phase 4: Regenerate docs
ā
./generate completed
ā
docs/config-openshift-v4_22.md updated (4 fields ā "Unsupported")
Phase 5: Validate
ā
./test passed
Feature "grub" removed from openshift/v4_22
Suggested commit message:
openshift/v4_22: Remove GRUB config support
See: https://issues.redhat.com/browse/MCO-630
See: #515
.opencode/skills/remove-feature/DESIGN.md.opencode/skills/remove-feature/examples/4a2be91, 2d9a25e, aa6ad0b, 9821f9b, cd75f80, 1f65fb6config/openshift/v4_22_exp/translate.go:264-285internal/doc/butane.yaml:402-438