From 588fc3f8ea0acac3a3e2b67b60dd3226d70a4747 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Wed, 1 Jul 2026 19:31:10 -0400 Subject: [PATCH] docs(auth): note getClientRegistrationKind's hydration invariant like getScope Round-3 @claude review of #1592 (optional nit): getClientRegistrationKind is the other synchronous getter that, like getScope, is safe only because its sole caller (buildOAuthConnectionState) awaits getClientInformation/ getServerMetadata first, flushing hydration before this runs on the post-redirect callback path. Add a docstring mirroring getScope's so a future refactor doesn't read it without a preceding awaited storage read. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01S3fTN8H3R8YV4yUGvZjYnX --- core/auth/oauth-storage.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/auth/oauth-storage.ts b/core/auth/oauth-storage.ts index 040e5a32..b428392e 100644 --- a/core/auth/oauth-storage.ts +++ b/core/auth/oauth-storage.ts @@ -141,6 +141,16 @@ export class OAuthStorageBase implements OAuthStorage { return await OAuthClientInformationSchema.parseAsync(clientInfo); } + /** + * Intentionally synchronous — same invariant as {@link getScope}: safe + * without awaiting hydration only because a preceding awaited read has + * already flushed it. Its sole caller, `buildOAuthConnectionState` + * (`connection-state.ts`), reads this right after awaiting + * `getClientInformation`/`getServerMetadata`, so on the post-redirect + * callback path (where the in-memory store is reset) hydration has landed + * by the time this runs. A future refactor reading it without a preceding + * awaited storage read would get a pre-hydration `undefined`. + */ getClientRegistrationKind( serverUrl: string, ): OAuthClientRegistrationKind | undefined {