Skip to content

Add selftest tui commands for manual prompt verification#5208

Open
pietern wants to merge 2 commits intomainfrom
selftest-tui
Open

Add selftest tui commands for manual prompt verification#5208
pietern wants to merge 2 commits intomainfrom
selftest-tui

Conversation

@pietern
Copy link
Copy Markdown
Contributor

@pietern pietern commented May 7, 2026

Summary

Adds a databricks selftest tui group (hidden, like the rest of selftest) with one subcommand per cmdio prompt entry point: prompt, secret, ask, ask-yes-no, ask-select, select, select-ordered, run-select, spinner, colors. Each runs a single helper with the simplest meaningful inputs; flags layer in customization (e.g. prompt --mask --validate, select-ordered --filter, run-select --rich, spinner --elapsed).

The motivation is twofold: I want to (1) sanity-check prompts on different terminals (iTerm2, Terminal.app, Windows console, VS Code, tmux) without having to construct a real workspace flow, and (2) eyeball the visual diff when a prompt's rendering is modified — both to catch regressions and to demonstrate intentional changes side-by-side.

Fixture data is drawn from the public Databricks docs so the demo looks like content a user would actually encounter.

This pull request and its description were written by Isaac.

Each scenario is a one-shot subcommand under `databricks selftest tui`
that exercises a single cmdio helper with the simplest meaningful inputs;
flags layer in customization. Used for manual visual confirmation across
terminals and to eyeball the visual diff when prompt rendering changes.

Coverage: ask, ask-yes-no, ask-select, prompt (--default, --mask,
--validate), secret, select (--n), select-ordered (--n, --long, --filter),
run-select (--rich, --conditional), spinner (--elapsed), colors.

Fixture data is drawn from the public Databricks docs so the demo looks
like content a user would actually encounter.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Waiting for approval

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

Eligible reviewers: @Divyansh-db, @chrisst, @hectorcast-db, @mihaimitrea-db, @parthban-db, @rauchy, @renaudhartert-db, @simonfaltum, @tanmay-db, @tejaskochar-db

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

@pietern pietern temporarily deployed to test-trigger-is May 7, 2026 10:09 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is May 7, 2026 10:09 — with GitHub Actions Inactive
@pietern pietern requested a review from simonfaltum May 7, 2026 10:15
@pietern
Copy link
Copy Markdown
Contributor Author

pietern commented May 7, 2026

@simonfaltum Good spot to include the pager as well, later perhaps.

Comment thread cmd/selftest/tui/fixtures.go
Comment thread cmd/selftest/tui/select.go Outdated
Comment thread cmd/selftest/tui/fixtures.go
- Validate --n > 0 in cobra PreRunE (both `select` and `select-ordered`).
  Previously a negative --n flowed into make([]Tuple, 0, n) and panicked.
- Mirror the production cluster picker more faithfully in --rich:
  expose State/Access/Runtime as methods on clusterItem so the templates
  exercise text/template's method-resolution path, and have State() return
  a pre-colored string via cmdio.Green/Red/Blue (matching the
  renderedState cache on libs/databrickscfg/cfgpickers/clusters.go).

Co-authored-by: Isaac
@pietern pietern temporarily deployed to test-trigger-is May 7, 2026 12:50 — with GitHub Actions Inactive
@pietern pietern temporarily deployed to test-trigger-is May 7, 2026 12:50 — with GitHub Actions Inactive
@pietern pietern requested a review from simonfaltum May 7, 2026 13:06
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