Skip to content

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

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

denik wants to merge 3 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.

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 injects one 504 on the publish, before and after the handler runs; the deploy retries the publish, a follow-up plan shows no changes, and destroy deletes the dashboard. Without the fix both cases fail with the 504 above.

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.
  • Up to 2 extra publish attempts with the standard 15s pause add at most ~30s to a deploy whose publish keeps failing.
  • Risk: low.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

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>
@github-actions github-actions Bot added the DABs DABs related issues label Nov 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: b07475e3b | Workflow run

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

6 tests: regression=2 unreleased=0 coverage=4 failing=0
test branch main (7377a87) 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/unpublish-out-of-band/DMS= ✅ ✅ ✅
TestAccept/bundle/resources/dashboards/unpublish-out-of-band/DMS=true ✅ ✅ ✅
TestAccept/bundle/resources/dashboards/publish_504/DMS=: branch ✅ | main (7377a87) ❌ | latest (v1.28.0) ❌

main (7377a87):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=3329388128/002/output.txt
        @@ -3,48 +3,13 @@
         
         >>> [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
        +Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +HTTP Status: 504 Gateway Timeout
        +API error_code: DEADLINE_EXCEEDED
        +API message: Fault injected by test.
         
        ->>> [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
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -
        ->>> [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
        +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/d57604d05b68e1a7.json

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=3387063/002/output.txt
        @@ -3,48 +3,13 @@
         
         >>> [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
        +Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +HTTP Status: 504 Gateway Timeout
        +API error_code: DEADLINE_EXCEEDED
        +API message: Fault injected by test.
         
        ->>> [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
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -
        ->>> [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
        +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/b9b896b9bcffcf21.json
TestAccept/bundle/resources/dashboards/publish_504/DMS=true: branch ✅ | main (7377a87) ❌ | latest (v1.28.0) ❌

main (7377a87):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=true1109821931/002/output.txt
        @@ -3,48 +3,13 @@
         
         >>> [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
        +Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +HTTP Status: 504 Gateway Timeout
        +API error_code: DEADLINE_EXCEEDED
        +API message: Fault injected by test.
         
        ->>> [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
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -
        ->>> [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
        +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/8841af75a04d75f7.json
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- bundle/resources/dashboards/publish_504/output.txt
        +++ /tmp/TestAcceptbundleresourcesdashboardspublish_504DMS=true3682331029/002/output.txt
        @@ -3,48 +3,13 @@
         
         >>> [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
        +Error: cannot create resources.dashboards.dashboard1: Fault injected by test. (504 DEADLINE_EXCEEDED)
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +Endpoint: POST [DATABRICKS_URL]/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        +HTTP Status: 504 Gateway Timeout
        +API error_code: DEADLINE_EXCEEDED
        +API message: Fault injected by test.
         
        ->>> [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
         
        ->>> print_requests.py --get //lakeview
        -POST /api/2.0/lakeview/dashboards
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -POST /api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published
        -
        ->>> [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
        +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/93dd2aae2d12bc95.json
FAIL

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>

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.

1 participant