Skip to content

direct: map secrets value/owner in DoRead; drop RemapState - #6809

Merged
denik merged 9 commits into
mainfrom
denik/secrets-normalize-prep
Oct 1, 2026
Merged

denik merged 9 commits into
mainfrom
denik/secrets-normalize-prep

Conversation

@denik

@denik denik commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

ResourceSecret's RemapState mapped value/owner from the API's effective_* fields — needed so the persisted state matches config and re-plans show no drift — but it also zeroed the output-only metadata (create_time, effective_value, metastore_id, …), dropping those fields from the plan's remote_state display.

This moves the value/owner mapping into a small in-place remapSecretRemote applied in DoRead/DoCreate/DoUpdate, and stops zeroing the rest: the output-only fields are already ignore_remote_changes, so they cause no drift and can flow through for visibility. RemapState is removed. Prep toward replacing hand-written RemapState with the automatic copier (#6777).

This pull request and its description were written by Isaac.

@github-actions github-actions Bot added the DABs DABs related issues label Sep 23, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: c46408b

Run: 36709089936

Env ❌​FAIL ✅​pass 🙈​skip Time
❌​ aws linux 5 277 16 6:49
❌​ aws windows 5 279 14 6:07
✅​ azure linux 281 16 5:41
✅​ azure windows 283 14 5:41
✅​ gcp linux 282 16 5:48
✅​ gcp windows 284 14 4:41
Test Name aws linux aws windows
❌​ TestAccept ❌​F ❌​F
❌​ TestAccept/bundle/resources/secrets/remove-expire-time ❌​F ❌​F
❌​ TestAccept/bundle/resources/secrets/remove-expire-time/DATABRICKS_BUNDLE_ENGINE=direct/DMS=true ❌​F ❌​F
❌​ TestAccept/bundle/resources/secrets/update-expire-time ❌​F ❌​F
❌​ TestAccept/bundle/resources/secrets/update-expire-time/DATABRICKS_BUNDLE_ENGINE=direct/DMS=true ❌​F ❌​F
Top 4 slowest tests (at least 2 minutes):
duration env testname
5:07 azure windows TestAccept
4:08 gcp windows TestAccept
4:07 azure linux TestAccept
3:54 gcp linux TestAccept

@denik
denik force-pushed the denik/secrets-normalize-prep branch 2 times, most recently from fdd6d54 to 6265ca9 Compare September 29, 2026 12:17
@denik denik changed the title direct: map secrets remote in DoRead/DoCreate/DoUpdate; drop RemapState direct: drop the redundant secrets RemapState Sep 29, 2026
@denik
denik marked this pull request as ready for review September 29, 2026 16:52
@denik
denik requested review from a team as code owners September 29, 2026 16:52
@denik denik changed the title direct: drop the redundant secrets RemapState direct: map secrets value/owner in DoRead; drop RemapState Sep 30, 2026
@denik
denik enabled auto-merge September 30, 2026 08:42
@denik
denik force-pushed the denik/secrets-normalize-prep branch from 29326d6 to e11e3f1 Compare September 30, 2026 10:11
denik and others added 9 commits September 30, 2026 13:30
ResourceSecret's RemapState renamed effective_value/effective_owner to
value/owner and dropped output-only fields. Move that into a shared
remapSecretRemote helper applied wherever the remote is produced
(DoRead/DoCreate/DoUpdate), so the remote is already mapped and RemapState
becomes an identity no-op. Remove it; the adapter returns the remote unchanged.

Plan remote_state now shows the mapped value/owner and omits output-only fields;
the direct-only update-value golden is regenerated.

Prep for replacing RemapState with the automatic copier.

Co-authored-by: Isaac <no-reply@databricks.com>
…state

Co-authored-by: Isaac <no-reply@databricks.com>
…e remote

StateType and RemoteType are both catalog.Secret, and every field the old RemapState
reshaped is already declared ignore_remote_changes (value/owner are input_only;
create_time, effective_value, metastore_id, etc. are output_only). The reshape
suppressed no drift; it only discarded the output-only fields from the plan's
remote_state display. Removing it: DoRead/DoCreate/DoUpdate already return the raw
secret, the field classifications handle drift, and the full remote is visible again.

Co-authored-by: Isaac <no-reply@databricks.com>
remapSecretRemote now sets value/owner from the effective_* fields the API returns (so
persisted state matches config and re-plans show no drift) but leaves the output-only
metadata (create_time, effective_value, metastore_id, ...) intact for the plan's
remote_state display. Replaces the old RemapState, which zeroed those fields and thus
dropped them from the display. Verified against the invariant no_drift suite.

Co-authored-by: Isaac <no-reply@databricks.com>
Keeping the output-only fields means metastore_id now appears in the plan. It is a
fixed testserver literal locally but a real UUID on cloud, which broke the Cloud=true
update-expire-time/remove-expire-time integration runs. Add [METASTORE_ID] replacements
(literal + UUID regex, Order=-1) scoped to those two tests so the golden is stable
across environments.

Co-authored-by: Isaac <no-reply@databricks.com>
A bare UUID regex over-matched the cloud service-principal username in the workspace
path (/Workspace/Users/<uuid> -> [METASTORE_ID] instead of [USERNAME]). Instead, extract
the exact metastore_id from the plan and add_repl it: a literal match at Order -100 that
normalizes only that value to [METASTORE_ID] — the testserver literal locally and the real
UUID on cloud — before the numeric rules run, without touching usernames.

Co-authored-by: Isaac <no-reply@databricks.com>
Keeping the output-only fields drags them into the plan's changes set, and their remote
values differ between the testserver and a real workspace (metastore_id, comment,
timestamps), which broke the Cloud runs. Project the update-expire-time/remove-expire-time
plans to expire_time -- the field these tests assert -- per the allow-list rule in
testing.md. This drops the earlier per-field metastore_id add_repl and fixes the remaining
comment mismatch in one move; update-value still shows the full remote_state.

Co-authored-by: Isaac <no-reply@databricks.com>
The earlier projection to {expire_time} dropped value/owner as collateral, though they
normalize cleanly on cloud ([redacted]/[USERNAME]) and aren't a fidelity risk. Project to
{expire_time, value, owner} instead -- keeping those while still excluding the
fidelity-sensitive output-only fields (metastore_id, comment, timestamps).

Co-authored-by: Isaac <no-reply@databricks.com>
…e projections

jq object construction emits keys in the order listed, so {expire_time, value, owner} put
value before owner. The plan's natural order is alphabetical (owner < value), so list
{expire_time, owner, value} to match and avoid reordering the golden.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/secrets-normalize-prep branch from 694ef4e to c46408b Compare September 30, 2026 11:30
@denik
denik disabled auto-merge October 1, 2026 09:06
@denik
denik merged commit b2e603d into main Oct 1, 2026
29 of 30 checks passed
@denik
denik deleted the denik/secrets-normalize-prep branch October 1, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants