Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(connect): stop reporting a loading cloud session as a sign-in change #11013

MergedProject516(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/11013/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 35 additions and 8 deletions.

x
0 of 3 viewed, 3 left
23 additions and 7 deletionspackages/client-runtime/src/authorization/layer.test.tsModified
View file
@@ -888,6 +888,29 @@
}),
​
+ it.effect("retries instead of blocking while the cloud session has not loaded", () =>
+ Effect.gen(function* () {
+ const harness = yield* makeHarness({
+ responses: [Response.json(DESCRIPTOR), accessToken("loaded-token")],
+ });
+ yield* Ref.set(harness.session, Option.none());
+ yield* Effect.gen(function* () {
+ const remote = yield* RemoteEnvironmentAuthorization.RemoteEnvironmentAuthorization;
+ const pending = yield* remote
+ .authorizeDpopHttp({ expectedEnvironmentId: ENVIRONMENT_ID })
+ .pipe(Effect.flip);
+ expect(pending).toMatchObject({
+ _tag: "ConnectionTransientError",
+ reason: "session-pending",
+ });
+ yield* Ref.set(harness.session, Option.some({ accountId: "account-1" }));
+ const loaded = yield* remote.authorizeDpopHttp({ expectedEnvironmentId: ENVIRONMENT_ID });
+ expect(loaded.httpAuthorization.accessToken).toBe("loaded-token");
+ }).pipe(Effect.provide(harness.layer));
+ expect(yield* Ref.get(harness.bootstrapCalls)).toBe(1);
+ }),
+ );
+​
it.effect("does not return or persist credentials after logout during renewal", () =>
Effect.gen(function* () {
const started = yield* Deferred.make<void>();