[VPEX][6b] local-env: address #5832 follow-up review comments#5936
Open
rugpanov wants to merge 3 commits into
Open
[VPEX][6b] local-env: address #5832 follow-up review comments#5936rugpanov wants to merge 3 commits into
rugpanov wants to merge 3 commits into
Conversation
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
Contributor
Waiting for approvalCould not determine reviewers from git history. Eligible reviewers: Suggestions based on git history. See OWNERS for ownership rules. |
…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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-envcommand remains hidden until #5835, so there is no user-visible changelog entry.Changes
libs/localenv/uv.go) —EnsureAvailableno longer runs the remote uv installer (curl … | sh/irm … | iex) silently. It now requires consent: a truthyDATABRICKS_LOCALENV_AUTO_INSTALL_UVopt-in for non-interactive runs (CI/IDE), or an interactivey/Nprompt viacmdio.AskYesOrNo. A non-interactive run without the opt-in returns an actionable error instead of downloading and executing an installer. (The--debuglog of the exact installer command from [VPEX][6/8] Add local-env uv backend and hidden CLI command #5832 is kept.)cmd/localenv/compute.go) —GetJobSparkVersionnow readsEnvironments[0].Spec.EnvironmentVersion, so a serverless--jobresolves to its actualserverless-vNinstead of always defaulting to v4. Empty still falls back to v4.cmd/localenv/sync.go) — skipbundleTargetwhen an explicit--cluster/--serverless/--jobflag is set.ResolveTargetonly consults the bundle as a fallback, so the secondTryConfigureBundleload (and its re-printed load-time diagnostics) was wasted for the explicit-flag case.Validateparse (libs/localenv/uv.go) — theuv runprobe now printsPYVER:/DBCVER:sentinels and parses by prefix instead of line position, so a stray stdout line from uv doesn't shift the parse.libs/localenv/uv.go) — fold single-callernewUvManagerintoNewUvManager; collapse the triplicatedresolveIndexURL+ conditionalWithEnvinto onerunUvhelper (the conditional stays so an already-setUV_INDEX_URLisn't clobbered).Tests
Adds unit tests for the install consent gate (
TestConfirmUvInstall) and the sentinel parse (TestLineWithPrefix). Fulllibs/localenvsuite passes, including under a CI-like environment withUV_INDEX_URL/PIP_INDEX_URLset.This pull request and its description were written by Isaac.