Skip to content

direct: retry the dashboard publish after create on transient errors - #8170

Open
denik wants to merge 8 commits into
mainfrom
denik/dashboard-publish-retry
Open

denik wants to merge 8 commits into
mainfrom
denik/dashboard-publish-retry

Conversation

@denik

@denik denik commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Changes

When the publish request that follows a dashboard create fails with a transient error (5xx, 408, inactivity timeout), the direct engine now retries it (retry.With(ctx, retry.IsTransient, ...), up to retry.MaxRetries times) instead of trashing the new dashboard and failing the deploy.

DoUpdate and DoDelete are already wrapped in retry.With(ctx, retry.IsTransient, ...) in bundle/direct/apply.go, so the publish inside DoUpdate is already retried. DoCreate is retried only when it marks its error retrySafe, which the dashboard create can't do as a whole, so its publish step had no retry. #7757 recovers a timed-out create request but not a timed-out publish after it.

Publishing the same draft with the same warehouse_id and embed_credentials again is harmless, so a publish that landed despite the error can be repeated.

When the retries give up, the existing cleanup trashes the new dashboard. That trash is now retried on transient errors too, as DoDelete is; a 404 on a retried attempt counts as done (an earlier attempt trashed it), as in libs/retry/filer.go. If the trash still fails, the deploy returns the publish error with the trash error appended.

That retried-delete rule now lives in one helper, retry.Delete in libs/retry, which libs/retry/filer.go and bundle/phases/dms.go also use. Before this PR each had its own copy; behavior is unchanged. A dashboard left behind there is not in state, so every later deploy would fail with 409 ALREADY_EXISTS on its path.

Why

Since #7757 merged on 2026-11-18, both failures of this error on main were on the publish call:

error test verbatim
error/433 bundle/resources/dashboards/unpublish-out-of-band/DMS=true (azure, 2026-11-23) Error: cannot create resources.dashboards.dashboard1: (504 DEADLINE_EXCEEDED) / Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
error/433 bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl/READPLAN= (aws, 2026-11-29) same, on POST .../lakeview/dashboards/[DASHBOARD_ID]/published

Tests

New acceptance test bundle/resources/dashboards/publish_504:

  • one 504 on the publish, before and after the handler runs: the deploy retries the publish with the same warehouse_id and embed_credentials, a follow-up plan shows no changes, and destroy deletes the dashboard. Without the fix both cases fail with the 504 above;
  • every publish attempt fails and the first cleanup trash times out after it was applied: the deploy fails with the publish error, the trash is retried, the plan shows it as to be created, and the next deploy creates it. Without the trash retry the case fails.

bundle/resources/dashboards/publish_failure_trash_404 stubs the trash with a 404 (the testserver answers a repeated trash with 200): a 504 then a 404 counts as done, and a 404 on the first attempt reports both errors.

Dashboard

  • error/433: Error: cannot create resources.dashboards.[NAME]: (504 DEADLINE_EXCEEDED) on POST .../lakeview/dashboards/[DASHBOARD_ID]/published

Gaps and risks

  • The cloud 504 itself can't be reproduced on demand; the fix is checked against the testserver only. The last commit names the two affected tests for the cloud run as a regression check.
  • A deploy whose publish keeps failing now takes up to 2 extra publish attempts and 2 extra trash attempts, each with the standard 15s pause, plus however long each attempt waits for the gateway or the 90s inactivity timeout.
  • A timed-out publish that the backend applies late, after a later deploy changed embed_credentials or warehouse_id, republishes the old values. Before this change the dashboard was trashed instead. The publish inside DoUpdate is already retried the same way, and the next deploy fixes embed_credentials drift.
  • The new dashboard is not in state until the publish succeeds, and that window now includes the retry pauses. A process killed in it leaves the dashboard behind, as a kill between the create and the publish already could.
  • Risk: low.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

@github-actions github-actions Bot added the DABs DABs related issues label Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: ec61a8f80 | Workflow run

Selected 2 changed tests (limit=20, 0 not selected)

8 tests: regression=4 unreleased=0 coverage=4 failing=0
test branch main (9a14ad6) latest (v1.28.0)
TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl/READPLAN= ✅ ✅ ✅
TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl/READPLAN=1 ✅ ✅ ✅
TestAccept/bundle/resources/dashboards/publish_504/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/dashboards/publish_504/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/dashboards/publish_failure_trash_404/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/dashboards/publish_failure_trash_404/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/dashboards/unpublish-out-of-band/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/dashboards/unpublish-out-of-band/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/dashboards/publish_504/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=1625678779/002/output.txt
        @@ -3,59 +3,6 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== The publish after the create times out and the dashboard was not published: deploy repeats the publish
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== Every publish attempt times out and so does the first cleanup: deploy trashes the dashboard and fails
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
         Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
         Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        @@ -65,35 +12,4 @@
         
         Files: 2 uploaded, 0 deleted
         
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -
        ->>> [CLI] bundle plan
        -create dashboards.dashboard1
        -
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
        -=== The next deploy creates the dashboard again
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Created dashboards.dashboard1
        -Files: 0 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        +Exit code: 1
        
    acceptance_test.go:1192: Test produced unexpected files:
        .databricks/.gitignore
        .databricks/bundle/default/deployment.json
        .databricks/bundle/default/released-deploy-locks.json
        .databricks/bundle/default/sync-snapshots/c3462177cdbf009b.json

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=3391674364/002/output.txt
        @@ -3,59 +3,6 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== The publish after the create times out and the dashboard was not published: deploy repeats the publish
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== Every publish attempt times out and so does the first cleanup: deploy trashes the dashboard and fails
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
         Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
         Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        @@ -65,35 +12,4 @@
         
         Files: 2 uploaded, 0 deleted
         
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -
        ->>> [CLI] bundle plan
        -create dashboards.dashboard1
        -
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
        -=== The next deploy creates the dashboard again
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Created dashboards.dashboard1
        -Files: 0 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        +Exit code: 1
        
    acceptance_test.go:1192: Test produced unexpected files:
        .databricks/.gitignore
        .databricks/bundle/default/deployment.json
        .databricks/bundle/default/released-deploy-locks.json
        .databricks/bundle/default/sync-snapshots/b89dd30230ec88ae.json
TestAccept/bundle/resources/dashboards/publish_504/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=true3110250659/002/output.txt
        @@ -3,59 +3,6 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== The publish after the create times out and the dashboard was not published: deploy repeats the publish
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== Every publish attempt times out and so does the first cleanup: deploy trashes the dashboard and fails
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
         Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
         Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        @@ -65,35 +12,4 @@
         
         Files: 2 uploaded, 0 deleted
         
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -
        ->>> [CLI] bundle plan
        -create dashboards.dashboard1
        -
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
        -=== The next deploy creates the dashboard again
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Created dashboards.dashboard1
        -Files: 0 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        +Exit code: 1
        
    acceptance_test.go:1192: Test produced unexpected files:
        .databricks/.gitignore
        .databricks/bundle/default/deployment.json
        .databricks/bundle/default/released-deploy-locks.json
        .databricks/bundle/default/resources.json
        .databricks/bundle/default/sync-snapshots/ea06824ae9f2f538.json

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=true2672226480/002/output.txt
        @@ -3,59 +3,6 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== The publish after the create times out and the dashboard was not published: deploy repeats the publish
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Created dashboards.dashboard1
        -Files: 2 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle plan
        -Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        -
        -=== Every publish attempt times out and so does the first cleanup: deploy trashes the dashboard and fails
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
         Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
         Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        @@ -65,35 +12,4 @@
         
         Files: 2 uploaded, 0 deleted
         
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -
        ->>> [CLI] bundle plan
        -create dashboards.dashboard1
        -
        -Plan: 1 to add, 0 to change, 0 to delete, 0 unchanged
        -
        -=== The next deploy creates the dashboard again
        -
        ->>> [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Created dashboards.dashboard1
        -Files: 0 uploaded, 0 deleted
        -Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        -
        ->>> show_requests
        -POST /api/2.0/lakeview/dashboards warehouse_id=warehouse-1234 embed_credentials=null
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published warehouse_id=warehouse-1234 embed_credentials=false
        -
        ->>> [CLI] bundle destroy --auto-approve
        -The following resources will be deleted:
        -  delete resources.dashboards.dashboard1
        -
        -All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        -
        -Destroy: 1 deleted
        +Exit code: 1
        
    acceptance_test.go:1192: Test produced unexpected files:
        .databricks/.gitignore
        .databricks/bundle/default/deployment.json
        .databricks/bundle/default/released-deploy-locks.json
        .databricks/bundle/default/resources.json
        .databricks/bundle/default/sync-snapshots/83ab99689b6cbc71.json
FAIL
TestAccept/bundle/resources/dashboards/publish_failure_trash_404/DMS=: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_failure_trash_404/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_failure_trash_4042657766411/002/output.txt
        @@ -3,12 +3,12 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (400 INVALID_PARAMETER_VALUE)
        +Warn: deploying resources.dashboards.dashboard1: failed to delete draft dashboard [DASHBOARD_ID] after publish failed: Fault injected by test.
        +Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
        -Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        +Endpoint: DELETE [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]?
        +HTTP Status: 504 Gateway Timeout
        +API error_code: DEADLINE_EXCEEDED
         API message: Fault injected by test.
         
         Files: 2 uploaded, 0 deleted
        @@ -17,19 +16,18 @@
         POST /api/2.0/lakeview/dashboards
         POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
         DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
         
         === The first cleanup trash gets a 404: deploy reports the publish error and the failed trash
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Warn: deploying resources.dashboards.dashboard1: failed to delete draft dashboard [DASHBOARD_ID] after publish failed: Dashboard not found.
        -Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (deleting dashboard [DASHBOARD_ID] after the failed publish also failed: Dashboard not found.) (400 INVALID_PARAMETER_VALUE)
        +Error: cannot create resources.dashboards.dashboard1: Dashboard not found. (404 RESOURCE_DOES_NOT_EXIST)
         
        -Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Fault injected by test.
        +Endpoint: DELETE [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]?
        +HTTP Status: 404 Not Found
        +API error_code: RESOURCE_DOES_NOT_EXIST
        +API message: Dashboard not found.
         
         Files: 1 uploaded, 0 deleted

latest (v1.28.0): same output as main (9a14ad6)

TestAccept/bundle/resources/dashboards/publish_failure_trash_404/DMS=true: branch ✅ | main (9a14ad6) ❌ | latest (v1.28.0) ❌

main (9a14ad6):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_failure_trash_404/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_failure_trash_40419270053/002/output.txt
        @@ -3,12 +3,12 @@
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warn: deploying resources.dashboards.dashboard1: retrying after 504 Gateway Timeout from DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (400 INVALID_PARAMETER_VALUE)
        +Warn: deploying resources.dashboards.dashboard1: failed to delete draft dashboard [DASHBOARD_ID] after publish failed: Fault injected by test.
        +Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
        -Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        +Endpoint: DELETE [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]?
        +HTTP Status: 504 Gateway Timeout
        +API error_code: DEADLINE_EXCEEDED
         API message: Fault injected by test.
         
         Files: 2 uploaded, 0 deleted
        @@ -17,19 +16,18 @@
         POST /api/2.0/lakeview/dashboards
         POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
         DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
        -DELETE /api/2.0/lakeview/dashboards/[DASHBOARD_ID]
         
         === The first cleanup trash gets a 404: deploy reports the publish error and the failed trash
         
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Warn: deploying resources.dashboards.dashboard1: failed to delete draft dashboard [DASHBOARD_ID] after publish failed: Dashboard not found.
        -Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (deleting dashboard [DASHBOARD_ID] after the failed publish also failed: Dashboard not found.) (400 INVALID_PARAMETER_VALUE)
        +Error: cannot create resources.dashboards.dashboard1: Dashboard not found. (404 RESOURCE_DOES_NOT_EXIST)
         
        -Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Fault injected by test.
        +Endpoint: DELETE [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]?
        +HTTP Status: 404 Not Found
        +API error_code: RESOURCE_DOES_NOT_EXIST
        +API message: Dashboard not found.
         
         Files: 1 uploaded, 0 deleted

latest (v1.28.0): same output as main (9a14ad6)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: ec61a8f

Run: 46398402533

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 179 19 2:45
💚​ aws-windows-latest-4core-16gb 1 179 19 3:57
💚​ azure linux-2core-8gb 1 178 19 3:24
💚​ azure-windows-latest-4core-16gb 1 178 19 4:05
💚​ gcp linux-2core-8gb 1 179 19 3:59
💚​ gcp-windows-latest-4core-16gb 1 179 19 4:02
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:21 gcp-windows-latest-4core-16gb TestAccept
3:20 azure-windows-latest-4core-16gb TestAccept
3:16 aws-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 29, 2026 09:03
@denik
denik requested review from a team as code owners November 29, 2026 09:03

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at 95c75c4. Each finding was verified against the code.

No blocking issues found. 1 non-blocking comment(s) below.

This PR retries the publish that follows a dashboard create in the direct engine on transient errors. When the publish still fails, the cleanup trash is now retried too. The publish retry looks right. The trash retry does not handle the NotFound that Delete in apply.go expects after a retry, so in the scenario this change targets, the deploy can report a misleading 404 instead of the publish failure.

DashboardId: createResp.DashboardId,
})
})
if deleteErr != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] The comment says this is retried like DoDelete. But Delete in bundle/direct/apply.go expects a NotFound when an earlier attempt already deleted the resource, and treats apierr.IsMissing as success. This loop has no such check. When the first Trash is applied and then returns a 504 (the case publish_504 injects with --after-handler), the retried trash can get a 404. The CLI then warns "failed to delete draft dashboard" even though it was deleted, and returns that 404 instead of the publish 504 that caused the failure. The test can't catch this because DashboardTrash in libs/testserver returns 200 for an already-trashed dashboard. Can we check deleteErr != nil && !apierr.IsMissing(deleteErr) here, and keep (or wrap) the publish error err in the returned error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Agreed, fixed in e840b86.

  • A 404 from a retried trash now counts as done (an earlier attempt may have trashed the dashboard despite its 504), the same rule libs/retry/filer.go uses for Delete. A 404 on the first attempt is still reported: that one doesn't prove an earlier request deleted anything, and treating it as success could hide a dashboard left outside state.
  • When the trash does fail, the deploy now returns the publish error with the trash error appended (... (deleting dashboard <id> after the failed publish also failed: ...)). The trash error is formatted with %v, so the error output still shows the publish request's endpoint and status.
  • Since the testserver answers a repeated trash with 200, the new test dashboards/publish_failure_trash_404 stubs DELETE with a 404 and covers both cases: a 504 then a 404 (done, only the publish error), and a 404 on the first attempt (both errors). Mutating either check fails it.

AI agent (opus5.5, isaac_claude)

Comment thread bundle/direct/dresources/dashboard.go Outdated
// Retried like DoDelete: a dashboard left behind is not in state, so every later deploy
// would fail with ALREADY_EXISTS on its path. A retry that finds it gone is done, since
// an earlier attempt may have trashed it despite its error.
retried := false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libs/retry/filer.go and bundle/phases/dms.go already retry a delete and count a 404 on a later attempt as done. Could the three share one helper in libs/retry, here or in a follow-up?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Done here, in a9727e9: new retry.Delete(ctx, isMissing, fn) in libs/retry/retry.go. It retries on IsTransient and accepts a "missing" error only on a later attempt. All three now call it: the retrying filer's Delete (with fs.ErrNotExist), deleteDeployment in bundle/phases/dms.go and the dashboard cleanup trash (both with apierr.IsMissing). Behavior is unchanged. The existing filer tests still pass, and new unit tests cover the helper directly: a 404 after a retry is success, a 404 on the first attempt is an error. A grep finds no other copy of the pattern. (libs/filer/files_client.go has a similar rule built on its own retrier and SDK retries, so I left it alone.)

AI agent (opus5.5, isaac_claude)

denik and others added 8 commits November 30, 2026 10:09
DoUpdate and DoDelete are wrapped in retry.With(retry.IsTransient) in
apply.go, but DoCreate is not, so a 504 on the publish that follows a
dashboard create trashed the new dashboard and failed the deploy.
Publishing the same draft again is harmless, so retry it in DoCreate.

cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
A dashboard left behind after the cleanup trash fails is not in state, so
every later deploy fails with ALREADY_EXISTS on its path. Retry the trash
on transient errors like DoDelete, and treat a retry that finds it gone
as done. The test now also covers every publish failing and checks the
warehouse_id and embed_credentials each publish sends.

cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
A trash that lands but times out gets a 404 on its retry; that means the
dashboard is gone, as in libs/retry/filer.go. A 404 on the first attempt
is still reported. When the trash does fail, the deploy returns the
publish error with the trash error appended, instead of the trash error.

cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
libs/retry/filer.go, bundle/phases/dms.go and the dashboard cleanup trash
each retried a delete and accepted a "missing" error only on a later
attempt. They now call one helper, retry.Delete, which takes the
caller's missing check (fs.ErrNotExist or apierr.IsMissing).

cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
…tests

errcode was removed from acceptance/script.prepare by #7975, so on
current main these scripts fail with "errcode: command not found".

cloud: TestAccept/bundle/resources/dashboards/unpublish-out-of-band TestAccept/bundle/invariant/no_drift/DMS=true/INPUT_CONFIG=dashboard.yml.tmpl

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik force-pushed the denik/dashboard-publish-retry branch from a9727e9 to ec61a8f Compare November 30, 2026 10:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues factory-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants