Skip to content

[VPEX][6b] local-env: address #5832 follow-up review comments#5936

Open
rugpanov wants to merge 3 commits into
mainfrom
dbconnect/06b-followups
Open

[VPEX][6b] local-env: address #5832 follow-up review comments#5936
rugpanov wants to merge 3 commits into
mainfrom
dbconnect/06b-followups

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Follow-up refinements from the #5832 review (all were left as non-blocking there and deferred with a "will address in a follow-up" reply). The local-env command remains hidden until #5835, so there is no user-visible changelog entry.

Changes

  • uv install consent (libs/localenv/uv.go) — EnsureAvailable no longer runs the remote uv installer (curl … | sh / irm … | iex) silently. It now requires consent: a truthy DATABRICKS_LOCALENV_AUTO_INSTALL_UV opt-in for non-interactive runs (CI/IDE), or an interactive y/N prompt via cmdio.AskYesOrNo. A non-interactive run without the opt-in returns an actionable error instead of downloading and executing an installer. (The --debug log of the exact installer command from [VPEX][6/8] Add local-env uv backend and hidden CLI command #5832 is kept.)
  • serverless job version (cmd/localenv/compute.go) — GetJobSparkVersion now reads Environments[0].Spec.EnvironmentVersion, so a serverless --job resolves to its actual serverless-vN instead of always defaulting to v4. Empty still falls back to v4.
  • double bundle load (cmd/localenv/sync.go) — skip bundleTarget when an explicit --cluster/--serverless/--job flag is set. ResolveTarget only consults the bundle as a fallback, so the second TryConfigureBundle load (and its re-printed load-time diagnostics) was wasted for the explicit-flag case.
  • robust Validate parse (libs/localenv/uv.go) — the uv run probe now prints PYVER: / DBCVER: sentinels and parses by prefix instead of line position, so a stray stdout line from uv doesn't shift the parse.
  • cleanup (libs/localenv/uv.go) — fold single-caller newUvManager into NewUvManager; collapse the triplicated resolveIndexURL + conditional WithEnv into one runUv helper (the conditional stays so an already-set UV_INDEX_URL isn't clobbered).

Tests

Adds unit tests for the install consent gate (TestConfirmUvInstall) and the sentinel parse (TestLineWithPrefix). Full libs/localenv suite passes, including under a CI-like environment with UV_INDEX_URL/PIP_INDEX_URL set.

This pull request and its description were written by Isaac.

Follow-ups deferred from the #5832 review, now that the command has landed
(still hidden until #5835):

- uv install consent (libs/localenv/uv.go): EnsureAvailable no longer runs the
  remote uv installer silently. It now requires consent — a truthy
  DATABRICKS_LOCALENV_AUTO_INSTALL_UV opt-in for non-interactive runs, or an
  interactive y/N prompt (cmdio.AskYesOrNo). A non-interactive run without the
  opt-in returns an actionable error instead of downloading and executing an
  installer. The --debug log of the installer command (from #5832) is kept.

- serverless job version (cmd/localenv/compute.go): GetJobSparkVersion now reads
  Environments[0].Spec.EnvironmentVersion so a serverless --job resolves to its
  actual serverless-vN instead of always defaulting to v4. Empty falls back to v4.

- double bundle load (cmd/localenv/sync.go): skip bundleTarget entirely when an
  explicit --cluster/--serverless/--job flag is set. ResolveTarget only consults
  the bundle as a fallback, so the second TryConfigureBundle load (and its
  re-printed load-time diagnostics) was wasted for the explicit-flag case.

- robust Validate parse (libs/localenv/uv.go): the uv-run probe now prints
  PYVER:/DBCVER: sentinels and parses by prefix instead of line position, so a
  stray stdout line from uv does not shift the parse.

- cleanup (libs/localenv/uv.go): fold single-caller newUvManager into
  NewUvManager; collapse the triplicated resolveIndexURL + conditional WithEnv
  into one runUv helper (the conditional stays so an already-set UV_INDEX_URL is
  not clobbered).

Adds unit tests for the install consent gate and the sentinel parse.

Co-authored-by: Isaac
@github-actions

Copy link
Copy Markdown
Contributor

Waiting for approval

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

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

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

@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 15:07 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 15:07 — with GitHub Actions Inactive
…ions

Two correctness findings from the review of the follow-up changes:

- confirmUvInstall could panic: EnsureAvailable is a library entry point
  reachable with a context that has no cmdio (e.g. a Pipeline built with
  context.Background()), where cmdio.IsPromptSupported panics. Guard with
  cmdio.HasIO and treat a missing cmdio as non-interactive (decline).

- GetJobSparkVersion used only Environments[0] for serverless jobs. A job
  whose environments pin differing environment_version values (or a
  pinned-vs-unpinned mix) has no single correct target, so refuse and ask for
  --serverless, mirroring the existing job-cluster divergence check.

Adds a test asserting confirmUvInstall declines (no panic) with no cmdio.

Co-authored-by: Isaac
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 15:16 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 15:16 — with GitHub Actions Inactive
Range over strings.SplitSeq instead of strings.Split: the seq variant
iterates without allocating the intermediate slice, clearing the
golangci-lint modernize/stringsseq finding.

Co-authored-by: Isaac
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 15:21 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 15, 2026 15:21 — with GitHub Actions Inactive
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.

1 participant