fix: prevent diffKeywordRegex from falsely matching YAML key=value list items in heredocs#6422
Merged
jamengual merged 1 commit intoApr 23, 2026
Conversation
47e88ea to
aca9e1b
Compare
…st items in heredocs Terraform HCL attribute assignments always use spaces around = (` = `), so requiring `\s=\s` instead of bare `=` in diffKeywordRegex is correct. YAML list items like `- ServerSideApply=true` (used in ArgoCD syncOptions) were being falsely treated as Terraform diff removal markers, causing them to appear as removals in PR comments even when no change was present. Closes runatlantis#6419 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Gabriel Martinez <gabrielmartinez@sisti.pt>
aca9e1b to
e1fada7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where diffKeywordRegex treated YAML key=value list items inside heredocs (e.g., ArgoCD syncOptions) as Terraform diff markers, leading to false “removed” lines in Atlantis PR comments.
Changes:
- Tightened
diffKeywordRegexto require whitespace around=(\s=\s) so YAMLkey=valueitems are no longer matched. - Added a regression test case reproducing the ArgoCD heredoc scenario and asserting the diff formatter preserves the YAML list item correctly.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
server/events/models/models.go |
Narrows diffKeywordRegex matching for assignments to avoid false positives on YAML key=value within heredocs. |
server/events/models/models_test.go |
Adds a regression test covering ArgoCD syncOptions: - ServerSideApply=true inside a heredoc. |
jamengual
approved these changes
Apr 23, 2026
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
diffKeywordRegexwas matching YAML list items like- ServerSideApply=true(used in ArgoCDsyncOptions) as Terraform diff markers, causing false removals to appear in PR comments even when there was no actual plan change.\s=\s(spaces around=) instead of bare=— Terraform HCL attribute assignments always use=, while YAMLkey=valuepairs never do.syncOptionsin a heredoc.Closes #6419
Root Cause
Introduced in #6069, which changed the operator alternation in
diffKeywordRegexfrom\s=\sto=. This broadened matching to unintentionally cover YAML list items of the form- Key=Valueinside heredoc strings.Test plan
argocd application with yaml key=value list items in heredoc) that reproduces the false positive before the fixTestDiffMarkdownFormattedTerraformOutputtests pass after the fix, including all CloudFormation cases added in fix: diff cloudformation stack list items #6069🤖 Generated with Claude Code