From 518455705e5aa54bc6a52f4fae3da0e8fbe6f030 Mon Sep 17 00:00:00 2001 From: Claude Bug Detective Date: Fri, 24 Apr 2026 17:38:48 +0000 Subject: [PATCH] Fix status patch no-op when spec changes during allocation reconciliation When reconcileAllocations removes stale allocations from the spec, it re-fetches the reservation to get the updated resourceVersion. The old code set old = res.DeepCopy() AFTER re-applying the status update, making old identical to res. The subsequent MergeFrom(old) patch then contained no status diff, silently dropping the status.allocations update. Move the DeepCopy before the status re-application so MergeFrom correctly detects the diff. Co-Authored-By: Claude Opus 4.7 --- internal/scheduling/reservations/commitments/controller.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/scheduling/reservations/commitments/controller.go b/internal/scheduling/reservations/commitments/controller.go index 3808dcf42..b6078daf1 100644 --- a/internal/scheduling/reservations/commitments/controller.go +++ b/internal/scheduling/reservations/commitments/controller.go @@ -447,9 +447,12 @@ func (r *CommitmentReservationController) reconcileAllocations(ctx context.Conte } return nil, fmt.Errorf("failed to re-fetch reservation: %w", err) } + // Capture the re-fetched state as the patch base BEFORE re-applying + // the status update. Otherwise MergeFrom(old) would see no diff + // and the status patch would be a no-op. + old = res.DeepCopy() // Re-apply the status update that was overwritten by the re-fetch. res.Status.CommittedResourceReservation.Allocations = newStatusAllocations - old = res.DeepCopy() } // Patch Status