Repository navigation
Conversation
Regression test report ✅Commit: Selected 18 changed tests (limit=20, 0 not selected) 36 tests: regression=34 unreleased=0 coverage=2 failing=0
TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resources/registered_models/removed_from_renamed_schema/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resources/registered_models/removed_from_renamed_schema/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌main (9a14ad6): latest (v1.28.0): 28 more failure details omitted, see the full report in the run. |
✅ Integration test reportCommit: bd30b89
Top 3 slowest tests (at least 2 minutes):
|
b680ea5 to
67b7645
Compare
67b7645 to
8015fc5
Compare
49cbb30 to
efce9ca
Compare
|
Heads-up: #7975 removed the To fix: use |
… resources in it Restores what was narrowed out of #8056: DoFindByInternalID (schemas, volumes) with the testserver list routes, findInMovedParents, the with_parent plan field and its makeGraph and --select handling, Destroy at a moved ID, and their tests. Adds its own changelog fragment (schema-moved-parent.md); #8056's fragment is unchanged. Rebased on #8056 as of efce9ca: the warnings use #8056's wording, and destroy_with_other_at_recorded_name now shows destroy deleting the bundle's schema at its new name (its Badness note and destroy_after_rename_out_of_band's are removed). The cleanup in the restored tests uses `|| true`, as main no longer has errcode (#7975). aws: TestAccept/bundle/resources/schemas/foreign_at_recorded_name TestAccept/bundle/resources/schemas/destroy_after_rename_out_of_band TestAccept/bundle/resources/schemas/recreated_at_recorded_name TestAccept/bundle/resources/schemas/destroy_renamed_with_model_and_secret TestAccept/bundle/resources/volumes/foreign_at_recorded_name TestAccept/bundle/resources/volumes/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/volumes/removed_from_renamed_schema TestAccept/bundle/resources/volumes/prevent_destroy_schema_without_dependency TestAccept/bundle/resources/volumes/prevent_destroy_mixed_case_schema TestAccept/bundle/resources/volumes/select_renamed_schema TestAccept/bundle/resources/registered_models/prevent_destroy_in_renamed_schema TestAccept/bundle/resources/registered_models/removed_from_renamed_schema TestAccept/bundle/resources/schemas/destroy_with_other_at_recorded_name Co-authored-by: Isaac <no-reply@databricks.com>
8015fc5 to
bd30b89
Compare
|
🤖 Done in
It stays a draft with no reviewers until #8056 merges. AI agent (opus5.5, isaac_claude) |
Depends on #8056; review it after #8056 merges. This PR is stacked on #8056: its base is #8056's branch, so the diff shows only this PR's commit. When #8056 merges, this PR is rebased onto main and its base set back to main.
This is the part of #8056 that was narrowed out during its review. The review threads about it are on #8056 and are all answered there.
Changes
In the direct deployment engine, a schema or volume records its backend id (
schema_id,volume_id;internal_id_field). This PR makes the plan and destroy check it, so that neither updates nor deletes an object that is not the bundle's, and destroy finds the bundle's own object after a rename out of band:findMovedlookup at the config's ID, so it finds the bundle's object when the config follows the rename. Otherwise it plans a create, which fails on the name. A warning (a diagnostic) names the object it leaves alone, and says how to take it over (bundle deployment bind, afterunbindif the state still has it).DoFindByInternalIDlooks for it by internal id: it lists the schemas in the catalog, or the volumes in the schema. The plan sets the entry's ID and apply deletes it there. A 403 at the recorded ID searches first, then keeps the old behavior.findInMovedParents): a Delete of a resource inside a parent the plan found at a new ID (a volume, model, secret or feature in a renamed schema; matched by case-insensitive full-name prefix; only types withparent_id_fieldsor the newmoves_with_parentconfig flag) is looked for under the parent's new ID. Verified there by its internal ID, it is deleted there as itself, before the parent. If it cannot be verified (not found, another object, or no internal ID to check) and the parent is deleted, it gets the new plan fieldwith_parent: no delete is sent for it at a guessed name, but approval,lifecycle.prevent_destroyand the counts treat it as a deletion, it is applied only after the parent's delete succeeded, a delete that depends on it also runs before the parent's, the parent's delete waits for what it depends on outside the parent (an external location an external volume names), and--selectfails unless the parent is in the selection too (named, or pulled in as a dependent). Whatever is still at a child's old path under a moved parent is never deleted there.GET /api/2.1/unity-catalog/schemasandGET /api/2.1/unity-catalog/volumes(list).acceptance/bin/replay_tfstate.py: matches a create request to its tfstate entry case-insensitively. UC lowercases names, so a mixed-case schema'sschema_idwas not remapped on replay, and the migrated state carried a stale id that the new check rejected (migrate/auto/schema-name-normalized).Why
This PR fixes behavior recorded as Badness in acceptance tests. #8056 already stops the CLI from updating or deleting another object at the recorded name; this PR makes destroy find the bundle's own after a rename out of band.
acceptance/bundle/resources/schemas/destroy_with_other_at_recorded_name(added in #8056):Before: a warning,
Destroy: 0 deleted, and the renamed schema still there. Now: destroy finds it by itsschema_idand sendsDELETE /api/2.1/unity-catalog/schemas/main.test-schema-moved-[UNIQUE_NAME]; the other schema at the recorded name is left alone.acceptance/bundle/resources/schemas/destroy_after_rename_out_of_band:Before:
Destroy: 0 deleted, and the renamed schema was still there. Now:Destroy: 2 deleted, withDELETE .../volumes/main.test-schema-renamed-[UNIQUE_NAME].myvolumeandDELETE .../schemas/main.test-schema-renamed-[UNIQUE_NAME].Tests
schemas/destroy_search_fails(local only: an injected 500 on the search fails destroy and keeps the state).volumes/prevent_destroy_in_renamed_schema(verified, and renamed too),volumes/prevent_destroy_schema_without_dependency(no recorded edge to the schema),volumes/prevent_destroy_mixed_case_schema(parent recorded in another case),volumes/removed_from_renamed_schema(parent kept in config),schemas/destroy_renamed_with_model_and_secret(no internal ID; a replacement schema at the old name is left alone),registered_models/prevent_destroy_in_renamed_schema(a model renamed with its schema),registered_models/removed_from_renamed_schema(a model deleted at its new path in a kept schema),volumes/select_renamed_schema(--select), and, local only:volumes/with_parent_delete_fails(the parent's delete fails),schemas/destroy_forbidden_at_recorded_name(403 at the recorded names),schemas/destroy_renamed_with_scope_named_like_itandschemas/rename_with_gone_scope_named_like_it(a secret scope named like the schema is never taken for its child, found or not).otherInternalID,findDeleteTarget,underMovedParent,with_parentinIsStateOnly/SendsNoDelete,makeGraphordering (a dependent of awith_parentchild, and its dependencies outside the parent) and cycles,FilterToSelected(awith_parentchild needs its parent in the selection, which may be pulled in through a catalog).Gaps and risks
Overall risk: medium. The change touches plan and destroy for every schema and volume in the direct engine, but it only narrows what the CLI updates or deletes, except in the two cases called out below.
Judgment call: a schema or volume deleted and created again outside the bundle is no longer adopted. The CLI cannot tell it from an object someone else created under the same name: both have another
schema_id/volume_idat the recorded name. Adopting it silently is what let destroy delete other people's schemas, so it is now left alone: deploy fails withALREADY_EXISTSand destroy leaves it, until the user runsbundle deployment unbindandbundle deployment bind. A warning on every plan names the object and the way out, andschemas/recreated_at_recorded_nameshows the recovery. Risk: medium. A user who drops and recreates schemas by hand sees deploys fail where they used to succeed; nothing is deleted or changed in the workspace.A deploy that removes a renamed schema or volume from config now deletes it, at its new name, as destroy does. Before, it only dropped the state entry and left the object. Risk: low; it is what removing a resource from config means, and the delete is listed and approved like any other.
Open question for the owner: bump
plan_version? (also open in a review thread) A saved plan's Delete can now carry a movedidandwith_parent. An older CLI rejects a plan withwith_parent(unknown field); one without it but with a movedidit applies at the recorded ID, which is what that CLI does with its own plan. A newer CLI applying a plan saved by an older one deletes what that plan found at the recorded ID, without this PR's check. Bumpingplan_versionwould reject both mixes with a clear error, but it changesplan_versioninbundle plan -o json, so I left it out. Risk if not bumped: low (needs a CLI upgrade betweenplananddeploy --plan, and a rename out of band in between).Destroy of a schema or volume deleted out of band now searches for it first. A 404 at the recorded ID cannot tell a rename from a delete, so the plan searches by internal ID (one list of the catalog's schemas, or the schema's volumes). A list that fails with anything other than not found or permission denied, after the client's retries, fails the plan, so the state keeps the record and the command can be run again. Before, the entry was dropped after the single GET. Making the failure a warning would drop the record of a schema that may only have been renamed, and leave it behind. Risk: low; a transient-looking failure fails a destroy that used to succeed.
Residual risks, unchanged by this PR or narrowed:
deploy --plan). The same window existed for the recorded name before. Risk: low.prevent_destroyon a volume or model deleted out of band blocks the destroy until it is removed from config (fails safe). Under a parent kept in config it is dropped from the state, as before. Risk: low.moves_with_parent), but the testserver does not move them with a schema, so no local test covers them. Risk: low; same behavior as for a model, which is tested.bundle deployment binddoes not record the internal id; the next deploy does. Until then the check has nothing to compare, as with state from an older CLI. Risk: low.Related PRs
apply.go) has merged and this branch is rebased on it. The overlap is small: this PR changesDestroy's signature, notDelete, and adds new helpers next tofindMoved. When Find a catalog renamed outside the bundle by its id #7418 lands, its resources get the identity check automatically; destroy's lookup applies once they implementDoFindByInternalID.Dashboard
Destroy: 0 deleted🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.