auth: distinguish "validation failed" from "couldn't validate" in auth profiles#5216
Draft
janniklasrose wants to merge 1 commit intomainfrom
Draft
auth: distinguish "validation failed" from "couldn't validate" in auth profiles#5216janniklasrose wants to merge 1 commit intomainfrom
auth profiles#5216janniklasrose wants to merge 1 commit intomainfrom
Conversation
…th profiles` Replace the binary `valid: true|false` with a three-state `status` (valid / invalid / unknown) plus an optional `error` description, so users can tell an expired token apart from a network blip. The legacy `valid` field is now a `*bool`: emitted only when the result is conclusive, omitted for transient errors that previously misreported as `valid: false`. Adds a 10s per-profile validation timeout (also bounding `EnsureResolved`'s host-metadata fetch via `HTTPTimeoutSeconds`/`RetryTimeoutSeconds`) so a single dead host no longer stalls the whole listing. Co-authored-by: Isaac
Contributor
Approval status: pending
|
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.
Changes
databricks auth profilesnow reports a three-state result per profile via a newstatusfield (valid,invalid,unknown,unvalidated) plus an optionalerrordescribing what went wrong.invalidwith a re-login hint, 403 →invalidwith a permissions hint, 5xx / network failure / timeout →unknown(the profile may be fine, the platform isn't reachable).--skip-validatereportsunvalidated.validfield is now*booland emitted only when the answer is conclusive:trueon success,falsefor proven-bad profiles, omitted for transient/unknown cases that previously misreported asvalid: false.cfg.HTTPTimeoutSeconds/cfg.RetryTimeoutSecondsso a hung host-metadata fetch inEnsureResolved(which runs oncontext.Backgroundinternally) can't stall the listing past that ceiling.Validnow rendersvalid(green) /invalid(red) /unknown(yellow) /-instead ofYES/NO.Why
A single
valid: falsewas overloaded across very different conditions — expired token, no network, 5xx from the workspace, malformed config, missing host. Users seeing redNOeverywhere had no way to tell whether to re-login, check the VPN, or fix the file. Three-state reporting plus an error string gives them an actionable signal. The legacy field is preserved (as*bool) for the optimistic-path consumers we know about; scripts that branched onvalid: falsewill start seeing the field absent for the cases where we genuinely couldn't tell.The per-profile timeout keeps
auth profilessnappy: previously a single dead host would retry for ~5 minutes against the SDK's defaultRetryTimeoutSeconds, blocking the whole listing.Tests
cmd/auth/profiles_test.go:TestClassifyValidationError— table-driven coverage of the error →(status, message)mapping (nil, deadline-exceeded, 401, 403, 500, 503, network, fallthrough).TestProfileLoadStatusMatrix— integration viahttptest: 401, 403, 500, network-down (closed server),InvalidConfig(viaexperimental_is_unified_host=truewithout an account ID), and--skip-validate.TestProfileLoadSPOGConfigType/TestProfileLoadNoDiscoveryStaysWorkspaceupdated to assert againstStatusinstead of the now-pointerValid.acceptance/cmd/auth/profiles/:expired-token/— 401 from the SCIM/Meendpoint producesstatus: "invalid",valid: false, and the remediation hint.server-error/— 500 producesstatus: "unknown"withvalidomitted.auth/login,auth/logout,auth/switch, andauth/host-metadata-cachethat includeauth profilesoutput)../task fmt,./task checks,./task lint, and the relevant unit + acceptance test runs all pass locally. The only failing tests on this machine (bundle/deploy/spark-jar-task,apps/runlocal/TestNodeApp*) are unrelated environment issues — missing Java runtime andNODE_OPTIONSinjected by my dev shell.This PR was written by Claude Code.