Repository navigation
Conversation
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…400, exercise destroy and saved-plan delete Co-authored-by: Isaac <no-reply@databricks.com>
cloud: TestAccept/bundle/invariant/delete_idempotent TestAccept/bundle/invariant/destroy_idempotent Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 3 changed tests (limit=20, 0 not selected) 272 tests: regression=5 unreleased=0 coverage=267 failing=0
TestAccept/bundle/invariant/destroy_idempotent/DMS=/INPUT_CONFIG=cluster.yml.tmpl/READPLAN=: branch ✅ | main (7a48abb) ❌ | latest (v1.28.0) ✅main (7a48abb): TestAccept/bundle/resources/clusters/deleted-out-of-band-plan/DMS=: branch ✅ | main (7a48abb) ❌ | latest (v1.28.0) ✅main (7a48abb): TestAccept/bundle/resources/clusters/deleted-out-of-band-plan/DMS=true: branch ✅ | main (7a48abb) ❌ | latest (v1.28.0) ❌main (7a48abb): latest (v1.28.0): same output as main (7a48abb) TestAccept/bundle/resources/clusters/deleted-out-of-band/DMS=: branch ✅ | main (7a48abb) ❌ | latest (v1.28.0) ❌main (7a48abb): latest (v1.28.0): TestAccept/bundle/resources/clusters/deleted-out-of-band/DMS=true: branch ✅ | main (7a48abb) ❌ | latest (v1.28.0) ❌main (7a48abb): latest (v1.28.0): |
✅ Integration test reportCommit: db54596
Top 50 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at db54596. Each finding was verified against the code.
No blocking issues found. 4 non-blocking comment(s) below.
This PR fixes the flaky "Cluster ... does not exist" failures in direct-engine deploy and destroy. DoRead now prefers the cluster GET error over the library-status error. The 400 "does not exist" response from library-status and permanent-delete is mapped to not-found, and the fake server now returns the cloud's 400 for missing clusters. The DoRead precedence fix looks right and is enough on its own for the reported failures. My main concern is the new exact-message matcher, which the repo's error rules discourage and which mostly duplicates deleteConfirmedGone. The rest are small test and comment cleanups.
| apiErr, ok := errors.AsType[*apierr.APIError](err) | ||
| return ok && apiErr.StatusCode == http.StatusBadRequest && | ||
| apiErr.ErrorCode == "INVALID_PARAMETER_VALUE" && | ||
| apiErr.Message == "Cluster "+id+" does not exist" |
There was a problem hiding this comment.
[nice to have] isClusterDoesNotExist decides by comparing apiErr.Message to the exact English text "Cluster does not exist". AGENTS.md rules out branching on error string content. If a cloud adds a trailing period or rewords the message, the mapping silently stops matching. In DoDelete (line 390) the mapping is also redundant: with the new DoRead precedence, the re-read in deleteConfirmedGone (bundle/direct/apply.go:412) already gets the SDK-mapped not-found and drops the state entry, so the only thing this adds is hiding the warning at apply.go:375. The comment at apply.go:409 says the repo re-reads on purpose instead of matching delete errors. Can we drop the mappings in DoDelete and readLibraries (line 212) and rely on the DoRead fix plus deleteConfirmedGone? If one of them is really needed, could it say why the message is the only signal available?
| return Response{} | ||
| } | ||
|
|
||
| // clusterDoesNotExist is how the cloud answers cluster and library-status requests for a |
There was a problem hiding this comment.
[nit] The comment says this is how the cloud answers cluster requests for a missing cluster. But ClustersEdit, ClustersResize, ClustersStart and ClustersDelete in this file, and LibrariesInstall in libraries.go, still return a bare 404. Can you narrow the comment to clusters/get, permanent-delete and libraries/cluster-status? Or, if the cloud answers the others the same way, should they use this helper too?
| # library-status and permanent-delete for it with 400 INVALID_PARAMETER_VALUE "does not exist". | ||
| trace $CLI bundle deploy | ||
| cluster_id=$(read_id.py foo) | ||
| print_requests.py > /dev/null |
There was a problem hiding this comment.
[nit] .agents/rules/testing.md asks for noisy output to go to LOG.<name>, not /dev/null. Lines 5, 9 and 24 throw away the recorded requests. Something like print_requests.py > LOG.setup clears them the same way and keeps them visible under go test -v.
| @@ -66,3 +72,91 @@ func TestClusterOverrideChangeDescLibraries(t *testing.T) { | |||
| }) | |||
| } | |||
| } | |||
There was a problem hiding this comment.
[nit] TestClusterDoReadMissingCluster delays clusters/get so the library-status 400 arrives first and then expects not-found. That is the same scenario bundle/resources/clusters/deleted-out-of-band covers with its 300ms [[Server]] delay, and the testing rules say not to add a unit test that only duplicates an acceptance test. Can it be dropped, keeping the unit tests that cover cases the acceptance tests can't, like the other 400 message and the cancellation?
🤖
Changes
ResourceCluster.DoReadranclusters/getandlibraries/cluster-statusconcurrently through an errgroup and returned whichever error came first. For a deleted cluster the backend answers both, andclusters/permanent-delete, with400 INVALID_PARAMETER_VALUE"Cluster does not exist". The Go SDK maps only theclusters/getanswer toErrResourceDoesNotExist. When the library-status error came first, the plan warned about a read failure and kept the delete,permanent-deletefailed with 400, and the re-read indeleteConfirmedGonelost the same race, so the command failed. Since #7931 that delete error failsbundle deploy/bundle destroyinstead of dropping the entry from state, so the race now shows up as flaky failures.DoRead: the cluster GET error takes precedence, and the library read is cancelled once the cluster GET failed (as the errgroup did before).readLibrariesandDoDelete: the exact "Cluster does not exist" 400 for the requested id is mapped toErrResourceDoesNotExist, so a cluster deleted between the two reads plans a create, andDelete/Recreatetreat a delete of an already-deleted cluster as done without a warning.libs/testserver:clusters/get,libraries/cluster-statusandpermanent-deletefor a missing cluster return the cloud's 400 (was 404 / success). One golden changes:bundle/migrate/auto/artifactsnow shows the cloud's message instead of "Not Found".Why
Dashboard: error/598, first seen on main on 2026-11-26 after #7931, on AWS, Azure and GCP:
Tests:
cluster*.yml.tmplvariants of both invariants.Tests
bundle/resources/clusters/deleted-out-of-band: the state points at a cluster that no longer exists, and aclusters/getstub answers the 400 after 300ms, so the library-status 400 always comes first.bundle destroyand a deploy that removes the cluster both fail on main with the error above; they pass here.bundle/resources/clusters/deleted-out-of-band-plan(no stub): a cluster deleted out of band and still in config is created again; a saved-plan delete of a cluster deleted after the plan sendspermanent-delete, gets the 400 and drops the state entry without a warning.cluster_test.gofor each mapping and for a different 400 message staying an error (each fails without its change), and one that the library read is cancelled once the cluster GET failed (main's errgroup did that too; it guards the new code).Gaps and risks
DoDeletefalls back to the existing re-read indeleteConfirmedGone, which keeps state unless the read confirms the cluster is gone, so a live cluster is not dropped.deleteConfirmedGonefallback at debug level; this PR makes clusters not need the fallback. No shared lines.DoRead).AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.