Skip to content

Commit ee67bb3

Browse files
fix(connections): preserve explicit pairing input precedence
1 parent 238b2fa commit ee67bb3

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎packages/client-runtime/src/connection/registry.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,17 @@ describe("EnvironmentRegistry routes", () => {
21052105
expectedEnvironmentId: RELAY_TARGET.environmentId,
21062106
};
21072107
yield* onboarding.registerPairing(input);
2108+
const connectProfiles = yield* Ref.get(harness.storedProfiles);
2109+
expect(
2110+
yield* onboarding
2111+
.registerPairing({
2112+
...input,
2113+
pairingUrl: input.host,
2114+
pairingCode: "pairing-code",
2115+
})
2116+
.pipe(Effect.flip),
2117+
).toMatchObject({ _tag: "ConnectionBlockedError", reason: "configuration" });
2118+
expect(yield* Ref.get(harness.storedProfiles)).toEqual(connectProfiles);
21082119
yield* onboarding.registerPairing({ ...input, pairingCode: "pairing-code" });
21092120
const pairedProfiles = yield* Ref.get(harness.storedProfiles);
21102121
const pairedCredentials = yield* Ref.get(harness.storedCredentials);

‎packages/shared/src/remote.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export const resolveRemoteAddressWithoutCredential = (input: {
254254
}): { readonly httpBaseUrl: string; readonly wsBaseUrl: string } | null => {
255255
const pairingUrl = input.pairingUrl?.trim() ?? "";
256256
const raw = (pairingUrl || input.host?.trim() || "").replace(/^\/+/, "");
257-
if (raw === "" || (pairingUrl === "" && (input.pairingCode?.trim() ?? "") !== "")) return null;
257+
if (raw === "" || (input.pairingCode?.trim() ?? "") !== "") return null;
258258
let url: URL;
259259
try {
260260
if (/^[a-zA-Z][a-zA-Z\d+-]*:\/\//.test(raw)) {

0 commit comments

Comments
 (0)