bundle: Clear local state on destroy to prevent lineage mismatch - #6210
Draft
janniklasrose wants to merge 2 commits into
Draft
bundle: Clear local state on destroy to prevent lineage mismatch#6210janniklasrose wants to merge 2 commits into
janniklasrose wants to merge 2 commits into
Conversation
Destroy only deleted the remote state, leaving the local state file (and its lineage) behind. When the same bundle was later redeployed from a different machine that had no local state, the fresh deploy minted a new lineage that no longer matched the lingering local one, so every subsequent command failed with "lineage mismatch in state files". Remove the local direct-engine state file on a successful destroy so no stale lineage is left behind; the next command then adopts the remote state cleanly. Reworks bundle/state/state_present, which relied on the local direct state surviving a destroy to assert serial continuity. Its engine- selection intent is unchanged; the mid-test destroy is dropped. Co-authored-by: Isaac
Base automatically changed from
janniklasrose/lineage-mismatch-message
to
main
August 10, 2026 10:08
Collaborator
Integration test reportCommit: f28302d
9 interesting tests: 4 SKIP, 3 RECOVERED, 1 KNOWN, 1 FAIL
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Stacked on top of #6207 (which adds the reproducing acceptance test).
bundle destroyonly deleted the remote state, leaving the local state file — and its lineage — behind. When the same bundle was later redeployed from a different machine that had no local state, the fresh deploy minted a new lineage that no longer matched the lingering local one, so every subsequent command failed withlineage mismatch in state files.This removes the local direct-engine state file on a successful destroy, so no stale lineage is left behind. The next command then finds no local state and adopts the remote state cleanly.
Why delete the file rather than just blanking the lineage: blanking alone does not fix it.
validateStatesstill string-compares the (now empty) local lineage against the remote one and mismatches, and even if empty lineages were skipped, the empty-but-higher-serial local state would out-rank the real remote state during winner selection and get deployed from. Deleting the file is a single, localized change that matches what a fresh machine looks like anyway — which is the exact situation being emulated.Scoped to the direct engine: lineage (a per-deployment-history UUID) is a direct-engine concept, and terraform manages its own state lifecycle.
Reworked test
acceptance/bundle/state/state_presentrelied on the local direct state surviving a destroy to assert serial continuity. Its engine-selection intent (a higher-serial direct state keeps winning regardless of theDATABRICKS_BUNDLE_ENGINEenv var) is unchanged; the mid-test destroy is dropped and the asserted final serial adjusts accordingly.The reproducing test added in #6207 (
acceptance/bundle/destroy/lineage-mismatch-after-redeploy) now shows machine A succeeding instead of erroring.Tests
state_presentpasses on both engine variants with identical output.bundle/phasesunit tests pass.This pull request and its description were written by Isaac, an AI coding agent.