Skip to content

fix(planpreview): aggregate NoChange across plugin results in pipedv1 - #7673

Open
Atharva-Ramawat wants to merge 2 commits into
pipe-cd:masterfrom
Atharva-Ramawat:fix/planpreview-no-change
Open

Atharva-Ramawat wants to merge 2 commits into
pipe-cd:masterfrom
Atharva-Ramawat:fix/planpreview-no-change

Conversation

@Atharva-Ramawat

Copy link
Copy Markdown
Contributor

What this PR does:

  • Fixes buildApp in pkg/app/pipedv1/planpreview/builder.go to aggregate r.GetNoChange() across all plugin results using a local noChange := true variable and assign result.NoChange = noChange on success.
  • Adds unit tests (TestBuilder_buildApp_NoChange) covering:
    • all plugins reporting NoChange: true
    • mixed plugin NoChange results
    • plugin returning an error

Why we need it:
Previously, builder.go mutated r.NoChange = r.NoChange && result.GetNoChange() instead of updating result.NoChange. Because MakeApplicationPlanPreviewResult defaults NoChange to false, the application-level NoChange flag was always false.

Which issue(s) this PR fixes:
Fixes #7672

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Atharva Ramawat <atharvaramawat027@gmail.com>
@Atharva-Ramawat
Atharva-Ramawat requested review from a team as code owners November 26, 2026 20:03
@Atharva-Ramawat
Atharva-Ramawat requested review from Warashi, armistcxy and ffjlabo and a balanced review from Copilot November 26, 2026 20:03
@netlify

netlify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

👷 Deploy request for pipecd-site pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9db250f

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unsupported-only or empty plugin responses can incorrectly report no resource changes despite no targets being previewed; the logic needs correction and regression coverage.

1 open issue
What changed in this PR

Fixes application-level plan-preview NoChange aggregation in pipedv1, addressing #7672.

Changes:

  • Aggregates NoChange across all returned plugin results without mutating plugin responses.
  • Sets the application flag after successful preview collection, leaving it false on errors.
  • Adds tests for unchanged results, mixed results, and plugin errors.
File Description
pkg/​app/​pipedv1/​planpreview/​builder.go Corrects application-level NoChange aggregation.
pkg/​app/​pipedv1/​planpreview/​builder_test.go Adds test helpers and aggregation regression tests.

Review effort: Balanced

Comment thread pkg/app/pipedv1/planpreview/builder.go Resolved
…ected

Signed-off-by: Atharva Ramawat <atharvaramawat027@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The builder can incorrectly mark an application as unchanged when another resource-changing plugin returns an unsupported or empty preview, hiding unpreviewed changes.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Unpreviewed resource changes can be reported as unchanged

pkg/​app/​pipedv1/​planpreview/​builder.go:319

If an unchanged preview is combined with Unimplemented or an empty response from another resource-changing plugin, this marks the whole application as unchanged without previewing all of its resources. For example, Cloud Run registers no preview service (pkg/app/pipedv1/plugin/cloudrun/main.go:26–31), so a mixed application can appear under “No resource changes were detected” despite unpreviewed Cloud Run changes. Keep NoChange false when resource-changing plugins lack preview results, and add mixed unchanged/unsupported and unchanged/empty tests.

1 resolved since last review

Review effort: Balanced

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pipedv1 planpreview: ApplicationPlanPreviewResult.NoChange is never set

2 participants