fix: prevent silent loop aborts during profile initialization#6352
Open
AftAb-25 wants to merge 2 commits intomindersec:mainfrom
Open
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
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