Add selftest tui commands for manual prompt verification#5208
Merged
Conversation
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
Contributor
Author
|
@simonfaltum Good spot to include the pager as well, later perhaps. |
simonfaltum
reviewed
May 7, 2026
simonfaltum
reviewed
May 7, 2026
simonfaltum
reviewed
May 7, 2026
- 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
cmdio.AskSelect is being removed in #5219 (its only caller migrated to RunSelect with the new HideHelp option), so this scenario would no longer compile against main once that lands. Co-authored-by: Isaac
The flag help on `select-ordered` already documents that `--n` is ignored when `--long` or `--filter` selects its own fixture, but the PreRunE validator was rejecting `--long --n=0` anyway. Skip the check in those modes. Co-authored-by: Isaac
Drop the trailing blank line left after removing newAskSelectCmd. Co-authored-by: Isaac
simonfaltum
approved these changes
May 8, 2026
cmdio.Secret is a tiny wrapper over the same prompt machinery; keeping a dedicated file for one 13-line function added more navigation overhead than it saved. 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.
Summary
Adds a
databricks selftest tuigroup (hidden, like the rest ofselftest) with one subcommand per cmdio prompt entry point:prompt,secret,ask,ask-yes-no,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.