Skip to content

Refuse to apply a plan that keeps a modified snapshot under --force - #7336

Open
pietern wants to merge 2 commits into
mainfrom
pietern/f05-6774-snapshot-force-plan
Open

pietern wants to merge 2 commits into
mainfrom
pietern/f05-6774-snapshot-force-plan

Conversation

@pietern

@pietern pietern commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Changes

bundle deploy --plan plan.json --force could stay on a snapshot that was modified in the workspace, if the plan was saved while the snapshot was clean. Applying such a plan now fails with "the last deployment was modified in the workspace since the plan was created; create a new plan with 'bundle plan --force' to move to a new snapshot".

Why

#6774 makes --force move the deployment to a fresh snapshot; that didn't hold for deploy --plan.

Tests

Extended acceptance/bundle/deploy/immutable/breakglass.

This pull request and its description were written by Isaac.

@github-actions github-actions Bot added the DABs DABs related issues label Nov 4, 2026
`bundle deploy --plan plan.json --force` reused the zip staged when the
plan was produced. If the snapshot was untouched at plan time and the
content had not changed, that zip carries the previous snapshot's name
and the plan holds a skip, so the forced deploy stayed on the snapshot
that was modified in the workspace, contrary to what --force promises.

Detect this case and ask the user to rerun `bundle plan --force`, which
moves the deployment to a fresh snapshot.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern
pietern force-pushed the pietern/f05-6774-snapshot-force-plan branch from 7fb73fa to aa3e234 Compare November 4, 2026 10:09
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 7b865e15d | Workflow run

Regression test report

Selected 1 changed tests (limit=20, 0 not selected)

1 tests: regression=1 unreleased=0 coverage=0 failing=0
test branch main (e1b8c92) latest (v1.24.0)
TestAccept/bundle/deploy/immutable/breakglass/DMS= ✅ ❌ ❌
TestAccept/bundle/deploy/immutable/breakglass/DMS=: branch ✅ | main (e1b8c92) ❌ | latest (v1.24.0) ❌

main (e1b8c92):

acceptance_test.go:1342: Diff:
        --- bundle/deploy/immutable/breakglass/output.txt
        +++ /tmp/TestAcceptbundledeployimmutablebreakglassDMS=3146650591/002/output.txt
        @@ -62,21 +62,11 @@
         
         === Deploying the saved plan with --force fails, since it keeps the modified snapshot
         >>> musterr [CLI] bundle deploy --plan plan.json --force
        -Error: the last deployment was modified in the workspace since the plan was created; create a new plan with 'bundle plan --force' to move to a new snapshot
        -
         Files: 0 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 0 deleted, 2 unchanged
         
        -=== A plan saved with --force moves to a new snapshot
        ->>> [CLI] bundle plan --force -o json
        +Unexpected success
         
        ->>> [CLI] bundle deploy --plan plan.json --force
        -Recreated internal_immutable_snapshots.immutable
        -Updated jobs.my_job
        -Files: 0 uploaded, 0 deleted
        -Resources: 1 created, 1 changed, 1 deleted, 0 unchanged
        -Fifth snapshot path: /Workspace/Users/[UUID]/.snapshots/[SNAPSHOT_HASH]/[SNAPSHOT_HASH]-[UUID]/snapshot/files/src/main.py
        -OK: the plan saved with --force moved the deployment to a new snapshot
        -
         >>> [CLI] bundle destroy --auto-approve
         The following resources will be deleted:
           delete resources.jobs.my_job
        @@ -84,3 +71,5 @@
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle-immutable-breakglass-[UNIQUE_NAME]/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1
        
FAIL

latest (v1.24.0): same output as main (e1b8c92)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 7b865e1

Run: 41864346068

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 273 15 6:14
✅​ aws-windows-latest-4core-16gb 275 13 6:29
✅​ azure linux-2core-8gb 272 15 5:29
✅​ azure-windows-latest-4core-16gb 274 13 5:06
✅​ gcp linux-2core-8gb 273 15 5:13
✅​ gcp-windows-latest-4core-16gb 275 13 5:43
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:34 gcp-windows-latest-4core-16gb TestAccept
3:32 aws-windows-latest-4core-16gb TestAccept
3:31 azure-windows-latest-4core-16gb TestAccept

The error is reached when the plan was saved with a plain 'bundle plan',
so "run 'bundle plan --force' again" was misleading.

Co-authored-by: Isaac <no-reply@databricks.com>
@pietern
pietern marked this pull request as ready for review November 5, 2026 08:56
@pietern
pietern requested review from a team as code owners November 5, 2026 08:56
snap.ZipPath = filepath.ToSlash(zipPath)
// A plan produced while the snapshot was untouched may keep it in place. Applying it would
// leave the deployment on the modified snapshot, which --force promises to move off.
if !m.clean && modified && snap.RelativePath() == prev.RelativePath {

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.

With this plan, deploy --plan plan.json without --force still fails at line 297 with "To confirm it, use the --force flag", and adding the flag lands here with a second, different error; the plan keeps the snapshot either way, so --force was never going to help. Can the kept-snapshot check run regardless of --force (plan keeps a dirty snapshot → "create a new plan with 'bundle plan --force'"), so the first error already says what to do? The test only runs the no-change plan with --force, so the chain isn't visible in output.txt.

@@ -0,0 +1 @@
* `bundle deploy --plan --force` now fails instead of staying on a snapshot that was modified in the workspace after the plan was created; create a new plan with `bundle plan --force`. ([#7336](https://github.com/databricks/cli/pull/7336))

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.

"snapshot" here could be read as a sync snapshot or a Postgres snapshot. The #6774 entry opens with "Immutable-folder deploys now refuse..."; can this one name immutable folders the same way?

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.

3 participants