Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): retry transient bearer bootstrap and degrade on session fetch failure #12919

Mergedjamesvillarrubia(GitHub profile, opens in a new tab)merged 7 commits intomain fromrefs/pull/12919/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 119 additions and 0 deletions.

x
0 of 2 viewed, 2 left
90 additions and 0 deletionsapps/desktop/src/backend/DesktopLocalEnvironmentAuth.test.tsModified
View file
@@ -1,8 +1,11 @@
import { assert, describe, it } from "@effect/vitest";
+import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
+import * as Fiber from "effect/Fiber";
import * as Layer from "effect/Layer";
import * as Ref from "effect/Ref";
import * as HttpClient from "effect/http/HttpClient";
+import * as HttpClientRequest from "effect/http/HttpClientRequest";
import * as HttpClientResponse from "effect/http/HttpClientResponse";
import { PRIMARY_LOCAL_ENVIRONMENT_ID } from "@t3tools/contracts";
import {
@@ -144,4 +147,91 @@
}).pipe(Effect.provide(TestClock.layer())),
+​
+ const tokenResponse = (request: HttpClientRequest.HttpClientRequest) =>
+ HttpClientResponse.fromWeb(
+ request,
+ new Response(
+ JSON.stringify({
+ access_token: "desktop-bearer-token",
+ issued_token_type: "urn:ietf:params:oauth:token-type:access_token",
+ token_type: "Bearer",
+ expires_in: 3600,
+ scope: "orchestration:read",
+ }),
+ { status: 200, headers: { "content-type": "application/json" } },
+ ),