Skip to content

[VPEX][2/8] Add local-env compute-target resolution#5824

Open
rugpanov wants to merge 2 commits into
dbconnect/01-enginefrom
dbconnect/02-target
Open

[VPEX][2/8] Add local-env compute-target resolution#5824
rugpanov wants to merge 2 commits into
dbconnect/01-enginefrom
dbconnect/02-target

Conversation

@rugpanov

@rugpanov rugpanov commented Jul 3, 2026

Copy link
Copy Markdown

Context

PR 2 of 8 in the stacked databricks local-env python sync series (see #5823 for the full plan). Stacked on #5823 — review that first; this PR's diff is only target.go + its test.

Base branch: dbconnect/01-engine (PR #5823). GitHub shows it against main until #5823 merges; the meaningful diff is the two files below. (The git branch names still use the dbconnect/ prefix from before the rename; the code and command are local-env.)

What this PR contains

target.go — compute-target resolution. Resolves a target to a TargetInfo and its environment key using ordered precedence:

--cluster flag  →  --serverless flag  →  --job flag  →  bundle target
  • Compute lookups go through the narrow ComputeClient seam, so the resolver is unit-tested against a stub with no SDK dependency.
  • ValidateTargetFlags guards the library path against more than one target flag being set (Cobra enforces this at the CLI layer too, in a later PR).
  • The classic-compute job branch reads the Spark version from the first return of GetJobSparkVersion, per that method's documented contract, not the recorded-version third return.

Dependencies & surface

Depends on the foundation PR (#5823) for NewError, the E_RESOLVE / E_NO_TARGET codes, TargetInfo, and the EnvKeyFor* helpers. Still dormant — nothing imports the package yet.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

Could not determine reviewers from git history.
Round-robin suggestion: @renaudhartert-db

Eligible reviewers: @andrewnester, @anton-107, @denik, @janniklasrose, @pietern, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 436dabf

Run: 28679374107

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 7 14 230 1045 4:03
💚​ aws windows 7 14 232 1043 4:07
💚​ aws-ucws linux 7 14 314 963 5:24
💚​ aws-ucws windows 7 14 316 961 4:06
💚​ azure linux 4 15 230 1044 4:26
💚​ azure windows 4 15 232 1042 4:09
💚​ azure-ucws linux 4 15 316 960 5:12
💚​ azure-ucws windows 4 15 318 958 4:21
💚​ gcp linux 4 15 229 1046 3:49
💚​ gcp windows 4 15 231 1044 3:47
21 interesting tests: 14 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 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ 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_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 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 5 slowest tests (at least 2 minutes):
duration env testname
3:12 azure windows TestAccept
3:07 aws windows TestAccept
3:06 azure-ucws windows TestAccept
3:02 aws-ucws windows TestAccept
2:53 gcp windows TestAccept

@rugpanov rugpanov force-pushed the dbconnect/01-engine branch from 865a2cd to 22f99d9 Compare July 3, 2026 13:20
@rugpanov rugpanov force-pushed the dbconnect/02-target branch from 5fdb8b6 to 2092138 Compare July 3, 2026 13:20
@rugpanov rugpanov changed the title Add dbconnect compute-target resolution [VPEX][2/8] Add local-env compute-target resolution Jul 3, 2026
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 13:21 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 13:21 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/02-target branch from 2092138 to 22d1137 Compare July 3, 2026 15:26
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:27 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:27 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:31 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:31 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/02-target branch from 8d309ae to d9b9c50 Compare July 3, 2026 18:15
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:15 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:15 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/02-target branch from d9b9c50 to 77ac2c8 Compare July 3, 2026 18:27
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:27 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:27 — with GitHub Actions Inactive
rugpanov added 2 commits July 3, 2026 21:13
Second in the stacked local-env series (builds on the foundation types).

target.go resolves a compute target to a TargetInfo (and its environment
key) using ordered precedence: --cluster flag → --serverless flag → --job
flag → bundle target. Compute lookups go through the narrow ComputeClient
seam so the resolver is unit-tested against a stub with no SDK dependency.
ValidateTargetFlags guards the library path against more than one target
flag being set.

The classic-compute job branch reads the Spark version from the first
return of GetJobSparkVersion, per that method's documented contract, rather
than the recorded-version third return.

Depends on the foundation PR for NewError, the E_RESOLVE / E_NO_TARGET
codes, TargetInfo, and the EnvKeyFor* helpers. Still dormant.

Co-authored-by: Isaac
Review of the target layer noted that ResolveTarget accepted incompatible
flags on the library path: called directly with e.g.
TargetFlags{Cluster: "c", Serverless: "v4"} it silently took the first
precedence branch and ignored the rest, resolving a different target than
requested. Cobra and the cmd layer already reject this, but ResolveTarget is
exported and ValidateTargetFlags exists specifically to guard callers that
bypass Cobra, so the resolver now runs that check first and returns
E_RESOLVE on conflicting flags.

Co-authored-by: Isaac
@rugpanov rugpanov force-pushed the dbconnect/02-target branch from 77ac2c8 to 436dabf Compare July 3, 2026 19:14
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 19:14 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 19:14 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants