Skip to content

fix: prevent silent loop aborts during profile initialization#6352

Open
AftAb-25 wants to merge 2 commits intomindersec:mainfrom
AftAb-25:fix/6351-reconciler
Open

fix: prevent silent loop aborts during profile initialization#6352
AftAb-25 wants to merge 2 commits intomindersec:mainfrom
AftAb-25:fix/6351-reconciler

Conversation

@AftAb-25
Copy link
Copy Markdown
Contributor

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 hits return nil.

Returning nil instantly aborts the entire for loop, 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

  1. Swapped the hard return nil with a graceful continue inside 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.
  2. Added a test (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

  • Code compiles cleanly
  • Includes tests for the changes (existing tests pass)

@AftAb-25 AftAb-25 requested a review from a team as a code owner April 12, 2026 19:22
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 59.39%. remained the same — AftAb-25:fix/6351-reconciler into mindersec:main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Reconciler permanently drops Profile Initialization for all remaining entities if a single entity event fails to marshal

2 participants