Skip to content

Add --auto-approve to experimental prompt sites#5026

Merged
simonfaltum merged 2 commits intomainfrom
simonfaltum/auto-approve-experimental-prompts
Apr 20, 2026
Merged

Add --auto-approve to experimental prompt sites#5026
simonfaltum merged 2 commits intomainfrom
simonfaltum/auto-approve-experimental-prompts

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

@simonfaltum simonfaltum commented Apr 20, 2026

Why

The rest of the CLI already exposes --auto-approve on confirmation prompts: bundle deploy, bundle destroy, pipelines deploy, pipelines destroy, completion install, completion uninstall, auth logout, and apps delete all have it. Five prompts in experimental commands do not, which is inconsistent and also blocks any non-interactive use of those commands (CI, scripts).

The five sites:

  • databricks ssh setup: "Host already exists" prompt
  • databricks ssh connect: required IDE extension install
  • databricks ssh connect: IDE settings update
  • databricks apps dev-remote: viewer connection request
  • databricks apps init: optional resource confirmation

All five are in Hidden: true / experimental commands.

Changes

Before: these prompts could not be bypassed, so these commands didn't match the --auto-approve convention the rest of the CLI has settled on.
Now: each of the four owning commands accepts --auto-approve, and the prompt is skipped when the flag is set.

Follows the same convention as the commands listed above: a bool flag on the command, threaded through the options struct, checked before the prompt. No new cmdio helper, no context-based capability, no new pattern - just applying the existing one to the last few places that didn't have it.

Behavior details:

  • ssh setup --auto-approve: recreates an existing host config without prompting.
  • ssh connect --auto-approve: installs the required IDE SSH extension and applies missing IDE settings without prompting. Also removes the cmdio.IsPromptSupported short-circuit on the settings path so the flag works in non-TTY contexts (the whole point).
  • apps dev-remote --auto-approve: auto-approves every viewer connection for the life of the session. Help text flags the trust implication (anyone with the shareable dev URL is trusted). Intended for trusted environments only.
  • apps init --auto-approve: skips the Configure <optional resource>? confirmation. Optional resources are only configured when their values are supplied via --set plugin.resourceKey.field=value.

No NEXT_CHANGELOG.md entry since all commands are experimental.

Test plan

  • make checks clean
  • make lint clean
  • go test ./experimental/ssh/... ./libs/apps/vite/... ./cmd/apps/... passes
  • Unit tests added:
    • TestSetup_AutoApproveRecreatesExistingHost: Setup with AutoApprove=true recreates a pre-existing host config
    • TestCheckIDESSHExtension_AutoApproveMissing_Installs: extension is installed without a prompt
    • TestCheckIDESSHExtension_NoPrompt_WithoutAutoApprove_Errors: non-interactive without the flag still errors with install instructions
    • TestCheckAndUpdateSettings_AutoApproveWithoutPromptSupport: settings applied even when prompts are unsupported
    • TestCheckAndUpdateSettings_AutoApproveCreatesMissingFile: missing settings file is created
    • TestNewBridge_AutoApprove: bridge stores the flag
    • TestBridgeHandleConnectionRequest_AutoApproveSkipsStdin: connection request is approved without reading stdin
  • Manual: databricks ssh setup --name h --cluster <id> twice; second run with --auto-approve recreates silently
  • Manual: databricks ssh connect --ide vscode --auto-approve with the SSH extension missing: installs without a prompt
  • Manual: databricks apps dev-remote --name <app> --auto-approve: external viewer opens the shareable URL and is approved without stdin interaction
  • Manual: databricks apps init --name x --features analytics --auto-approve: optional resources are skipped when no --set supplied; honored when --set is supplied

Five confirmation prompts in experimental commands had no bypass flag,
so CI and scripted invocations would either hang waiting on stdin or
fail outright.

- `databricks ssh setup --auto-approve` recreates an existing host
  config without prompting.
- `databricks ssh connect --auto-approve` installs the required IDE
  SSH extension and applies missing IDE settings without prompting.
- `databricks apps dev-remote --auto-approve` trusts every viewer
  connection for the life of the session. Intended for trusted
  environments only.
- `databricks apps init --auto-approve` skips the optional-resource
  confirmation; optional resources are only configured when their
  values are supplied via --set.

All affected commands are hidden/experimental, so no CHANGELOG entry
is added.
@simonfaltum simonfaltum requested a review from pkosiec April 20, 2026 11:36
- client.go: drop the outer `(cmdio.IsPromptSupported(ctx) || opts.AutoApprove)`
  guard; `CheckAndUpdateSettings` already owns this policy internally
  and returns nil with a log when neither holds, so the outer check was
  duplicate state that had to be kept in sync with the callee.
- init.go: drop a tautological field comment and a docstring sentence
  that duplicated an inline comment at the only branch using the flag.
Comment thread cmd/apps/init.go
@simonfaltum simonfaltum added this pull request to the merge queue Apr 20, 2026
Merged via the queue into main with commit db527d1 Apr 20, 2026
28 checks passed
@simonfaltum simonfaltum deleted the simonfaltum/auto-approve-experimental-prompts branch April 20, 2026 14:08
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.

2 participants