OSAC-3132: migrate ComputeInstance and ClusterOrder feedback controllers to Bridge #402
@vladikr: This pull request references OSAC-3132 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 task to target the "5.0.0" version, but no target version was set.
<details>
In response to this:
>## Summary
>Migrate ComputeInstance and ClusterOrder feedback controllers to use the feedback.Bridge. Each controller is in a separate commit.>| Commit | Controller | Notes |
>|--------|-----------|-------|
>| 1 | ComputeInstance | Syncs 6 conditions, 7 phases, IP addresses, lastRestartedAt |
>| 2 | ClusterOrder | Syncs conditions, phases (with HostedCluster fetch on Ready), node requests; drops logger field |
>## Behavioral improvements
>Both controllers previously had no NotFound-during-deletion handling — if the fulfillment service archived the record before the feedback finalizer was removed, the controller would error-loop indefinitely. The Bridge fixes this automatically.
>## ClusterOrder details
>-SyncUpdateclosure captureshubClientfor HostedCluster lookups on the Ready phase
>- Constructor signature drops the
logger logr.Logger parameter — the Bridge uses ctrllog.FromContext(ctx) consistently (matching all other feedback controllers)>-
cmd/main.go updated accordingly>-
clone/equal generic helpers remain in feedback_controller.go — still used by ExternalIP and ExternalIPAttachment (migrated in the next PR)>- Extracted
newClusterOrderFeedbackBridge helper so tests can wire the Bridge with mock clients>## What's next
>Per the migration plan in #387:
>- [x] ~~Subnet~~ (#387)
>- [x] ~~VirtualNetwork, SecurityGroup, NATGateway, ExternalIPPool~~ (#401)
>- [x] ComputeInstance, ClusterOrder (this PR)
>- [ ] ExternalIP (uses
IsNotFound)>- [ ] ExternalIPAttachment (uses
PostSaveOnDelete)>## Test plan
>- [x] make lint — 0 issues>- [x]
make test — all pass (controller coverage 72.2%)>- [x] All 36 ComputeInstance and 15 ClusterOrder feedback tests pass unchanged
>Jira: https://redhat.atlassian.net/browse/OSAC-3132
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.
</details>
<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->

<!-- review_stack_entry_end -->
<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->
[!WARNING]
## Review limit reached
> @vladikr, you've reached your PR review limit, so we couldn't start this review.> Next review available in: 56 minutes
> Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).
> <details>
<summary>How can I continue?</summary>
> After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.> To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.
> </details>
>
<details>
<summary>How do review limits work?</summary>
> CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.
> For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.
> Please refer docs for additional details.
> </details>
> <details>
<summary>Review details</summary>
> <details>
<summary>⚙️ Run configuration</summary>
> Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
> Review profile: ASSERTIVE
> Plan: Pro Plus
> Run ID: 0257a4c7-c7c5-43a2-8a4b-75ff7902d7a3> </details>
> <details>
<summary>📥 Commits</summary>
> Reviewing files that changed from the base of the PR and between c45ae6dc1a467ab867e8d47a9af705c6276f3b56 and 4910b88c556c7daba3bed7234df269603fd4e516.
> </details>
> <details>
<summary>📒 Files selected for processing (5)</summary>
> cmd/main.go internal/controller/clusterorder_feedback_controller_test.go internal/controller/computeinstance_feedback_controller.go internal/controller/computeinstance_feedback_controller_test.go internal/controller/feedback_controller.go> </details>
> </details>
<!-- end of auto-generated comment: rate limited by coderabbit.ai -->
<!-- walkthrough_start -->
Walkthrough
ClusterOrder and ComputeInstance feedback reconcilers now use shared feedback.Bridge instances for reconciliation and fulfillment-service synchronization. Constructors, controller setup, tests, and resource-specific synchronization helpers were updated.
Changes
Feedback bridge migration
|Layer / File(s)|Summary|
|---|---|
|Bridge wiring and reconciler construction <br> internal/controller/feedback_controller.go, internal/controller/computeinstance_feedback_controller.go, cmd/main.go, internal/controller/_feedback_controller_test.go|Reconciler state and constructors now use typed bridges, with controller setup and test initialization updated for the revised signatures and fields.|
|ClusterOrder bridge synchronization <br> internal/controller/feedback_controller.go|ClusterOrder reconciliation delegates fetching, saving, signaling, deletion, condition and phase updates, hosted-cluster URLs, and node-request synchronization to bridge callbacks.|
|ComputeInstance bridge synchronization <br> internal/controller/computeinstance_feedback_controller.go|ComputeInstance reconciliation delegates to bridge callbacks and synchronizes conditions, phase, IP addresses, and restart timestamps through standalone helpers.|
Estimated code review effort: 4 (Complex) | ~45 minutes
Sequence Diagram(s)
sequenceDiagram
participant FeedbackReconciler
participant feedback.Bridge
participant ClustersClient
participant HubClient
FeedbackReconciler->>feedback.Bridge: Reconcile request
feedback.Bridge->>ClustersClient: Fetch and save Cluster
feedback.Bridge->>HubClient: Fetch HostedCluster for URLs
feedback.Bridge->>ClustersClient: Signal Cluster
Possibly related PRs
feedback.Bridge integration used by these controllers.Suggested labels: ok-to-test
Suggested reviewers: akshaynadkarni, tzvatot, alosadagrande
<!-- walkthrough_end -->
<!-- pre_merge_checks_walkthrough_start -->
<details>
<summary>🚥 Pre-merge checks | ✅ 11</summary>
<details>
<summary>✅ Passed checks (11 passed)</summary>
| 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: migrating the ComputeInstance and ClusterOrder feedback controllers to Bridge. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| 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-Hardcoded-Secrets | ✅ Passed | No hardcoded secrets were introduced; the changes only add bridge wiring and mock test setup, with no credential literals or embedded credentials. |
| No-Weak-Crypto | ✅ Passed | No weak crypto or custom crypto appears in the changed files; the only crypto-related code is standard TLS setup and protobuf equality. |
| No-Injection-Vectors | ✅ Passed | No flagged injection patterns appear in the changed files; the PR only rewires feedback controllers and tests, with no SQL, shell, eval, pickle, YAML, or innerHTML sinks. |
| Container-Privileges | ✅ Passed | The PR touches only Go code, and a repo scan found no privileged, hostPID/hostNetwork/hostIPC, SYS_ADMIN, or allowPrivilegeEscalation:true settings. |
| No-Sensitive-Data-In-Logs | ✅ Passed | No new logs expose secrets/PII; added bridge/controller logs only emit phases, conditions, resource classes, and opaque IDs. |
| Ai-Attribution | ✅ Passed | PASS: PR commits mention Claude Code and each relevant commit has an Assisted-by trailer; no Co-Authored-By appears in inspected history. |
</details>
</details>
<!-- pre_merge_checks_walkthrough_end -->
<!-- finishing_touch_checkbox_start -->
<details>
<summary>✨ Finishing Touches</summary>
<details>
<summary>🧪 Generate unit tests (beta)</summary>
</details>
</details>
<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->
---
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
<details>
<summary>❤️ Share</summary>
</details>
<sub>Comment @coderabbitai help to get the list of available commands.</sub>
<!-- tips_end -->
_🗄️ Data Integrity & Integration_ | _🟠 Major_ | _⚡ Quick win_
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
git log -1 --format=%H
git show HEAD~2:internal/controller/computeinstance_feedback_controller.go 2>/dev/null | rg -n -A20 'COMPUTE_INSTANCE_STATE_DELETING'
Repository: osac-project/osac-operator
Length of output: 1190
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate and inspect the affected controller plus related bridge delete-state handling.
printf 'Files matching computeinstance_feedback_controller.go:\n'
fd -a 'computeinstance_feedback_controller\.go$' . || true
printf '\nCurrent controller section:\n'
sed -n '1,180p' internal/controller/computeinstance_feedback_controller.go
printf '\nSearch for syncComputeInstanceUpdate/Delete usage and ClusterOrder delete state handling:\n'
rg -n 'syncComputeInstanceUpdate|syncComputeInstanceDelete|SyncUpdate|SyncDelete|ClusterOrder|SetState\(.*DELETING\)|GetPhaseMappingFor' internal/controller -S
Repository: osac-project/osac-operator
Length of output: 50382
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect relevant definitions and tests for ComputeInstance Phase mappings and delete behavior.
printf 'Candidate files:\n'
rg -l 'func ComputeInstancePhase|ComputeInstancePhase|ComputeInstanceState_|DELETING|ClusterOrder' internal pkg . --glob '!vendor/**' --glob '!node_modules/**' || true
printf '\nDefinitions/usages around phase mapping:\n'
rg -n 'func .*Phase|PhaseMapping|Phase.*Delete|Delete.*Phase|DELETING|GetStatus.*SetState|SetState\(.*DELETING\)' internal pkg --glob '*.go' || true
printf '\nRelevant test snippets with Deleting/DELETING:\n'
rg -n -C 4 'Deleting|DELETING|computeinstance_feedback|SyncDelete' --glob '*_test.go' || true
Repository: osac-project/osac-operator
Length of output: 39209
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'ComputeInstance feedback test delete/state snippets:\n'
sed -n '230,280p' internal/controller/computeinstance_feedback_controller_test.go
sed -n '630,690p' internal/controller/computeinstance_feedback_controller_test.go
printf '\nNon-deleting delete-state examples for comparison:\n'
sed -n '80,130p' internal/controller/subnet_feedback_controller.go
sed -n '80,130p' internal/controller/natgateway_feedback_controller.go
sed -n '80,130p' internal/controller/externalippool_feedback_controller.go
printf '\nBridge delete lifecycle references:\n'
sed -n '1,220p' internal/controller/feedback/bridge.go
Repository: osac-project/osac-operator
Length of output: 17111
---
</details>
Force DELETING on the ComputeInstance delete sync, or rename syncComputeInstanceDelete as dead code.
ComputeInstancePhaseRunning does not map to COMPUTE_INSTANCE_STATE_DELETING, but the delete Update call should record deletion state before the finalizer is removed. The current tests cover only Phase = Deleting, so a running instance deleted with other finalizers would signal the fulfillment service as RUNNING. Mirror the subnet/NAT/Gateway delete handlers: preserve Failed if needed, otherwise set DELETING.
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/controller/computeinstance_feedback_controller.go` around lines 110
- 124, Update syncComputeInstanceDelete to force the ComputeInstance phase to
DELETING during deletion, preserving Failed when applicable, before the
finalizer is removed. Mirror the existing subnet/NAT/Gateway delete-handler
behavior and leave syncComputeInstanceUpdate unchanged.
</details>
<!-- fingerprinting:phantom:medusa:komodo -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:7d04efec7f993992513c95c8 -->
<!-- This is an auto-generated reply by CodeRabbit -->
_📐 Maintainability & Code Quality_ | _🔵 Trivial_ | _💤 Low value_
nil hubClient as a "skip HostedCluster lookup" sentinel is fragile.
syncClusterOrderDelete passes nil and syncClusterOrderPhaseReady silently returns on hubClient == nil. A future caller that forgets to wire the client gets silent no-op URL syncing instead of a compile/runtime signal. Prefer an explicit parameter.
<details>
<summary>♻️ Suggested shape</summary>
-func syncClusterOrderPhase(ctx context.Context, hubClient clnt.Client, obj *ckv1alpha1.ClusterOrder, remote *privatev1.Cluster) error {
+// fetchURLs is false on the delete path, where the state is forced to DELETING anyway.
+func syncClusterOrderPhase(ctx context.Context, hubClient clnt.Client, fetchURLs bool, obj *ckv1alpha1.ClusterOrder, remote *privatev1.Cluster) error {
and gate the lookup on fetchURLs rather than on a nil client.
</details>
Also applies to: 191-197
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/controller/feedback_controller.go` around lines 127 - 135, Replace
the nil hubClient sentinel in syncClusterOrderPhase with an explicit fetchURLs
parameter, and make syncClusterOrderPhaseReady gate HostedCluster lookup on
fetchURLs rather than client nilness. Update all callers, including
syncClusterOrderDelete, to pass the intended behavior; require and use hubClient
whenever URL fetching is enabled.
</details>
<!-- fingerprinting:phantom:medusa:komodo -->
<!-- cr-indicator-types:nitpick -->
<!-- cr-comment:v1:8a434e1256a0f21732c11711 -->
<!-- This is an auto-generated comment by CodeRabbit -->
✅ Addressed in commit 32424af
_🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
rg -n 'CLUSTER_CONDITION_TYPE_' --glob 'internal/api/**' | sort -u | head -50
Repository: osac-project/osac-operator
Length of output: 164
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Relevant files:\n'
fd -a 'feedback_controller.go|.*cluster.*\.(go|proto)$|.*api.*' . | sed 's#^\./##' | head -100
printf '\nSearch condition symbols:\n'
rg -n 'ClusterOrderConditionType|CLUSTER_CONDITION_TYPE_|synchron|Feedback|feedback_controller' --glob '*.go' --glob '*.proto' . | head -200
printf '\nTarget file excerpt:\n'
sed -n '120,165p' internal/controller/feedback_controller.go | cat -n
Repository: osac-project/osac-operator
Length of output: 34005
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'ClusterOrderConditionType definitions:\n'
sed -n '1,220p' api/v1alpha1/clusterorder_conditions.go | cat -n
printf '\nPrivate ClusterConditionType definitions in proto files:\n'
rg -n 'enum.*Condition|CLUSTER_CONDITION_TYPE_|Condition.*=' api internal/api --glob '*.proto' | sed -n '1,200p'
printf '\nFeedback bridge implementation excerpt:\n'
sed -n '1,220p' internal/controller/feedback_controller.go | cat -n
printf '\nCluster condition helper references:\n'
rg -n 'findClusterCondition|setClusterCondition|Sync.*Condition|syncClusterConditionFromCR|ClusterConditionType' internal/api internal/controller --glob '*.go' | sed -n '1,200p'
Repository: osac-project/osac-operator
Length of output: 1707
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'All occurrences of cluster order condition const/typed values:\n'
rg -n 'ClusterOrderCondition(Accepted|Progressing|ControlPlaneAvailable|Available|Type)|ClusterConditionType|ConditionStatus|metav1.Condition|last.transition|LastTransitionTime' --glob '*.go' --glob '*.proto' . | sed -n '1,240p'
printf '\nClusterOrder status/condition files:\n'
for f in api/v1alpha1/clusterorder_conditions.go api/v1alpha1/clusterorder_types.go api/v1alpha1/zz_generated.deepcopy.go internal/controller/feedback_controller.go internal/controller/clusterorder_feedback_controller_test.go; do
if [ -f "$f" ]; then
echo "--- $f"
wc -l "$f"
fi
done
printf '\nRelevant generated/type sections:\n'
rg -n 'ClusterOrder.*Condition|Conditions.*ClusterOrderCondition|type ClusterOrderCondition|StatusCondition|SetStatusCondition|RemoveStatusCondition' api/v1alpha1 internal/controller --glob '*.go' | sed -n '1,240p'
Repository: osac-project/osac-operator
Length of output: 50382
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'feedback_controller.go relevant implementation:\n'
sed -n '220,315p' internal/controller/feedback_controller.go | cat -n
printf '\nClusterOrderFeedback tests around conditions/sync:\n'
sed -n '1,260p' internal/controller/clusterorder_feedback_controller_test.go | cat -n
printf '\nPrivate proto condition enum search exact:\n'
find internal/api osac -maxdepth 4 -type f \( -name '*.proto' -o -name '*.pb.go' \) 2>/dev/null | xargs -r rg -n 'type ClusterConditionType|CLUSTER_CONDITION_TYPE_|ConditionType' | sed -n '1,160p'
Repository: osac-project/osac-operator
Length of output: 36281
---
</details>
Avoid collapsing ClusterOrder conditions through ClusterConditionType_UNSPECIFIED.
syncClusterConditionFromCR(remote, privatev1.ClusterConditionType_CLUSTER_CONDITION_TYPE_UNSPECIFIED, ...) always targets the same UNSPECIFIED destination condition, so multiple ClusterOrder condition types overwrite that one remote condition and make last_transition_time flip when their statuses change. Map to a single concrete remote condition only if that is intended, otherwise preserve separate remote condition types for these CR status signals.
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/controller/feedback_controller.go` around lines 137 - 150, The
syncClusterOrderConditions function currently maps all recognized ClusterOrder
conditions to the single remote PROGRESSING condition, collapsing distinct
status signals and causing transition timestamps to overwrite each other. Update
the mapping so each ClusterOrder condition is synchronized to its intended
distinct concrete privatev1.ClusterConditionType, avoiding UNSPECIFIED or any
shared destination unless explicitly intended; leave unknown-condition handling
unchanged.
</details>
<!-- fingerprinting:phantom:medusa:komodo -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:6acce334b81d6cdc5261bf8e -->
<!-- This is an auto-generated reply by CodeRabbit -->
_🗄️ Data Integrity & Integration_ | _🟡 Minor_ | _⚡ Quick win_
<details>
<summary>🧩 Analysis chain</summary>
🏁 Script executed:
#!/bin/bash
rg -nP -B3 -A1 '\bNumberOfNodes\b' --type=go api/
Repository: osac-project/osac-operator
Length of output: 742
---
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate and inspect the relevant Go code around the conversion and any validation.
ast-grep outline internal/controller/feedback_controller.go --view compact || true
sed -n '220,270p' internal/controller/feedback_controller.go
rg -n "NumberOfNodes|SetSize|Number of nodes|positive|minimum|min" internal/controller/policycontroller.go internal/controller api -g '*.go'
Repository: osac-project/osac-operator
Length of output: 15441
---
</details>
Bounds-check NumberOfNodes before converting to int32.
NumberOfNodes is defined as int, so values above math.MaxInt32 wrap to a negative int32 here and can be written to node-set status. Clamp or reject before calling nodeSet.SetSize(newValue).
<details>
<summary>🧰 Tools</summary>
<details>
<summary>🪛 ast-grep (0.45.0)</summary>
[warning] 248-248: Narrowing a non-constant integer to a smaller fixed-width type (int8/int16/int32, uint8/uint16/uint32) can silently overflow or wrap, yielding negative or truncated values that are dangerous in size, length, or index logic. Validate the source value is within the target type's range before converting (e.g. bounds-check, or use a checked helper), and avoid narrowing untrusted or len()/parsed values.
Context: int32(nodeRequest.NumberOfNodes)
Note: [CWE-190] Integer Overflow or Wraparound.
(integer-overflow-narrowing-conversion-go)
</details>
</details>
<details>
<summary>🤖 Prompt for AI Agents</summary>
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/controller/feedback_controller.go` around lines 248 - 257, Validate
nodeRequest.NumberOfNodes in the node-set size update flow before converting it
to int32, rejecting or clamping values above math.MaxInt32. Update the logic
around nodeSet.GetSize and nodeSet.SetSize so only bounded values are converted
and written, while preserving the existing change logging and update behavior
for valid values.
</details>
<!-- fingerprinting:phantom:medusa:komodo -->
<!-- cr-indicator-types:potential_issue -->
<!-- cr-comment:v1:e134308cfea33280ac048b79 -->
_Sources: Path instructions, Linters/SAST tools_
<!-- This is an auto-generated reply by CodeRabbit -->
Actionable comments posted: 4
<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>
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 `@internal/controller/computeinstance_feedback_controller.go`:
- Around line 110-124: Update syncComputeInstanceDelete to force the
ComputeInstance phase to DELETING during deletion, preserving Failed when
applicable, before the finalizer is removed. Mirror the existing
subnet/NAT/Gateway delete-handler behavior and leave syncComputeInstanceUpdate
unchanged.
In `@internal/controller/feedback_controller.go`:
- Around line 127-135: Replace the nil hubClient sentinel in
syncClusterOrderPhase with an explicit fetchURLs parameter, and make
syncClusterOrderPhaseReady gate HostedCluster lookup on fetchURLs rather than
client nilness. Update all callers, including syncClusterOrderDelete, to pass
the intended behavior; require and use hubClient whenever URL fetching is
enabled.
- Around line 248-257: Validate nodeRequest.NumberOfNodes in the node-set size
update flow before converting it to int32, rejecting or clamping values above
math.MaxInt32. Update the logic around nodeSet.GetSize and nodeSet.SetSize so
only bounded values are converted and written, while preserving the existing
change logging and update behavior for valid values.
- Around line 137-150: The syncClusterOrderConditions function currently maps
all recognized ClusterOrder conditions to the single remote PROGRESSING
condition, collapsing distinct status signals and causing transition timestamps
to overwrite each other. Update the mapping so each ClusterOrder condition is
synchronized to its intended distinct concrete privatev1.ClusterConditionType,
avoiding UNSPECIFIED or any shared destination unless explicitly intended; leave
unknown-condition handling unchanged.
</details>
<details>
<summary>🪄 Autofix (Beta)</summary>
Fix all unresolved CodeRabbit comments on this PR:
</details>
---
<details>
<summary>ℹ️ Review info</summary>
<details>
<summary>⚙️ Run configuration</summary>
Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 22cbecc4-297b-4926-9023-1bcecb31454a
</details>
<details>
<summary>📥 Commits</summary>
Reviewing files that changed from the base of the PR and between 77e1d55eae193ba00986e66ab881d534a6ee2b03 and 78837790832ca7df116e8d103a1f91d66cb244a2.
</details>
<details>
<summary>📒 Files selected for processing (5)</summary>
cmd/main.go
internal/controller/clusterorder_feedback_controller_test.go
internal/controller/computeinstance_feedback_controller.go
internal/controller/computeinstance_feedback_controller_test.go
internal/controller/feedback_controller.go
</details>
<details>
<summary>💤 Files with no reviewable changes (1)</summary>
cmd/main.go
</details>
</details>
<!-- This is an auto-generated comment by CodeRabbit for review status -->
hmm, bu this is exactly how it was before this change. the original handleDelete called syncState without forcing DELETING
@vladikr, you’re right. The original handleDelete called syncState and therefore preserved the CR’s existing phase; this migration retains that behavior through syncCIPhase. My concern describes a pre-existing behavior, not a regression introduced by this PR, so I’m withdrawing the finding.
🐇
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vladikr
Repo: osac-project/osac-operator PR: 402
File: internal/controller/computeinstance_feedback_controller.go:110-124
Timestamp: 2026-07-30T02:52:59.635Z
Learning: In `internal/controller/computeinstance_feedback_controller.go`, ComputeInstance deletion feedback preserves the CR’s existing phase through the normal phase synchronization path; it does not forcibly set the remote state to `COMPUTE_INSTANCE_STATE_DELETING`. This behavior existed before the feedback.Bridge migration.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<sub>You are interacting with an AI system.</sub>
<!-- This is an auto-generated reply by CodeRabbit -->
yes, indeed; however, this limitation was there before this change.
@vladikr, agreed—this is pre-existing behavior and not introduced by this bridge migration, so I’m withdrawing the finding for this PR. Would you like me to open a follow-up issue to track the bounds check separately?
🐇
<!-- <review_comment_withdrawn> -->
<sub>You are interacting with an AI system.</sub>
<!-- This is an auto-generated reply by CodeRabbit -->
This behavior was there prior to this change as well. all four original syncCondition* functions mapped to CLUSTER_CONDITION_TYPE_PROGRESSING
I can follow up but not in this PR.
@vladikr, confirmed — the refactor preserves the pre-existing mapping of all four conditions to CLUSTER_CONDITION_TYPE_PROGRESSING; it did not introduce that behavior. I’m withdrawing this PR-scoped finding.
Would you like me to open a GitHub follow-up issue for evaluating distinct condition mappings?
<!-- <review_comment_withdrawn> -->
---
<details>
<summary>✏️ Learnings added</summary>
Learnt from: vladikr
Repo: osac-project/osac-operator PR: 402
File: internal/controller/feedback_controller.go:137-150
Timestamp: 2026-07-30T03:16:45.179Z
Learning: In `internal/controller/feedback_controller.go`, all four recognized `ClusterOrder` status conditions historically map to the single fulfillment-service condition type `privatev1.ClusterConditionType_CLUSTER_CONDITION_TYPE_PROGRESSING`. This behavior predates PR `#402`’s feedback bridge migration; do not treat it as a regression introduced by that migration.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
</details>
<sub>You are interacting with an AI system.</sub>
<!-- This is an auto-generated reply by CodeRabbit -->
Approved these changes.
@tzvatot I think this is ready. Only two controllers will be left after this, and there are 2 bugs that i found and will follow up.
syncComputeInstanceUpdate and syncComputeInstanceDelete have identical bodies. Unlike the ClusterOrder controller (where delete forces DELETING and skips URL sync), these two genuinely do the same thing.
Use a single function for both:
SyncUpdate: syncComputeInstanceSync,
SyncDelete: syncComputeInstanceSync,
If the delete path needs to diverge later (e.g., to force DELETING like ClusterOrder does), add a separate function at that point.
Requested changes.
yes, good point. I thought to preserve the structure.
ok, I'll upidate :)
@tzvatot done, can you please take a look again? :)
Previous finding (identical syncComputeInstanceUpdate/syncComputeInstanceDelete) is fixed.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: <a href="https://github.com/osac-project/osac-operator/pull/402#pullrequestreview-4819260841" title="Approved">tzvatot</a>, <a href="https://github.com/osac-project/osac-operator/pull/402#" title="Author self-approved">vladikr</a>
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
</details>
<!-- META={"approvers":[]} -->
tzvatot
vladikr
Summary
Migrate ComputeInstance and ClusterOrder feedback controllers to use the
feedback.Bridge. Each controller is in a separate commit.| Commit | Controller | Notes |
|--------|-----------|-------|
| 1 | ComputeInstance | Syncs 6 conditions, 7 phases, IP addresses, lastRestartedAt |
| 2 | ClusterOrder | Syncs conditions, phases (with HostedCluster fetch on Ready), node requests; drops logger field |
Behavioral improvements
Both controllers previously had no NotFound-during-deletion handling — if the fulfillment service archived the record before the feedback finalizer was removed, the controller would error-loop indefinitely. The Bridge fixes this automatically.
ClusterOrder details
SyncUpdateclosure captureshubClientfor HostedCluster lookups on the Ready phaselogger logr.Loggerparameter — the Bridge usesctrllog.FromContext(ctx)consistently (matching all other feedback controllers)cmd/main.goupdated accordinglyclone/equalgeneric helpers remain infeedback_controller.go— still used by ExternalIP and ExternalIPAttachment (migrated in the next PR)newClusterOrderFeedbackBridgehelper so tests can wire the Bridge with mock clientsWhat's next
Per the migration plan in #387:
IsNotFound)PostSaveOnDelete)Test plan
make lint— 0 issuesmake test— all pass (controller coverage 72.2%)Jira: https://redhat.atlassian.net/browse/OSAC-3132
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Bug Fixes
Improved synchronization of cluster order and compute instance feedback with fulfillment services, keeping conditions, phases, node requests, service URLs, IP addresses, and restart timestamps current.
Preserved safe behavior when the fulfillment connection is unavailable by keeping feedback reconciliation disabled.
Refactor
Refactored cluster order and compute instance feedback reconciliation to use a shared bridge, unifying update/delete handling and related sync logic.
Tests
* Updated feedback reconciler and compute instance feedback reconciler tests to match the new bridge-based wiring.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->