Repository navigation
UC secrets follow a renamed catalog or schema - #7381
Conversation
|
Commit: Regression test reportSelected 20 changed tests (limit=20, 3 not selected) 48 tests: regression=43 unreleased=0 coverage=5 failing=0
TestAccept/bundle/migrate/auto/registered-model-rename/DMS=: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): same output as main (c450460) TestAccept/bundle/resources/catalogs/rename/DMS=/READPLAN=: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): TestAccept/bundle/resources/catalogs/rename/DMS=/READPLAN=1: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): TestAccept/bundle/resources/catalogs/rename/DMS=true/READPLAN=: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): TestAccept/bundle/resources/catalogs/rename/DMS=true/READPLAN=1: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): TestAccept/bundle/resources/grants/registered_model_change_name/DMS=: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): TestAccept/bundle/resources/grants/registered_model_change_name/DMS=true: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): TestAccept/bundle/resources/registered_models/basic/DMS=: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): same output as main (c450460) TestAccept/bundle/resources/registered_models/basic/DMS=true: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): same output as main (c450460) TestAccept/bundle/resources/registered_models/move_from_renamed_schema/DMS=/READPLAN=: branch ✅ | main (c450460) ❌ | latest (v1.28.0) ❌main (c450460): latest (v1.28.0): 33 more failure details omitted, see the full report in the run. |
✅ Integration test reportCommit: f1a4220
Top 6 slowest tests (at least 2 minutes):
|
344a6c9 to
24b12d9
Compare
24b12d9 to
35b8737
Compare
35b8737 to
5bd3516
Compare
5bd3516 to
a333a4b
Compare
a333a4b to
4ccf5ab
Compare
4ccf5ab to
cdc56bf
Compare
cdc56bf to
0d1ef07
Compare
0d1ef07 to
d16b7c2
Compare
d16b7c2 to
5e37c6e
Compare
5e37c6e to
2957d38
Compare
2957d38 to
ce6daec
Compare
ce6daec to
2b74f07
Compare
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…WithID check (review) table_name is not a parent ID field, so the case was a recreate before the check, and no resource has parent_id_fields without DoUpdateWithID. Co-authored-by: Isaac <no-reply@databricks.com>
…ID field (review) Co-authored-by: Isaac <no-reply@databricks.com>
…al ID A volume or a schema is found at its new ID by the plan (findMoved), as on main; only a model or a secret, which nothing identifies at its new path, needs its moved ID recorded before the update. Co-authored-by: Isaac <no-reply@databricks.com>
…gain This reverts 85c4ecb: volumes are back on findMoved. Co-authored-by: Isaac <no-reply@databricks.com>
058ceb4 to
dea6d57
Compare
Co-authored-by: Isaac <no-reply@databricks.com>
UC moves a secret with its renamed parent, so the planner now re-keys it (update_id, parent_renamed) instead of recreating it, which failed with ALREADY_EXISTS. A secret cannot be renamed itself, so its DoUpdateWithID only re-keys; the adapter check now accepts DoUpdateWithID for a resource whose provided_id_fields a parent rename can 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>
Co-authored-by: Isaac <no-reply@databricks.com>
…t; drop duplicated test-server moves Co-authored-by: Isaac <no-reply@databricks.com>
The recreate deletes the secret at its recorded path after the schema's rename moved it, so the moved secret is left behind. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…secret Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…rets (review S3) The check is skipped for resources that implement OverrideChangeDesc, as secrets do. Co-authored-by: Isaac <no-reply@databricks.com>
Only parent_id_fields (catalog_name, schema_name, from #7718) follow a parent's rename, so a name that references a renamed schema's name recreates the secret instead of re-keying it to a path that does not exist. Co-authored-by: Isaac <no-reply@databricks.com>
…ADY_EXISTS Verified on AWS, Azure and GCP: "Secret '<full_name>' already exists". Co-authored-by: Isaac <no-reply@databricks.com>
…adness, review G1) Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…elds imply them (#7938) Co-authored-by: Isaac <no-reply@databricks.com>
dea6d57 to
f1a4220
Compare
simonfaltum
left a comment
There was a problem hiding this comment.
🤖 Automated review from simonfaltum's review agent (pr-review skill) at f1a4220. Each finding was verified against the code; simonfaltum may follow up.
No blocking issues found, approving. 3 non-blocking comment(s) and 1 question(s) below.
This PR adds DoUpdateWithID to UC secrets, so a secret in a renamed catalog or schema is re-keyed or updated at its new path instead of being deleted and recreated. The main flows work and are well tested on real workspaces, and CI is green. One edge case remains: the follow check compares only the schema or catalog name, not the parent's full name, so a secret in a different catalog can be re-keyed in state to a path that doesn't exist. There are also two small test and changelog nits, and one question about the provided_id_fields: name entry.
Questions
provided_id_fields: namein secrets.yml isn't needed for parent renames: a name change already recreates through the generatedrecreate_on_changes. The entry does change two things. A remote-onlynamedifference, such as UC normalizing the case, is now skipped where base recreated the secret. And the reason a name change shows in the plan is nowid_fieldinstead ofspec:immutable, as seen in recreate_in_renamed_schema/output.txt. Is that intended? If so, could the description mention it, with a case-only test like the volume and model ones? Otherwise the entry could be dropped. (non-blocking)
Accepted answers
- Isn't the --plan Repl already handled by $(readplanarg)?: #7381 (comment)
| // DoUpdateWithID updates a secret whose catalog or schema was renamed: UC moved the secret with its | ||
| // parent, so it is addressed at its new ID. A secret cannot be renamed itself, so this is the only | ||
| // way its ID changes. | ||
| func (r *ResourceSecret) DoUpdateWithID(ctx context.Context, _ string, state *catalog.Secret, entry *PlanEntry) (string, *catalog.Secret, error) { |
There was a problem hiding this comment.
[nice to have] With this DoUpdateWithID, canFollowParentRename is true for secrets. followsParentRename then decides whether a secret moved with its parent, but it compares only that one field's old value, not the parent's full name.
Example: a secret sits at prod.shared.k. In one deploy, its schema_name changes from the literal shared to ${resources.schemas.s.name}, catalog_name: prod stays, and the bundle schema s is renamed from staging.shared to staging.next. The plan marks the secret update_id/parent_renamed with state_only, and the deploy records prod.next.k without any request. UC still has prod.shared.k. The next deploy creates prod.next.k and leaves prod.shared.k orphaned. Before this PR, the same config planned a recreate: delete prod.shared.k, create prod.next.k.
Suggest that followsParentRename re-key a child only when its recorded ID starts with the parent's recorded old ID plus .. Registered models from #7379 have the same gap.
|
|
||
| # Drop the remote_state fields that differ between clouds or from the test server. | ||
| plan() { | ||
| trace $CLI bundle plan --output json | tee .databricks/plan.json | jq .plan | normalize_uc_payload.py created_at updated_at updated_by metastore_id browse_only effective_predictive_optimization_flag enable_predictive_optimization isolation_mode securable_type |
There was a problem hiding this comment.
[nit] .agents/rules/testing.md says to record plan entries with plan_filter.py unless the test asserts on remote_state. This test and recreate_in_renamed_schema (script:16) pipe jq .plan into normalize_uc_payload.py, so the GET payloads of the catalog, schema and secret end up in Cloud goldens. A field UC adds to any of those responses would fail both tests on every cloud. Sibling rename tests on main use the same pattern. Keep tee .databricks/plan.json for READPLAN, and pipe the golden through plan_filter.py before jq .plan.
| @@ -0,0 +1 @@ | |||
| * UC secrets follow a renamed catalog or schema. ([#7381](https://github.com/databricks/cli/pull/7381)) | |||
There was a problem hiding this comment.
[nit] The pr-checklist asks for a changelog entry that leads with a verb, or uses "now" for a resulting behavior. This one has neither. Suggest: * UC secrets now follow a renamed catalog or schema instead of being recreated. ([#7381](https://github.com/databricks/cli/pull/7381))
Changes
A UC secret in a renamed catalog or schema (
schema_name: ${resources.schemas.<s>.name}) now follows its parent the way volumes do since #7343 and registered models do in #7379: withIDFromState, the framework re-keys it without a request (state_only). Before, it was recreated where the parent's rename moved it: the secret was deleted and created again.UC cannot rename a secret, so its own name still recreates, even when it references a renamed resource's name: only its
parent_id_fields(catalog_name,schema_name, from #7718) follow a parent. When the secret also has its own changes, the newDoUpdateWithIDsends the update at the new path, and the framework records the new path first (#7379), so a failed update is retried there.Stacked on #7379.
Tests
secrets/recreate_in_renamed_schema(Cloud = true): rename the schema and the secret in one deploy. The secret is recreated, and the old one is deleted where the schema's rename moved it.secrets/parent_rename(Cloud = true): rename the schema (no request to the secret), then rename the catalog and change the secret's comment in one deploy (one PATCH at the new path).create_timestays the same and the final plan is a no-op.secrets/parent_rename_out_of_band(Cloud = true,Badness): a secret has no recorded id, so when its schema is renamed outside the bundle the plan creates it again and UC rejects the create. Same on main.schemas/rename_with_model_and_secret(Cloud = true): the secret now follows the schema's rename too; the deploy sends only the schema's PATCH.Secret '<name>' does not exist.,409 ALREADY_EXISTSSecret '<name>' already exists; checked on AWS, Azure and GCP).This pull request and its description were written by Isaac.