Skip to content

Make experimental YAML-sync state upload best-effort#5524

Open
simonfaltum wants to merge 2 commits into
mainfrom
simonfaltum/b53-yamlsync-deploy-fail
Open

Make experimental YAML-sync state upload best-effort#5524
simonfaltum wants to merge 2 commits into
mainfrom
simonfaltum/b53-yamlsync-deploy-fail

Conversation

@simonfaltum

Copy link
Copy Markdown
Member

Why

Found during a full-repo review of the CLI. The experimental YAML-sync state upload (gated behind DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC) runs after a deploy has already succeeded and is meant to be best-effort: its own errors are logged as warnings and the deploy continues. But the state conversion it performs reuses direct-engine code (SecretScopeFixups, CalculatePlan, DeploymentBundle.Apply) that reports failures through logdiag on the shared deploy context. Any such failure flips a successful deploy to exit 1.

A concrete trigger: a schema with an empty grants: [] block. Terraform emits no grants resource for an empty list, so the converted state has no entry for the grants plan node, and the deploy fails with Error: state entry not found for "resources.schemas.schema1.grants" even though all resources deployed fine.

Changes

Before, a conversion failure inside the YAML-sync upload failed the whole deploy with exit 1; now it is logged as warnings and the deploy completes normally.

  • libs/logdiag: added IsolatedContext, which returns a child context with a fresh diagnostics state shadowing the parent's. InitContext now reuses it.
  • bundle/statemgmt/upload_state_for_yaml_sync.go: the mutator runs its work in an isolated, collecting logdiag scope and downgrades any collected diagnostics to log.Warnf, consistent with its existing best-effort error handling. Since DeploymentBundle.Apply reports failures only through logdiag, convertState now checks the isolated scope after it and returns an error instead of uploading a snapshot that is missing entries for the failed resources.

Test plan

  • New acceptance test acceptance/bundle/deploy/yaml-sync-empty-grants: deploys a schema with grants: [] and the env var set; before the fix it exited 1 with Error: state entry not found, now it completes with warnings and exit 0.
  • New unit test TestIsolatedContext verifying diagnostics logged through the isolated scope do not leak to the parent context.
  • go test ./libs/logdiag/ ./bundle/statemgmt/ ./bundle/direct/ passes.
  • ./task fmt-q, ./task lint-q, and ./task checks pass.

This pull request and its description were written by Isaac.

The UploadStateForYamlSync mutator runs after a successful deploy when
DATABRICKS_BUNDLE_ENABLE_EXPERIMENTAL_YAML_SYNC is set. Its state
conversion reuses direct-engine code (SecretScopeFixups, CalculatePlan,
Apply) that reports failures via logdiag on the shared deploy context,
flipping the whole deploy to exit 1. A schema with an empty grants list
triggers this: terraform emits no grants resource for an empty list, so
the migration plan has a node with no state entry.

Collect the conversion's diagnostics in an isolated logdiag scope and
downgrade them to warnings, consistent with the mutator's existing
best-effort error handling. Skip uploading the snapshot when conversion
failed so a partial snapshot is never published.

Co-authored-by: Isaac
@simonfaltum simonfaltum requested a review from denik June 9, 2026 21:09
@simonfaltum simonfaltum temporarily deployed to test-trigger-is June 9, 2026 21:09 — with GitHub Actions Inactive
@simonfaltum simonfaltum temporarily deployed to test-trigger-is June 9, 2026 21:09 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

5 files changed
Suggested: @denik
Also eligible: @shreyas-goenka, @pietern, @andrewnester, @anton-107, @janniklasrose, @lennartkats-db

/bundle/ - needs approval

Files: bundle/statemgmt/upload_state_for_yaml_sync.go
Suggested: @denik
Also eligible: @shreyas-goenka, @pietern, @andrewnester, @anton-107, @janniklasrose, @lennartkats-db

General files (require maintainer)

Files: libs/logdiag/logdiag.go, libs/logdiag/logdiag_test.go
Based on git history:

  • @denik -- recent work in bundle/statemgmt/, libs/logdiag/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Commit: d5668dd

Run: 27255254054

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 7 15 261 929 6:43
💚​ aws windows 7 15 263 927 11:30
💚​ aws-ucws linux 7 15 357 843 8:03
💚​ aws-ucws windows 7 15 359 841 11:49
💚​ azure linux 1 17 264 927 7:30
💚​ azure windows 1 17 266 925 10:42
💚​ azure-ucws linux 1 17 362 839 7:58
💚​ azure-ucws windows 1 17 364 837 11:37
💚​ gcp linux 1 17 260 930 8:17
💚​ gcp windows 1 17 262 928 11:17
22 interesting tests: 15 SKIP, 7 RECOVERED
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/grants/select 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 30 slowest tests (at least 2 minutes):
duration env testname
6:19 gcp windows TestAccept
6:19 aws windows TestAccept
6:06 aws-ucws windows TestAccept
6:03 azure windows TestAccept
6:00 azure-ucws windows TestAccept
4:27 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:07 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
4:04 gcp linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:53 gcp windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:13 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:11 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:08 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:03 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:57 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:56 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:54 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:53 gcp linux TestAccept
2:50 aws linux TestAccept
2:48 aws-ucws linux TestAccept
2:48 azure linux TestAccept
2:48 azure-ucws linux TestAccept
2:48 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:47 aws-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:46 azure linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:45 azure-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:36 azure windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:35 aws-ucws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:35 azure-ucws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:32 aws linux TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:24 aws windows TestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants