Skip to content

acceptance: pin the stale-plan hole in deployment history recording - #6221

Draft
shreyas-goenka wants to merge 1 commit into
isaac/pr6052-fixesfrom
isaac/dms-plan-staleness
Draft

acceptance: pin the stale-plan hole in deployment history recording#6221
shreyas-goenka wants to merge 1 commit into
isaac/pr6052-fixesfrom
isaac/dms-plan-staleness

Conversation

@shreyas-goenka

Copy link
Copy Markdown
Contributor

Why

Stacked on #6094 (base isaac/pr6052-fixes).

ValidatePlanAgainstState skips its lineage/serial check when the plan carries no
lineage, which is the case for a plan computed before any deployment exists:

if plan.Lineage == "" {
    return nil
}

That is fine as a first-deploy allowance, but it also means the plan is applied when a
deployment has appeared in the meantime. The plan asserted "nothing is deployed" and
nothing re-checks that assertion, so a create is replayed against a deployment that
already has the resource, and a second CREATE operation is recorded for it.

What

Adds acceptance/bundle/dms/stale-plan-not-detected, which captures today's behaviour
rather than the wanted one:

  1. bundle plan -o json before anything is deployed — the plan records
    "lineage": null, "serial": null and a create
  2. bundle deploy — creates the deployment and its first version
  3. bundle deploy --plan <the earlier plan> — accepted, and records a second CREATE

Badness in test.toml describes what is wrong with the test and the fix it is
waiting for, so the golden is not mistaken for intended behaviour. A TODO(DMS) on
ValidatePlanAgainstState points at the test.

The fix this is waiting for

Take the lineage from the DMS deployment ID and the serial from the version the plan
was computed against, and treat both being empty as a positive claim that no
deployment existed — so a deployment found at the state path at apply time is an
error. The deployment-ID half can land on its own; the serial half also needs the WAL
recovery check in dstate reworked, since it currently requires the serial to advance
by exactly one per local commit.

Tests

go test ./acceptance -run TestAccept/bundle/dms — 33 pass.

This pull request and its description were written by Isaac.

@shreyas-goenka
shreyas-goenka force-pushed the isaac/dms-plan-staleness branch from 8ded923 to 35ba48c Compare August 11, 2026 09:56
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 5b5f042

Run: 31494592441

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 306 1144 11:14
💚​ aws windows 4 4 308 1142 10:09
💚​ azure linux 4 4 305 1144 11:27
💚​ azure windows 4 4 307 1142 13:22
💚​ gcp linux 1 5 306 1144 12:51
💚​ gcp windows 1 5 308 1142 11:22
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 32 slowest tests (at least 2 minutes):
duration env testname
8:44 azure windows TestAccept
6:44 aws windows TestAccept
6:33 gcp windows TestAccept
4:24 azure windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
4:23 gcp windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
4:12 gcp linux TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:55 azure windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:52 gcp windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:39 gcp linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:20 aws linux TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:17 azure windows TestFilerWorkspaceFilesExtensionsReadDir
3:15 gcp windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:12 aws windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
3:07 azure linux TestAccept
3:06 aws linux TestAccept
3:02 gcp linux TestAccept
2:53 azure linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:52 azure linux TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:51 gcp windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:40 gcp linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:37 aws linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:34 gcp linux TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:33 azure linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:28 aws windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:28 azure linux TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:27 aws linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:22 aws windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=direct/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:16 aws linux TestFilerWorkspaceFilesExtensionsRead
2:14 aws windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform/DATABRICKS_BUNDLE_RECORD_DEPLOYMENT_HISTORY=
2:12 azure windows TestFilerRecursiveDelete/workspace_files
2:03 aws windows TestSyncFullFileSync
2:02 gcp windows TestFilerWorkspaceFilesExtensionsReadDir

@shreyas-goenka
shreyas-goenka force-pushed the isaac/dms-plan-staleness branch 3 times, most recently from 607dd83 to bf1af90 Compare August 11, 2026 12:14
A plan computed before any deployment exists carries no lineage and no serial, so
ValidatePlanAgainstState skips its check entirely. If a deployment is created between
that plan and its apply, the plan is applied anyway and records a second CREATE for a
resource that already exists.

The test captures today's behaviour rather than the wanted one, so Badness describes
what is wrong with it and the fix it is waiting for: take the lineage from the DMS
deployment ID and the serial from the version the plan was computed against, and
reject a plan that claims no deployment when one exists.

Co-authored-by: Isaac
@shreyas-goenka
shreyas-goenka force-pushed the isaac/dms-plan-staleness branch from bf1af90 to 5b5f042 Compare August 11, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants