From d45cbde1cd6026f7a99a4f584cd16d1012b5a4b0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 22 Jun 2026 16:12:01 +0000 Subject: [PATCH] Format managed relay Effect refactor Co-authored-by: Julius Marminge --- apps/mobile/src/connection/platform.ts | 10 ++++++---- apps/web/src/connection/platform.ts | 10 ++++++---- .../client-runtime/src/relay/managedRelayState.ts | 14 +++----------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/apps/mobile/src/connection/platform.ts b/apps/mobile/src/connection/platform.ts index e55b14760c..0af1adddac 100644 --- a/apps/mobile/src/connection/platform.ts +++ b/apps/mobile/src/connection/platform.ts @@ -106,10 +106,12 @@ const capabilitiesLayer = Layer.succeedContext( ); return yield* Option.match(token, { onNone: () => - Effect.fail(new ConnectionBlockedError({ - reason: "authentication", - detail: "The T3 Cloud session is unavailable.", - })), + Effect.fail( + new ConnectionBlockedError({ + reason: "authentication", + detail: "The T3 Cloud session is unavailable.", + }), + ), onSome: Effect.succeed, }); }), diff --git a/apps/web/src/connection/platform.ts b/apps/web/src/connection/platform.ts index 32b148dac6..e2a2385d9a 100644 --- a/apps/web/src/connection/platform.ts +++ b/apps/web/src/connection/platform.ts @@ -178,10 +178,12 @@ const capabilitiesLayer = Layer.effectContext( ); return yield* Option.match(token, { onNone: () => - Effect.fail(new ConnectionBlockedError({ - reason: "authentication", - detail: "The T3 Cloud session is unavailable.", - })), + Effect.fail( + new ConnectionBlockedError({ + reason: "authentication", + detail: "The T3 Cloud session is unavailable.", + }), + ), onSome: Effect.succeed, }); }), diff --git a/packages/client-runtime/src/relay/managedRelayState.ts b/packages/client-runtime/src/relay/managedRelayState.ts index 0285eea866..3c56585161 100644 --- a/packages/client-runtime/src/relay/managedRelayState.ts +++ b/packages/client-runtime/src/relay/managedRelayState.ts @@ -113,10 +113,7 @@ interface ManagedRelaySessionCacheState { } function isFreshCachedToken(cachedToken: CachedClerkToken, nowMillis: number): boolean { - return ( - cachedToken.expiresAtMillis > - nowMillis + Duration.toMillis(CLERK_TOKEN_EXPIRY_SKEW) - ); + return cachedToken.expiresAtMillis > nowMillis + Duration.toMillis(CLERK_TOKEN_EXPIRY_SKEW); } function decodeCachedToken(token: string): Option.Option { @@ -174,10 +171,7 @@ export function createManagedRelaySession(input: ManagedRelaySessionInput): Mana yield* Deferred.failCause(deferred, readExit.cause).pipe(Effect.orDie); } - if ( - Option.isSome(state.pendingToken) && - state.pendingToken.value.deferred === deferred - ) { + if (Option.isSome(state.pendingToken) && state.pendingToken.value.deferred === deferred) { state = { ...state, pendingToken: Option.none(), @@ -286,9 +280,7 @@ function requireClerkToken( ): Effect.Effect { const session = get(managedRelaySessionAtom); if (!session || session.accountId !== accountId) { - return Effect.fail( - new ManagedRelaySessionTokenUnavailableError({ reason: "missing-session" }), - ); + return Effect.fail(new ManagedRelaySessionTokenUnavailableError({ reason: "missing-session" })); } return readSessionClerkToken(session); }