[VPEX][9] Rename target flags to match spec (--cluster-id, --dry-run, …)#5960
Conversation
Integration test reportCommit: 97a0ec4
9 interesting tests: 4 RECOVERED, 4 SKIP, 1 flaky
Top 10 slowest tests (at least 2 minutes):
|
anton-107
left a comment
There was a problem hiding this comment.
Reviewed as part of the full stack (#5960–#5965). Clean, mechanical rename with matching goldens — the flag definitions, GetString/GetBool reads, the mutually-exclusive group, and every user-facing message/hint move together, and the command stays Hidden. Approving.
One low/nit to fold in (here or in a follow-up):
- [nit] Stale
--checkreferences in test files. This PR's description says the internal--checkdoc comments were updated to--dry-run, but the test files were never touched:libs/localenv/pipeline_test.go(lines 29, 35, 39, 43, 47, 51, 122, 130, 150, 154, 159, 186) andlibs/localenv/constraints_test.go(128, 141) still say--check. Several aret.Error/assert-failure messages (e.g.pipeline_test.go:35"EnsureAvailable must not be called under --check"), so on failure a developer sees a message referencing a flag that no longer exists.
Reviewed with AI assistance (build + unit tests + adversarial verification against the checked-out top of stack).
78f2249 to
a84ab00
Compare
Per the [P0] CLI Changes spec, rename the setup-local flags: - --cluster → --cluster-id - --serverless → --serverless-version - --job → --job-id - --check → --dry-run - --constraint-source → --constraint-source-url (still hidden) Updates the flag definitions, GetString/GetBool reads, the mutually-exclusive group, and the user-facing flag names in ValidateTargetFlags, noTargetMessage, the E_ENV_UNSUPPORTED hint, and the job-ambiguity errors in compute.go. Internal --check doc comments are updated to --dry-run for accuracy. Acceptance scripts and goldens regenerated. Co-authored-by: Isaac
a84ab00 to
97a0ec4
Compare
|
Fixed the stale |
Stacked on #5960 (flag renames), which is stacked on #5959 (command rename). ## What Adds `--cluster-name` as a compute target for `environments setup-local`, per the `[P0] CLI Changes` spec. It resolves the cluster **name** to an **ID** via the Clusters API, then resolves identically to `--cluster-id` (`source=cluster`, env key from the resolved cluster's `spark_version`). ## Changes - `ComputeClient` gains `GetClusterByName`; `sdkCompute` implements it via the SDK's `Clusters.GetByClusterName`, which errors on an **unknown** or **ambiguous** name (two clusters sharing it) — both surfaced as an actionable `E_RESOLVE`. - `--cluster-name` joins the mutually-exclusive target group (`--cluster-id`/`--cluster-name`/`--serverless-version`/`--job-id`) and the bundle-fallback guard. - New `ResolveTarget` precedence branch after `--cluster-id`. ## Testing - Unit tests: success (name→ID→env key), ambiguity → `E_RESOLVE`, and `--cluster-id`/`--cluster-name` mutual exclusivity. - Acceptance: `cluster-name-check` (happy path, stubbed `clusters/list`) and `cluster-name-ambiguous` (`E_RESOLVE`); help golden updated. - `go build ./...`, lint (0 issues), deadcode clean, unit + acceptance green. This pull request and its description were written by Isaac.
Integration test reportCommit: bcc0851
28 interesting tests: 16 FAIL, 5 RECOVERED, 4 flaky, 2 SKIP, 1 KNOWN
Top 50 slowest tests (at least 2 minutes):
|
…icks#5965) Stacked on databricks#5964 → databricks#5963 → databricks#5962 → databricks#5961 → databricks#5960 → databricks#5959. ## What `--serverless-version` is now documented to take a **bare number** (e.g. `5`) rather than `v5`. - Input `5` is the documented form; `v5`/`V5` are still accepted (tolerant). - Both map to the same env key `serverless/serverless-vN`, so the **environments-repo layout is unchanged** (still `serverless/serverless-v5/…`). ## Changes - Flag help: `e.g. v4` → `e.g. 5`; the `E_ENV_UNSUPPORTED` hint suggests `--serverless-version 5`. - `defaultServerlessVersion` stored in bare form (`"5"`); still resolves to `serverless-v5` via `NormalizeServerless`. - Acceptance scripts pass the bare form; env-key goldens unchanged (`serverless-vN`). - Unit tests cover bare + v-prefixed input and the default constant. ## Testing `go build ./...`, lint (0 issues), deadcode clean, unit + acceptance green. This pull request and its description were written by Isaac.
Stacked on databricks#5960 (flag renames), which is stacked on databricks#5959 (command rename). ## What Adds `--cluster-name` as a compute target for `environments setup-local`, per the `[P0] CLI Changes` spec. It resolves the cluster **name** to an **ID** via the Clusters API, then resolves identically to `--cluster-id` (`source=cluster`, env key from the resolved cluster's `spark_version`). ## Changes - `ComputeClient` gains `GetClusterByName`; `sdkCompute` implements it via the SDK's `Clusters.GetByClusterName`, which errors on an **unknown** or **ambiguous** name (two clusters sharing it) — both surfaced as an actionable `E_RESOLVE`. - `--cluster-name` joins the mutually-exclusive target group (`--cluster-id`/`--cluster-name`/`--serverless-version`/`--job-id`) and the bundle-fallback guard. - New `ResolveTarget` precedence branch after `--cluster-id`. ## Testing - Unit tests: success (name→ID→env key), ambiguity → `E_RESOLVE`, and `--cluster-id`/`--cluster-name` mutual exclusivity. - Acceptance: `cluster-name-check` (happy path, stubbed `clusters/list`) and `cluster-name-ambiguous` (`E_RESOLVE`); help golden updated. - `go build ./...`, lint (0 issues), deadcode clean, unit + acceptance green. This pull request and its description were written by Isaac.
Stacked on databricks#5961 (`--cluster-name`) → databricks#5960 → databricks#5959. ## What Per the `[P0] CLI Changes` spec, the serverless stand-in used when the source does not pin a version is now **`serverless-v5`** (was `v4`). Applies only to the fallback cases: - a serverless `--job-id` whose environment records no version, and - a bundle that records `serverless` without a version. Explicitly passing `--serverless-version <vN>` is unaffected. ## Changes - Introduce `defaultServerlessVersion = "v5"` in `envkey.go`, used at both fallback sites in `target.go` so the default lives in one place. - Update the two unit tests that assert the default. No acceptance goldens change: all serverless acceptance tests pass `--serverless-version v4` explicitly, so none exercise the default path. ## Note VS Code resolves the real serverless version itself and passes `--serverless-version` explicitly (spec §63), so this fallback is only hit when the version is genuinely unknown — but v5 is now the correct stand-in per spec. This pull request and its description were written by Isaac.
Stacked on databricks#5962 (serverless-v5) → databricks#5961 → databricks#5960 → databricks#5959. ## What Per the `[P0] CLI Changes` spec, a bad-flags usage error is now surfaced as **`E_USAGE`** at the **preflight** phase, through the phase/JSON contract — instead of a bare Cobra mutual-exclusion error printed before `RunE` (which produces no command JSON object). ## Why The VS Code extension branches on the JSON `error.code`. Previously, passing two target flags triggered Cobra's `MarkFlagsMutuallyExclusive` *before* `RunE`, so `--output json` emitted nothing structured. Now the conflict is caught inside the pipeline and reported like any other phase failure. ## Changes - Add the `E_USAGE` error code. - Validate target flags at the top of the pipeline's preflight → `E_USAGE`, `diskMutated=false`. - Drop `cmd.MarkFlagsMutuallyExclusive` and the redundant early-return in `runPipeline` so the conflict flows into the pipeline. - `flag-conflict` golden updated (now shows the phase table + preflight error); new `flag-conflict-json` asserts `error{code:"E_USAGE", failurePhase:"preflight"}`; pipeline unit test for the path. ## Testing `go build ./...`, lint (0 issues), deadcode clean, unit + acceptance green. This pull request and its description were written by Isaac.
…ricks#5964) Stacked on databricks#5963 (E_USAGE) → databricks#5962 → databricks#5961 → databricks#5960 → databricks#5959. ## What Reconciles the error codes with the `[P0] CLI Changes` spec table (spec item databricks#10). **No behavior change** — the code already emits the correct set. The spec's table was stale: - omitted `E_NOT_WRITABLE` (preflight) and `E_PYTHON_INSTALL` (provision), and - wrongly listed `E_UV_MISSING` as "reserved / not emitted" when the CLI does emit it at preflight. ## Changes - Annotate each `ErrorCode` constant with the phase that emits it, and document the two spec codes the CLI deliberately never emits: `E_PYTHON_POLICY` (no signal source yet) and `E_AUTH` (handled earlier by `MustWorkspaceClient`). This makes the constant block the authoritative reference the spec mirrors. - Fix a `TargetInfo` doc comment that still said "four precedence sources" — with `--cluster-name` there are now five flag sources (the JSON `source` value is still one of cluster/serverless/job/bundle). ## Note The spec doc's error-code table itself (in the VPEX ERD, a Google Doc) has been updated separately to match — that's outside this repo. ## Testing `go build ./...`, lint (0 issues), deadcode clean, unit + acceptance green (comment-only code change). This pull request and its description were written by Isaac.
Stacked on #5959 (the command rename).
What
Renames the
environments setup-localflags to match the[P0] CLI Changesspec:--cluster--cluster-id--serverless--serverless-version--job--job-id--check--dry-run--constraint-source--constraint-source-url(still hidden)Changes
GetString/GetBoolreads, and the mutually-exclusive group incmd/environments/sync.go.ValidateTargetFlags,noTargetMessage, theE_ENV_UNSUPPORTEDhint (constraints.go), and the job-ambiguity errors (compute.go).--checkdoc comments updated to--dry-runfor accuracy.No behavior change beyond the flag spellings; the command stays
Hidden.Testing
go build ./..., lint (0 issues), deadcode clean,libs/localenv+cmd/environmentsunit tests,acceptance/localenv+acceptance/helpregenerated and green.This pull request and its description were written by Isaac.