Skip to content

Store pending device code logins and add cmdio.IsInputTTY - #7234

Closed
maksim-zuev-db wants to merge 2 commits into
device-code-interactive-testsfrom
device-code-pending-login-storage
Closed

maksim-zuev-db wants to merge 2 commits into
device-code-interactive-testsfrom
device-code-pending-login-storage

Conversation

@maksim-zuev-db

Copy link
Copy Markdown
Member

Stacked on #7222.

Changes

Two building blocks of the non-interactive device code login (#7220):

  • storage.Entry gets a PendingLogin field that holds the device code and the user code of a device code login until a later CLI invocation completes it. A pending entry has no token. The file, keyring, and memory stores persist it.
  • cmdio.IsInputTTY reports whether stdin is a terminal. Unlike IsPromptSupported, it does not depend on stderr, NO_COLOR, TERM=dumb, or Git Bash, which only matter for rendering prompts.

Why

The non-interactive login keeps the device code in the user's token storage, so it is never printed or passed on the command line. It runs when nobody can type into stdin, which IsPromptSupported does not tell apart. Split out of #7220 to keep that PR smaller.

Tests

Unit tests for storing and looking up a pending login in each store, and for IsInputTTY.

This pull request and its description were written by Isaac.

maksim-zuev-db and others added 2 commits October 28, 2026 15:18
IsPromptSupported tells whether the CLI can render a prompt, so it also
depends on stderr, NO_COLOR, TERM=dumb and Git Bash. A command that reads a
plain line from stdin only needs to know whether a user can type into it.

Co-authored-by: Isaac <no-reply@databricks.com>
A non-interactive device code login is completed by a later CLI invocation.
Entry gets a PendingLogin field that holds the device code and the user code
until then, so that the device code stays in the user's token storage instead
of being printed or passed on the command line. A pending entry has no token.

Co-authored-by: Isaac <no-reply@databricks.com>
@maksim-zuev-db

Copy link
Copy Markdown
Member Author

Merged into #7220.

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.

1 participant