Repository navigation
Fix artifactSet Diff for duplicate revisions - #2234
Open
amalsaidov wants to merge 1 commit into
Open
amalsaidov wants to merge 1 commit into
amalsaidov wants to merge 1 commit into
Conversation
Diff compared each current revision against the updated set with one-directional membership and a length check. When a set holds the same revision more than once, a change that turns a distinct revision into a duplicate kept the length equal and still found every current revision in the updated set, so Diff reported no change. For a GitRepository with multiple includes that resolve to the same revision, that masks an included artifact change and leaves the aggregated artifact stale until another reconcile is triggered. Compare the two sets as multisets of revisions so repeated revisions must appear the same number of times in both. Signed-off-by: Amal Saidov <amalsaidov@users.noreply.github.com> Assisted-by: Claude Code/claude-opus-4-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
artifactSet.Diffdecides whether a GitRepository's set of includedartifacts has changed. It did a length check and then, for each current
revision, looked for any match in the updated set.
With that one-directional membership check, a set that holds the same
revision more than once can change without being detected: if a distinct
revision is replaced by a duplicate of another, the length stays equal
and every current revision is still found in the updated set, so
Diffreturns
false.Example (current vs stored):
These differ ("bar" is gone), but
Diffreports no change. This isreachable for a GitRepository with multiple
.spec.includeentries thatresolve to the same revision (for instance two includes of the same
commit). The call site is
reconcileIncludeingitrepository_controller.go, where a missed change leaves theaggregated artifact stale until another reconcile is triggered.
The fix compares the two sets as multisets of revisions, so a repeated
revision must appear the same number of times in both. Order-independence
and the existing cases are preserved.
Added table cases cover the duplicate-revision change and an
out-of-order equal set. The new duplicate case fails on the previous
implementation and passes with this change.
AI-assisted; directed, reviewed and tested by the author.