Skip to content

Commit 6df6b16

Browse files
Merge commit 'f87ecf0cc307f974745da8eea856fab5711023f3' into fix/audit-editor-wrapped-scroll
2 parents 634ee09 + f87ecf0 commit 6df6b16

30 files changed

Lines changed: 312 additions & 324 deletions

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ describe("ElectronDialog", () => {
4343
);
4444

4545
assert.instanceOf(error, ElectronDialog.ElectronDialogPickFolderError);
46-
assert.isTrue(ElectronDialog.isElectronDialogError(error));
4746
assert.strictEqual(error.ownerWindowId, 7);
4847
assert.strictEqual(error.defaultPath, "/workspace");
4948
assert.strictEqual(error.cause, cause);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export const ElectronDialogError = Schema.Union([
7373
ElectronDialogShowErrorBoxError,
7474
]);
7575
export type ElectronDialogError = typeof ElectronDialogError.Type;
76-
export const isElectronDialogError = Schema.is(ElectronDialogError);
7776

7877
export interface ElectronDialogPickFolderInput {
7978
readonly owner: Option.Option<Electron.BrowserWindow>;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ describe("ElectronTheme", () => {
6464
const error = yield* Effect.flip(electronTheme.setSource("dark"));
6565

6666
assert.instanceOf(error, ElectronTheme.ElectronThemeSetSourceError);
67-
assert.isTrue(ElectronTheme.isElectronThemeSetSourceError(error));
6867
assert.strictEqual(error.source, "dark");
6968
assert.strictEqual(error.cause, cause);
7069
assert.include(error.message, "dark");

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ export class ElectronThemeSetSourceError extends Schema.TaggedErrorClass<Electro
1919
}
2020
}
2121

22-
export const isElectronThemeSetSourceError = Schema.is(ElectronThemeSetSourceError);
23-
2422
export class ElectronTheme extends Context.Service<
2523
ElectronTheme,
2624
{

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ describe("ElectronUpdater", () => {
7171
const error = yield* updater.checkForUpdates.pipe(Effect.flip);
7272

7373
assert.instanceOf(error, ElectronUpdater.ElectronUpdaterCheckForUpdatesError);
74-
assert.isTrue(ElectronUpdater.isElectronUpdaterError(error));
7574
assert.equal(error.channel, "beta");
7675
assert.strictEqual(error.cause, cause);
7776
assert.equal(error.message, "Electron updater failed to check for updates on channel beta.");
@@ -89,7 +88,6 @@ describe("ElectronUpdater", () => {
8988
const error = yield* updater.downloadUpdate.pipe(Effect.flip);
9089

9190
assert.instanceOf(error, ElectronUpdater.ElectronUpdaterDownloadUpdateError);
92-
assert.isTrue(ElectronUpdater.isElectronUpdaterError(error));
9391
assert.equal(error.channel, "nightly");
9492
assert.strictEqual(error.cause, cause);
9593
assert.equal(
@@ -126,7 +124,6 @@ describe("ElectronUpdater", () => {
126124
.pipe(Effect.flip);
127125

128126
assert.instanceOf(error, ElectronUpdater.ElectronUpdaterQuitAndInstallError);
129-
assert.isTrue(ElectronUpdater.isElectronUpdaterError(error));
130127
assert.equal(error.channel, "alpha");
131128
assert.equal(error.isSilent, true);
132129
assert.equal(error.isForceRunAfter, false);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export const ElectronUpdaterError = Schema.Union([
5454
ElectronUpdaterQuitAndInstallError,
5555
]);
5656
export type ElectronUpdaterError = typeof ElectronUpdaterError.Type;
57-
export const isElectronUpdaterError = Schema.is(ElectronUpdaterError);
5857

5958
export class ElectronUpdater extends Context.Service<
6059
ElectronUpdater,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ describe("ElectronWindow", () => {
7979
const error = yield* electronWindow.create(options).pipe(Effect.flip);
8080

8181
assert.instanceOf(error, ElectronWindow.ElectronWindowCreateError);
82-
assert.isTrue(ElectronWindow.isElectronWindowCreateError(error));
8382
assert.deepEqual(error.options, {
8483
title: "T3 Code",
8584
width: 1100,

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export class ElectronWindowCreateError extends Schema.TaggedErrorClass<ElectronW
5858
}
5959
}
6060

61-
export const isElectronWindowCreateError = Schema.is(ElectronWindowCreateError);
62-
6361
export class ElectronWindowOperationError extends Schema.TaggedErrorClass<ElectronWindowOperationError>()(
6462
"ElectronWindowOperationError",
6563
{

‎apps/desktop/src/linuxSecretStorage.test.ts‎

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
33
import {
44
normalizeLinuxPasswordStorePreference,
55
resolveLinuxPasswordStoreSwitch,
6-
resolveLinuxSecretStorageUnavailableMessage,
76
} from "./linuxSecretStorage.ts";
87

98
const autoSwitch = (env: NodeJS.ProcessEnv) =>
@@ -124,80 +123,4 @@ describe("linuxSecretStorage", () => {
124123
}),
125124
).toBe("gnome-libsecret");
126125
});
127-
128-
it("uses GNOME Keyring remediation for libsecret and unknown backends", () => {
129-
expect(
130-
resolveLinuxSecretStorageUnavailableMessage({
131-
configuredPreference: "auto",
132-
selectedBackend: "gnome_libsecret",
133-
env: { XDG_CURRENT_DESKTOP: "niri" },
134-
}),
135-
).toContain("GNOME Keyring");
136-
});
137-
138-
it("prefers explicit libsecret selection over KDE desktop heuristics", () => {
139-
expect(
140-
resolveLinuxSecretStorageUnavailableMessage({
141-
configuredPreference: "gnome-libsecret",
142-
selectedBackend: "unknown",
143-
env: { XDG_CURRENT_DESKTOP: "KDE" },
144-
}),
145-
).toContain("GNOME Keyring");
146-
expect(
147-
resolveLinuxSecretStorageUnavailableMessage({
148-
configuredPreference: "auto",
149-
selectedBackend: "gnome_libsecret",
150-
env: { XDG_CURRENT_DESKTOP: "KDE" },
151-
}),
152-
).toContain("GNOME Keyring");
153-
});
154-
155-
it("prefers explicit KWallet preference over selected gnome-libsecret backend", () => {
156-
expect(
157-
resolveLinuxSecretStorageUnavailableMessage({
158-
configuredPreference: "kwallet6",
159-
selectedBackend: "gnome_libsecret",
160-
env: { XDG_CURRENT_DESKTOP: "niri" },
161-
}),
162-
).toContain("KWallet");
163-
expect(
164-
resolveLinuxSecretStorageUnavailableMessage({
165-
configuredPreference: "kwallet",
166-
selectedBackend: "gnome-libsecret",
167-
env: {},
168-
}),
169-
).toContain("KWallet");
170-
});
171-
172-
it("uses KWallet remediation wording for KDE-looking sessions", () => {
173-
expect(
174-
resolveLinuxSecretStorageUnavailableMessage({
175-
configuredPreference: "auto",
176-
selectedBackend: "kwallet6",
177-
env: {},
178-
}),
179-
).toContain("KWallet");
180-
expect(
181-
resolveLinuxSecretStorageUnavailableMessage({
182-
configuredPreference: "auto",
183-
selectedBackend: "unknown",
184-
env: { XDG_CURRENT_DESKTOP: "KDE" },
185-
}),
186-
).toContain("KWallet");
187-
expect(
188-
resolveLinuxSecretStorageUnavailableMessage({
189-
configuredPreference: "auto",
190-
selectedBackend: "unknown",
191-
env: { DESKTOP_SESSION: "plasmawayland" },
192-
}),
193-
).toContain("KWallet");
194-
// A desktop name outranks a bare KDE marker when choosing the wording.
195-
expect(
196-
resolveLinuxSecretStorageUnavailableMessage({
197-
configuredPreference: "auto",
198-
selectedBackend: "unknown",
199-
env: { GDMSESSION: "gnome", KDE_FULL_SESSION: "true" },
200-
}),
201-
).toContain("GNOME Keyring");
202-
});
203126
});

‎apps/desktop/src/linuxSecretStorage.ts‎

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ const ELECTRON_KDE_DESKTOP = "KDE";
2525
// Chromium recognizes LXQt and still selects basic text for it, so it does need a forced backend.
2626
const ELECTRON_UNPROTECTED_DESKTOPS = new Set(["LXQt"]);
2727

28-
const KDE_NAME_PREFIXES = ["kde", "plasma"];
29-
const NEGATIVE_FLAG_VALUES = new Set(["0", "false", "no", "off"]);
30-
3128
export function normalizeLinuxPasswordStorePreference(
3229
value: unknown,
3330
): LinuxPasswordStorePreference {
@@ -77,102 +74,6 @@ function electronSelectsProtectedBackend(env: NodeJS.ProcessEnv): boolean {
7774
return false;
7875
}
7976

80-
export function resolveLinuxSecretStorageUnavailableMessage(input: {
81-
readonly configuredPreference: LinuxPasswordStorePreference;
82-
readonly selectedBackend: string | null;
83-
readonly env: NodeJS.ProcessEnv;
84-
}): string {
85-
if (input.configuredPreference === "gnome-libsecret") {
86-
return getGnomeKeyringRemediationMessage();
87-
}
88-
89-
if (
90-
input.configuredPreference === "kwallet" ||
91-
input.configuredPreference === "kwallet5" ||
92-
input.configuredPreference === "kwallet6"
93-
) {
94-
return getKWalletRemediationMessage();
95-
}
96-
97-
const backend = normalizeSelectedStorageBackend(input.selectedBackend);
98-
if (backend === "gnome-libsecret") {
99-
return getGnomeKeyringRemediationMessage();
100-
}
101-
102-
if (
103-
backend === "kwallet" ||
104-
backend === "kwallet5" ||
105-
backend === "kwallet6" ||
106-
looksLikeKdeSession(input.env)
107-
) {
108-
return getKWalletRemediationMessage();
109-
}
110-
111-
return getGnomeKeyringRemediationMessage();
112-
}
113-
114-
function getGnomeKeyringRemediationMessage(): string {
115-
return "T3 Code could not access GNOME Keyring to save this environment credential. Install and start GNOME Keyring, then restart T3 Code.";
116-
}
117-
118-
function getKWalletRemediationMessage(): string {
119-
return "T3 Code could not access KWallet to save this environment credential. Enable the KDE wallet subsystem in System Settings, then restart T3 Code.";
120-
}
121-
122-
// Advisory only: this picks between the GNOME Keyring and KWallet wording in the failure notice. It
123-
// never decides which backend to select, so a loose match costs a user slightly wrong instructions
124-
// rather than an unprotected credential store.
125-
function looksLikeKdeSession(env: NodeJS.ProcessEnv): boolean {
126-
const currentDesktopNames = nonEmptyDesktopNames(env.XDG_CURRENT_DESKTOP);
127-
if (currentDesktopNames.length > 0) {
128-
return currentDesktopNames.some(isKdeDesktopName);
129-
}
130-
131-
const legacyNames = legacyDesktopNames(env);
132-
if (legacyNames.length > 0) {
133-
return legacyNames.some(isKdeDesktopName);
134-
}
135-
136-
return isSet(env.KDE_SESSION_VERSION) || isAffirmativeFlag(env.KDE_FULL_SESSION);
137-
}
138-
139-
function isKdeDesktopName(name: string): boolean {
140-
return KDE_NAME_PREFIXES.some((prefix) => name.startsWith(prefix));
141-
}
142-
143-
function legacyDesktopNames(env: NodeJS.ProcessEnv): string[] {
144-
return [env.XDG_SESSION_DESKTOP, env.DESKTOP_SESSION, env.GDMSESSION].flatMap((entry) => {
145-
const normalized = normalizeDesktopName(entry);
146-
return normalized ? [normalized] : [];
147-
});
148-
}
149-
150-
function nonEmptyDesktopNames(value: string | undefined): string[] {
151-
return splitDesktopNameList(value).flatMap((entry) => {
152-
const normalized = normalizeDesktopName(entry);
153-
return normalized ? [normalized] : [];
154-
});
155-
}
156-
157-
function isSet(value: string | undefined): boolean {
158-
return Boolean(value?.trim());
159-
}
160-
161-
function isAffirmativeFlag(value: string | undefined): boolean {
162-
const normalized = value?.trim().toLowerCase();
163-
return normalized ? !NEGATIVE_FLAG_VALUES.has(normalized) : false;
164-
}
165-
16677
function splitDesktopNameList(value: string | undefined): string[] {
16778
return value?.split(":") ?? [];
16879
}
169-
170-
function normalizeDesktopName(value: string | undefined): string | null {
171-
const normalized = value?.trim().toLowerCase();
172-
return normalized && normalized.length > 0 ? normalized : null;
173-
}
174-
175-
function normalizeSelectedStorageBackend(value: string | null): string | null {
176-
const normalized = value?.trim().toLowerCase().replace(/_/gu, "-");
177-
return normalized && normalized.length > 0 ? normalized : null;
178-
}

0 commit comments

Comments
 (0)