Skip to content

Skip non-matching siblings in dyn wildcard visits#5511

Open
simonfaltum wants to merge 6 commits into
mainfrom
simonfaltum/b24-dyn-wildcard-nil
Open

Skip non-matching siblings in dyn wildcard visits#5511
simonfaltum wants to merge 6 commits into
mainfrom
simonfaltum/b24-dyn-wildcard-nil

Conversation

@simonfaltum

Copy link
Copy Markdown
Member

Why

Found during a full-repo review of the CLI. When a wildcard pattern visits a map or sequence, a single element that cannot be traversed aborts the whole transform. For example, a bundle where one job has an empty tasks: block fails bundle validate with a cryptic error, and the remaining valid jobs are never processed:

Error: failed to normalize paths: expected a sequence at "resources.jobs.empty_tasks.tasks", found nil

This is inconsistent with MapByPattern, which already treats nil values as "no match" at the top level.

Changes

Before, the wildcard visitors in libs/dyn/pattern.go skipped a sibling only on a missing key or an out-of-bounds index; now they also skip siblings whose value is nil or not the collection kind the pattern expects, so the remaining siblings are still processed. Errors returned by the visit callback itself still abort the transform, and fixed path components applied to mismatched kinds still error as before.

  • anyKeyComponent.visit and anyIndexComponent.visit use a new isNoMatchError helper that extends the skipped set with cannotTraverseNilError, expectedMapError, and expectedSequenceError.
  • Added an acceptance test with an empty-tasks job alongside a valid job; bundle validate now succeeds and fully processes both jobs.

Test plan

  • New unit tests in libs/dyn covering nil and wrong-kind siblings under * and [*], and callback error propagation
  • New acceptance test acceptance/bundle/validate/empty_tasks, passing for both terraform and direct engines (failed with the error above before the fix)
  • go test ./libs/dyn/... and go test ./bundle/config/...
  • ./task fmt-q, ./task lint-q, ./task checks

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 7b1a742

Run: 28378271949

Env ❌​FAIL 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🟨​ aws linux 7 1 13 232 1037 11:06
🟨​ aws windows 7 1 13 234 1035 9:05
💚​ aws-ucws linux 8 13 316 955 11:42
💚​ aws-ucws windows 8 13 318 953 7:54
❌​ azure linux 1 1 1 1 15 230 1036 10:30
💚​ azure windows 2 15 234 1034 4:34
❌​ azure-ucws linux 2 1 1 15 316 952 15:01
🟨​ azure-ucws windows 1 1 15 318 950 11:06
💚​ gcp linux 2 15 231 1038 9:55
💚​ gcp windows 2 15 233 1036 7:07
23 interesting tests: 13 SKIP, 8 KNOWN, 2 FAIL
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 🟨​K 🟨​K 💚​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 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 🟨​K 🟨​K 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 🟨​K 🟨​K 💚​R 💚​R
🟨​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 🟨​K 🟨​K 💚​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_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/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo 🔄​f 🔄​f 💚​R 💚​R 🟨​K 💚​R 🟨​K 🟨​K 💚​R 💚​R
❌​ TestFetchRepositoryInfoAPI_FromRepo/root ✅​p ✅​p ✅​p ✅​p ❌​F ✅​p ❌​F ✅​p ✅​p
❌​ TestFetchRepositoryInfoAPI_FromRepo/subdir ✅​p ✅​p ✅​p ✅​p 🔄​f ✅​p ❌​F ✅​p ✅​p
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:32 gcp windows TestAccept
2:42 aws-ucws linux TestFilerRecursiveDelete/dbfs
2:41 aws-ucws windows TestAccept
2:39 azure-ucws windows TestAccept
2:33 azure windows TestAccept
2:26 azure-ucws windows TestAccept/bundle/generate/auto-bind/DATABRICKS_BUNDLE_ENGINE=terraform

Co-authored-by: Isaac
@simonfaltum simonfaltum requested review from janniklasrose and removed request for shreyas-goenka June 22, 2026 10:34
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.

3 participants