Fix status patch no-op when spec changes during allocation reconciliation#758
Conversation
…tion 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 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 40 minutes and 5 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Test Coverage ReportTest Coverage 📊: 70.0% |
Summary
reconcileAllocations, when stale VM allocations are removed from the spec (specChanged=true), the status patch silently becomes a no-op. This happens becauseold = res.DeepCopy()was called AFTERres.Status.CommittedResourceReservation.Allocations = newStatusAllocations, makingoldandresidentical for the status fields. The subsequentclient.MergeFrom(old)patch contained no status diff.res.DeepCopy()call before the status re-application so the merge-from base correctly reflects the pre-update state, producing the intended status diff.Impact
When a committed-resource reservation has stale allocations removed (VMs that left the hypervisor), the status.allocations field was not being updated to reflect verified allocations. This could cause the usage reconciler to work with stale allocation data and prevent accurate tracking of committed resource usage.
Test plan
TestReconcileAllocations_HypervisorCRDPathtests pass🤖 Generated with Claude Code