Skip to content

Commit 1ead03a

Browse files
Merge upstream browser fixes and preserve request timeout isolation
2 parents f07b86a + d9f7c0c commit 1ead03a

864 files changed

Lines changed: 46082 additions & 10942 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.coderabbit.config.ts‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
import { defineConfig, type CodeRabbitContext } from "@coderabbitai/config";
22

3-
const approvability = `Fail when a maintainer should read this pull request before CodeRabbit approves it, and name the rule and file. Fail if it:
4-
5-
- Changes a product default: a setting's default value, or what users get without opting in. Making a feature do what it already promises is a bug fix, not a default change.
6-
- Adds or broadens a directive that disables or suppresses a lint, type-checker, LSP, or other static-analysis diagnostic, including file-level, line-level, and configuration-level overrides.
7-
- Adds a subsystem or user workflow, or is a large refactor across apps or packages.
8-
- Changes packages/contracts or persisted data in a way that existing clients or stored data might not accept.
9-
- Changes authentication, pairing, credentials, secrets, or remote connection trust.
10-
- Adds or changes an external side effect, such as acting on GitHub, publishing a release, or calling a webhook.
11-
- Adds, upgrades, or patches a dependency.
12-
- Changes CI or release configuration, agent or contributor instructions, or any review tool's configuration, including .github/, AGENTS.md, CONTRIBUTING.md, .agents/, and .coderabbit.config.ts.
13-
14-
Otherwise pass. A focused bug fix, copy or layout fix, revert, or docs-only or test-only change passes unless a rule above applies. If you cannot decide, fail rather than report inconclusive. When failing, say that the pull request needs a maintainer's review.
15-
`;
16-
173
// Org members and collaborators merge their own pull requests. On anyone else's, CodeRabbit
18-
// requests changes until its comments are resolved and its checks pass, then approves.
4+
// requests changes until its comments are resolved, then approves.
195
const UNGATED_AUTHORS = new Set(["OWNER", "MEMBER", "COLLABORATOR"]);
206
const isGated = ({ pr }: CodeRabbitContext) => !UNGATED_AUTHORS.has(pr?.authorAssociation ?? "");
217

@@ -31,13 +17,6 @@ export default defineConfig((ctx) => ({
3117
pre_merge_checks: {
3218
docstrings: { mode: "off" },
3319
override_requested_reviewers_only: isGated(ctx),
34-
custom_checks: [
35-
{
36-
name: "Approvability",
37-
mode: isGated(ctx) ? "error" : "off",
38-
instructions: approvability,
39-
},
40-
],
4120
},
4221
path_filters: [
4322
// Vendored read-only reference checkouts of upstream Effect and Alchemy

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@t3tools/tailscale": "workspace:*",
2525
"dbus-next": "0.10.2",
2626
"effect": "catalog:",
27-
"electron": "44.4.2",
27+
"electron": "44.4.5",
2828
"electron-store": "^8.2.0",
2929
"electron-updater": "^6.8.9",
3030
"ffi-rs": "1.3.2",

‎apps/desktop/src/app/DesktopAppIdentity.test.ts‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ describe("DesktopAppIdentity", () => {
217217
const identity = yield* DesktopAppIdentity.DesktopAppIdentity;
218218
yield* identity.configure;
219219

220-
assert.deepEqual(calls.setName, ["T3 Code (Alpha)"]);
220+
assert.deepEqual(calls.setName, ["T3 Code Alpha"]);
221221
assert.equal(calls.setAboutPanelOptions[0]?.applicationName, "T3 Code (Alpha)");
222222
assert.equal(calls.setAboutPanelOptions[0]?.applicationVersion, "1.2.3");
223223
assert.equal(calls.setAboutPanelOptions[0]?.version, "0123456789ab");
@@ -237,6 +237,39 @@ describe("DesktopAppIdentity", () => {
237237
);
238238
});
239239

240+
it.effect.each([
241+
{ stage: "Alpha", environment: {} },
242+
{
243+
stage: "Nightly",
244+
environment: { appVersion: "0.0.43-nightly.20260929.2428" },
245+
},
246+
{
247+
stage: "Dev",
248+
environment: { env: { VITE_DEV_SERVER_URL: "http://localhost:5173" } },
249+
},
250+
])("uses a valid native User-Agent product name for $stage", ({ stage, environment }) => {
251+
const calls: ElectronAppCalls = {
252+
setAboutPanelOptions: [],
253+
setDockIcon: [],
254+
setName: [],
255+
};
256+
257+
return withIdentity(
258+
Effect.gen(function* () {
259+
const identity = yield* DesktopAppIdentity.DesktopAppIdentity;
260+
yield* identity.configure;
261+
262+
const runtimeName = calls.setName[0];
263+
assert.isDefined(runtimeName);
264+
assert.equal(runtimeName, `T3 Code ${stage}`);
265+
// RFC 9110's token grammar, after Electron removes ASCII spaces.
266+
assert.match(runtimeName.replaceAll(" ", ""), /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/);
267+
assert.equal(calls.setAboutPanelOptions[0]?.applicationName, `T3 Code (${stage})`);
268+
}),
269+
{ calls, environment },
270+
);
271+
});
272+
240273
it.effect("sets the dock icon only when running unpackaged", () => {
241274
const calls: ElectronAppCalls = {
242275
setAboutPanelOptions: [],

‎apps/desktop/src/app/DesktopAppIdentity.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ export const make = Effect.gen(function* () {
9191

9292
const configure = Effect.gen(function* () {
9393
const commitHash = yield* resolveAboutCommitHash;
94-
yield* electronApp.setName(environment.displayName);
94+
// Electron removes spaces from this name to build the native User-Agent
95+
// product token, but leaves parentheses intact. Keep the runtime name valid
96+
// without rewriting preview sessions (which breaks Turnstile, #7110).
97+
yield* electronApp.setName(
98+
`${environment.branding.baseName} ${environment.branding.stageLabel}`,
99+
);
95100
yield* electronApp.setAboutPanelOptions({
96101
applicationName: environment.displayName,
97102
applicationVersion: environment.appVersion,

‎apps/desktop/src/app/DesktopLifecycle.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ function layerDesktopWindow(
9696
dispatchMenuAction: () => Effect.void,
9797
dispatchSnapShotEvent: () => Effect.void,
9898
zoomMain: () => Effect.void,
99+
runMainContentsCommand: () => Effect.void,
99100
syncAppearance: Effect.void,
100101
});
101102
}

‎apps/desktop/src/backend/DesktopBackendPool.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.De
100100
dispatchMenuAction: () => Effect.die("unexpected menu action"),
101101
dispatchSnapShotEvent: () => Effect.void,
102102
zoomMain: () => Effect.die("unexpected zoom"),
103+
runMainContentsCommand: () => Effect.die("unexpected main contents command"),
103104
syncAppearance: Effect.void,
104105
} satisfies DesktopWindow.DesktopWindow["Service"]),
105106
),

‎apps/desktop/src/electron/ElectronDialog.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ export class ElectronDialog extends Context.Service<
9595
readonly pickFiles: (
9696
input: ElectronDialogPickFilesInput,
9797
) => Effect.Effect<readonly string[], ElectronDialogPickFilesError>;
98+
/** Pass `owner` to attach the box to that window so it cannot fall behind it. */
9899
readonly showMessageBox: (
99100
options: Electron.MessageBoxOptions,
101+
owner?: Electron.BrowserWindow,
100102
) => Effect.Effect<Electron.MessageBoxReturnValue, ElectronDialogShowMessageBoxError>;
101103
readonly showErrorBox: (title: string, content: string) => Effect.Effect<void>;
102104
}
@@ -164,9 +166,12 @@ export const make = ElectronDialog.of({
164166
});
165167
return result.canceled ? [] : result.filePaths;
166168
}),
167-
showMessageBox: (options) =>
169+
showMessageBox: (options, owner) =>
168170
Effect.tryPromise({
169-
try: () => Electron.dialog.showMessageBox(options),
171+
try: () =>
172+
owner === undefined
173+
? Electron.dialog.showMessageBox(options)
174+
: Electron.dialog.showMessageBox(owner, options),
170175
catch: (cause) =>
171176
new ElectronDialogShowMessageBoxError({
172177
type: options.type ?? null,

‎apps/desktop/src/electron/ElectronShell.test.ts‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ describe("ElectronShell", () => {
106106
}).pipe(Effect.provide(ElectronShell.layer)),
107107
);
108108

109+
it.effect("opens the JetBrains Toolbox ssh deep link", () =>
110+
Effect.gen(function* () {
111+
openExternalMock.mockResolvedValue(undefined);
112+
113+
const url =
114+
"jetbrains://gateway/ssh/environment?h=example.com&launchIde=true&ideHint=IU&projectHint=%2Fhome%2Fuser%2Fproject";
115+
const electronShell = yield* ElectronShell.ElectronShell;
116+
const result = yield* electronShell.openExternal(url);
117+
118+
assert.equal(result, true);
119+
assert.deepEqual(openExternalMock.mock.calls, [[url]]);
120+
}).pipe(Effect.provide(ElectronShell.layer)),
121+
);
122+
109123
it.effect("does not open editor URLs that mix up link shapes", () =>
110124
Effect.gen(function* () {
111125
openExternalMock.mockResolvedValue(undefined);
@@ -114,9 +128,12 @@ describe("ElectronShell", () => {
114128
const results = yield* Effect.all([
115129
electronShell.openExternal("zed://extension/attacker"),
116130
electronShell.openExternal("vscode://ssh/example.com/home/user/project"),
131+
electronShell.openExternal("jetbrains://idea/navigate/reference?project=x&path=y"),
132+
electronShell.openExternal("jetbrains://gateway/ssh/environment?launchIde=true"),
133+
electronShell.openExternal("jetbrains://gateway/com.example.provider/connect?h=x"),
117134
]);
118135

119-
assert.deepEqual(results, [false, false]);
136+
assert.deepEqual(results, [false, false, false, false, false]);
120137
assert.equal(openExternalMock.mock.calls.length, 0);
121138
}).pipe(Effect.provide(ElectronShell.layer)),
122139
);
@@ -134,9 +151,10 @@ describe("ElectronShell", () => {
134151
"vscode://:secret@vscode-remote/ssh-remote+example.com/home/user/project",
135152
),
136153
electronShell.openExternal("zed://ssh/[email protected]/home/user/project"),
154+
electronShell.openExternal("jetbrains://user@gateway/ssh/environment?h=example.com"),
137155
]);
138156

139-
assert.deepEqual(results, [false, false, false]);
157+
assert.deepEqual(results, [false, false, false, false]);
140158
assert.equal(openExternalMock.mock.calls.length, 0);
141159
}).pipe(Effect.provide(ElectronShell.layer)),
142160
);

‎apps/desktop/src/electron/ElectronShell.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import * as Option from "effect/Option";
1212
import * as Electron from "electron";
1313

1414
// Remote open-in-editor deep links (`vscode://vscode-remote/ssh-remote+…`,
15-
// `zed://ssh/<host>/<path>`) must reach the OS handler; every other non-web
16-
// scheme stays blocked.
15+
// `zed://ssh/<host>/<path>`, `jetbrains://gateway/ssh/environment?h=…`) must
16+
// reach the OS handler; every other non-web scheme stays blocked.
1717
const SAFE_WEB_PROTOCOLS = new Set(["http:", "https:"]);
1818
const REMOTE_EDITOR_PROTOCOLS = new Set(
1919
REMOTE_CAPABLE_EDITOR_IDS.flatMap((id) => {
@@ -31,9 +31,13 @@ const isRemoteEditorUrl = (url: URL) =>
3131
url.password.length === 0 &&
3232
(url.protocol === "zed:"
3333
? url.host === "ssh" && ZED_SSH_PATHNAME.test(url.pathname)
34-
: url.host === "vscode-remote" &&
35-
url.pathname.startsWith("/ssh-remote+") &&
36-
url.pathname.length > "/ssh-remote+".length);
34+
: url.protocol === "jetbrains:"
35+
? url.host === "gateway" &&
36+
url.pathname === "/ssh/environment" &&
37+
(url.searchParams.get("h") ?? "").length > 0
38+
: url.host === "vscode-remote" &&
39+
url.pathname.startsWith("/ssh-remote+") &&
40+
url.pathname.length > "/ssh-remote+".length);
3741

3842
export function parseSafeExternalUrl(rawUrl: unknown): Option.Option<string> {
3943
if (typeof rawUrl !== "string") {

‎apps/desktop/src/ipc/channels.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export const PREVIEW_RECORDING_SAVE_CHANNEL = "desktop:preview-recording-save";
109109
export const PREVIEW_RECORDING_FRAME_CHANNEL = "desktop:preview-recording-frame";
110110
export const PREVIEW_STATE_CHANGE_CHANNEL = "desktop:preview-state-change";
111111
export const PREVIEW_POINTER_EVENT_CHANNEL = "desktop:preview-pointer-event";
112+
export const PREVIEW_OPEN_LINK_CHANNEL = "desktop:preview-open-link";
112113

113114
export const MAC_PERMISSION_HELPER_CHANNEL = "desktop:mac-permission-helper";
114115

0 commit comments

Comments
 (0)