Repository navigation
[DECO-28500] Sync a remote run_as on jobs whose config leaves it unset - #7494
Conversation
|
Commit: Regression test reportSelected 2 changed tests (limit=20, 0 not selected) 3 tests: regression=2 unreleased=0 coverage=1 failing=0
TestAccept/bundle/config-remote-sync/job_run_as/DMS=: branch ✅ | main (f153f69) ❌ | latest (v1.26.0) ❌main (f153f69): latest (v1.26.0): TestAccept/bundle/config-remote-sync/job_run_as/DMS=true: branch ✅ | main (f153f69) ❌ | latest (v1.26.0) ❌main (f153f69): latest (v1.26.0): |
✅ Integration test reportCommit: b0c621a
Top 3 slowest tests (at least 2 minutes):
|
c83ff1d to
cc6cc1c
Compare
f712989 to
759b252
Compare
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
🤖 AI review from review-factory: 3 independent reviewer models (Claude Opus 5.5, Claude Fable 5.2, Claude Sonnet 5.5) with cross-verification. Only findings that reviewers agreed on are posted.
Syncs a remote job run_as into configs lacking one; reviewers confirmed a removed-and-redeployed run_as is written back, plus a redundant whole-object replace.
Findings: 1 major, 1 minor.
config-remote-sync skipped a job's run_as entirely, so a run-as change made in the Jobs UI never reached a config without run_as. Replace the blanket skip with a rule for the whole run_as object: sync it unless the remote has none, it is unchanged since the last deploy, or it names the job's creator. Jobs updated by the terraform engine carry an explicit run_as set to the job's identity, which the creator check filters out. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
config-remote-sync is a hidden command used only by DABs in the workspace; changes to it do not get release notes. Co-authored-by: Isaac <no-reply@databricks.com>
759b252 to
9d7317e
Compare
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
🤖 AI review (Claude Fable 5.2 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
A remote run_as on a job whose config has none is either a Jobs UI edit or a value the server kept: jobs/reset without run_as keeps the previous run_as, so a run_as removed from the config and deployed stays on the job. Every sync wrote it back. Only the caller knows which case applies, so a whole-object run_as is now synced only for jobs listed in the new --sync-run-as-ids flag. This replaces the creator heuristic, which also missed jobs whose ownership was transferred. When the config sets run_as, the plan reports the remote edit key by key, so the whole-object change is skipped instead of emitted as a duplicate replace. Co-authored-by: Isaac <no-reply@databricks.com>
run_as on jobs whose config leaves it unsetrun_as on jobs whose config leaves it unset, for jobs passed in --sync-run-as-ids
run_as on jobs whose config leaves it unset, for jobs passed in --sync-run-as-idsrun_as on jobs whose config leaves it unset
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Fable 5.2, cross-verified). Only points the reviewers agreed on are posted.
No blocking or major issues found.
Resolve conflicts with #7645 (lifecycle metadata) and #7536 (permissions): - convertPlanChange applies skipJobRunAs before applyLifecycle. - applyLifecycle no longer drops a job's whole run_as as a backend default; skipJobRunAs already limits it to jobs passed in --sync-run-as-ids. Also validate --sync-run-as-ids inside PostStateFunc so an invalid value is reported through WriteResult (status: failed with -o json) and telemetry, like --select-ids. Co-authored-by: Isaac <no-reply@databricks.com>
|
Overall LGTM but I'm not super happy with having extra command flag
Can we derive it in the config somehow and add more guardrails? E.g. if it's the server-side default value (e.g. owner) - maybe we can skip sync? If not possible, maybe we could consider a generic argument for such cases? i.e. |
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Fable 5.2 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
No issues found.
Replace the --sync-run-as-ids flag with a rule config-remote-sync applies on its own. A job without run_as runs as its owner: the IS_OWNER entry of its ACL, or its creator when job access control is off. The Jobs UI always shows and saves a principal, so a remote run_as that names the owner says what the config already says and is skipped. Any other remote run_as is what the job runs as, so it is written to the config. That includes a run_as removed from the config and deployed, which jobs/reset keeps. The owner comes from the ACLs config-remote-sync already reads for unmanaged permissions (now returned unfiltered), from the plan for declared ones, or from a direct read for declared permissions that were never deployed. When the ACL can't be read, run_as is not synced. Co-authored-by: Isaac <no-reply@databricks.com>
|
@ilyakuz-db Yes, it can be derived. A remote run_as the YAML doesn't set is now synced unless it's the job's owner (IS_OWNER in the ACL, or the creator). That's safe: no run_as already means the owner, so skipping the owner never makes the YAML wrong. Every other UI edit picks someone else and is synced. The trade-off is the case the flag was for. If run_as is removed from the YAML and deployed, the server keeps the old value, and sync writes it back. I think that's fine, because the job really does still run as that principal. Maybe it even helps users as they realize that just removing run_as from config did not revert back to running as owner, so they can be explicit for the next deploy. |
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Fable 5.2, cross-verified). Only points the reviewers agreed on are posted.
Co-authored-by: Isaac <no-reply@databricks.com>
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Follow-up review by review-factory (Claude Opus 5.5 + Claude Fable 5.2, cross-verified). Only points the reviewers agreed on are posted.
No new issues found.
Resolve the conflict with #7717 in permissions.go: readUnmanagedPermissions keeps returning the raw ACL (jobOwners needs the IS_OWNER entry), and addPermissionsChanges now filters it with withoutCurrentUserDefaults. Co-authored-by: Isaac <no-reply@databricks.com>
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Fable 5.2, cross-verified). Only points the reviewers agreed on are posted.
No blocking or major issues found.
| if adapter == nil { | ||
| return nil, errPermissionsNotRead | ||
| } | ||
| return readPermissions(ctx, b, adapter, resourceKey) |
There was a problem hiding this comment.
[AI Generated] nit: No test can fail on this direct read: the second sync reaches it for transferred_owner, but a failed read also gives "No changes detected". Can one case with undeployed permissions expect run_as: add?
Changes
config-remote-syncnow writes a remote jobrun_asinto a config that doesn't set one, unless it names the job's owner (skipJobRunAsinbundle/configsync/runas.go). It replaces the blanketresources.jobs.*.run_asskip.run_asruns as, per the Jobs API (run_as_user_name): theIS_OWNERentry of the job's ACL, orcreator_user_namewhen job access control is off. The ACL comes from:IS_OWNER/CAN_MANAGEis still dropped before permissions are written);run_aschange is still skipped when:run_as(the plan reports the edit key by key);run_as;applyLifecycleno longer drops a job's wholerun_asas a backend default;skipJobRunAsdecides it.Why
run_as, which is most bundles.run_asis unset) and only saves a different one, so the owner check doesn't drop UI edits.run_asset to the owner (provider code), so they are skipped.run_asremoved from the config and deployed is written back:jobs/resetwithoutrun_askeeps the previous value, so the job still runs as that principal.--sync-run-as-idsflag from an earlier revision, so the caller needs no new flag.Tests
config-remote-sync/job_run_as:run_ason a job without one → synced;run_asnaming the owner → not synced, both with the creator as owner and after an ownership transfer;run_asremoved from config and deployed → written back;run_asadded locally, not deployed, then changed remotely → one key-level change;run_as: {}on a principal kind switch #7493 are unchanged;config-remote-sync/terraform_state: a terraform-pinnedrun_asnaming the owner isn't reported.skipJobRunAsandjobOwners.This pull request and its description were written by Isaac.