Skip to content

Commit c663ec2

Browse files
committed
fix: resolve project settings conflicts with main
2 parents 9d1b9a8 + 0c200c5 commit c663ec2

367 files changed

Lines changed: 8953 additions & 2058 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.

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,6 @@ describe("DesktopClerk", () => {
6363
storageMock.mockReset();
6464
});
6565

66-
it("derives the Clerk Frontend API hostname used by the desktop CSP", () => {
67-
const publishableKey = `pk_test_${btoa("clerk.t3.codes$")}`;
68-
69-
assert.equal(
70-
DesktopClerk.resolveDesktopClerkFrontendApiHostname(publishableKey),
71-
"clerk.t3.codes",
72-
);
73-
assert.equal(DesktopClerk.resolveDesktopClerkFrontendApiHostname(""), undefined);
74-
assert.equal(DesktopClerk.resolveDesktopClerkFrontendApiHostname("invalid"), undefined);
75-
});
76-
7766
it.effect("acquires and releases the SDK bridge with the layer", () => {
7867
const cleanup = vi.fn();
7968
const events: string[] = [];
@@ -208,27 +197,4 @@ describe("DesktopClerk", () => {
208197
Effect.provideService(ElectronWindow.ElectronWindow, electronWindow),
209198
);
210199
});
211-
212-
it.each([
213-
{ isDevelopment: true, scheme: "t3code-dev" },
214-
{ isDevelopment: false, scheme: "t3code" },
215-
])("configures the SDK with the $scheme renderer origin", ({ isDevelopment, scheme }) => {
216-
const bridge = { cleanup: vi.fn(), isPrimaryInstance: true };
217-
storageMock.mockReturnValue(storageAdapter);
218-
createClerkBridgeMock.mockReturnValue(bridge);
219-
220-
assert.equal(DesktopClerk.createDesktopClerkBridge("/tmp/t3-state", isDevelopment), bridge);
221-
assert.deepEqual(storageMock.mock.calls, [[{ path: "/tmp/t3-state" }]]);
222-
assert.deepEqual(createClerkBridgeMock.mock.calls, [
223-
[
224-
{
225-
storage: storageAdapter,
226-
passkeys: true,
227-
renderer: { scheme, host: "app" },
228-
},
229-
],
230-
]);
231-
storageMock.mockClear();
232-
createClerkBridgeMock.mockClear();
233-
});
234200
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class DesktopClerk extends Context.Service<
5353
}
5454
>()("@t3tools/desktop/app/DesktopClerk") {}
5555

56-
export function resolveDesktopClerkFrontendApiHostname(
56+
function resolveDesktopClerkFrontendApiHostname(
5757
publishableKey: string | undefined,
5858
): string | undefined {
5959
const normalizedKey = publishableKey?.trim();
@@ -72,7 +72,7 @@ export const desktopClerkFrontendApiHostname = resolveDesktopClerkFrontendApiHos
7272
: __T3CODE_BUILD_CLERK_PUBLISHABLE_KEY__,
7373
);
7474

75-
export function createDesktopClerkBridge(stateDir: string, isDevelopment: boolean) {
75+
function createDesktopClerkBridge(stateDir: string, isDevelopment: boolean) {
7676
return createClerkBridge({
7777
storage: storage({ path: stateDir }),
7878
passkeys: true,

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

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,45 +37,22 @@ describe("DesktopPreReadyPlatform", () => {
3737
registerSchemesMock.mockReset();
3838
});
3939

40-
it("reads an explicit Electron command-line switch value", () => {
41-
const value = DesktopPreReadyPlatform.readCommandLineSwitchValue(
42-
{
43-
hasSwitch: (switchName) => switchName === "password-store",
44-
getSwitchValue: (switchName) => {
45-
assert.equal(switchName, "password-store");
46-
return "basic";
47-
},
48-
},
49-
"password-store",
40+
it.effect("preserves an explicit Linux password-store switch", () => {
41+
hasSwitchMock.mockImplementation((switchName) => switchName === "password-store");
42+
getSwitchValueMock.mockReturnValue(" basic ");
43+
44+
return Effect.gen(function* () {
45+
const options = yield* DesktopPreReadyPlatform.DesktopPreReadyElectronOptions;
46+
47+
assert.equal(options.linuxPasswordStoreCommandLine, "basic");
48+
assert.isFalse(appendSwitchMock.mock.calls.some(([name]) => name === "password-store"));
49+
}).pipe(
50+
Effect.provide(
51+
DesktopPreReadyPlatform.layer.pipe(
52+
Layer.provide(Layer.succeed(HostProcessPlatform, "linux")),
53+
),
54+
),
5055
);
51-
52-
assert.equal(value, "basic");
53-
});
54-
55-
it("treats valueless Electron command-line switches as absent", () => {
56-
const value = DesktopPreReadyPlatform.readCommandLineSwitchValue(
57-
{
58-
hasSwitch: () => true,
59-
getSwitchValue: () => "",
60-
},
61-
"password-store",
62-
);
63-
64-
assert.isNull(value);
65-
});
66-
67-
it("returns null for missing Electron command-line switches", () => {
68-
const value = DesktopPreReadyPlatform.readCommandLineSwitchValue(
69-
{
70-
hasSwitch: () => false,
71-
getSwitchValue: () => {
72-
throw new Error("Unexpected switch value read.");
73-
},
74-
},
75-
"password-store",
76-
);
77-
78-
assert.isNull(value);
7956
});
8057

8158
it.effect(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface DesktopPreReadyCommandLineReader {
1717
readonly getSwitchValue: (switchName: string) => string;
1818
}
1919

20-
export function readCommandLineSwitchValue(
20+
function readCommandLineSwitchValue(
2121
commandLine: DesktopPreReadyCommandLineReader,
2222
switchName: string,
2323
): string | null {

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,6 @@ const withPackagedWslHarness = <A, E, R>(
218218
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer));
219219

220220
describe("DesktopBackendConfiguration", () => {
221-
it("accepts only normalized SHA-256 archive identities", () => {
222-
assert.equal(
223-
DesktopBackendConfiguration.parseWslRuntimeArchiveHash(` ${"A".repeat(64)}\n`),
224-
"a".repeat(64),
225-
);
226-
assert.isNull(DesktopBackendConfiguration.parseWslRuntimeArchiveHash("abc123"));
227-
});
228-
229221
it.effect("resolvePrimary produces a stable scoped bootstrap token", () =>
230222
withHarness(
231223
Effect.gen(function* () {

‎apps/desktop/src/backend/DesktopBackendConfiguration.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ const WSL_RUNTIME_ARCHIVE_NAME = "wsl-runtime.tar.gz";
243243
const WSL_RUNTIME_ARCHIVE_HASH_NAME = `${WSL_RUNTIME_ARCHIVE_NAME}.sha256`;
244244
const SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/i;
245245

246-
export const parseWslRuntimeArchiveHash = (value: string): string | null => {
246+
const parseWslRuntimeArchiveHash = (value: string): string | null => {
247247
const trimmed = value.trim();
248248
return SHA256_HEX_PATTERN.test(trimmed) ? trimmed.toLowerCase() : null;
249249
};

‎apps/desktop/src/wsl/wslPathParsing.test.ts‎

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { describe, it, expect } from "vite-plus/test";
22

33
import {
4-
DISTRO_NAME_PATTERN,
54
extractDistroFromUncPath,
65
isValidDistroName,
76
parseWslDistroList,
8-
resolveWslHomeUncPath,
97
resolveWslPickFolderDefaultPath,
108
wslUncPathToLinuxPath,
119
} from "./wslPathParsing.ts";
@@ -116,29 +114,6 @@ describe("wslUncPathToLinuxPath", () => {
116114
});
117115
});
118116

119-
describe("resolveWslHomeUncPath", () => {
120-
const distros = [
121-
{ name: "Debian", isDefault: true, version: 2 as const },
122-
{ name: "Ubuntu", isDefault: false, version: 2 as const },
123-
];
124-
125-
it("uses the configured distro when one is selected", () => {
126-
expect(resolveWslHomeUncPath({ distro: "Ubuntu" }, distros)).toBe(
127-
"\\\\wsl.localhost\\Ubuntu\\home",
128-
);
129-
});
130-
131-
it("uses the actual default distro when config uses the WSL default", () => {
132-
expect(resolveWslHomeUncPath({ distro: null }, distros)).toBe(
133-
"\\\\wsl.localhost\\Debian\\home",
134-
);
135-
});
136-
137-
it("omits the default path when no default distro is known", () => {
138-
expect(resolveWslHomeUncPath({ distro: null }, [])).toBeNull();
139-
});
140-
});
141-
142117
describe("resolveWslPickFolderDefaultPath", () => {
143118
const config = { distro: null };
144119
const distros = [{ name: "Debian", isDefault: true, version: 2 as const }];
@@ -184,23 +159,22 @@ describe("resolveWslPickFolderDefaultPath", () => {
184159
});
185160
});
186161

187-
describe("DISTRO_NAME_PATTERN / isValidDistroName", () => {
162+
describe("isValidDistroName", () => {
188163
it("accepts common distro names", () => {
189164
for (const name of ["Ubuntu", "Ubuntu-22.04", "kali-linux", "Debian", "Ubuntu 22.04"]) {
190-
expect(DISTRO_NAME_PATTERN.test(name)).toBe(true);
191165
expect(isValidDistroName(name)).toBe(true);
192166
}
193167
});
194168

195169
it("rejects names with trailing whitespace, hyphen, or dot", () => {
196170
for (const name of ["Ubuntu ", "Ubuntu-", "Ubuntu."]) {
197-
expect(DISTRO_NAME_PATTERN.test(name)).toBe(false);
171+
expect(isValidDistroName(name)).toBe(false);
198172
}
199173
});
200174

201175
it("rejects names containing control or shell-meta characters", () => {
202176
for (const name of ["bad\nname", "bad\tname", "bad/name", "bad!name", "bad;name"]) {
203-
expect(DISTRO_NAME_PATTERN.test(name)).toBe(false);
177+
expect(isValidDistroName(name)).toBe(false);
204178
}
205179
});
206180
});

‎apps/desktop/src/wsl/wslPathParsing.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface WslConfig {
1010

1111
// Literal space — \s would also match \n/\t/\r and corrupt UNC paths like \\wsl.localhost\<distro>\...
1212
// Trailing char must also be \w so hand-edited config like "Ubuntu " / "Ubuntu-" / "Ubuntu." rejects.
13-
export const DISTRO_NAME_PATTERN = /^\w(?:[\w \-.]*\w)?$/;
13+
const DISTRO_NAME_PATTERN = /^\w(?:[\w \-.]*\w)?$/;
1414

1515
export function parseWslDistroList(stdout: Buffer): readonly WslDistro[] {
1616
const hasUtf16Bom = stdout.length >= 2 && stdout[0] === 0xff && stdout[1] === 0xfe;
@@ -61,10 +61,7 @@ export function wslUncPathToLinuxPath(windowsPath: string): string | null {
6161
return `/${rest.split("\\").filter(Boolean).join("/")}`;
6262
}
6363

64-
export function resolveWslHomeUncPath(
65-
config: WslConfig,
66-
distros: readonly WslDistro[],
67-
): string | null {
64+
function resolveWslHomeUncPath(config: WslConfig, distros: readonly WslDistro[]): string | null {
6865
const distroName = config.distro ?? distros.find((distro) => distro.isDefault)?.name ?? null;
6966
return distroName ? `\\\\wsl.localhost\\${distroName}\\home` : null;
7067
}
24.4 KB
80.8 KB

0 commit comments

Comments
 (0)