Skip to content

Report accurate resource counts in bundle summaries - #7006

Draft
janniklasrose wants to merge 2 commits into
mainfrom
janniklasrose/print-summary-despite-destroy-error
Draft

janniklasrose wants to merge 2 commits into
mainfrom
janniklasrose/print-summary-despite-destroy-error

Conversation

@janniklasrose

Copy link
Copy Markdown
Member

Summary

Bundle deploy and destroy summaries reported the planned operation count, so a resource that failed to apply was still reported as created/deleted — e.g. Destroy: 3 deleted when one of three resources actually failed to delete. This makes the summaries report what actually happened:

Destroy: 2 deleted, 1 failed
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 2 failed
  • destroy prints its summary even when the destroy errors partway (partial deletions may already have succeeded), with a failed count.
  • deploy prints its resource summary on a partial resource failure too (previously suppressed), with accurate counts.

How

Per-resource outcomes are tracked during the direct engine's Apply:

  • PlanEntry.Attempted — the apply graph reached this node.
  • PlanEntry.Applied — its backend operation then succeeded.

Plan.CountApplied() tallies by outcome (plus a Failed total). The deploy summary prints on failure only when a resource actually failed, so a failure before the graph runs (a config error) or after a fully successful apply (a state-push error) still reports files only — preserving the existing partial-summary-on-push-fail behavior. Attempted is what distinguishes "attempted and failed" from "never reached".

Direct engine only; the terraform engine was removed in v1.20.0.

Tests

  • Added acceptance/bundle/deploy/summary-on-error (deploy partial failure) and reworked destroy/summary-on-error (three chained jobs, one delete fails) — chaining via id references keeps the apply order deterministic.
  • Added a unit test for CountApplied covering created/changed/deleted/failed, recreate, state-only delete, skip, and the attempted-but-not-reached case.
  • Updated the failure-injection goldens across bundle/dms, bundle/resources/*, bundle/resource_deps/*, and bundle/migrate/* to show the new accurate summary line.

This pull request and its description were written by Isaac.

janniklasrose and others added 2 commits October 9, 2026 12:03
Make the destroy summary line ("Destroy: N deleted") print even when the
destroy encounters errors partway through. This is a follow-up to PR #6210.

Before this change, early returns on errors (during the resource Apply, DMS
finalization, or file deletion) skipped the summary entirely. Extract the
summary into logDestroySummary and invoke it via defer in destroyCore so it
prints on every return path; partial deletions may have already succeeded.

The count is the planned deletions, not the actually-succeeded ones. Making
the count reflect only successful deletions is a separate follow-up.

Add an acceptance test that injects a failed resource delete and asserts the
summary still prints after the destroy error. The dms/failed-delete golden
gains the same summary line for the same reason.

Co-authored-by: Isaac <no-reply@databricks.com>
The deploy and destroy summaries counted planned operations, so a resource
that failed to apply was still reported as created/deleted. Track per-resource
outcomes during Apply - Attempted when the graph reaches a node, Applied when
its backend operation succeeds - and count what actually happened:

  Destroy: 2 deleted, 1 failed
  Resources: 1 created, 0 changed, 0 deleted, 0 unchanged, 2 failed

The deploy summary now also prints on a partial resource failure (it was
suppressed before). It stays suppressed when no resource failed: a failure
before the apply graph runs (e.g. a config error) or after it (e.g. a
state-push error) still reports files only, as before.

Direct engine only; the terraform engine was removed in v1.20.0.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added the DABs DABs related issues label Oct 9, 2026
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 9e7f1c7

Run: 37934329664

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 323 34 6:11
✅​ aws-windows-latest-4core-16gb 325 32 7:32
✅​ azure linux-2core-8gb 295 43 5:17
✅​ azure-windows-latest-4core-16gb 297 41 6:02
✅​ gcp linux-2core-8gb 296 43 5:09
✅​ gcp-windows-latest-4core-16gb 298 41 6:17
Top 4 slowest tests (at least 2 minutes):
duration env testname
4:16 gcp-windows-latest-4core-16gb TestAccept
3:41 aws-windows-latest-4core-16gb TestAccept
3:38 azure-windows-latest-4core-16gb TestAccept
2:01 azure linux-2core-8gb TestAccept/bundle/resources/job_runs/failed_run/DMS=true

This branch has not been deployed

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

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants