From 23aa2a734ed4c70e3cf13773a73592ee1bbe4e21 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 3 Mar 2026 13:04:34 +0100 Subject: [PATCH 1/2] Fix dashboard tests for Lakeview API behavior change The server-side Lakeview API changed behavior in two ways: 1. `lakeview update` now returns the full `serialized_dashboard` in its response, even when the update only changed other fields (e.g. `display_name`). Previously it returned "{}". 2. `lakeview update` now clears fields not included in the request (e.g. `warehouse_id`). Previously unspecified fields were preserved. Both changes are consistent with a move from partial update (merge) to full replace semantics on the Lakeview API's mutable fields. Update acceptance tests, testserver, and integration test to match. Co-Authored-By: Claude Opus 4.6 --- .../detect-change/out.patch.requests.direct.txt | 3 ++- .../detect-change/out.patch.requests.terraform.txt | 3 ++- .../bundle/resources/dashboards/detect-change/script | 2 +- .../resources/dashboards/generate_inplace/output.txt | 10 ++++++++-- integration/assumptions/dashboard_assumptions_test.go | 10 ++++++++-- libs/testserver/dashboards.go | 4 +--- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.direct.txt b/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.direct.txt index 3eacc58a6c..dbd639d9cf 100644 --- a/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.direct.txt +++ b/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.direct.txt @@ -2,7 +2,8 @@ "method": "PATCH", "path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]", "body": { - "serialized_dashboard": "{}" + "serialized_dashboard": "{}", + "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" } } { diff --git a/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.terraform.txt b/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.terraform.txt index c9bd2149cb..65c491ab30 100644 --- a/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.terraform.txt +++ b/acceptance/bundle/resources/dashboards/detect-change/out.patch.requests.terraform.txt @@ -2,7 +2,8 @@ "method": "PATCH", "path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]", "body": { - "serialized_dashboard": "{}" + "serialized_dashboard": "{}", + "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" } } { diff --git a/acceptance/bundle/resources/dashboards/detect-change/script b/acceptance/bundle/resources/dashboards/detect-change/script index 773ca7041c..ccf2614230 100644 --- a/acceptance/bundle/resources/dashboards/detect-change/script +++ b/acceptance/bundle/resources/dashboards/detect-change/script @@ -29,7 +29,7 @@ $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name,page_display_name: (.ser title "Make an out of band modification to the dashboard and confirm that it is detected:\n" RESOURCE_ID=$($CLI workspace get-status "${DASHBOARD_PATH}" | jq -r '.resource_id') -DASHBOARD_JSON='{"serialized_dashboard": "{}"}' +DASHBOARD_JSON="{\"serialized_dashboard\": \"{}\", \"warehouse_id\": \"$TEST_DEFAULT_WAREHOUSE_ID\"}" $CLI lakeview update "${RESOURCE_ID}" --json "${DASHBOARD_JSON}" | jq '{lifecycle_state}' title "Try to redeploy the bundle and confirm that the out of band modification is detected:" diff --git a/acceptance/bundle/resources/dashboards/generate_inplace/output.txt b/acceptance/bundle/resources/dashboards/generate_inplace/output.txt index 6c37f56723..1e38d3d5a1 100644 --- a/acceptance/bundle/resources/dashboards/generate_inplace/output.txt +++ b/acceptance/bundle/resources/dashboards/generate_inplace/output.txt @@ -9,7 +9,7 @@ Deployment complete! "{\n \"uiSettings\": {\n \"theme\": {\n \"widgetHeaderAlignment\": \"ALIGNMENT_UNSPECIFIED\"\n }\n }\n}\n" === Update dashboard -"{}\n" +"{\n \"uiSettings\": {\n \"theme\": {\n \"widgetHeaderAlignment\": \"ALIGNMENT_UNSPECIFIED\"\n }\n }\n}\n" >>> [CLI] bundle generate dashboard --resource already_exists Error: dashboard.lvdash.json already exists. Use --force to overwrite @@ -30,7 +30,13 @@ Exit code: 1 Writing dashboard to dashboard.lvdash.json >>> cat dashboard.lvdash.json -{} +{ + "uiSettings": { + "theme": { + "widgetHeaderAlignment": "ALIGNMENT_UNSPECIFIED" + } + } +} >>> [CLI] bundle destroy --auto-approve The following resources will be deleted: diff --git a/integration/assumptions/dashboard_assumptions_test.go b/integration/assumptions/dashboard_assumptions_test.go index b55d14b9c3..ed4cb04898 100644 --- a/integration/assumptions/dashboard_assumptions_test.go +++ b/integration/assumptions/dashboard_assumptions_test.go @@ -88,11 +88,12 @@ func TestDashboardAssumptions_WorkspaceImport(t *testing.T) { current, err := convert.FromTyped(currentDashboard, dyn.NilValue) require.NoError(t, err) - // Collect updated paths. + // Collect updated and deleted paths. var updatedFieldPaths []string + var deletedFieldPaths []string _, err = merge.Override(previous, current, merge.OverrideVisitor{ VisitDelete: func(basePath dyn.Path, left dyn.Value) error { - assert.Fail(t, "unexpected delete operation") + deletedFieldPaths = append(deletedFieldPaths, basePath.String()) return nil }, VisitInsert: func(basePath dyn.Path, right dyn.Value) (dyn.Value, error) { @@ -111,5 +112,10 @@ func TestDashboardAssumptions_WorkspaceImport(t *testing.T) { "etag", "update_time", }, updatedFieldPaths) + + // The warehouse_id field is cleared after workspace import. + assert.ElementsMatch(t, []string{ + "warehouse_id", + }, deletedFieldPaths) } } diff --git a/libs/testserver/dashboards.go b/libs/testserver/dashboards.go index b68b8a4685..eab45bdbdc 100644 --- a/libs/testserver/dashboards.go +++ b/libs/testserver/dashboards.go @@ -198,9 +198,7 @@ func (s *FakeWorkspace) DashboardUpdate(req Request) Response { datasetSchema := req.URL.Query().Get("dataset_schema") dashboard.SerializedDashboard = transformSerializedDashboard(updateReq.SerializedDashboard, datasetCatalog, datasetSchema) } - if updateReq.WarehouseId != "" { - dashboard.WarehouseId = updateReq.WarehouseId - } + dashboard.WarehouseId = updateReq.WarehouseId dashboard.UpdateTime = time.Now().UTC().Format(time.RFC3339) s.Dashboards[dashboardId] = dashboard From dfe4e88589af07870f0e8f24214ad8c9e29fb1eb Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Tue, 3 Mar 2026 13:31:08 +0100 Subject: [PATCH 2/2] Update dashboard-inplace test fixture for warehouse_id clearing The testserver's DashboardUpdate now clears warehouse_id when not provided in the update request, matching the new Lakeview API behavior. Update expected output accordingly. Co-Authored-By: Claude Opus 4.6 --- acceptance/bundle/generate/dashboard-inplace/output.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/bundle/generate/dashboard-inplace/output.txt b/acceptance/bundle/generate/dashboard-inplace/output.txt index c1688d6724..cb2027af91 100644 --- a/acceptance/bundle/generate/dashboard-inplace/output.txt +++ b/acceptance/bundle/generate/dashboard-inplace/output.txt @@ -21,7 +21,7 @@ Deployment complete! "path":"/Users/[USERNAME]/.bundle/dashboard update inplace/default/resources/test dashboard.lvdash.json", "serialized_dashboard":"{\"a\":\"b\"}\n", "update_time":"[TIMESTAMP]", - "warehouse_id":"my-warehouse-1234" + "warehouse_id":"" } === update the dashboard file using bundle generate