Exclude PoweredOn from provisioning config version hash#12
Conversation
PoweredOn is handled by reconcilePower() which directly calls the management backend API — it does not need the provisioning template. Including it in the hash caused the template to re-trigger on every power state toggle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 7 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository: osac-project/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise 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 |
|
@coderabbitai can you review now? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR details
gh pr view 12 --repo osac-project/host-management-openstack
echo "=== PR DIFF ==="
gh pr diff 12 --repo osac-project/host-management-openstackLength of output: 2290 🏁 Script executed: #!/bin/bash
echo "=== HostLeaseSpec definition ==="
rg -n "HostLeaseSpec" --type go -A 40
echo "=== ComputeDesiredConfigVersion ==="
rg -n "ComputeDesiredConfigVersion" --type go -A 20
echo "=== reconcilePower in hostlease_controller.go ==="
rg -n "reconcilePower" --type go -A 30
echo "=== Full provisioning package files ==="
fd . --type f -e go | xargs grep -l "ComputeDesiredConfigVersion" 2>/dev/nullLength of output: 68741 🏁 Script executed: #!/bin/bash
echo "=== HostLeaseSpec full definition ==="
fd . --type f -e go | xargs grep -l "type HostLeaseSpec struct" 2>/dev/null | xargs cat
echo "=== Find provisioning package ==="
fd . --type f -e go | xargs grep -l "func ComputeDesiredConfigVersion" 2>/dev/null | xargs cat
echo "=== hostlease_controller.go full relevant section (lines 340-400) ==="
cat internal/controller/hostlease_controller.go | head -420 | tail -100Length of output: 4073 🏁 Script executed: #!/bin/bash
echo "=== All Go files in repo ==="
fd . --type f -e go
echo "=== go.mod ==="
cat go.mod 2>/dev/null || echo "no go.mod at root"
echo "=== Find any HostLeaseSpec references ==="
rg -rn "PoweredOn" --type go
echo "=== Find provisioning package location ==="
fd provisioning --type d
fd "*.go" --type f | xargs grep -l "func ComputeDesiredConfigVersion" 2>/dev/nullLength of output: 9754
🟡 Medium — Positional struct initialization (silent mis-assignment risk)The anonymous struct literal uses positional (unnamed) field assignment: provisioning.ComputeDesiredConfigVersion(struct {
HostType string
ExternalHostID string
ExternalHostName string
HostClass string
NetworkClass string
Selector v1alpha1.HostSelectorSpec
InventoryLabels map[string]string
InventoryPersistentLabels map[string]string
TemplateID string
TemplateParameters string
}{
hostLease.Spec.HostType, // positional — tied to declaration order
hostLease.Spec.ExternalHostID,
...
})If someone reorders the field declarations, the values will be silently mis-assigned (e.g. Recommendation: Use named field initialization: }{
HostType: hostLease.Spec.HostType,
ExternalHostID: hostLease.Spec.ExternalHostID,
ExternalHostName: hostLease.Spec.ExternalHostName,
HostClass: hostLease.Spec.HostClass,
NetworkClass: hostLease.Spec.NetworkClass,
Selector: hostLease.Spec.Selector,
InventoryLabels: hostLease.Spec.InventoryLabels,
InventoryPersistentLabels: hostLease.Spec.InventoryPersistentLabels,
TemplateID: hostLease.Spec.TemplateID,
TemplateParameters: hostLease.Spec.TemplateParameters,
}🟡 Medium — Silent maintenance trap: new spec fields could be silently omittedThe anonymous struct is a manual allowlist. If a new field is added to Recommendation: Consider defining a named type 🔵 Low — No regression test for the hash exclusionThe bug was that a ✅ Looks good
🧠 Learnings used |
PoweredOn is handled by reconcilePower() which directly calls the management backend API - it does not need the provisioning template. Including it in the hash caused the template to re-trigger on every power state toggle.
Closes: osac-project/issues#407