Skip to content

fix(dynamic-plugins): omit synthetic deprecated disabled field - #3642

Open
hopehadfield wants to merge 2 commits into
redhat-developer:mainfrom
hopehadfield:feat/rhidp-17293-deprecate-disabled
Open

hopehadfield wants to merge 2 commits into
redhat-developer:mainfrom
hopehadfield:feat/rhidp-17293-deprecate-disabled

Conversation

@hopehadfield

Copy link
Copy Markdown
Member

Summary

Avoid writing disabled: false into dynamic-plugin YAML when the field was never specified. Track whether the deprecated key was present so explicitly supplied disabled: false and disabled: true survive operator merges and round trips. Preserve enabled precedence; update the operator fixture to use enabled.

This prevents the operator from generating deprecation warnings for entries that did not use the legacy key. The runtime warning itself is introduced separately in rhdh-plugins#5023.

Related: RHIDP-17293.

Test plan

  • go test ./pkg/model ./internal/controller -count=1
  • gofmt -l pkg/model/dynamic-plugins.go pkg/model/dynamic-plugins_test.go (no output)
  • Verify absent disabled is omitted, explicit false/true round-trip, and enabled keeps precedence.

Refs: RHIDP-17293
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
@hopehadfield
hopehadfield requested a review from a team as a code owner September 28, 2026 23:05
@rhdh-qodo-merge

Copy link
Copy Markdown

PR Summary by Qodo

Omit synthetic deprecated disabled fields from dynamic-plugin YAML

🐞 Bug fix 🕐 20-40 Minutes

Grey Divider

AI Description

• Omit deprecated disabled from generated plugin YAML unless it was explicitly supplied.
• Preserve explicit legacy values through merges and YAML round trips while keeping enabled
 precedence.
• Test activation combinations and migrate the minimal fixture to enabled.
Diagram

graph TD
  A["Base YAML"] --> C["Decode presence"] --> D["Merge activation"] --> E{"Disabled supplied?"}
  B["Overlay YAML"] --> C
  E -->|Yes| F["Keep disabled"] --> H["ConfigMap YAML"]
  E -->|No| G["Omit disabled"] --> H
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Represent Disabled as *bool
  • ➕ A nil pointer would represent absence without separate presence tracking.
  • ➖ Changes the existing DynaPlugin field type and requires updates to callers and activation logic.

Recommendation: Keep the presence flag and custom YAML methods: they distinguish absent from explicit false without changing the public bool field. A pointer would simplify serialization but impose a broader compatibility change.

Files changed (3) +92 / -9

Bug fix (1) +46 / -5
dynamic-plugins.goTrack legacy-key presence during YAML decoding and plugin merges +46/-5

Track legacy-key presence during YAML decoding and plugin merges

• Custom YAML methods omit an absent 'disabled' key while retaining explicitly supplied true and false values. Merge logic carries that presence through overlays, drops inherited legacy keys when appropriate, and preserves 'enabled' precedence.

pkg/model/dynamic-plugins.go

Tests (2) +46 / -4
dynamic-plugins_test.goCover disabled-key round trips and merge precedence +44/-2

Cover disabled-key round trips and merge precedence

• Tests verify omission of synthetic keys, round trips for explicit legacy values, and merge behavior for both-key and disabled-only overlays.

pkg/model/dynamic-plugins_test.go

minimal-dynamic-plugins.yamlUse enabled in the minimal dynamic-plugin fixture +2/-2

Use enabled in the minimal dynamic-plugin fixture

• Replaces two deprecated 'disabled: false' entries with 'enabled: true' while preserving their enabled behavior.

pkg/model/testdata/minimal-dynamic-plugins.yaml

@rhdh-qodo-merge

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@rhdh-qodo-merge

Copy link
Copy Markdown

Important

The /generate_labels command by Qodo is sunsetting on the 1st of October 2026 and will no longer be available. We recommend switching to the latest Qodo review capabilities. Learn more

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR images built and pushed successfully!

Images are available for testing (expires in 7 days):

Image Full tag PR tag
Operator quay.io/rhdh-community/operator:2.1.0-pr-3642-061ce03 quay.io/rhdh-community/operator:2.1.0-pr-3642
Bundle quay.io/rhdh-community/operator-bundle:2.1.0-pr-3642-061ce03 quay.io/rhdh-community/operator-bundle:2.1.0-pr-3642
Catalog quay.io/rhdh-community/operator-catalog:2.1.0-pr-3642-061ce03 quay.io/rhdh-community/operator-catalog:2.1.0-pr-3642

Refs: RHIDP-17293
Signed-off-by: Hope Hadfield <hhadfiel@redhat.com>
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR images built and pushed successfully!

Images are available for testing (expires in 7 days):

Image Full tag PR tag
Operator quay.io/rhdh-community/operator:2.1.0-pr-3642-5dee1be quay.io/rhdh-community/operator:2.1.0-pr-3642
Bundle quay.io/rhdh-community/operator-bundle:2.1.0-pr-3642-5dee1be quay.io/rhdh-community/operator-bundle:2.1.0-pr-3642
Catalog quay.io/rhdh-community/operator-catalog:2.1.0-pr-3642-5dee1be quay.io/rhdh-community/operator-catalog:2.1.0-pr-3642

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.27%. Comparing base (ef90854) to head (5dee1be).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/model/dynamic-plugins.go 86.66% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3642      +/-   ##
==========================================
+ Coverage   59.84%   60.27%   +0.43%     
==========================================
  Files          51       51              
  Lines        3586     3640      +54     
==========================================
+ Hits         2146     2194      +48     
- Misses       1246     1249       +3     
- Partials      194      197       +3     
Flag Coverage Δ
nightly ?
unittests 60.27% <86.66%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/model/dynamic-plugins.go 80.81% <86.66%> (+0.63%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant