pipecd icon indicating copy to clipboard operation
pipecd copied to clipboard

HasDiff returns false when a resource's OwnerIds or ParentIds actually changed

Open vipulpandey21 opened this issue 3 months ago • 0 comments

What's happening

KubernetesResourceState.HasDiff is supposed to tell piped whether a resource's state changed, so it knows whether to report an update. For every field except OwnerIds/ParentIds, a mismatch correctly returns true. For OwnerIds and ParentIds, a mismatch returns false instead — the opposite of what it should do:

for i := range s.OwnerIds {
    if s.OwnerIds[i] != a.OwnerIds[i] {
        return false // should be true, a diff was found here
    }
}

Why it matters

If a resource's owner or parent changes (e.g. a Pod picked up by a new ReplicaSet during a rollout), HasDiff says "nothing changed", so piped never reports the update, and the live state shown to users keeps the old relationship.

Where

pkg/model/application_live_state.go, lines 47-57.

How I found it

I was tracing how piped reports Kubernetes resource state changes. This function has no test coverage at all, which is likely why this went unnoticed — it's been like this since 2020.

I have a fix and a test ready, opening a PR for it.

vipulpandey21 avatar Aug 05 '26 12:08 vipulpandey21