From 7a8b2cbcbb2c13bebbc7d31b1b7687066a3ae2af Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Thu, 20 Aug 2026 11:22:52 +0200 Subject: [PATCH 1/3] Remove dashboards from list of objects skipped on workspace export-dir --- cmd/workspace/workspace/export_dir.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/workspace/workspace/export_dir.go b/cmd/workspace/workspace/export_dir.go index 77056f4d28c..362b6e4e30b 100644 --- a/cmd/workspace/workspace/export_dir.go +++ b/cmd/workspace/workspace/export_dir.go @@ -57,7 +57,6 @@ func isFileSizeError(err error) bool { // These will be skipped with a warning during export-dir. var nonExportableTypes = []workspace.ObjectType{ workspace.ObjectTypeLibrary, - workspace.ObjectTypeDashboard, workspace.ObjectTypeRepo, // MLFLOW_EXPERIMENT is not defined as a constant in the SDK workspace.ObjectType("MLFLOW_EXPERIMENT"), From 97536f0a424aa887fd532fcfb9841e19fca8cf5b Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Thu, 20 Aug 2026 11:24:41 +0200 Subject: [PATCH 2/3] Add cloud acceptance test for dashboards as part of export-dir --- .../dashboard.lvdash.json | 11 ++++++++ .../export-dir-dashboard/out.test.toml | 3 ++ .../workspace/export-dir-dashboard/output.txt | 9 ++++++ .../cmd/workspace/export-dir-dashboard/script | 28 +++++++++++++++++++ .../workspace/export-dir-dashboard/test.toml | 10 +++++++ 5 files changed, 61 insertions(+) create mode 100644 acceptance/cmd/workspace/export-dir-dashboard/dashboard.lvdash.json create mode 100644 acceptance/cmd/workspace/export-dir-dashboard/out.test.toml create mode 100644 acceptance/cmd/workspace/export-dir-dashboard/output.txt create mode 100644 acceptance/cmd/workspace/export-dir-dashboard/script create mode 100644 acceptance/cmd/workspace/export-dir-dashboard/test.toml diff --git a/acceptance/cmd/workspace/export-dir-dashboard/dashboard.lvdash.json b/acceptance/cmd/workspace/export-dir-dashboard/dashboard.lvdash.json new file mode 100644 index 00000000000..0a39c4a05c7 --- /dev/null +++ b/acceptance/cmd/workspace/export-dir-dashboard/dashboard.lvdash.json @@ -0,0 +1,11 @@ +{ + "pages": [ + { + "name": "main", + "displayName": "Main", + "pageType": "PAGE_TYPE_CANVAS", + "layoutVersion": "GRID_V1", + "layout": [] + } + ] +} diff --git a/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml b/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml new file mode 100644 index 00000000000..764efe08700 --- /dev/null +++ b/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml @@ -0,0 +1,3 @@ +Cloud = true +RequiresWarehouse = true +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/cmd/workspace/export-dir-dashboard/output.txt b/acceptance/cmd/workspace/export-dir-dashboard/output.txt new file mode 100644 index 00000000000..c31d2b55df0 --- /dev/null +++ b/acceptance/cmd/workspace/export-dir-dashboard/output.txt @@ -0,0 +1,9 @@ + +>>> [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/export-dir-dashboard-[UNIQUE_NAME] + +>>> [CLI] workspace export-dir /Workspace/Users/[USERNAME]/export-dir-dashboard-[UNIQUE_NAME] [TEST_TMP_DIR]/export +Exporting files from /Workspace/Users/[USERNAME]/export-dir-dashboard-[UNIQUE_NAME] +/Workspace/Users/[USERNAME]/export-dir-dashboard-[UNIQUE_NAME]/export-dir-dashboard-[UNIQUE_NAME].lvdash.json -> [TEST_TMP_DIR]/export/export-dir-dashboard-[UNIQUE_NAME].lvdash.json +Export complete + +>>> diff.py [TEST_TMP_DIR]/expected.json [TEST_TMP_DIR]/exported.json diff --git a/acceptance/cmd/workspace/export-dir-dashboard/script b/acceptance/cmd/workspace/export-dir-dashboard/script new file mode 100644 index 00000000000..2bfddc0bb90 --- /dev/null +++ b/acceptance/cmd/workspace/export-dir-dashboard/script @@ -0,0 +1,28 @@ +DASHBOARD_NAME="export-dir-dashboard-$UNIQUE_NAME" +DASHBOARD_DIR="/Workspace/Users/$CURRENT_USER_NAME/export-dir-dashboard-$UNIQUE_NAME" +dashboard_id="" + +cleanup() { + if [ -n "$dashboard_id" ]; then + $CLI lakeview trash "$dashboard_id" >> LOG.cleanup 2>&1 || true + fi + $CLI workspace delete "$DASHBOARD_DIR" --recursive >> LOG.cleanup 2>&1 || true +} +trap cleanup EXIT + +trace $CLI workspace mkdirs "$DASHBOARD_DIR" + +dashboard_id=$($CLI lakeview create \ + --display-name "$DASHBOARD_NAME" \ + --warehouse-id "$TEST_DEFAULT_WAREHOUSE_ID" \ + --serialized-dashboard "$(cat dashboard.lvdash.json)" \ + --json "{\"parent_path\": \"$DASHBOARD_DIR\"}" \ + -o json | jq -r '.dashboard_id') +add_repl "$dashboard_id" DASHBOARD_ID + +mkdir -p "$TEST_TMP_DIR/export" +trace $CLI workspace export-dir "$DASHBOARD_DIR" "$TEST_TMP_DIR/export" + +jq -S . dashboard.lvdash.json > "$TEST_TMP_DIR/expected.json" +jq -S . "$TEST_TMP_DIR/export/$DASHBOARD_NAME.lvdash.json" > "$TEST_TMP_DIR/exported.json" +trace diff.py "$TEST_TMP_DIR/expected.json" "$TEST_TMP_DIR/exported.json" diff --git a/acceptance/cmd/workspace/export-dir-dashboard/test.toml b/acceptance/cmd/workspace/export-dir-dashboard/test.toml new file mode 100644 index 00000000000..13bbdc360ad --- /dev/null +++ b/acceptance/cmd/workspace/export-dir-dashboard/test.toml @@ -0,0 +1,10 @@ +Cloud = true +RequiresWarehouse = true + +Env.MSYS_NO_PATHCONV = "1" +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +Ignore = [ + "expected.json", + "export", + "exported.json", +] From c8ab5fdbac50e1c4b6f1e610e901d8e907e47278 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Thu, 20 Aug 2026 12:11:55 +0200 Subject: [PATCH 3/3] export-dir-dashboard: make cloud test robust to backend normalization The test diffed the exported dashboard against the exact input JSON, but the Lakeview backend normalizes the serialized dashboard on create (e.g. it drops an empty "layout": []). The local testserver echoes the input verbatim, so the test passed locally but failed on every real workspace. Assert the dashboard file was exported instead of diffing its content. This is what the change under test actually verifies (dashboards are no longer skipped by export-dir). Dropping the diff also removes the diff.py call that MSYS_NO_PATHCONV broke on Windows. Gate the test off Windows: export-dir prints the local destination with OS-native separators, which is incidental to the OS-independent export behavior being tested. Co-authored-by: Isaac --- .../cmd/workspace/export-dir-dashboard/out.test.toml | 1 + acceptance/cmd/workspace/export-dir-dashboard/output.txt | 2 +- acceptance/cmd/workspace/export-dir-dashboard/script | 7 ++++--- acceptance/cmd/workspace/export-dir-dashboard/test.toml | 8 +++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml b/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml index 764efe08700..bc1000590f3 100644 --- a/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml +++ b/acceptance/cmd/workspace/export-dir-dashboard/out.test.toml @@ -1,3 +1,4 @@ Cloud = true RequiresWarehouse = true +GOOS.windows = false EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/cmd/workspace/export-dir-dashboard/output.txt b/acceptance/cmd/workspace/export-dir-dashboard/output.txt index c31d2b55df0..21c8b788853 100644 --- a/acceptance/cmd/workspace/export-dir-dashboard/output.txt +++ b/acceptance/cmd/workspace/export-dir-dashboard/output.txt @@ -6,4 +6,4 @@ Exporting files from /Workspace/Users/[USERNAME]/export-dir-dashboard-[UNIQUE_NA /Workspace/Users/[USERNAME]/export-dir-dashboard-[UNIQUE_NAME]/export-dir-dashboard-[UNIQUE_NAME].lvdash.json -> [TEST_TMP_DIR]/export/export-dir-dashboard-[UNIQUE_NAME].lvdash.json Export complete ->>> diff.py [TEST_TMP_DIR]/expected.json [TEST_TMP_DIR]/exported.json +>>> assert_exists.py [TEST_TMP_DIR]/export/export-dir-dashboard-[UNIQUE_NAME].lvdash.json diff --git a/acceptance/cmd/workspace/export-dir-dashboard/script b/acceptance/cmd/workspace/export-dir-dashboard/script index 2bfddc0bb90..febb56173c4 100644 --- a/acceptance/cmd/workspace/export-dir-dashboard/script +++ b/acceptance/cmd/workspace/export-dir-dashboard/script @@ -23,6 +23,7 @@ add_repl "$dashboard_id" DASHBOARD_ID mkdir -p "$TEST_TMP_DIR/export" trace $CLI workspace export-dir "$DASHBOARD_DIR" "$TEST_TMP_DIR/export" -jq -S . dashboard.lvdash.json > "$TEST_TMP_DIR/expected.json" -jq -S . "$TEST_TMP_DIR/export/$DASHBOARD_NAME.lvdash.json" > "$TEST_TMP_DIR/exported.json" -trace diff.py "$TEST_TMP_DIR/expected.json" "$TEST_TMP_DIR/exported.json" +# The Lakeview backend normalizes the serialized dashboard on create (e.g. it +# drops an empty "layout": []), so the exported content is not byte-identical to +# the input. Assert the dashboard was exported rather than diffing the content. +trace assert_exists.py "$TEST_TMP_DIR/export/$DASHBOARD_NAME.lvdash.json" diff --git a/acceptance/cmd/workspace/export-dir-dashboard/test.toml b/acceptance/cmd/workspace/export-dir-dashboard/test.toml index 13bbdc360ad..53f632d9741 100644 --- a/acceptance/cmd/workspace/export-dir-dashboard/test.toml +++ b/acceptance/cmd/workspace/export-dir-dashboard/test.toml @@ -1,10 +1,12 @@ Cloud = true RequiresWarehouse = true -Env.MSYS_NO_PATHCONV = "1" +# export-dir prints the local destination with OS-native separators, so the +# output diverges on Windows. The exported-dashboard behavior is OS-independent, +# so cover it on Linux/macOS only. +GOOS.windows = false + EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] Ignore = [ - "expected.json", "export", - "exported.json", ]