Repository navigation
Conversation
…ty syncs Six acceptance tests for the permissions sync added in #7536 where the identity that runs config-remote-sync is not the one that deploys, and one where the synced config is deployed to another target. aws: TestAccept/bundle/config-remote-sync/permissions gcp: TestAccept/bundle/config-remote-sync/permissions Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 9 changed tests (limit=20, 0 not selected) 50 tests: regression=0 unreleased=0 coverage=50 failing=0
|
✅ Integration test reportCommit: 7caa85e
17 interesting tests: 16 MISS, 1 RECOVERED
Top 6 slowest tests (at least 2 minutes):
|
A deploy by a non-admin service principal that asks for a job's ownership fails on the real backend with 403 "only workspace admins can change the owner of a job". The testserver let it through, so the owner and handover tests recorded an ownership change that the cloud run does not show. aws: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs gcp: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs Co-authored-by: Isaac <no-reply@databricks.com>
… default ACL - Each imported block has one entry, and ACL lines are sorted after the replacements, so neither the backend's order nor the principals' names change the output. - no_grants sets the owner only where the testserver has none. - handover is destroyed by the identity that created the job. - The testserver checks the owner change on the validated ACL, so a request without an owner still gets the 400 it got before. aws: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs gcp: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs Co-authored-by: Isaac <no-reply@databricks.com>
… and an undeployed block aws: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs gcp: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs Co-authored-by: Isaac <no-reply@databricks.com>
aws: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs gcp: TestAccept/bundle/config-remote-sync/permissions TestAccept/bundle/resources/permissions/jobs Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at 7caa85e. Each finding was verified against the code.
No blocking issues found. 5 non-blocking comment(s) below.
This PR adds nine acceptance tests that record what config-remote-sync does with permissions when the identity that syncs isn't the one that deploys, plus one cross-target case. It also adds a testserver rule that rejects a non-admin guest's attempt to change a job's owner with a 403. I found no wrong behavior. The testserver check holds up when traced through the creator-owned, guest-owned and owner-kept cases. What's left is cleanup: the scripts don't follow the acceptance rules for the permissions set output and for reading resource IDs, the no_grants script works around a testserver gap, the new owner lookup repeats the creator-owner fallback, and one comment needs clearer wording.
| $CLI permissions set jobs $job_id --json '{"access_control_list":[ | ||
| {"permission_level":"IS_OWNER","service_principal_name":"'"$TEST_SP_APPLICATION_ID"'"}, | ||
| {"permission_level":"CAN_MANAGE","'"$CURRENT_USER_FIELD"'":"'"$CURRENT_USER_NAME"'"} | ||
| ]}' > /dev/null |
There was a problem hiding this comment.
[nice to have] testing.md says to send noisy output to LOG.<name>, not to /dev/null. Here the response of permissions set is thrown away, so if a grant fails or comes back different on a cloud run, nothing records what the backend returned. Can these go to something like > LOG.permissions_set? The same applies to declared, experiment, handover, no_grants, owner, syncer_home, undeployed, and both calls in other_target.
|
|
||
| title "The service principal deploys a job that declares no permissions" | ||
| trace as-test-sp $CLI bundle deploy | ||
| job_id=$(as-test-sp $CLI bundle summary -o json | jq -r '.resources.jobs.my_job.id') |
There was a problem hiding this comment.
[nice to have] testing.md asks for the acceptance/bin/ helpers instead of inline jq pipelines, and read_id.py my_job prints the ID from state and registers the [MY_JOB_ID] replacement. Could this be job_id=$(as-test-sp read_id.py my_job)? In owner/script and handover/script (lines 10–11) that would also replace the hand-written jq plus add_repl "$job_id" MY_JOB_ID pair. The same pipeline appears in every other new script, and other_target would use read_id.py -t staging / -t prod.
| title "Nobody changes the job's ACL: the deployer is its owner\n" | ||
| # The backend makes the creator of a job its owner. The testserver does not record that, so set | ||
| # it there; on a real workspace the ACL is left as the deploy made it. | ||
| if [ -z "$(print_acl jobs $job_id)" ]; then |
There was a problem hiding this comment.
[nice to have] Locally the ACL is empty, so this branch writes IS_OWNER for the SP itself. The local run therefore sets the ACL in a test titled "Nobody changes the job's ACL", and the cloud run takes a different path to the same golden. testing.md asks to model API behavior in libs/testserver/, and the new jobOwner() already treats the creator as owner. Could GetPermissions for jobs report that creator as IS_OWNER so this branch can go, or does that change too many other goldens for this PR?
|
|
||
| // jobOwner returns the principal with IS_OWNER in a job's ACL or, while no owner was set | ||
| // explicitly, the job's creator. Call with s.mu held. | ||
| func (s *FakeWorkspace) jobOwner(jobId int64) string { |
There was a problem hiding this comment.
[nice to have] jobOwner repeats the rule guestHasJobAccess already applies: the creator is the owner only while the ACL names no IS_OWNER. If one copy changes, the access check and the new owner-change check will disagree. guestHasJobAccess could be written as hasAccess || s.jobOwner(jobId) == principal, which is equivalent because an explicit owner always has a direct entry. Could we do that so the fallback lives in one place?
| } | ||
|
|
||
| // Only a workspace admin can change the owner of a job (verified against the backend). The | ||
| // primary identity is treated as an admin; an as-test-sp guest that is not the owner is not. |
There was a problem hiding this comment.
[nit] "an as-test-sp guest that is not the owner is not" reads as if a guest that owns the job counts as an admin. The code does let such a guest hand ownership to anyone, but the PR description says that case wasn't checked against the backend. Could the comment say so, e.g. "A guest that owns the job may pass ownership on; whether the backend allows that is not modeled"?
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
| @@ -0,0 +1 @@ | |||
| Badness = "A permissions block is added to the config by an identity other than the deployer and synced before it is deployed. config-remote-sync adds the deployer's IS_OWNER to the block and removes the new entry, but leaves out the syncing identity's own CAN_MANAGE, so the deployer's next deploy revokes it." | |||
There was a problem hiding this comment.
[AI Generated] nit: Dropping the hand-added CAN_VIEW users entry also happens with a single identity, as TestAddUndeployedPermissionsChanges expects. Can the Badness leave that out, or say that part isn't identity-specific?
Changes
Nine acceptance tests that record what
bundle config-remote-syncdoes with permissions today when the identity that runs it is not the one that deploys, and when the synced config is deployed to another target. No production code changes; one rule is added to the testserver (below).Since #7536, the sync imports the whole remote ACL of a deployed resource that declares no permissions, and leaves the syncing identity's own
IS_OWNER/CAN_MANAGEout, because deploy adds an entry for the deploying identity. That holds when the same identity syncs and deploys. In these tests a service principal deploys (as a CI pipeline would) and another identity syncs the same deployment.other_identity/can_manageCAN_MANAGEon the job. The sync writespermissions:without it, and the service principal's next deploy revokes it.other_identity/syncer_homeroot_pathin the author's home, deployed by CI). Local only.other_identity/experimentcan_managefor a resource type withoutIS_OWNER.other_identity/ownerCAN_MANAGE, so its next deploy asks for the ownership back. That deploy fails with 403only workspace admins can change the owner of a job; a deployer who is an admin would become the owner again.other_identity/no_grantsIS_OWNERinto the config; the next deploy starts managing the job's ACL.other_identity/declaredIS_OWNERto the block. A grant made to the syncing identity itself is reported as no change, and the next deploy revokes it.other_identity/undeployedIS_OWNERbut not the syncing identity's ownCAN_MANAGE, and the next deploy revokes it.other_identity/handoverowner. Marked# Undefined.other_target# Undefined.The first seven carry a
Badnessnote. The last two record behavior that is not decided either way.Testserver: a permissions update by the
as-test-spguest that changes the owner of a job it does not own now fails with the backend's 403... only workspace admins can change the owner of a job .... The first cloud run ofownerandhandovershowed that error where the testserver had accepted the change.Why
A job, pipeline or other resource that declares no permissions used to keep whatever ACL it had: deploy did not touch it. After a sync writes a
permissions:block, every later deploy replaces the ACL with that block. When the block was written from another identity's point of view, the deploy removes a grant that nobody meant to remove, or fails. On the commit before #7536 the scripts for the unmanaged cases end with the grant and the owner unchanged.These tests are evidence for deciding what to do about it. They are useful whichever way that goes.
Tests
The nine tests above; all but
syncer_homeareCloud = true. In this PR's first cloud runcan_manage,experiment,no_grants,declaredandother_targetpassed on AWS and GCP with the goldens recorded against the testserver (other_targetalso on Azure).ownerandhandoverfailed there with the 403 above; their goldens now record it and the testserver returns it. The wholebundleacceptance suite passes with the testserver change, with no other golden changed.Gaps and risks
other_identitytests assume, asresources/permissions/jobs/destroy_without_mgmtpermsdoes, that the test's main identity is a workspace admin and the test service principal is not. They need that service principal, so they do not run on Azure.no_grantssets that ACL there; on a real workspace the ACL is left as the deploy made it.🤖 AI agent (fable5.2, isaac_claude)
This pull request and its description were written by Isaac.