Skip to content

Commit 89ba40b

Browse files
Remove non-functional hidden alias flags from bundle generate (#5591)
## Changes Remove the hidden `--existing-dashboard-id`, `--existing-dashboard-path`, `--existing-alert-id`, and `--existing-genie-space-id` alias flags from `bundle generate dashboard|alert|genie-space`. These aliased the canonical `--existing-id` / `--existing-path` flags by registering a second flag bound to the same variable ("included for symmetry with the other generate commands"), but they were never wired into the cobra requirement groups (`MarkFlagsOneRequired` / `MarkFlagRequired`). Cobra validates those groups on the named flags' `Changed` state, so an alias-only invocation always failed flag validation before reaching the command: ``` $ databricks bundle generate genie-space --existing-genie-space-id abc123 Error: at least one of the flags in the group [existing-id resource] is required ``` The aliases were broken from the commit that introduced each of them (#1847 for dashboard, #4108 for alert, #5282 for genie-space), are hidden from help output, and are referenced nowhere in docs, examples, or tests — no working invocation ever depended on them. With this change, passing one yields cobra's `unknown flag` error plus usage listing the canonical flags, instead of the misleading requirement-group error. The canonical long-form flags of the other generate commands (`--existing-job-id`, `--existing-pipeline-id`, `--existing-app-name`) are unaffected. ## Tests - Manual: each removed alias now fails with `unknown flag`; canonical `--existing-id` / `--existing-path` invocations still pass flag validation. - `go test ./cmd/bundle/generate/...` and `go test ./acceptance -run TestAccept/bundle/generate` pass with no golden output changes (hidden flags never appeared in help output). This pull request and its description were written by Isaac, an AI coding agent.
1 parent fd28114 commit 89ba40b

4 files changed

Lines changed: 1 addition & 16 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* direct: Fix resolving a resource reference that is used more than once within the same field ([#5558](https://github.com/databricks/cli/pull/5558)).
1313
* Bundle variable references now accept Unicode letters in path segments (e.g. `${var.变量}`). ([#5532](https://github.com/databricks/cli/pull/5532))
1414
* Ignore remote changes for vector search direct_access_index_spec.schema_json to prevent drift when the backend normalizes the schema ([#5481](https://github.com/databricks/cli/pull/5481)).
15+
* Remove hidden, never-functional `--existing-dashboard-id`, `--existing-dashboard-path`, `--existing-alert-id`, and `--existing-genie-space-id` alias flags from `bundle generate`; use the documented `--existing-id` / `--existing-path` flags instead ([#5591](https://github.com/databricks/cli/pull/5591)).
1516

1617
### Dependency updates
1718

cmd/bundle/generate/alert.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ After generation, you can deploy this alert to other targets using:
5757
cmd.Flags().StringVar(&alertID, "existing-id", "", `ID of the alert to generate configuration for`)
5858
cmd.MarkFlagRequired("existing-id")
5959

60-
// Alias lookup flag that includes the resource type name.
61-
// Included for symmetry with the other generate commands, but we prefer the shorter flag.
62-
cmd.Flags().StringVar(&alertID, "existing-alert-id", "", `ID of the alert to generate configuration for`)
63-
cmd.Flags().MarkHidden("existing-alert-id")
64-
6560
cmd.Flags().StringVarP(&configDir, "config-dir", "d", "resources", `directory to write the configuration to`)
6661
cmd.Flags().StringVarP(&sourceDir, "source-dir", "s", "src", `directory to write the alert definition to`)
6762
cmd.Flags().BoolVarP(&force, "force", "f", false, `force overwrite existing files in the output directory`)

cmd/bundle/generate/dashboard.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,6 @@ bundle files automatically, useful during active dashboard development.`,
525525
cmd.Flags().StringVar(&d.existingID, "existing-id", "", `ID of the dashboard to generate configuration for`)
526526
cmd.Flags().StringVar(&d.resource, "resource", "", `resource key of dashboard to watch for changes`)
527527

528-
// Alias lookup flags that include the resource type name.
529-
// Included for symmetry with the other generate commands, but we prefer the shorter flags.
530-
cmd.Flags().StringVar(&d.existingPath, "existing-dashboard-path", "", `workspace path of the dashboard to generate configuration for`)
531-
cmd.Flags().StringVar(&d.existingID, "existing-dashboard-id", "", `ID of the dashboard to generate configuration for`)
532-
cmd.Flags().MarkHidden("existing-dashboard-path")
533-
cmd.Flags().MarkHidden("existing-dashboard-id")
534-
535528
// Output flags.
536529
cmd.Flags().StringVarP(&d.resourceDir, "resource-dir", "d", "resources", `directory to write the configuration to`)
537530
cmd.Flags().StringVarP(&d.dashboardDir, "dashboard-dir", "s", "src", `directory to write the dashboard representation to`)

cmd/bundle/generate/genie_space.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,6 @@ bundle files automatically, useful during active Genie space development.`,
441441
cmd.Flags().StringVar(&g.existingID, "existing-id", "", `ID of the Genie space to generate configuration for`)
442442
cmd.Flags().StringVar(&g.resource, "resource", "", `resource key of Genie space to watch for changes`)
443443

444-
// Alias lookup flag that includes the resource type name.
445-
cmd.Flags().StringVar(&g.existingID, "existing-genie-space-id", "", `ID of the Genie space to generate configuration for`)
446-
cmd.Flags().MarkHidden("existing-genie-space-id")
447-
448444
// Output flags.
449445
cmd.Flags().StringVarP(&g.resourceDir, "resource-dir", "d", "resources", `directory to write the configuration to`)
450446
cmd.Flags().StringVarP(&g.genieSpaceDir, "genie-space-dir", "s", "src", `directory to write the Genie space representation to`)

0 commit comments

Comments
 (0)