Skip to content

Commit 86e1b67

Browse files
juliusmarmingecodex
andcommitted
Fix PR review comments
Co-authored-by: codex <[email protected]>
1 parent d6afc6d commit 86e1b67

6 files changed

Lines changed: 37 additions & 15 deletions

File tree

‎apps/web/src/rpc/wsTransport.test.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,7 @@ describe("WsTransport", () => {
327327

328328
await transport.dispose();
329329

330-
expect(onClose).toHaveBeenCalledWith(
331-
{
332-
code: 1000,
333-
reason: "",
334-
},
335-
{
336-
intentional: true,
337-
},
338-
);
330+
expect(onClose).not.toHaveBeenCalled();
339331
expect(getWsConnectionStatus()).toMatchObject({
340332
connectionLabel: "Remote Mac mini",
341333
phase: "connected",

‎apps/web/src/rpc/wsTransport.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export class WsTransport {
247247
Layer.mergeAll(
248248
createWsRpcProtocolLayer(this.url, {
249249
...this.lifecycleHandlers,
250-
isActive: () => this.activeSessionId === sessionId,
250+
isActive: () => !this.disposed && this.activeSessionId === sessionId,
251251
isCloseIntentional: () =>
252252
this.disposed ||
253253
this.intentionalCloseDepth > 0 ||

‎packages/ssh/src/config.test.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ describe("ssh config", () => {
2525
yield* fs.makeDirectory(path.join(sshDir, "config.d"), { recursive: true });
2626
yield* fs.writeFileString(
2727
path.join(sshDir, "config"),
28-
["Host devbox", " HostName devbox.example.com", "Include config.d/*.conf", ""].join("\n"),
28+
[
29+
"Host devbox",
30+
" HostName devbox.example.com",
31+
"Host=equalsbox",
32+
"Include=config.d/*.conf",
33+
"",
34+
].join("\n"),
2935
);
3036
yield* fs.writeFileString(
3137
path.join(sshDir, "config.d", "team.conf"),
@@ -63,6 +69,13 @@ describe("ssh config", () => {
6369
port: null,
6470
source: "ssh-config",
6571
},
72+
{
73+
alias: "equalsbox",
74+
hostname: "equalsbox",
75+
username: null,
76+
port: null,
77+
source: "ssh-config",
78+
},
6679
{
6780
alias: "known.example.com",
6881
hostname: "known.example.com",

‎packages/ssh/src/config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function stripInlineComment(line: string): string {
1313

1414
function splitDirectiveArgs(value: string): ReadonlyArray<string> {
1515
return value
16+
.replace(/=(?!=)/gu, " ")
1617
.trim()
1718
.split(/\s+/u)
1819
.map((entry) => entry.trim())

‎packages/ssh/src/tunnel.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
buildRemotePairingScript,
1313
buildRemoteStopScript,
1414
buildRemoteT3RunnerScript,
15+
describeReadinessCause,
1516
issueRemotePairingToken,
1617
REMOTE_PICK_PORT_SCRIPT,
1718
SshEnvironmentManager,
@@ -192,6 +193,23 @@ describe("ssh tunnel scripts", () => {
192193
),
193194
);
194195

196+
it("preserves primitive readiness reason values in diagnostic output", () => {
197+
assert.deepEqual(
198+
describeReadinessCause({
199+
_tag: "HttpClientError",
200+
message: "Backend readiness probe failed.",
201+
reason: "authentication failed",
202+
cause: "upstream closed",
203+
}),
204+
{
205+
_tag: "HttpClientError",
206+
message: "Backend readiness probe failed.",
207+
reason: "authentication failed",
208+
cause: "upstream closed",
209+
},
210+
);
211+
});
212+
195213
it.effect("accepts pretty-printed pairing JSON from the remote CLI", () => {
196214
const target = {
197215
alias: "devbox",

‎packages/ssh/src/tunnel.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function applyScriptPlaceholders(
192192
return result;
193193
}
194194

195-
function describeReadinessCause(cause: unknown): unknown {
195+
export function describeReadinessCause(cause: unknown): unknown {
196196
if (cause instanceof SshReadinessError) {
197197
return {
198198
_tag: cause._tag,
@@ -215,9 +215,7 @@ function describeReadinessCause(cause: unknown): unknown {
215215
return {
216216
...(typeof record._tag === "string" ? { _tag: record._tag } : {}),
217217
...(typeof record.message === "string" ? { message: record.message } : {}),
218-
...(typeof record.reason === "object" && record.reason !== null
219-
? { reason: describeReadinessCause(record.reason) }
220-
: {}),
218+
...(record.reason === undefined ? {} : { reason: describeReadinessCause(record.reason) }),
221219
...(record.cause === undefined ? {} : { cause: describeReadinessCause(record.cause) }),
222220
};
223221
}

0 commit comments

Comments
 (0)