fix: avoid silently aborting profile init on single entity marshalling error#6331
Merged
evankanderson merged 1 commit intomindersec:mainfrom Apr 11, 2026
Conversation
…rofileInitEvents When entRefresh.ToMessage() fails for a single entity inside the profile init event loop, the code used to return nil which silently aborted the entire loop. Any entities after the failed one would never get their profile init events published, and the caller would see no error indicating that entities were skipped. Change return nil to continue so that a single entity's marshalling failure is logged and skipped, while the remaining entities still get their refresh events published as expected. Fixes mindersec#6330
evankanderson
approved these changes
Apr 11, 2026
Member
evankanderson
left a comment
There was a problem hiding this comment.
I don't see any way to test this, as the only error that can be triggered is from json.Marshal() on HandleEntityAndDoMessage, which is a struct with simple fields and tags.
I'm willing to approve this, but it's not really a likely bug fix. (If the go allocator fails for json.Marshal(), we're unlikely to make further progress. Similarly, if the descriptor for HandleEntityAndDoMessage gets corrupted in-memory, we've got a bad enough day that this isn't going to save it.)
2 tasks
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.
Description
This PR fixes a bug in the profile initialization flow where a single entity's parsing/marshalling issue could completely stop the rest of a project's entities from being evaluated against a new profile.
In internal/reconcilers/run_profile.go, publishProfileInitEvents loops over all registered entities for a project. Previously, if
entRefresh.ToMessage(m)failed inside that loop, the code returnednil. This silently exited the entire function, abandoning all remaining entities in the slice. From the caller's perspective (handleProfileInitEvent), the function returned successfully, so no retries were triggered and nothing was visibly wrong except that some entities were randomly skipped during profile initialization.Change:
Instead of
return nil, this simply logs the error and usescontinueto move on to the next entity in the loop.Fixes #6330
Checklist