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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S3fTN8H3R8YV4yUGvZjYnX
This commit is contained in:
parent
4e149719bd
commit
588fc3f8ea
1 changed files with 10 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue