Skip to content

Commit 9251ff1

Browse files
PR Batch Testerclaude
andcommitted
fix(server): guest sharing reads the running connector after the merge
Main's guest sharing calls inspectConnector without a tunnel config. Keep the config optional so it still reads whichever connector is running, while T3 Connect reachability checks the saved one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 23347ba commit 9251ff1

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎apps/server/src/cloud/ManagedEndpointRuntime.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export class CloudManagedEndpointRuntime extends Context.Service<
5757
readonly applyConfig: (
5858
config: RelayManagedEndpointRuntimeConfig | null,
5959
) => Effect.Effect<CloudManagedEndpointRuntimeStatus>;
60-
/** `null` when no running connector matches this configuration. */
60+
/** `null` when no connector is running, or, given a configuration, none matches it. */
6161
readonly inspectConnector: (
62-
config: RelayManagedEndpointRuntimeConfig,
62+
config?: RelayManagedEndpointRuntimeConfig,
6363
) => Effect.Effect<ConnectorFacts | null>;
6464
/** Emits when a connector registers a connection or its readiness changes. */
6565
readonly readinessChanged: Stream.Stream<void>;
@@ -733,12 +733,12 @@ export const make = Effect.gen(function* () {
733733
);
734734

735735
const inspectConnector = Effect.fn("CloudManagedEndpointRuntime.inspectConnector")(function* (
736-
expectedConfig: RelayManagedEndpointRuntimeConfig,
736+
expectedConfig?: RelayManagedEndpointRuntimeConfig,
737737
) {
738738
const active = yield* Ref.get(activeRef);
739739
if (
740740
!active ||
741-
active.configKey !== runtimeConfigKey(expectedConfig) ||
741+
(expectedConfig !== undefined && active.configKey !== runtimeConfigKey(expectedConfig)) ||
742742
!(yield* active.child.isRunning.pipe(Effect.orElseSucceed(() => false)))
743743
) {
744744
return null;

‎apps/server/src/guest/GuestShareService.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ const layerOrchestration = Layer.mergeAll(
7272
// The Connect hostname the fake tunnel reports. Tests set it to null to simulate an unlink.
7373
const hostname = Ref.makeUnsafe<string | null>("env.t3.test");
7474
const layerConnect = Layer.mock(CloudManagedEndpointRuntime)({
75-
inspectConnector: Effect.map(Ref.get(hostname), (value) => ({
76-
readyConnections: 1,
77-
hostname: value,
78-
protocol: "http2",
79-
})),
75+
inspectConnector: () =>
76+
Effect.map(Ref.get(hostname), (value) => ({
77+
readyConnections: 1,
78+
hostname: value,
79+
protocol: "http2",
80+
})),
8081
});
8182
const layerProviders = Layer.mock(ProviderRegistry.ProviderRegistry)({
8283
getProviders: Effect.succeed([]),

‎apps/server/src/guest/GuestShareService.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ const make = Effect.gen(function* () {
259259
return decodeSessionClaims(base64UrlDecodeUtf8(parts.payload));
260260
});
261261

262-
const connectHostname = managedEndpoint.inspectConnector.pipe(
263-
Effect.map((facts) => facts?.hostname ?? null),
264-
);
262+
const connectHostname = managedEndpoint
263+
.inspectConnector()
264+
.pipe(Effect.map((facts) => facts?.hostname ?? null));
265265
// A beta: while it is off, no link opens and every guest request is refused.
266266
const sharingEnabled = serverSettings.getSettings.pipe(
267267
Effect.map((settings) => settings.guestSharingEnabled),

0 commit comments

Comments
 (0)