Skip to content

Commit 44f2eda

Browse files
denikIsaac
andauthored
acc: match PROD_ROOT_DIR_ID with a regex in default-python/classic (#7324)
## Changes `bundle/templates/default-python/classic` looked up the prod root directory's object id with `workspace get-status` and registered it as a literal replacement (`add_repl`). It used python because jq 1.6 rounds ids above 2^53. Replace this with a `[[Repls]]` regex on `/permissions/directories/<id>`, the only place the id appears. ## Why A literal replacement rewrites the id's digits wherever they appear in the output: inside timestamps, UUIDs, ports and wheel versions. Every failure of this test on the dashboard in the last 3 weeks is that collision: 23 errors across both variants. [#7253](#7253) made such collisions practically impossible by giving testserver ids 16 digits. This PR removes the literal entirely, so the replacement can only ever match the permissions path. It also drops an extra API call and the python workaround from the script. Dashboard tests: [classic/DMS=/READPLAN=](http://go/cli/dashboard/test/13727?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d), [classic/DMS=/READPLAN=1](http://go/cli/dashboard/test/13774?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | Error | Verbatim snippet (`+` side of the diff) | |---|---| | [1079](http://go/cli/dashboard/error/1079?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `Note that http://127.0.0.1:[PROD_ROOT_DIR_ID]5 is used for initialization.` | | [1307](http://go/cli/dashboard/error/1307?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"cli_version": "[CLI_VERSION]+1[PROD_ROOT_DIR_ID]9783df6",` | | [1313](http://go/cli/dashboard/error/1313?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"created_time": 1[PROD_ROOT_DIR_ID]42371540,` | | [1314](http://go/cli/dashboard/error/1314?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"created_time": 179266[PROD_ROOT_DIR_ID]051,` | | [1315](http://go/cli/dashboard/error/1315?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"created_time": 1792130[PROD_ROOT_DIR_ID]45,` | | [1316](http://go/cli/dashboard/error/1316?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"created_time": 179242[PROD_ROOT_DIR_ID]583,` | | [1317](http://go/cli/dashboard/error/1317?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"created_time": [PROD_ROOT_DIR_ID]766033611,` | | [1353](http://go/cli/dashboard/error/1353?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"nuid": "5ch3m4-w1dg-3t98-7654-3210[PROD_ROOT_DIR_ID]5432",` | | [1354](http://go/cli/dashboard/error/1354?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"nuid": "5ch3m4-w1dg-3t98-7654-32[PROD_ROOT_DIR_ID]765432",` | | [1355](http://go/cli/dashboard/error/1355?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"nuid": "5ch3m4-w1dg-3t98-7654-3210987[PROD_ROOT_DIR_ID]2",` | | [1392](http://go/cli/dashboard/error/1392?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"rowLimit": [PROD_ROOT_DIR_ID]` | | [1411](http://go/cli/dashboard/error/1411?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"whl": "/Workspace/Users/[USERNAME]/.bundle/my_default_python/dev/artifacts/.internal/my_default_python-0.0.1+179341154774253[PROD_ROOT_DIR_ID]-py3-none-any.whl"` | | [2009](http://go/cli/dashboard/error/2009?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"nuid": "a1b2c3d4-e5f6-[PROD_ROOT_DIR_ID]-abcd-ef123456[PROD_ROOT_DIR_ID]",` | | [2182](http://go/cli/dashboard/error/2182?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `uuid: 7[PROD_ROOT_DIR_ID]faf-1ebc-4fb9-8a70-33338ab9a01d` | | [2200](http://go/cli/dashboard/error/2200?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"lineage": "a68d3430-dc71-[PROD_ROOT_DIR_ID]-9991-be16930f9243",` | | [2522](http://go/cli/dashboard/error/2522?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"lineage": "5b11bdde-a8c2-4a02-93d4-c39232[PROD_ROOT_DIR_ID]77",` | | [2528](http://go/cli/dashboard/error/2528?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"cli_version": "[CLI_VERSION]+[PROD_ROOT_DIR_ID]44069a29",` | | [2592](http://go/cli/dashboard/error/2592?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"lineage": "bf681176-596e-43aa-9c1e-7e39a9d6[PROD_ROOT_DIR_ID]",` | | [2980](http://go/cli/dashboard/error/2980?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"whl": "/Workspace/Users/[USERNAME]/.bundle/my_default_python/dev/artifacts/.internal/my_default_python-0.0.1+179301174[PROD_ROOT_DIR_ID]197650-py3-none-any.whl"` | | [2981](http://go/cli/dashboard/error/2981?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"whl": "/Workspace/Users/[USERNAME]/.bundle/my_default_python/dev/artifacts/.internal/my_default_python-0.0.1+1792057[PROD_ROOT_DIR_ID]4053359-py3-none-any.whl"` | | [3036](http://go/cli/dashboard/error/3036?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `"last_modified": 17933761[PROD_ROOT_DIR_ID]6,` | | [3066](http://go/cli/dashboard/error/3066?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `Note that http://127.0.0.1:[PROD_ROOT_DIR_ID]8 is used for initialization.` | | [3070](http://go/cli/dashboard/error/3070?main=1&pr=1&end=2026-11-03T13:00:00Z&last=21d) | `uuid: 33c2e4b1-1077-[PROD_ROOT_DIR_ID]-b7ea-7c2055eae54a` | ## Tests `go test ./acceptance -run TestAccept/bundle/templates/default-python/classic -update` produces no golden changes. This pull request and its description were written by Isaac. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent bab9198 commit 44f2eda

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎acceptance/bundle/templates/default-python/classic/script‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ trace $CLI bundle plan -t dev -o json | nostamp > ../../out.plan_after_deploy_de
2121
$CLI bundle deploy -t prod $(readplanarg ../../out.plan_prod.json) 2>&1 | grep -vE '^Building python_artifact|^Uploading dist'
2222
print_requests.py --sort '^//import-file/' '^//telemetry-ext' > ../../out.requests.prod.txt
2323
read_id.py -t prod sample_job > /dev/null
24-
# Extracted with python, not jq: the id exceeds 2^53 and jq 1.6 rounds it.
25-
root_dir_id=$(MSYS_NO_PATHCONV=1 $CLI workspace get-status "/Workspace/Users/${CURRENT_USER_NAME}/.bundle/my_default_python/prod" -o json | python3 -c 'import sys, json; print(json.load(sys.stdin)["object_id"])')
26-
add_repl "$root_dir_id" PROD_ROOT_DIR_ID
2724
trace $CLI bundle plan -t prod # check if there is drift
2825
trace $CLI bundle plan -t prod -o json | nostamp > ../../out.plan_after_deploy_prod.json
2926

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
Phase = 1
22
RecordRequests = true
33
EnvMatrix.READPLAN = ["", "1"]
4+
5+
[[Repls]]
6+
# The prod deploy sets permissions on its root directory, addressed by workspace object id.
7+
Old = '/permissions/directories/\d+'
8+
New = '/permissions/directories/[PROD_ROOT_DIR_ID]'

0 commit comments

Comments
 (0)