Skip to content

fix: stabilize changed template data#1043

Open
immanuwell wants to merge 1 commit into
fluxcd:mainfrom
immanuwell:fix/deterministic-change-template-data
Open

fix: stabilize changed template data#1043
immanuwell wants to merge 1 commit into
fluxcd:mainfrom
immanuwell:fix/deterministic-change-template-data

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

This makes .Changed.Changes and the Change-Id style template data stable for the same logical update set.

Before this, the aggregation path walked nested maps, so the rendered change data could come out in a different order between runs. That can change commit messages and Gerrit Change-Ids for the same update set. Kinda flaky, not great.

Repro:

  1. Use the Gerrit style messageTemplate that hashes .Changed.FileChanges, .Changed.Objects, and .Changed.Changes.
  2. Reconcile an automation that updates more than one file, object, or change.
  3. Render the same logical result repeatedly. Before this patch, .Changed.Changes can come out in different orders, and aggregated object changes can shuffle too.
  4. With this patch, the rendered change data stays stable.

Related: #771
Context: #925

Sort aggregated change data before rendering templates so Change-Id\nstyle templates stay stable for the same logical update set.\n\nAdd regression coverage for deterministic change aggregation and\nrepeated template rendering.

Signed-off-by: immanuwell <pchpr.00@list.ru>
Assisted-by: Codex/GPT-5
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.

1 participant