fix: prevent silent loop aborts during profile initialization#6352
Closed
AftAb-25 wants to merge 2 commits intomindersec:mainfrom
Closed
fix: prevent silent loop aborts during profile initialization#6352AftAb-25 wants to merge 2 commits intomindersec:mainfrom
AftAb-25 wants to merge 2 commits intomindersec:mainfrom
Conversation
Member
evankanderson
left a comment
There was a problem hiding this comment.
It appears that the current error handling code is effectively unreachable (we're marshalling a watermill Message with a UUID and an empty payload -- the only time this should fail is if something is seriously wrong in json.Marshal, probably due to memory corruption).
I'm not sure that the "fix" here is worth the cost -- especially since the switch from return nil to continue seems to have already merged.
Member
|
(This was fixed in #6331 ) |
Member
|
I'm going to close this PR given #6352 (review). If you feel strongly, feel free to reopen and argue cases where this issue could arise. |
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.
Summary
This PR fixes a critical data starvation flaw in the Reconciler where a single broken entity payload would prematurely abort the profile initialization loop for the rest of a project.
Currently in internal/reconcilers/run_profile.go, when publishProfileInitEvents iterates through a project's entities to evaluate a new profile, it builds a refresh message payload using
entRefresh.ToMessage(m). If that single payload fails to marshal, the reconciler simply hitsreturn nil.Returning
nilinstantly aborts the entireforloop, meaning any remaining repositories or artifacts in the project are silently discarded and never evaluated against the new profile rules. Worse, it causes the event router to ACK the payload as successful, so it is never retried.Changes
return nilwith a gracefulcontinueinside the error block so the engine cleanly logs the specific entity's marshaling error and naturally continues querying the rest of the project's repositories.skip entity on marshal error) in run_profile_test.go that explicitly simulates a marshaling failure mid-batch to guarantee downstream entities continue processing unhindered.Fixes #6351
Checklist