Skip to content

ROSAENG-62084: fix: sync autoRepair and labels into passthrough fiel… - #332

Open
gdbranco wants to merge 1 commit into
openshift-online:mainfrom
gdbranco:fix/autorepair-db
Open

ROSAENG-62084: fix: sync autoRepair and labels into passthrough fiel…#332
gdbranco wants to merge 1 commit into
openshift-online:mainfrom
gdbranco:fix/autorepair-db

Conversation

@gdbranco

@gdbranco gdbranco commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

…ds on read

NodePoolCRToPlatform now populates nodePool.management.autoRepair from the top-level autoRepair field (defaulting to true when unset, matching the operator default) and nodePool.nodeLabels from the top-level labels field, keeping the API response internally consistent.

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling change

Testing

  • Unit tests pass (make test)
  • Integration tests pass (if applicable)
  • Manual verification completed

Checklist

  • My code follows the project's coding conventions
  • I have updated documentation as needed
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass

Summary by CodeRabbit

  • Bug Fixes

    • Node pool auto-repair settings now consistently synchronize, defaulting to enabled when unspecified.
    • Node pool labels now propagate correctly, including clearing outdated labels when none are configured.
    • Node pool rendering now reliably reflects the current label configuration.
  • Tests

    • Added coverage for auto-repair defaults, label propagation, and empty-label handling.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift-online/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c224758d-46cb-450a-b532-9e34f7ef03b6

📥 Commits

Reviewing files that changed from the base of the PR and between 944d792 and 1e6fb14.

📒 Files selected for processing (2)
  • platform-api/go.mod
  • platform-api/pkg/clients/hyperfleetdb/convert.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • platform-api/go.mod
  • platform-api/pkg/clients/hyperfleetdb/convert.go

Walkthrough

NodePool conversion now propagates autoRepair and labels to passthrough fields. Unset autoRepair defaults to true, and absent labels clear stale values. The node pool renderer also assigns labels unconditionally. Tests cover these cases.

Changes

NodePool synchronization

Layer / File(s) Summary
NodePool conversion synchronization
platform-api/pkg/clients/hyperfleetdb/convert.go, platform-api/pkg/clients/hyperfleetdb/convert_test.go, platform-api/go.mod
NodePoolCRToPlatform synchronizes autoRepair and nodeLabels. Tests cover unset, true, and false values, plus non-empty and empty labels. k8s.io/utils is declared as a direct dependency.
Node pool renderer label synchronization
hyperfleet-operator/internal/render/nodepool.go
The renderer assigns nodePool.Spec.Labels unconditionally, including when the map is empty.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 1e6fb

The change synchronizes node pool response fields and has no actionable merge-blocking risk remaining after normal checks and review.

Possibly related PRs

Suggested labels: lgtm

Suggested reviewers: typeid

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main changes: synchronizing autoRepair and labels into passthrough fields.
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.
No-Weak-Crypto ✅ Passed The PR diff only adds autoRepair/label synchronization, ptr dependency changes, and tests; it introduces no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The diff changes Go conversion and label synchronization only; it adds no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The diff adds no production logging or print calls. New labels and autoRepair values are mapped into API responses; existing handler logs emit only operation metadata and errors.
No-Hardcoded-Secrets ✅ Passed The diff adds only boolean/map synchronization, tests, comments, and a Go dependency; no secret literals, credential-bearing URLs, long base64 strings, or secret assignments were introduced.
No-Injection-Vectors ✅ Passed The PR adds typed bool/map assignments and tests only; diff and structural scans found no SQL concatenation, shell/eval/exec, unsafe YAML/pickle, or HTML injection sink.
Ai-Attribution ✅ Passed The authored PR description and HEAD commit mention no AI tool; HEAD has no attribution or Co-Authored-By trailers, so the conditional check is not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
platform-api/pkg/clients/hyperfleetdb/convert_test.go (2)

128-139: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover stale passthrough labels in the empty case.

The test creates a zero-valued nested NodePool, so it passes even when NodePoolCRToPlatform leaves old NodeLabels unchanged. Pre-populate Spec.NodePool.NodeLabels, keep Spec.Labels nil or empty, and assert that the returned map is empty.

🤖 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 `@platform-api/pkg/clients/hyperfleetdb/convert_test.go` around lines 128 -
139, Update TestNodePoolCRToPlatform_LabelsEmpty to initialize
Spec.NodePool.NodeLabels with a non-empty stale map while keeping Spec.Labels
nil or empty, then assert NodePoolCRToPlatform clears it and returns an empty
NodeLabels map.

70-85: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Make the explicit-false case test an override.

NodePoolSpecPassthrough.Management.AutoRepair starts as false. A converter that ignores an explicit false therefore still passes this test row. Initialize the nested value to true for this case, or add an initialMgmt table field, before calling NodePoolCRToPlatform.

🤖 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 `@platform-api/pkg/clients/hyperfleetdb/convert_test.go` around lines 70 - 85,
Update the “explicit false propagates to passthrough” test in the
NodePoolCRToPlatform test table so the nested management AutoRepair value starts
as true before conversion, or introduce and apply an initialMgmt fixture field.
Verify the conversion overrides that initial true value to false when autoRepair
is explicitly false.
🤖 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.

Inline comments:
In `@platform-api/pkg/clients/hyperfleetdb/convert.go`:
- Around line 136-139: The converter must synchronize empty top-level labels as
well as non-empty ones. In platform-api/pkg/clients/hyperfleetdb/convert.go
lines 136-139, update the label conversion to assign NodeLabels unconditionally
from Labels. In platform-api/pkg/clients/hyperfleetdb/convert_test.go lines
128-139, pre-populate stale NodeLabels and assert that empty top-level Labels
clears them.

---

Nitpick comments:
In `@platform-api/pkg/clients/hyperfleetdb/convert_test.go`:
- Around line 128-139: Update TestNodePoolCRToPlatform_LabelsEmpty to initialize
Spec.NodePool.NodeLabels with a non-empty stale map while keeping Spec.Labels
nil or empty, then assert NodePoolCRToPlatform clears it and returns an empty
NodeLabels map.
- Around line 70-85: Update the “explicit false propagates to passthrough” test
in the NodePoolCRToPlatform test table so the nested management AutoRepair value
starts as true before conversion, or introduce and apply an initialMgmt fixture
field. Verify the conversion overrides that initial true value to false when
autoRepair is explicitly false.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift-online/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 286aea32-3a43-4716-8576-7bf67c82723f

📥 Commits

Reviewing files that changed from the base of the PR and between f0366b5 and d32345d.

📒 Files selected for processing (3)
  • hyperfleet-operator/internal/render/nodepool_test.go
  • platform-api/pkg/clients/hyperfleetdb/convert.go
  • platform-api/pkg/clients/hyperfleetdb/convert_test.go

Comment thread platform-api/pkg/clients/hyperfleetdb/convert.go Outdated
@gdbranco

Copy link
Copy Markdown
Contributor Author

/retest-konflux

@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)
platform-api/go.mod (1)

36-36: 🔒 Security & Privacy | 🔵 Trivial | 🏗️ Heavy lift

Add or document the remaining supply-chain controls.

go.sum contains both hashes, OSV reports no vulnerabilities, and k8s.io/utils uses Apache-2.0. Record license compatibility and provide SBOM, provenance attestations, and Sigstore/cosign signing for release artifacts.

🤖 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 `@platform-api/go.mod` at line 36, Document the supply-chain controls for the
k8s.io/utils dependency: record Apache-2.0 license compatibility and add or
reference SBOM generation, provenance attestations, and Sigstore/cosign
signatures for release artifacts. Keep the existing dependency version and
checksum handling unchanged.

Source: Path instructions

🤖 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 `@platform-api/go.mod`:
- Line 36: Document the supply-chain controls for the k8s.io/utils dependency:
record Apache-2.0 license compatibility and add or reference SBOM generation,
provenance attestations, and Sigstore/cosign signatures for release artifacts.
Keep the existing dependency version and checksum handling unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift-online/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 81638c23-9bc6-4ceb-84d8-0eabee72aebc

📥 Commits

Reviewing files that changed from the base of the PR and between d32345d and 7aa72b3.

📒 Files selected for processing (1)
  • platform-api/go.mod

@gdbranco
gdbranco force-pushed the fix/autorepair-db branch 2 times, most recently from f04c31d to 944d792 Compare August 12, 2026 21:54
@cdoan1 cdoan1 changed the title ROSAENG-62084 | fix: sync autoRepair and labels into passthrough fiel… ROSAENG-62084: fix: sync autoRepair and labels into passthrough fiel… Aug 12, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 12, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

@gdbranco: This pull request references ROSAENG-62084 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target the "5.0.0" version, but no target version was set.

Details

In response to this:

…ds on read

NodePoolCRToPlatform now populates nodePool.management.autoRepair from the top-level autoRepair field (defaulting to true when unset, matching the operator default) and nodePool.nodeLabels from the top-level labels field, keeping the API response internally consistent.

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling change

Testing

  • Unit tests pass (make test)
  • Integration tests pass (if applicable)
  • Manual verification completed

Checklist

  • My code follows the project's coding conventions
  • I have updated documentation as needed
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass

Summary by CodeRabbit

  • Enhancements
  • Node pool settings now preserve automatic repair configuration during conversion, defaulting to enabled when unspecified.
  • Node labels are consistently synchronized with the platform representation.
  • Clearing node pool labels now also clears previously stored platform labels, preventing stale configuration.
  • Updates ensure node pool configuration remains accurate when settings are added, changed, or removed.

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 openshift-eng/jira-lifecycle-plugin repository.

@cdoan1

cdoan1 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

/approve

@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cdoan1, gdbranco

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 Aug 12, 2026
@cdoan1

cdoan1 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

/test on-demand-e2e

…ds on read

NodePoolCRToPlatform now populates nodePool.management.autoRepair from
the top-level autoRepair field (defaulting to true when unset, matching
the operator default) and nodePool.nodeLabels from the top-level labels
field, keeping the API response internally consistent.
@gdbranco

Copy link
Copy Markdown
Contributor Author

/test on-demand-e2e

@gdbranco

Copy link
Copy Markdown
Contributor Author

/retest

2 similar comments
@cdoan1

cdoan1 commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

/retest

@cdoan1

cdoan1 commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

/retest

@cdoan1

cdoan1 commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

@gdbranco rebase and konflux should work

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants