Skip to content

fix(yaml): compare decoded scalar values to avoid rewriting folded blocks#8296

Merged
olblak merged 2 commits into
updatecli:mainfrom
loispostula:fix/8295-yaml-folded-scalar-rewrite
Apr 8, 2026
Merged

fix(yaml): compare decoded scalar values to avoid rewriting folded blocks#8296
olblak merged 2 commits into
updatecli:mainfrom
loispostula:fix/8295-yaml-folded-scalar-rewrite

Conversation

@loispostula

Copy link
Copy Markdown
Contributor

Fix #8295

Folded/literal scalars (>-, |) stringify with their formatting markers, causing the change-detection to always report a diff and rewrite the node, which corrupted the original formatting on every run.

Test

To test this pull request, you can run the following commands:

cd pkg/plugins/resources/yaml
go test

Two regression tests added in target_test.go:

  • Idempotent re-run on a >- folded block with identical value: asserts no rewrite.
  • >- folded block with changed value: asserts rewrite still triggers.

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

Tradeoff

Potential improvement

loispostula and others added 2 commits April 7, 2026 21:24
…ocks

Folded/literal scalars (>-, |) stringify with their formatting markers,
causing the change-detection to always report a diff and rewrite the
node, which corrupted the original formatting on every run.

Fixes updatecli#8295

Signed-off-by: Loïs Postula <lois@postu.la>
@olblak olblak added bug Something isn't working resource-yaml Resource of kind YAML labels Apr 8, 2026
@olblak olblak enabled auto-merge (squash) April 8, 2026 06:05
@olblak olblak merged commit 0792f93 into updatecli:main Apr 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working resource-yaml Resource of kind YAML

Projects

None yet

Development

Successfully merging this pull request may close these issues.

github action autodiscovery adds empty line to multiline key

2 participants