Skip to content

Google: warn when gcloud's active configuration doesn't exist - #116

Open
odgrim wants to merge 2 commits into
mainfrom
track-a/google-missing-active-config
Open

odgrim wants to merge 2 commits into
mainfrom
track-a/google-missing-active-config

Conversation

@odgrim

@odgrim odgrim commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Change

A gcloud sign-in that uses no configuration because gcloud's active configuration doesn't exist now warns:

gcloud's active configuration "gone" doesn't exist, so this sign-in uses the Application Default Credentials with no configuration.

With #106, a mistyped CLOUDSDK_ACTIVE_CONFIG_NAME, or an active_config naming a configuration that's gone, signs in with the Application Default Credentials alone, matching the "No configuration" first choice. Before this change that happened silently.

  • It warns with the field absent and with "No configuration" chosen, since Runbooks sends the first choice for an untouched field.
  • A configuration named in the field never warns.
  • No active configuration and no default gives no warning: nothing named a configuration.
  • select keeps the warning: it changes only the project.

Decisions

  • untouched_configuration returns Untouched { Held, Missing, Unset }, not Option<ConfigurationName>. The warning comes from the same function that picks the first choice, so the two can't disagree about which state is which.
  • An invalid name counts as missing. No file can hold it. The name goes through quoted, as other quoted values do: str::escape_debug, which also escapes ', then the first 256 characters of that, then "…" if any are left, all inside double quotes.
  • Candidate and Session carry warning: Option<String>. Only gcloud sets it.

Gaps

  • Conflicts with Google: warn of a project the login can't read #113 in Session::identity, which builds warnings from the chosen project. Whichever lands second gathers both.
  • The gcloud detection source still treats a missing active configuration as not found, with no warning.
  • An active_config that can't be read (over 64 KiB, a directory, unreadable) counts as no active configuration, as before: the sign-in uses default and doesn't warn.
  • The warning names neither where the name came from (CLOUDSDK_ACTIVE_CONFIG_NAME or active_config) nor what to do. Runbooks' fake and docs copy these words.

Evidence

  • the_first_configuration_choice_is_what_an_untouched_field_uses, six gcloud states:
    • for active_config "gone", "dev\nfoo" and 300 "a", expects the warning, quoting "gone", "dev\nfoo" and 256 "a" then "…";
    • for the other three, expects none;
    • in every state, the field absent and the first choice give the same result, warnings included;
    • naming default gives no warning;
    • select keeps the sign-in's warning;
    • choosing "No configuration" warns exactly as the untouched field does, so not while a configuration is held.
  • Before the change it failed: left: Null, right: Array [Object {"message": String("gcloud's active configuration \"gone\" doesn't exist, ...")}].
  • Hand mutants, each failing that test (152 passed, 1 failed):
    • never warning;
    • warning when a configuration is named;
    • not warning when "No configuration" is chosen;
    • an invalid name treated as no active configuration;
    • the name unescaped;
    • a warning when "No configuration" is chosen while a configuration is held;
    • the name printed whole;
    • select dropping the warning.
  • mise run check: 500 tests run: 500 passed, 0 skipped, lint clean, semver no publishable crates.
  • Rebased for the stack, 7d7574c to 18a505d: the PR's diff has the same git patch-id --stable (8f4382d247f4) and the same changed lines, now on main with Azure: refusals and names as main reads them, and a service principal's reach #109.

@odgrim
odgrim changed the base branch from track-a/schema-release-text to main December 6, 2026 15:26
@odgrim
odgrim marked this pull request as ready for review December 6, 2026 15:43
A sign-in that uses no configuration because gcloud's active one, from
CLOUDSDK_ACTIVE_CONFIG_NAME or active_config, names none a file holds
now says so in identity.warnings. An absent field and the first choice
still sign in alike.
A 300-character active name is cut to 256 in the warning; select keeps
the warning; and choosing no configuration while one is held warns of
nothing.
@odgrim
odgrim force-pushed the track-a/google-missing-active-config branch from 7d7574c to 18a505d Compare December 6, 2026 16:04
@odgrim
odgrim added this pull request to stack #119 December 6, 2026 16:05

This branch has not been deployed

No deployments
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