Skip to content

Commit 629df6a

Browse files
denikIsaac
andauthored
testserver: use 16-digit workspace object ids to fix flaky id replacements (#7253)
## Changes The testserver now gives workspace objects 16-digit ids (`4000000000000000` + counter) instead of `1000` + counter. ## Why Scripts register these ids as literal replacements (`add_repl "$id" DEPLOYMENT_ID`), and user replacements are applied before the harness's patterns. A 4-digit id also matched inside other numbers in the output and cut them up — timestamps (no longer matching `[UNIX_TIME_NANOS]`), lineage UUIDs, `resource_id`s, ports, `cli_version` hashes: ``` - "whl": ".../my_default_python-0.0.1+[UNIX_TIME_NANOS][0]-py3-none-any.whl" + "whl": ".../my_default_python-0.0.1+1[PROD_ROOT_DIR_ID]23385490265124-py3-none-any.whl" ``` Fixing it at the source covers every test that registers a tree-node id, rather than anchoring each script's replacement. 16 digits matches real workspace object ids; a leading 4 never matches the `1[78]...` timestamp patterns, and a specific 16-digit run practically never occurs inside a UUID chunk or a timestamp. Dashboard errors from local runs, Oct 1 – Nov 2 ([default-python/classic](http://go/cli/dashboard/test/acceptance.TestAccept/bundle/templates/default-python/classic/DMS=/READPLAN=1?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) and `bundle/dms/*`). Each snippet is the first changed line with the id cut into another value: | Error | Test | Snippet | Why the 16-digit id fixes it | |---|---|---|---| | [1307](http://go/cli/dashboard/error/1307?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (macos) | `+ "cli_version": "[CLI_VERSION]+1[PROD_ROOT_DIR_ID]9783df6",` | inside a run shorter than 16 chars | | [1313](http://go/cli/dashboard/error/1313?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ "created_time": 1[PROD_ROOT_DIR_ID]42371540,` | inside a run shorter than 16 chars | | [1314](http://go/cli/dashboard/error/1314?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (linux) | `+ "created_time": 179266[PROD_ROOT_DIR_ID]051,` | inside a run shorter than 16 chars | | [1315](http://go/cli/dashboard/error/1315?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (linux) | `+ "created_time": 1792130[PROD_ROOT_DIR_ID]45,` | inside a run shorter than 16 chars | | [1316](http://go/cli/dashboard/error/1316?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (windows) | `+ "created_time": 179242[PROD_ROOT_DIR_ID]583,` | inside a run shorter than 16 chars | | [1317](http://go/cli/dashboard/error/1317?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (windows) | `+ "created_time": [PROD_ROOT_DIR_ID]766033611,` | inside a run shorter than 16 chars | | [1353](http://go/cli/dashboard/error/1353?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (linux) | `+ "nuid": "5ch3m4-w1dg-3t98-7654-3210[PROD_ROOT_DIR_ID]5432",` | inside a run shorter than 16 chars | | [1354](http://go/cli/dashboard/error/1354?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (linux) | `+ "nuid": "5ch3m4-w1dg-3t98-7654-32[PROD_ROOT_DIR_ID]765432",` | inside a run shorter than 16 chars | | [1355](http://go/cli/dashboard/error/1355?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (linux) | `+ "nuid": "5ch3m4-w1dg-3t98-7654-3210987[PROD_ROOT_DIR_ID]2",` | inside a run shorter than 16 chars | | [1392](http://go/cli/dashboard/error/1392?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (linux) | `Unexpected output "rowLimit": [PROD_ROOT_DIR_ID]` | whole value equals the 4-digit id | | [1079](http://go/cli/dashboard/error/1079?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (linux) | `+ Note that http://127.0.0.1:[PROD_ROOT_DIR_ID]5 is used for initialization.` | inside a run shorter than 16 chars | | [2182](http://go/cli/dashboard/error/2182?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (macos) | `+ uuid: 7[PROD_ROOT_DIR_ID]faf-1ebc-4fb9-8a70-33338ab9a01d` | inside a run shorter than 16 chars | | [2200](http://go/cli/dashboard/error/2200?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ "lineage": "a68d3430-dc71-[PROD_ROOT_DIR_ID]-9991-be16930f9243",` | inside a run shorter than 16 chars | | [2522](http://go/cli/dashboard/error/2522?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ "lineage": "5b11bdde-a8c2-4a02-93d4-c39232[PROD_ROOT_DIR_ID]77",` | inside a run shorter than 16 chars | | [2528](http://go/cli/dashboard/error/2528?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=` (linux) | `+ "cli_version": "[CLI_VERSION]+[PROD_ROOT_DIR_ID]44069a29",` | inside a run shorter than 16 chars | | [2592](http://go/cli/dashboard/error/2592?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ "lineage": "bf681176-596e-43aa-9c1e-7e39a9d6[PROD_ROOT_DIR_ID]",` | inside a run shorter than 16 chars | | [3036](http://go/cli/dashboard/error/3036?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ "last_modified": 17933761[PROD_ROOT_DIR_ID]6,` | inside a run shorter than 16 chars | | [3066](http://go/cli/dashboard/error/3066?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ Note that http://127.0.0.1:[PROD_ROOT_DIR_ID]8 is used for initialization.` | inside a run shorter than 16 chars | | [3070](http://go/cli/dashboard/error/3070?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/templates/default-python/classic/DMS=/READPLAN=1` (macos) | `+ uuid: 33c2e4b1-1077-[PROD_ROOT_DIR_ID]-b7ea-7c2055eae54a` | inside a run shorter than 16 chars | | [93](http://go/cli/dashboard/error/93?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/record-failure/DMS=true` (linux) | `+ Endpoint: POST http://127.0.0.1:[DEPLOYMENT_ID]1/api/2.2/jobs/create` | inside a run shorter than 16 chars | | [1340](http://go/cli/dashboard/error/1340?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/successful-recreate/DMS=true` (linux) | `+ "lineage": "8037e727-4e27-4cc4-8636-c1c8[DEPLOYMENT_ID]d21",` | inside a run shorter than 16 chars | | [1386](http://go/cli/dashboard/error/1386?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/depends-on/DMS=true` (macos) | `+ "resource_id": "879[DEPLOYMENT_ID]41474890000",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | | [1388](http://go/cli/dashboard/error/1388?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/depends-on/DMS=true` (linux) | `+ "resource_id": "879204843836[DEPLOYMENT_ID]941",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | | [2042](http://go/cli/dashboard/error/2042?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/no-drift/DMS=true` (macos) | `+ "cli_version": "[CLI_VERSION]+e3a74b[DEPLOYMENT_ID]02",` | inside a run shorter than 16 chars | | [2154](http://go/cli/dashboard/error/2154?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/stale-plan/DMS=true/READPLAN=1` (windows) | `+ "resource_id": "8791993254222[DEPLOYMENT_ID]00",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | | [2155](http://go/cli/dashboard/error/2155?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/stale-plan/DMS=true/READPLAN=` (macos) | `+ "resource_id": "87924034[DEPLOYMENT_ID]1413000",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | | [2245](http://go/cli/dashboard/error/2245?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/stale-plan/DMS=true/READPLAN=` (windows) | `+ "__id__": "87930[DEPLOYMENT_ID]7322207800",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | | [3018](http://go/cli/dashboard/error/3018?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/failed-delete/DMS=true` (linux) | `+ "resource_id": "8793[DEPLOYMENT_ID]0179872414",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | | [3077](http://go/cli/dashboard/error/3077?main=1&pr=1&end=2026-11-03T00:00:00Z&last=33d) | `bundle/dms/depends-on/DMS=true` (linux) | `+ "resource_id": "8793612[DEPLOYMENT_ID]22543488",` | inside a 19-digit testserver id; would need it to contain `4000000000000…` | ## Tests Regenerated the whole local acceptance suite with `-update`: no golden output changes (every printed id is already replaced). All unit-test packages that use the testserver pass. This pull request and its description were written by Isaac. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 88152b3 commit 629df6a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎libs/testserver/fake_workspace.go‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ var (
103103
workspaceID atomic.Int64
104104
)
105105

106-
// nextTreenodeID starts above common version numbers and counts, which scripts
107-
// can otherwise mask when registering literal ID replacements.
106+
// nextTreenodeID returns 16-digit ids, like real workspace object ids. Scripts register them as
107+
// literal replacements, which apply before the harness's patterns; a short id would also match
108+
// inside other numbers in the output (timestamps, UUIDs, ports) and cut them up. A 16-digit id
109+
// starting with 4 practically never occurs inside those, and never looks like a timestamp.
108110
func nextTreenodeID() int64 {
109-
return 1000 + workspaceID.Add(1)
111+
return 4_000_000_000_000_000 + workspaceID.Add(1)
110112
}
111113

112114
// IDs are prefixed with 7 and padded to avoid matching regex 1[78]\d{14}

0 commit comments

Comments
 (0)