# Proposed run (preview)

Proposed runs are previews of changes that would be applied to your infrastructure if the new code was to somehow become canonical, for example by pushing it to the [tracked branch](../../stack/stack-settings#repository-and-branch).

Proposed runs are generally triggered by Git push events. By default, whenever a push occurs to any branch other than the [tracked branch](../../stack/stack-settings#repository-and-branch), a proposed run is started - one for each of the affected stacks. This default behavior can be extensively customized using our [push policies](../policy/git-push-policy).

The purpose of proposed runs is not to make changes to your infrastructure but to merely preview and report them during the [planning](#planning) phase.

## Planning

Once the workspace is prepared by the [Initializing](..#initializing) phase, planning runs a vendor-specific preview command and interprets the results. For Terraform that command is `terraform plan`, for Pulumi - `pulumi preview`. The result of the planning phase is the collection of currently managed resources and outputs as well as planned changes. This is used as an input to [plan policies](#plan-policies) (optional) and to [calculate the delta](#delta) - always.

Note that the Planning phase can be safely [stopped by the user](..#stopping-runs).

## Plan policies

If any [plan policies](../policy/terraform-plan-policy) are attached to the current stack, each of these policies is evaluated to automatically determine whether the change is acceptable according to the rules adopted by your organization. Here is an example of an otherwise successful planning phase that still fails due to policy violations:

![](https://3862190545-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LshwwDZmA4HXN0k9e8O%2F-MRxoDgfUQPm6X66S6X6%2F-MRxws5hDAJuz6pJiifv%2FTest_multi-endpoint_support___6__%C2%B7_Managed_stack.png?alt=media\&token=df59575f-5feb-4ea4-99b6-26facca36b04)

You can read more about plan policies [here](../policy/terraform-plan-policy).

## Delta

If the planning phase is successful (which includes policy evaluation), Spacelift analyses the diff and counts the resources and outputs that would be added, changed and deleted if the changes were to be applied. Here's one example of one such delta being reported:

![](https://3862190545-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LshwwDZmA4HXN0k9e8O%2F-LuPHx1kPzir6GcXAAKM%2F-LuPNi0gbSVvpBbQF5rv%2F01DTA81NX98GZ17DFND94KXTPP_%C2%B7_End-to-end_testing.png?alt=media\&token=4f1c4463-ef79-450e-a64c-1cba3f41a7cc)

## Success criteria

The planning phase will fail if:

* infrastructure definitions are incorrect - eg. malformed, invalid etc.;
* external APIs (eg. AWS, GCP, Azure etc.) fail when previewing changes;
* plan policies return one or more _deny_ reasons;
* a worker node crashes - eg. you kill a private worker node while it's executing the job;

If that happens, the run will transition to the [failed](..#failed) state. Otherwise, the proposed run terminates in the [finished](..#finished) state.

## Reporting

The results of proposed runs are reported in multiple ways:

* always - in VCS, as commit statuses and pull request comments - please refer to [GitHub](../../integrations/source-control/github) and [GitLab](../../integrations/source-control/gitlab) documentation for the exact details;
* through [Slack notifications](../../integrations/slack) - if set up;
* through [webhooks](../../integrations/webhooks) - if set up;
