Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacks: the plan function should stop on validation errors #34720

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

liamcervante
Copy link
Member

Currently, we are reporting duplicate diagnostics during the planning stage. This is because we always execute the static evaluation and the dynamic evaluation, whether or not there were errors during the static evaluation. The dynamic evaluation then finds the same errors in the static evaluation, and then both sets are reported.

I think we should return early if the static evaluation finds problems. There's a comment in the main_plan.go file that indicates this was the original intent: main_plan.go:106-109. However, this doesn't actually happen. The reportDiags function that sets the seenAnyErrors boolean is never actually called. Instead the walk function just announces the diagnostics directly: main_plan.go:186.

This PR makes the walk function process the diagnostics properly, through the reportDiags function. This function does still announce the diagnostics, but also tracks errors so that the plan can stop early if we find any. I've also added some tests into plan_test.go, so that we execute the same set of configurations into the both a simple validate and plan operation, that makes sure (a) the plan and validate functions agree on what is or isn't valid configurations and (b) we don't return duplicate diagnostics during the plan anymore.

@liamcervante liamcervante requested a review from a team February 23, 2024 09:09
@liamcervante liamcervante merged commit 831630f into main Feb 26, 2024
6 checks passed
Copy link

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

@liamcervante liamcervante deleted the liamcervante/stacks/validate-fail-stops-plan branch February 26, 2024 09:42
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants