You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal: guarantee exactly one browser login per process even under dbt multi-threaded mode
(one Connection per worker) — the browser bounces once, not once per worker.
Scope (in): a module-level singleton owning the provider + TokenSet; login single-flight via
a one-shot ready future (first connect() logs in, the rest block on its completion-or-failure and
share it); the one-identity guard (a later connect() naming a different organization_id raises InterfaceError; an omitted one inherits the established org); a shutdown_all() escape hatch for
test isolation and tidy teardown.
Deferred to child 7: the refcount + park-don't-evict + linger lifecycle. Without a
background thread there is nothing to park at refcount 0, so the baseline holder simply keeps the
shared provider alive until shutdown_all() or interpreter exit — the holder-side half of the
daemon simplification.
Out of scope:connect() invoking it (child 5) — this child is built and concurrency-tested
standalone first; the daemon and its refcount lifecycle (child 7).
Prior art:mcp-confluent is the direct analogue — oauth/oauth-holder.tsOAuthHolder owns
the single AuthContext, with ensureLoggedIn() single-flight via a shared inFlightLogin
promise; the "one OAuth identity" rule is enforced at config load (rejects multiple type: oauth
connections — CONFIGURATION.md). ide-sidecar is the counter-example: no process-wide
identity — auth is per-connection (CCloudConnectionState each owns a CCloudOAuthContext), the
only app-wide singleton being the connection registry ConnectionStateManager. That per-connection
duplication is exactly what our holder exists to avoid.
Sized right: singleton + login single-flight + concurrency tests; no daemon, no refcount, no connect() surface yet.
(one
Connectionper worker) — the browser bounces once, not once per worker.TokenSet; login single-flight viaa one-shot ready future (first
connect()logs in, the rest block on its completion-or-failure andshare it); the one-identity guard (a later
connect()naming a differentorganization_idraisesInterfaceError; an omitted one inherits the established org); ashutdown_all()escape hatch fortest isolation and tidy teardown.
background thread there is nothing to park at refcount 0, so the baseline holder simply keeps the
shared provider alive until
shutdown_all()or interpreter exit — the holder-side half of thedaemon simplification.
connect()invoking it (child 5) — this child is built and concurrency-testedstandalone first; the daemon and its refcount lifecycle (child 7).
CCloudOAuthprovider: login + on-request refresh + two auth views #153.oauth/oauth-holder.tsOAuthHolderownsthe single
AuthContext, withensureLoggedIn()single-flight via a sharedinFlightLoginpromise; the "one OAuth identity" rule is enforced at config load (rejects multiple
type: oauthconnections —
CONFIGURATION.md). ide-sidecar is the counter-example: no process-wideidentity — auth is per-connection (
CCloudConnectionStateeach owns aCCloudOAuthContext), theonly app-wide singleton being the connection registry
ConnectionStateManager. That per-connectionduplication is exactly what our holder exists to avoid.
connect()surface yet.