Repository navigation
Conversation
Without deployment history, a delete rejected with an error other than not-found or permission-denied fell through to dropping the resource from state, so the command succeeded and the resource stayed in the workspace untracked. Return the error again, as before the deployment history change. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…ete-error Co-authored-by: Isaac <no-reply@databricks.com>
|
Commit: Regression test reportSelected 2 changed tests (limit=20, 0 not selected) 4 tests: regression=2 unreleased=0 coverage=2 failing=0
TestAccept/bundle/destroy/delete-error/DMS=: branch ✅ | main (0c71683) ❌ | latest (v1.28.0) ❌main (0c71683): latest (v1.28.0): TestAccept/bundle/resources/materialization_sets/settled_failure/DMS=: branch ✅ | main (0c71683) ❌ | latest (v1.28.0) ❌main (0c71683): latest (v1.28.0): |
✅ Integration test reportCommit: 7fda907
Top 6 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 7c6fe4c. Each finding was verified against the code.
No blocking issues found. 1 non-blocking comment(s) below.
This PR makes (*DeploymentUnit).Delete return the delete error on runs without deployment history too, so a rejected delete fails bundle deploy/bundle destroy and the resource stays in state. That restores the behavior from before #6094. The change in apply.go is right: RecordFailure already does nothing when history isn't recorded, and deleteConfirmedGone is still checked first. One test gap remains: the settled_failure golden doesn't show the state that its new title describes.
Co-authored-by: Isaac <no-reply@databricks.com>
…er order Co-authored-by: Isaac <no-reply@databricks.com>
settled_failure/test.toml: #7919 added a Badness for the bug this PR fixes; keep this branch's version, which drops it with the DMS pin. Co-authored-by: Isaac <no-reply@databricks.com>
Changes
(*DeploymentUnit).Deletereturns the delete error again when the backend rejects a delete with an error that is not missing, managed-by-parent or permission-denied, and a re-read does not show the resource gone. Before, without deployment history, it fell through to dropping the resource from state:bundle destroyandbundle deploy(for a resource removed from the config) reported success while the resource stayed in the workspace, untracked.This is a regression from #6094 (7bf1485), which changed the final
into
} else if db.IsDeploymentMetadataService() { ...; return err }(renamed toRecordsHistoryin #7169), so the case without deployment history lost its return.Fix shape: I kept the pre-#6094 behavior. The error is returned for every run, with or without deployment history, and the resource stays in state so the next deploy or destroy retries the delete.
RecordFailureis still called unconditionally in that branch; it is already a no-op when history is not recorded, so nothing extra is written for runs without history.Tests:
bundle/destroy/delete-error(from acc: record that a rejected delete drops the resource from state in bundle/destroy/delete-error #7930): output now shows both commands failing with the delete error and the job kept in state;Badnessremoved and theDMS=truevariant re-enabled (both variants now share one golden).bundle/resources/materialization_sets/settled_failure: its destroy step recorded the old behavior ("forgives a delete error ... drops the state while the set stays in the workspace") and was pinned toDMS=""for that reason. It now asserts the destroy fails (musterr) and runs on both variants.In the fix PR,
bundle/destroy/delete-errorasserts the failures withmusterrand prints the state after the partial destroy:foo(rejected) is kept andbar(deleted) is gone.Scope notes:
IsGone(or the error classification) taught about it; I did not find such a case among the existing tests.destroyCorereturns before printing theDestroy: N deletedsummary. That is existing behavior for every delete error (including runs with history) and is left for a separate change.Overlap: #7496 changes the same lines and keeps the fallthrough (with a warning and a "removed from state" count). This PR removes the fallthrough instead; the two need to be reconciled whichever lands first.
Why
A destroy that reports success while leaving resources in the workspace is worse than a failure: the user has no state and no message pointing at the leftover resource.
This PR was created by analyzing coverage gaps.
Coverage: bundle/direct/apply.go,
(*DeploymentUnit).Delete, the branch for a delete error that is not missing, managed-by-parent or permission-denied.Tests
go test ./acceptance -run 'TestAccept/bundle/destroy/delete-error'andTestAccept/bundle/resources/materialization_sets;go test ./bundle/....AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.