@devries-cameron20 / t3code Mirror · read-only / commits / eb1085957e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 20:45 UTC

test(web): prune low-value tests in apps/web (second pass) (#22591)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 20, 2026 at 18:30 UTC eb1085957eb920f524fdbf5324897e12f2575003
147 files changed +94 -5736
apps/web/src/browser/browserDefaults.test.ts
+1 -22
@@ -1,8 +1,6 @@
1 import { describe, expect, it, vi } from "vite-plus/test";
2 import { DEFAULT_BROWSER_PROFILE_ID, INCOGNITO_BROWSER_PROFILE_ID } from "@t3tools/contracts";
3
4 -import { ensureClientSettingsHydrated } from "~/hooks/useSettings";
5 -
4 const settings = vi.hoisted(() => ({ current: {} as Record<string, unknown> }));
5
6 vi.mock("~/hooks/useSettings", () => ({
@@ -11,7 +9,7 @@ vi.mock("~/hooks/useSettings", () => ({
9 ensureClientSettingsHydrated: vi.fn(async () => undefined),
10 }));
11
14 -const { getBrowserDefaults, resolveBrowserDefaults } = await import("./browserDefaults");
12 +const { getBrowserDefaults } = await import("./browserDefaults");
13
14 const withDefaultProfile = (browserDefaultProfileId: string) => {
15 settings.current = {
@@ -32,22 +30,3 @@ describe("getBrowserDefaults profile resolution", () => {
30 );
31 });
32 });
35 -
36 -describe("resolveBrowserDefaults", () => {
37 - it("rejects failed reads and uses the saved profile after a successful retry", async () => {
38 - withDefaultProfile("work");
39 - settings.current.browserDefaultZoomFactor = 1.25;
40 - settings.current.browserDefaultAppearance = "dark";
41 - const failure = new Error("Settings read failed");
42 - vi.mocked(ensureClientSettingsHydrated).mockRejectedValueOnce(failure);
43 -
44 - await expect(resolveBrowserDefaults()).rejects.toBe(failure);
45 - await expect(resolveBrowserDefaults()).resolves.toMatchObject({
46 - viewport: { _tag: "fill" },
47 - zoomFactor: 1.25,
48 - appearance: "dark",
49 - autoShowFloatingPreview: true,
50 - profileId: "work",
51 - });
52 - });
53 -});
apps/web/src/browser/browserTargetResolver.test.ts
-14
@@ -128,20 +128,6 @@ describe("browser target resolver", () => {
128 }
129 });
130
131 - it("supports private IPv6 environment hosts", async () => {
132 - readPreparedConnection.mockReturnValue({
133 - httpBaseUrl: "http://[fd7a:115c:a1e0::53]:3773",
134 - });
135 - const { resolveBrowserNavigationTarget } = await import("./browserTargetResolver");
136 - expect(
137 - resolveBrowserNavigationTarget(EnvironmentId.make("environment-1"), {
138 - kind: "environment-port",
139 - port: 5173,
140 - path: "/app?mode=test",
141 - }).resolvedUrl,
142 - ).toBe("http://[fd7a:115c:a1e0::53]:5173/app?mode=test");
143 - });
144 -
131 it("classifies exact private IPv4 and IPv6 boundaries", async () => {
132 const { isPrivateNetworkHost } = await import("./browserTargetResolver");
133 const privateHosts = [
apps/web/src/browserFaviconStore.test.ts
-72
@@ -10,12 +10,10 @@ import {
10 lookupFavicon,
11 recordFaviconForProject,
12 recordFaviconForThread,
13 - registerFaviconProjectForThread,
13 resetBrowserFaviconsForTests,
14 resolveBrowserFaviconStorage,
15 useBrowserFaviconStore,
16 } from "./browserFaviconStore";
18 -import { BROWSER_FAVICON_MAX_ENTRIES } from "./browserFaviconLogic";
17
18 const environmentId = EnvironmentId.make("env-1");
19 const projectRef = scopeProjectRef(environmentId, ProjectId.make("project-1"));
@@ -69,60 +67,6 @@ describe("browser favicon store", () => {
67 ).toBeNull();
68 });
69
72 - it("keeps exact host aliases attached to the newest canonical icon", () => {
73 - const olderPng = "data:image/png;base64,QkJCQg==";
74 - const newerPng = "data:image/png;base64,Q0NDQw==";
75 - recordFaviconForProject(
76 - projectRef,
77 - favicon("http://192.168.64.2:3000/", 10, olderPng),
78 - "192.168.64.2",
79 - );
80 - recordFaviconForProject(
81 - projectRef,
82 - favicon("http://192.168.64.3:3000/", 20, newerPng),
83 - "192.168.64.3",
84 - );
85 - recordFaviconForProject(
86 - projectRef,
87 - favicon("http://192.168.64.4:3000/", 15, olderPng),
88 - "192.168.64.4",
89 - );
90 - const byKey = useBrowserFaviconStore.getState().byKey;
91 - for (const host of ["192.168.64.2", "192.168.64.3", "192.168.64.4"]) {
92 - expect(lookupFavicon(byKey, projectRef, `http://${host}:3000/`, null)).toBe(newerPng);
93 - }
94 - expect(byKey["env-1:project-1 http://localhost:3000"]?.capturedAt).toBe(20);
95 - });
96 -
97 - it("evicts an icon and its exact host aliases atomically", () => {
98 - recordFaviconForProject(projectRef, favicon("http://192.168.64.2:3000/", 100), "192.168.64.2");
99 - for (let index = 1; index < BROWSER_FAVICON_MAX_ENTRIES; index += 1) {
100 - recordFaviconForProject(
101 - projectRef,
102 - favicon(`https://example-${index}.com/`, 100 + index),
103 - null,
104 - );
105 - }
106 - expect(
107 - lookupFavicon(
108 - useBrowserFaviconStore.getState().byKey,
109 - projectRef,
110 - "http://192.168.64.2:3000/",
111 - null,
112 - ),
113 - ).toBe(PNG);
114 -
115 - recordFaviconForProject(projectRef, favicon("https://evicts-oldest.example/", 1_000), null);
116 - expect(
117 - lookupFavicon(
118 - useBrowserFaviconStore.getState().byKey,
119 - projectRef,
120 - "http://192.168.64.2:3000/",
121 - null,
122 - ),
123 - ).toBeNull();
124 - });
125 -
70 it("retains multiple origins until project and connection metadata hydrate", () => {
71 expect(
72 recordFaviconForThread(threadRef, favicon("http://localhost:3000/", 1), null, undefined),
@@ -165,22 +109,6 @@ describe("browser favicon store", () => {
109 expect(Object.values(useBrowserFaviconStore.getState().pendingByThreadKey)[0]).toBeDefined();
110 });
111
168 - it("flushes and resolves a pending draft-thread favicon after physical project registration", () => {
169 - recordFaviconForThread(threadRef, favicon("http://localhost:8025/", 10), null, undefined);
170 - registerFaviconProjectForThread(threadRef, projectRef);
171 - const registered = useBrowserFaviconStore.getState().projectRefByThreadKey["env-1:thread-1"];
172 - expect(registered).toEqual(projectRef);
173 - expect(flushPendingFaviconsForThread(threadRef, registered!, undefined)).toBe(true);
174 - expect(
175 - lookupFavicon(
176 - useBrowserFaviconStore.getState().byKey,
177 - registered!,
178 - "http://localhost:8025/",
179 - null,
180 - ),
181 - ).toBe(PNG);
182 - });
183 -
112 it("keeps the memory shadow authoritative after an asymmetric primary write failure", () => {
113 vi.stubGlobal("window", {
114 localStorage: {
apps/web/src/browserHistoryStore.test.ts
-30
@@ -35,10 +35,6 @@ describe("normalizeHistoryUrl", () => {
35 );
36 });
37
38 - it("normalizes bare public hosts to https", () => {
39 - expect(normalizeHistoryUrl("myapp.test")).toBe("https://myapp.test/");
40 - });
41 -
38 it("preserves hash routes and strips credentials", () => {
39 expect(normalizeHistoryUrl("http://localhost:3000/app#/route")).toBe(
40 "http://localhost:3000/app#/route",
@@ -54,17 +50,6 @@ describe("normalizeHistoryUrl", () => {
50 });
51
52 describe("upsertHistoryEntry", () => {
57 - it("moves revisits to front, updates the timestamp, and keeps the title", () => {
58 - const existing = [
59 - entry({ url: "http://a.test/", lastVisitedAt: 500, title: "A" }),
60 - entry({ url: "http://b.test/", lastVisitedAt: 400 }),
61 - ];
62 - const next = upsertHistoryEntry(existing, "http://b.test/", 3000);
63 - expect(next.map((e) => e.url)).toEqual(["http://b.test/", "http://a.test/"]);
64 - expect(next[0]?.lastVisitedAt).toBe(3000);
65 - expect(next[1]?.title).toBe("A");
66 - });
67 -
53 it("with insertOrdered, replaying an older visit for an existing entry keeps its newer timestamp", () => {
54 const existing = [entry({ url: "http://a.test/", lastVisitedAt: 2000 })];
55 const next = upsertHistoryEntry(existing, "http://a.test/", 1000, { insertOrdered: true });
@@ -128,14 +113,6 @@ describe("useBrowserHistoryStore", () => {
113 resetBrowserHistoryForTests();
114 });
115
131 - it("records visits for registered threads under the project key", () => {
132 - useBrowserHistoryStore.getState().registerThreadProject(threadRef, "proj-a");
133 - recordVisitForThread(threadRef, "myapp.test/admin#section", 1234);
134 - expect(useBrowserHistoryStore.getState().byProjectKey["proj-a"]).toEqual([
135 - { url: "https://myapp.test/admin#section", lastVisitedAt: 1234 },
136 - ]);
137 - });
138 -
116 it("sets titles update-only via the thread helper", () => {
117 useBrowserHistoryStore.getState().registerThreadProject(threadRef, "proj-a");
118 setTitleForThreadUrl(threadRef, "http://a.test/", "Should not create");
@@ -187,13 +164,6 @@ describe("useBrowserHistoryStore", () => {
164 { url: "http://localhost:5173/app", lastVisitedAt: 5 },
165 ]);
166 });
190 -
191 - it("does not match a genuinely different path via the trailing-slash comparison", () => {
192 - useBrowserHistoryStore.getState().registerThreadProject(threadRef, "proj-a");
193 - recordVisitForThread(threadRef, "http://a.test/community", 1);
194 - setTitleForThreadUrl(threadRef, "http://a.test/community/foo", "Foo");
195 - expect(useBrowserHistoryStore.getState().byProjectKey["proj-a"]?.[0]?.title).toBeUndefined();
196 - });
167 });
168
169 describe("pendingVisitsByThreadKey", () => {
apps/web/src/bundledDev.test.ts
-41
@@ -10,8 +10,6 @@ import react from "@vitejs/plugin-react";
10 import { createServer } from "vite-plus";
11 import { expect, it } from "vite-plus/test";
12
13 -import { warmLazyEntries } from "../vite/warmBundledDev";
14 -
13 const execFile = NodeUtil.promisify(NodeChildProcess.execFile);
14
15 it("initializes React refresh before a shared UI chunk runs in bundled dev", async () => {
@@ -120,42 +118,3 @@ console.log("App started with React refresh ready.");`,
118 await NodeFSP.rm(root, { recursive: true, force: true });
119 }
120 });
123 -
124 -it("warms the wanted lazy chunk chain and nothing else", async () => {
125 - const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-warm-"));
126 - let server: Awaited<ReturnType<typeof createServer>> | undefined;
127 -
128 - try {
129 - await NodeFSP.mkdir(NodePath.join(root, "src"));
130 - await NodeFSP.writeFile(
131 - NodePath.join(root, "index.html"),
132 - '<html><body><script type="module" src="/src/bootstrap.ts"></script></body></html>',
133 - );
134 - await NodeFSP.writeFile(NodePath.join(root, "src/bootstrap.ts"), 'void import("./main");');
135 - await NodeFSP.writeFile(
136 - NodePath.join(root, "src/main.ts"),
137 - 'export const route = () => import("./route"); export const rare = () => import("./rare");',
138 - );
139 - await NodeFSP.writeFile(NodePath.join(root, "src/route.ts"), "export const route = 1;");
140 - await NodeFSP.writeFile(NodePath.join(root, "src/rare.ts"), "export const rare = 1;");
141 -
142 - server = await createServer({
143 - configFile: false,
144 - root,
145 - logLevel: "silent",
146 - experimental: { bundledDev: true },
147 - server: { host: "127.0.0.1", port: 0 },
148 - });
149 - await server.listen();
150 -
151 - // The route is only discoverable after main compiles, so this also covers the pass walk.
152 - const warmed = await warmLazyEntries(server, ["src/main.ts", "src/route.ts"]);
153 - expect(warmed.map((id) => NodePath.relative(root, id.split("?")[0] ?? id))).toEqual([
154 - "src/main.ts",
155 - "src/route.ts",
156 - ]);
157 - } finally {
158 - await server?.close();
159 - await NodeFSP.rm(root, { recursive: true, force: true });
160 - }
161 -});
apps/web/src/closedViewStore.test.ts
-16
@@ -29,22 +29,6 @@ const snapshot: PreviewSessionSnapshot = {
29 };
30
31 describe("closedViewStore", () => {
32 - it.each([null, {}, { entries: null }, { entries: {} }, { entries: "invalid" }])(
33 - "rehydrates malformed older history %j as empty history",
34 - async (state) => {
35 - useClosedViewStore.getState().remember(diff(refA));
36 - const { storage, name } = useClosedViewStore.persist.getOptions();
37 - await storage!.setItem(name!, {
38 - state: state as { entries: ClosedViewEntry[] },
39 - version: 0,
40 - });
41 - await useClosedViewStore.persist.rehydrate();
42 - expect(useClosedViewStore.persist.hasHydrated()).toBe(true);
43 - expect(useClosedViewStore.getState().entries).toEqual([]);
44 - expect(await storage!.getItem(name!)).toEqual({ state: { entries: [] }, version: 2 });
45 - },
46 - );
47 -
32 it.each([
33 { id: "bad", kind: "browser", threadRef: refA, snapshot: {} },
34 {
apps/web/src/components/BranchToolbar.logic.test.ts
-5
@@ -98,11 +98,6 @@ describe("deriveLocalBranchNameFromRemoteRef", () => {
98 "upstream/feature/demo",
99 );
100 });
101 -
102 - it("returns the original name when ref is malformed", () => {
103 - expect(deriveLocalBranchNameFromRemoteRef("origin/")).toBe("origin/");
104 - expect(deriveLocalBranchNameFromRemoteRef("/feature/demo")).toBe("/feature/demo");
105 - });
101 });
102
103 describe("dedupeRemoteBranchesWithLocalMatches", () => {
apps/web/src/components/ChatView.logic.test.ts
-76
@@ -140,30 +140,6 @@ describe("resolveDraftPromotionNavigationTarget", () => {
140 });
141
142 describe("deriveComposerSendState", () => {
143 - it("treats expired terminal pills as non-sendable content", () => {
144 - const state = deriveComposerSendState({
145 - prompt: "[Terminal 1](t3-context://v1/terminal/ctx-expired)",
146 - imageCount: 0,
147 - terminalContexts: [
148 - {
149 - id: "ctx-expired",
150 - threadId,
151 - terminalId: "default",
152 - terminalLabel: "Terminal 1",
153 - lineStart: 4,
154 - lineEnd: 4,
155 - text: "",
156 - createdAt: now,
157 - },
158 - ],
159 - });
160 -
161 - expect(state.trimmedPrompt).toBe("");
162 - expect(state.sendableTerminalContexts).toEqual([]);
163 - expect(state.expiredTerminalContextCount).toBe(1);
164 - expect(state.hasSendableContent).toBe(false);
165 - });
166 -
143 it("keeps text sendable while excluding expired terminal pills", () => {
144 const state = deriveComposerSendState({
145 prompt: `yoo [Terminal 1](t3-context://v1/terminal/ctx-expired) waddup`,
@@ -189,24 +165,6 @@ describe("deriveComposerSendState", () => {
165 });
166
167 describe("hasServerAcknowledgedLocalDispatch", () => {
192 - it("does not acknowledge unchanged server state", () => {
193 - const localDispatch = createLocalDispatchSnapshot(
194 - makeThread({ latestRun: completedTurn, runtime: readySession }),
195 - );
196 -
197 - expect(
198 - hasServerAcknowledgedLocalDispatch({
199 - localDispatch,
200 - phase: "ready",
201 - latestRun: completedTurn,
202 - runtime: readySession,
203 - hasPendingApproval: false,
204 - hasPendingUserInput: false,
205 - threadError: null,
206 - }),
207 - ).toBe(false);
208 - });
209 -
168 it("acknowledges a settled newer background turn", () => {
169 const localDispatch = createLocalDispatchSnapshot(
170 makeThread({ latestRun: completedTurn, runtime: readySession }),
@@ -431,18 +389,6 @@ describe("deriveCommittedServerUserMessageIds", () => {
389 });
390 });
391
434 -describe("draft hero submission transition", () => {
435 - it("does not auto-navigate a background submission after server promotion", () => {
436 - expect(
437 - resolveDraftPromotionNavigationTarget({
438 - serverThreadRef: { environmentId, threadId },
439 - serverThread: makeThread({ latestRun: completedTurn }),
440 - backgroundSubmissionPending: true,
441 - }),
442 - ).toBeNull();
443 - });
444 -});
445 -
392 describe("resolveThreadSwitchTimeline", () => {
393 afterEach(() => {
394 resetHeldThreadTimeline();
@@ -463,17 +409,6 @@ describe("resolveThreadSwitchTimeline", () => {
409 ).toEqual({ entries: ["a1", "a2"], displayThreadKey: "env-1:thread-a" });
410 });
411
466 - it("prefers live entries over a remembered snapshot", () => {
467 - rememberReadyThreadTimeline({ threadKey: "env-1:thread-b", entries: ["stale-b"] });
468 - expect(
469 - resolveThreadSwitchTimeline({
470 - loading: false,
471 - activeThreadKey: "env-1:thread-b",
472 - nextEntries: ["fresh-b"],
473 - }),
474 - ).toEqual({ entries: ["fresh-b"], displayThreadKey: "env-1:thread-b" });
475 - });
476 -
412 it("does not hold another environment's timeline across a jump", () => {
413 expect(threadKeysShareEnvironment("env-1:thread-a", "env-2:thread-b")).toBe(false);
414 expect(
@@ -1078,17 +1013,6 @@ describe("mergeDirectPreviewAnnotation", () => {
1013 const image = (id: string) =>
1014 ({ id, type: "image", name: `${id}.png`, mimeType: "image/png", sizeBytes: 1 }) as never;
1015
1081 - it("appends the screenshot and claims the crop when the turn has room", () => {
1082 - const result = mergeDirectPreviewAnnotation({
1083 - images: [],
1084 - fileCount: 0,
1085 - previewAnnotations: [],
1086 - direct: { annotation: annotation("a"), image: image("crop") },
1087 - });
1088 - expect(result.images.map((entry) => entry.id)).toEqual(["crop"]);
1089 - expect(result.previewAnnotations[0]?.screenshot?.dataUrl).toBe("");
1090 - });
1091 -
1016 it("drops the screenshot claim when the attachment cap is full", () => {
1017 const result = mergeDirectPreviewAnnotation({
1018 images: [],
apps/web/src/components/GitActionsControl.logic.test.ts
-46
@@ -6,7 +6,6 @@ import {
6 resolveAutoFeatureBranchName,
7 resolveLiveThreadBranchUpdate,
8 resolveQuickAction,
9 - resolveThreadBranchUpdate,
9 } from "./GitActionsControl.logic";
10
11 function status(overrides: Partial<VcsStatusResult> = {}): VcsStatusResult {
@@ -77,24 +76,6 @@ describe("when: ref is clean, up to date, and has no open PR", () => {
76 });
77 });
78
80 -describe("when: ref is behind upstream", () => {
81 - it("resolveQuickAction returns pull", () => {
82 - const quick = resolveQuickAction(status({ behindCount: 2 }), false);
83 - assert.deepInclude(quick, { kind: "run_pull", label: "Pull", disabled: false });
84 - });
85 -});
86 -
87 -describe("when: working tree has local changes", () => {
88 - it("resolveQuickAction returns commit, push, and create PR", () => {
89 - const quick = resolveQuickAction(status({ hasWorkingTreeChanges: true }), false);
90 - assert.deepInclude(quick, {
91 - kind: "run_action",
92 - action: "commit_push_pr",
93 - label: "Commit, push & PR",
94 - });
95 - });
96 -});
97 -
79 describe("when: on default ref without open PR", () => {
80 it("resolveQuickAction returns commit and push when local changes exist", () => {
81 const quick = resolveQuickAction(
@@ -160,33 +141,6 @@ describe("requiresDefaultBranchConfirmation", () => {
141 });
142 });
143
163 -describe("resolveThreadBranchUpdate", () => {
164 - it("returns a branch update when the action created a new branch", () => {
165 - const update = resolveThreadBranchUpdate({
166 - action: "commit_push_pr",
167 - branch: {
168 - status: "created",
169 - name: "feature/fix-toast-copy",
170 - },
171 - commit: {
172 - status: "created",
173 - commitSha: "89abcdef01234567",
174 - subject: "feat: add ref sync",
175 - },
176 - push: { status: "pushed", branch: "feature/fix-toast-copy" },
177 - pr: { status: "skipped_not_requested" },
178 - toast: {
179 - title: "Pushed 89abcde to origin/feature/fix-toast-copy",
180 - cta: { kind: "none" },
181 - },
182 - });
183 -
184 - assert.deepEqual(update, {
185 - branch: "feature/fix-toast-copy",
186 - });
187 - });
188 -});
189 -
144 describe("resolveLiveThreadBranchUpdate", () => {
145 it("returns a branch update when live git status differs from stored thread metadata", () => {
146 const update = resolveLiveThreadBranchUpdate({
apps/web/src/components/ProviderUpdateLaunchNotification.logic.test.ts
-140
@@ -13,7 +13,6 @@ import {
13 canOneClickUpdateProviderCandidate,
14 collectProviderUpdateOutcomeSnapshots,
15 collectUpdatedProviderSnapshots,
16 - environmentGroupsWithUpdates,
16 firstRejectedProviderUpdateMessage,
17 getProviderUpdateProgressToastView,
18 getProviderUpdateRunToastView,
@@ -21,7 +20,6 @@ import {
20 hasOneClickUpdateProviderCandidate,
21 isProviderUpdateCandidate,
22 isProviderSettingsUpdateCandidate,
24 - localEnvironmentUpdateNotificationKey,
23 providerUpdateNotificationKey,
24 resolveEnvironmentUpdateRowStatus,
25 type LocalEnvironmentProvidersInput,
@@ -350,15 +348,6 @@ describe("provider update launch notification logic", () => {
348 });
349 });
350
353 - it("does not show a sidebar pill for passive update availability", () => {
354 - expect(
355 - getProviderUpdateSidebarPillView([
356 - provider({ driver: driver("codex"), canUpdate: true }),
357 - provider({ driver: driver("cursor"), canUpdate: false }),
358 - ]),
359 - ).toBeNull();
360 - });
361 -
351 describe("multi-backend update outcomes", () => {
352 const terminalState = (
353 status: "succeeded" | "failed" | "unchanged",
@@ -411,42 +400,6 @@ describe("provider update launch notification logic", () => {
400 ).toMatchObject({ phase: "failed" });
401 });
402
414 - it("reports success only when every backend succeeded", () => {
415 - const snapshots = collectProviderUpdateOutcomeSnapshots([
416 - fulfilledOutcome(
417 - true,
418 - provider({
419 - driver: driver("codex"),
420 - updateState: terminalState("succeeded", "Provider updated."),
421 - }),
422 - ),
423 - fulfilledOutcome(
424 - false,
425 - provider({
426 - driver: driver("codex"),
427 - updateState: terminalState("succeeded", "Provider updated."),
428 - }),
429 - ),
430 - ]);
431 -
432 - expect(
433 - getProviderUpdateProgressToastView({ providers: snapshots, providerCount: 1 }),
434 - ).toMatchObject({ phase: "succeeded" });
435 - });
436 -
437 - it("ignores backends that did not return the targeted instance", () => {
438 - const primary = provider({
439 - driver: driver("codex"),
440 - updateState: terminalState("succeeded", "Provider updated."),
441 - });
442 - const snapshots = collectProviderUpdateOutcomeSnapshots([
443 - fulfilledOutcome(true, primary),
444 - fulfilledOutcome(false, null),
445 - ]);
446 -
447 - expect(snapshots).toEqual([primary]);
448 - });
449 -
403 it("treats a rejected dispatch as not contributing a snapshot", () => {
404 const primary = provider({
405 driver: driver("codex"),
@@ -492,54 +445,6 @@ describe("provider update launch notification logic", () => {
445 ?.isSettling,
446 ).toBe(true);
447 });
495 -
496 - it("keeps only environments that have a one-click update on offer", () => {
497 - const { groups } = buildLocalEnvironmentUpdateGroups([
498 - environment({
499 - environmentId: "env-windows",
500 - isPrimary: true,
501 - providers: [provider({ driver: driver("codex") })],
502 - }),
503 - environment({
504 - environmentId: "env-wsl",
505 - providers: [
506 - provider({ driver: driver("codex"), advisoryStatus: "current", latestVersion: null }),
507 - ],
508 - }),
509 - ]);
510 -
511 - expect(environmentGroupsWithUpdates(groups).map((group) => group.environmentId)).toEqual([
512 - "env-windows",
513 - ]);
514 - });
515 -
516 - it("keys the notification by environment, driver and latest version", () => {
517 - const noUpdates = buildLocalEnvironmentUpdateGroups([
518 - environment({
519 - environmentId: "env-windows",
520 - isPrimary: true,
521 - providers: [
522 - provider({ driver: driver("codex"), advisoryStatus: "current", latestVersion: null }),
523 - ],
524 - }),
525 - ]);
526 - expect(localEnvironmentUpdateNotificationKey(noUpdates.groups)).toBeNull();
527 -
528 - const both = buildLocalEnvironmentUpdateGroups([
529 - environment({
530 - environmentId: "env-windows",
531 - isPrimary: true,
532 - providers: [provider({ driver: driver("codex"), latestVersion: "1.1.0" })],
533 - }),
534 - environment({
535 - environmentId: "env-wsl",
536 - providers: [provider({ driver: driver("codex"), latestVersion: "1.1.0" })],
537 - }),
538 - ]);
539 - const key = localEnvironmentUpdateNotificationKey(both.groups);
540 - expect(key).toContain("env-windows=codex:1.1.0");
541 - expect(key).toContain("env-wsl=codex:1.1.0");
542 - });
448 });
449
450 describe("resolveEnvironmentUpdateRowStatus", () => {
@@ -551,12 +456,6 @@ describe("provider update launch notification logic", () => {
456 candidates: [updateCandidate({ driver: driver("codex"), latestVersion: "1.1.0" })],
457 providers: [],
458 };
554 - const runningResult: ProviderUpdateToastView = {
555 - phase: "running",
556 - type: "loading",
557 - title: "Updating providers",
558 - description: "Running provider update command.",
559 - };
459 const succeededResult: ProviderUpdateToastView = {
460 phase: "succeeded",
461 type: "success",
@@ -581,18 +480,6 @@ describe("provider update launch notification logic", () => {
480 }),
481 ).toMatchObject({ kind: "failed", text: "boom" });
482 });
584 -
585 - it("falls through a non-terminal result to live server state", () => {
586 - expect(
587 - resolveEnvironmentUpdateRowStatus({
588 - group,
589 - error: undefined,
590 - result: runningResult,
591 - pill: successPill,
592 - isPending: true,
593 - }),
594 - ).toMatchObject({ kind: "success" });
595 - });
483 });
484 });
485
@@ -674,31 +561,4 @@ describe("getProviderUpdateRunToastView", () => {
561 description: "Mac Studio · Claude: npm exited with code 1.\nLaptop · Codex: WebSocket closed",
562 });
563 });
677 -
678 - it("reports success when every update succeeded", () => {
679 - const succeeded = AsyncResult.success({
680 - providers: [
681 - provider({
682 - driver: driver("codex"),
683 - updateState: updateState("succeeded", "Provider updated."),
684 - }),
685 - ],
686 - });
687 -
688 - expect(
689 - getProviderUpdateRunToastView([
690 - run("Mac Studio", "codex", succeeded),
691 - run("Laptop", "codex", succeeded),
692 - ]),
693 - ).toEqual({
694 - type: "success",
695 - title: "2 providers updated",
696 - description: "New sessions will use the updated providers.",
697 - });
698 - expect(
699 - getProviderUpdateRunToastView([
700 - run("Server", "codex", AsyncResult.failure(Cause.interrupt())),
701 - ]),
702 - ).toBeNull();
703 - });
564 });
apps/web/src/components/PullRequestThreadDialog.test.ts
-36
@@ -150,12 +150,6 @@ function prepareAction(label: "Local" | "Worktree") {
150 return action;
151 }
152
153 -function visibleText(node: ReactNode): string {
154 - if (Array.isArray(node)) return node.map(visibleText).join(" ");
155 - if (typeof node === "string" || typeof node === "number") return String(node);
156 - return isValidElement<{ children?: ReactNode }>(node) ? visibleText(node.props.children) : "";
157 -}
158 -
153 describe("pull request worktree permissions", () => {
154 beforeEach(() => {
155 state.canOperate = false;
@@ -173,14 +167,6 @@ describe("pull request worktree permissions", () => {
167 state.prepared = [];
168 });
169
176 - it("does not prepare a worktree or run setup with only source-control permission", async () => {
177 - await prepareAction("Worktree")();
178 -
179 - expect(state.checkouts).toEqual([]);
180 - expect(state.setupScripts).toBe(0);
181 - expect(state.prepared).toEqual([]);
182 - });
183 -
170 it("rechecks task permission before invoking a retained worktree action", async () => {
171 state.canOperate = true;
172 const prepare = prepareAction("Worktree");
@@ -190,26 +176,4 @@ describe("pull request worktree permissions", () => {
176 expect(state.checkouts).toEqual([]);
177 expect(state.setupScripts).toBe(0);
178 });
193 -
194 - it.each(["Local", "Worktree"] as const)(
195 - "shows the returned scope denial for a retained %s callback without starting a checkout",
196 - async (label) => {
197 - state.canOperate = true;
198 - state.manager = { operation: "pull", error: null, isRunning: true };
199 - const prepare = prepareAction(label);
200 - state.canWriteSourceControl = false;
201 -
202 - await prepare();
203 -
204 - expect(visibleText(renderDialog())).toContain(
205 - "This connection cannot change source control.",
206 - );
207 - expect(state.checkouts).toEqual([]);
208 - expect(state.setupScripts).toBe(0);
209 - expect(state.prepared).toEqual([]);
210 - expect(state.openChanges).toEqual([]);
211 - expect(state.tracks).toBe(0);
212 - expect(state.manager).toEqual({ operation: "pull", error: null, isRunning: true });
213 - },
214 - );
179 });
apps/web/src/components/Sidebar.drag.test.ts
+2 -71
@@ -1,6 +1,6 @@
1 import { describe, expect, it } from "vite-plus/test";
2 import { closestCenter, type CollisionDetection } from "@dnd-kit/core";
3 -import { verticalListSortingStrategy, type SortingStrategy } from "@dnd-kit/sortable";
3 +import type { SortingStrategy } from "@dnd-kit/sortable";
4 import {
5 createSidebarCollisionDetection,
6 createSidebarSortingStrategy,
@@ -119,11 +119,6 @@ describe("sidebar collision detection", () => {
119 },
120 );
121
122 - it("selects the nearest supported target", () => {
123 - const detector = createSidebarCollisionDetection(() => true);
124 - expect(detector(collisionArgs())[0]?.id).toBe("blocked");
125 - });
126 -
122 it.each([
123 { sourceSection: "active", pins: 0 },
124 { sourceSection: "active", pins: 1 },
@@ -301,22 +296,6 @@ describe("sidebar drag projection", () => {
296 thread("s1", "settled"),
297 ];
298
304 - it.each([
305 - ["p1", "p2"],
306 - ["p2", "p1"],
307 - ])("preserves existing pinned transforms from %s to %s", (active, over) => {
308 - const strategy = createSidebarSortingStrategy({
309 - items: pinned,
310 - settledOrder: [],
311 - settledExpanded: true,
312 - });
313 - const args = layout(pinned, active, over);
314 - for (let index = 0; index < pinned.length; index += 1) {
315 - if (index === args.activeIndex) continue;
316 - expect(strategy({ ...args, index })).toEqual(verticalListSortingStrategy({ ...args, index }));
317 - }
318 - });
319 -
299 it("keeps the pinned header above the gap when a lower pin moves to the top", () => {
300 const result = preview(
301 { items: pinned, settledOrder: [], settledExpanded: true },
@@ -428,37 +407,6 @@ describe("sidebar drag projection", () => {
407 },
408 );
409
431 - it("scales the label space with the measured root scale", () => {
432 - const items = [pinnedHeader, thread("p", "pinned"), divider, thread("a1", "active")];
433 - const result = preview(
434 - { items, settledOrder: [], settledExpanded: true, boundaryLabelHeight: 16 },
435 - "a1",
436 - "p",
437 - 2,
438 - );
439 - expect(result.get(sidebarMarkerId("pinned-divider"))?.y).toBe(32 + 165);
440 - });
441 -
442 - it("keeps the pinned header above the first arriving pin", () => {
443 - const items = [
444 - pinnedHeader,
445 - divider,
446 - thread("a1", "active"),
447 - thread("a2", "active"),
448 - settledHeader,
449 - thread("s", "settled"),
450 - ];
451 - const result = preview(
452 - { items, settledOrder: [], settledExpanded: true },
453 - "a2",
454 - sidebarMarkerId("pinned-header"),
455 - );
456 - expect(result.get(sidebarMarkerId("pinned-header"))).toEqual(stationary);
457 - expect(result.get(sidebarMarkerId("pinned-divider"))?.y).toBe(83);
458 - expect(result.get("a1")?.y).toBe(83);
459 - expect(result.get(sidebarMarkerId("settled-header"))?.y).toBe(0);
460 - });
461 -
410 it.each([
411 ["p", -83, -1],
412 ["s", 0, 82],
@@ -562,24 +510,6 @@ describe("sidebar drag projection", () => {
510 expect(result.get(sidebarMarkerId("settled-placeholder"))).toEqual({ ...stationary, y: -83 });
511 });
512
565 - it("preserves a collapsed snoozed header while another section changes", () => {
566 - const items = [
567 - pinnedHeader,
568 - thread("p", "pinned"),
569 - divider,
570 - thread("a", "active"),
571 - marker("snoozed-header"),
572 - settledHeader,
573 - marker("settled-placeholder"),
574 - ];
575 - const result = preview(
576 - { items, settledOrder: [], settledExpanded: false },
577 - "a",
578 - sidebarMarkerId("settled-placeholder"),
579 - );
580 - expect(result.get(sidebarMarkerId("snoozed-header"))).toEqual({ ...stationary, y: -46 });
581 - });
582 -
513 it("previews a time-ordered inbox drop at its time slot, above the Working shelf", () => {
514 const items = [
515 pinnedHeader,
@@ -786,6 +716,7 @@ describe("lifted card clearance", () => {
716 }
717 });
718
719 + // regression: #10453 the label clamp must not swallow drags that are already below it
720 it("preserves pointer movement below the label", () => {
721 expect(apply(511, 36, -200).y).toBe(-200);
722 });
apps/web/src/components/Sidebar.logic.test.ts
+1 -109
@@ -1,7 +1,4 @@
1 -import {
2 - formatWorkingDurationLabel,
3 - presentThreadShell,
4 -} from "@t3tools/client-runtime/state/models";
1 +import { presentThreadShell } from "@t3tools/client-runtime/state/models";
2 import * as DateTime from "effect/DateTime";
3 import { deriveActiveWorkStartedAt } from "../session-logic.ts";
4 import { describe, expect, it, vi } from "vite-plus/test";
@@ -419,19 +416,6 @@ describe("resolveThreadStatusPill", () => {
416 },
417 };
418
422 - it("shows pending approval before all other statuses", () => {
423 - expect(
424 - resolveThreadStatusPill({
425 - thread: {
426 - ...baseThread,
427 - hasPendingApprovals: true,
428 - hasPendingUserInput: true,
429 - blockedOnThreadWait: true,
430 - },
431 - }),
432 - ).toMatchObject({ label: "Pending Approval", pulse: false });
433 - });
434 -
419 it("shows an active thread wait without a pulse and resumes Working when it ends", () => {
420 const blocked = { ...baseThread, blockedOnThreadWait: true };
421 expect(resolveSidebarThreadStatus(blocked)).toBe("waiting");
@@ -469,33 +453,6 @@ describe("resolveThreadStatusPill", () => {
453 });
454 });
455
472 - it("keeps an active turn working when background tasks are also present", () => {
473 - expect(
474 - resolveThreadStatusPill({
475 - thread: {
476 - ...baseThread,
477 - pendingBackgroundTasks: [{ taskId: "bg-1", description: "sleep 20", kind: "command" }],
478 - },
479 - }),
480 - ).toMatchObject({ label: "Working", pulse: true });
481 - });
482 -
483 - it("does not show waiting after the background task roster clears", () => {
484 - expect(
485 - resolveThreadStatusPill({
486 - thread: {
487 - ...baseThread,
488 - pendingBackgroundTasks: [],
489 - runtime: {
490 - ...baseThread.runtime,
491 - status: "idle",
492 - activeRunId: null,
493 - },
494 - },
495 - }),
496 - ).toBeNull();
497 - });
498 -
456 it("shows plan ready when a settled plan turn has a proposed plan ready for follow-up", () => {
457 expect(
458 resolveThreadStatusPill({
@@ -596,31 +553,6 @@ describe("resolveThreadStatusPill", () => {
553 });
554
555 describe("resolveProjectStatusIndicator", () => {
599 - it("surfaces the highest-priority actionable state across project threads", () => {
600 - expect(
601 - resolveProjectStatusIndicator([
602 - {
603 - label: "Completed",
604 - colorClass: "text-emerald-600",
605 - dotClass: "bg-emerald-500",
606 - pulse: false,
607 - },
608 - {
609 - label: "Pending Approval",
610 - colorClass: "text-amber-600",
611 - dotClass: "bg-amber-500",
612 - pulse: false,
613 - },
614 - {
615 - label: "Working",
616 - colorClass: "text-sky-600",
617 - dotClass: "bg-sky-500",
618 - pulse: true,
619 - },
620 - ]),
621 - ).toMatchObject({ label: "Pending Approval", dotClass: "bg-amber-500" });
622 - });
623 -
556 it("ranks waiting below active work and above plan-ready", () => {
557 const waiting = {
558 label: "Waiting" as const,
@@ -704,41 +636,6 @@ function makeThread(overrides: ThreadFixtureOverrides = {}): Thread {
636 }
637
638 describe("getFallbackThreadIdAfterDelete", () => {
707 - it("returns the top remaining thread in the deleted thread's project sidebar order", () => {
708 - const fallbackThreadId = getFallbackThreadIdAfterDelete({
709 - threads: [
710 - makeThread({
711 - id: ThreadId.make("thread-oldest"),
712 - projectId: ProjectId.make("project-1"),
713 - createdAt: "2026-03-09T10:00:00.000Z",
714 - messages: [],
715 - }),
716 - makeThread({
717 - id: ThreadId.make("thread-active"),
718 - projectId: ProjectId.make("project-1"),
719 - createdAt: "2026-03-09T10:05:00.000Z",
720 - messages: [],
721 - }),
722 - makeThread({
723 - id: ThreadId.make("thread-newest"),
724 - projectId: ProjectId.make("project-1"),
725 - createdAt: "2026-03-09T10:10:00.000Z",
726 - messages: [],
727 - }),
728 - makeThread({
729 - id: ThreadId.make("thread-other-project"),
730 - projectId: ProjectId.make("project-2"),
731 - createdAt: "2026-03-09T10:20:00.000Z",
732 - messages: [],
733 - }),
734 - ],
735 - deletedThreadId: ThreadId.make("thread-active"),
736 - sortOrder: "created_at",
737 - });
738 -
739 - expect(fallbackThreadId).toBe(ThreadId.make("thread-newest"));
740 - });
741 -
639 it("skips other threads being deleted in the same action", () => {
640 const fallbackThreadId = getFallbackThreadIdAfterDelete({
641 threads: [
@@ -937,11 +834,6 @@ describe("sortSidebarV2ProjectGroups", () => {
834 });
835
836 describe("pinOrderKeyBetween", () => {
940 - it("extends into new digits when bounds are adjacent", () => {
941 - const key = pinOrderKeyBetween("g", "h")!;
942 - expect("g" < key && key < "h").toBe(true);
943 - });
944 -
837 it("stays strictly ordered under repeated top insertion", () => {
838 let head: string | null = null;
839 const keys: string[] = [];
apps/web/src/components/Sidebar.pointer.browser.test.tsx
+1 -19
@@ -4,7 +4,6 @@ import { fakeTimers } from "../../test/render";
4 import { SidebarPointerSensor } from "./Sidebar.pointer";
5
6 const sensors: SidebarPointerSensor[] = [];
7 -let hidden = false;
7
8 function pointer(type: string, values: PointerEventInit = {}) {
9 return new PointerEvent(type, {
@@ -44,8 +43,6 @@ function gesture(
43 function setup() {
44 const stack = new DisposableStack();
45 stack.use(fakeTimers());
47 - hidden = false;
48 - stack.use(vi.spyOn(document, "hidden", "get").mockImplementation(() => hidden));
46 stack.defer(() => {
47 for (const sensor of sensors.splice(0)) sensor.cancel();
48 // Cancelled sensors keep suppressing clicks on the shared document until the next press.
@@ -56,22 +53,6 @@ function setup() {
53 }
54
55 describe("sidebar pointer lifecycle", () => {
59 - const interruptions = {
60 - blur: () => window.dispatchEvent(new Event("blur")),
61 - hidden: () => {
62 - hidden = true;
63 - document.dispatchEvent(new Event("visibilitychange"));
64 - },
65 - pagehide: () => window.dispatchEvent(new Event("pagehide")),
66 - resize: () => window.dispatchEvent(new Event("resize")),
67 - escape: () => document.dispatchEvent(new KeyboardEvent("keydown", { code: "Escape" })),
68 - pointercancel: () => document.dispatchEvent(pointer("pointercancel")),
69 - "missed release": () =>
70 - document.dispatchEvent(pointer("pointermove", { buttons: 0, clientY: 100 })),
71 - };
72 - for (const [] of Object.entries(interruptions)) {
73 - }
74 -
56 it("drops context when a zero-button move precedes pointerup", () => {
57 using _environment = setup();
58 const onDrop = vi.fn((point: { x: number; y: number }) => point.x > 50);
@@ -90,6 +71,7 @@ describe("sidebar pointer lifecycle", () => {
71 expect(drag.onFinish).toHaveBeenCalledExactlyOnceWith(true);
72 });
73
74 + // regression: #17373 a zero-button release outside a drop target must cancel, not reorder
75 it("cancels a missed sidebar release without committing a reorder", () => {
76 using _environment = setup();
77 const onDrop = vi.fn((point: { x: number; y: number }) => point.x > 50);
apps/web/src/components/ThreadStatusIndicators.test.tsx deleted
-39
@@ -1,39 +0,0 @@
1 -import type { ThreadPullRequestLink } from "@t3tools/contracts";
2 -import { describe, expect, it } from "vite-plus/test";
3 -
4 -import { linkedPullRequestSnapshotStatus } from "./ThreadStatusIndicators";
5 -
6 -describe("linked pull request snapshots", () => {
7 - const link: ThreadPullRequestLink = {
8 - host: "gitlab.example.com",
9 - repository: "acme/web",
10 - number: 42,
11 - url: "https://gitlab.example.com/acme/web/-/merge_requests/42",
12 - source: "manual",
13 - linkedAt: "2026-01-01T00:00:00Z",
14 - stack: null,
15 - snapshot: null,
16 - };
17 - it.each([
18 - ["https://git.cafe/owner/repo/pulls/42", "gitcafe"],
19 - ["https://staging.git.cafe/owner/repo/pulls/42", "gitcafe"],
20 - ["https://codeberg.org/owner/repo/pulls/42", "forgejo"],
21 - ["https://gitlab.example.com/acme/web/-/merge_requests/42", "gitlab"],
22 - ["https://github.com/owner/repo/pull/42", "github"],
23 - ])("classifies %s as %s", (url, kind) => {
24 - const result = linkedPullRequestSnapshotStatus({
25 - ...link,
26 - url,
27 - snapshot: {
28 - state: "open",
29 - title: "Change",
30 - headBranch: "feature",
31 - baseBranch: "main",
32 - isDraft: false,
33 - updatedAt: null,
34 - syncedAt: "2026-01-03T00:00:00Z",
35 - },
36 - });
37 - expect(result?.sourceControlProvider.kind).toBe(kind);
38 - });
39 -});
apps/web/src/components/chat/ComposerPendingApprovalActions.browser.test.tsx deleted
-68
@@ -1,68 +0,0 @@
1 -import { RuntimeRequestId, type ProviderApprovalOption } from "@t3tools/contracts";
2 -import { describe, expect, it, vi } from "vite-plus/test";
3 -
4 -import { act, render } from "../../../test/render";
5 -import { ComposerPendingApprovalActions } from "./ComposerPendingApprovalActions";
6 -
7 -function renderActions(
8 - onRespond: () => Promise<undefined>,
9 - options?: ReadonlyArray<ProviderApprovalOption>,
10 -) {
11 - return render(
12 - <ComposerPendingApprovalActions
13 - requestId={RuntimeRequestId.make("approval-1")}
14 - canRespond
15 - isResponding={false}
16 - options={options}
17 - onRespondToApproval={onRespond}
18 - />,
19 - );
20 -}
21 -
22 -const rowLabels = (container: HTMLElement) =>
23 - [...container.querySelectorAll("button")]
24 - .map((button) => button.textContent?.trim())
25 - .filter(Boolean);
26 -
27 -async function openMore(container: HTMLElement) {
28 - await act(async () =>
29 - container.querySelector<HTMLElement>('[aria-label="More approval options"]')!.click(),
30 - );
31 - return [...document.querySelectorAll<HTMLElement>('[role="menuitem"]')];
32 -}
33 -
34 -describe("ComposerPendingApprovalActions", () => {
35 - it("keeps the main decisions in the row and sends a secondary decision from the menu", async () => {
36 - const onRespond = vi.fn(async () => undefined);
37 - await using screen = await renderActions(onRespond);
38 - expect(rowLabels(screen.container)).toEqual(["Decline", "Approve"]);
39 -
40 - const items = await openMore(screen.container);
41 - expect(items.map((item) => item.textContent?.trim())).toEqual([
42 - "Cancel",
43 - "Always allow this session",
44 - ]);
45 - await act(async () => items[1]!.click());
46 - expect(onRespond).toHaveBeenCalledWith(RuntimeRequestId.make("approval-1"), "acceptForSession");
47 - });
48 -
49 - it("keeps provider labels, including secondary ones, where the user can find them", async () => {
50 - const onRespond = vi.fn(async () => undefined);
51 - await using screen = await renderActions(onRespond, [
52 - { decision: "decline", label: "Deny" },
53 - { decision: "acceptAlways", label: "Always allow Safari" },
54 - { decision: "accept", label: "Allow once" },
55 - ]);
56 - expect(rowLabels(screen.container)).toEqual(["Deny", "Allow once"]);
57 - expect((await openMore(screen.container)).map((item) => item.textContent?.trim())).toEqual([
58 - "Always allow Safari",
59 - ]);
60 -
61 - await act(async () =>
62 - [...screen.container.querySelectorAll("button")]
63 - .find((button) => button.textContent?.trim() === "Allow once")!
64 - .click(),
65 - );
66 - expect(onRespond).toHaveBeenCalledWith(RuntimeRequestId.make("approval-1"), "accept");
67 - });
68 -});
apps/web/src/components/chat/ContextWindowMeter.logic.test.ts
-10
@@ -134,16 +134,6 @@ describe("hasDismissedResumeCompaction", () => {
134 ]),
135 ).toBe(false);
136 });
137 -
138 - it("ignores pending questions and malformed resolved payloads", () => {
139 - expect(
140 - hasDismissedResumeCompaction([
141 - { kind: "user-input.requested", payload: { answers: { question: "Don't ask again" } } },
142 - { kind: "user-input.resolved", payload: null },
143 - { kind: "user-input.resolved", payload: { answers: ["Don't ask again"] } },
144 - ]),
145 - ).toBe(false);
146 - });
137 });
138
139 describe("shouldReserveContextWindowMeter", () => {
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
-345
@@ -989,48 +989,6 @@ describe("deriveMessagesTimelineRows", () => {
989 ]);
990 });
991
992 - it("keeps the working header below the initiating prompt across repeated steers", () => {
993 - const runId = RunId.make("steered-run");
994 - const startedAt = "2026-01-01T00:00:00Z";
995 - const prompt = (id: string, inputIntent: "steer" | "send") => ({
996 - id,
997 - kind: "message" as const,
998 - createdAt: startedAt,
999 - message: {
1000 - id: MessageId.make(id),
1001 - role: "user" as const,
1002 - text: id,
1003 - runId,
1004 - ...(inputIntent === "steer" ? { inputIntent } : {}),
1005 - createdAt: startedAt,
1006 - updatedAt: startedAt,
1007 - streaming: false,
1008 - },
1009 - });
1010 - const timelineEntries = [prompt("initial-prompt", "send")];
1011 - for (let index = 0; index < 3; index += 1) {
1012 - const rows = deriveMessagesTimelineRows({
1013 - timelineEntries,
1014 - latestRun: { runId, status: "running", startedAt, completedAt: null },
1015 - isWorking: true,
1016 - activeTurnStartedAt: startedAt,
1017 - turnDiffSummaries: [],
1018 - supportsConversationRollback: false,
1019 - });
1020 - expect(rows.slice(0, 2).map((row) => row.id)).toEqual([
1021 - "initial-prompt",
1022 - "working-indicator-row",
1023 - ]);
1024 - expect(rows.filter((row) => row.kind === "working")).toEqual([
1025 - expect.objectContaining({ createdAt: startedAt }),
1026 - ]);
1027 - expect(rows.filter((row) => row.kind === "message").map((row) => row.id)).toEqual(
1028 - timelineEntries.map((entry) => entry.id),
1029 - );
1030 - timelineEntries.push(prompt(`steer-${index}`, "steer"));
1031 - }
1032 - });
1033 -
992 it.each(["steer", "promoted_queued_to_steer"] as const)(
993 "keeps the duration header at the initiating prompt when %s arrives before output",
994 (inputIntent) => {
@@ -1214,56 +1172,6 @@ describe("deriveMessagesTimelineRows", () => {
1172 expect(ended.some((row) => row.kind === "thinking")).toBe(false);
1173 });
1174
1217 - it("does not fold the active in-progress turn", () => {
1218 - const rows = deriveMessagesTimelineRows({
1219 - timelineEntries: [
1220 - {
1221 - id: "assistant-thought-entry",
1222 - kind: "message",
1223 - createdAt: "2026-01-01T00:00:05Z",
1224 - message: {
1225 - id: "assistant-thought" as never,
1226 - role: "assistant",
1227 - text: "Working on it.",
1228 - runId: "turn-1" as never,
1229 - createdAt: "2026-01-01T00:00:05Z",
1230 - updatedAt: "2026-01-01T00:00:06Z",
1231 - streaming: false,
1232 - },
1233 - },
1234 - {
1235 - id: "work-entry-1",
1236 - kind: "work",
1237 - createdAt: "2026-01-01T00:00:08Z",
1238 - entry: {
1239 - id: "work-1",
1240 - createdAt: "2026-01-01T00:00:08Z",
1241 - runId: "turn-1" as never,
1242 - label: "Ran command",
1243 - tone: "tool" as const,
1244 - },
1245 - },
1246 - ],
1247 - latestRun: {
1248 - runId: "turn-1" as never,
1249 - status: "running",
1250 - startedAt: "2026-01-01T00:00:00Z",
1251 - completedAt: null,
1252 - },
1253 - isWorking: true,
1254 - activeTurnStartedAt: "2026-01-01T00:00:00Z",
1255 - turnDiffSummaries: [],
1256 - supportsConversationRollback: false,
1257 - });
1258 -
1259 - expect(rows.some((row) => row.kind === "turn-fold")).toBe(false);
1260 - expect(rows.map((row) => row.id)).toEqual([
1261 - "working-indicator-row",
1262 - "assistant-thought-entry",
1263 - "live-activity-row",
1264 - ]);
1265 - });
1266 -
1175 it("keeps a promptless restart in one active visual response", () => {
1176 const rows = deriveMessagesTimelineRows({
1177 timelineEntries: [
@@ -1864,60 +1772,6 @@ describe("deriveMessagesTimelineRows", () => {
1772 ).toBe(true);
1773 });
1774
1867 - it("shows a provider-native subagent's runless tools as live work while it works", () => {
1868 - const entries = (commandStatus: "inProgress" | "completed") => [
1869 - {
1870 - id: "task-entry",
1871 - kind: "message" as const,
1872 - createdAt: "2026-01-01T00:00:00Z",
1873 - message: {
1874 - id: "task" as never,
1875 - role: "user" as const,
1876 - text: "Audit the adapters",
1877 - runId: null,
1878 - createdAt: "2026-01-01T00:00:00Z",
1879 - updatedAt: "2026-01-01T00:00:00Z",
1880 - streaming: false,
1881 - },
1882 - },
1883 - {
1884 - id: "command-entry",
1885 - kind: "work" as const,
1886 - createdAt: "2026-01-01T00:00:05Z",
1887 - entry: {
1888 - id: "command",
1889 - createdAt: "2026-01-01T00:00:05Z",
1890 - runId: null,
1891 - label: "Running git",
1892 - command: "git diff --stat",
1893 - requestKind: "command" as const,
1894 - tone: "tool" as const,
1895 - toolLifecycleStatus: commandStatus,
1896 - },
1897 - },
1898 - ];
1899 - const rows = (input: { commandStatus: "inProgress" | "completed"; working: boolean }) =>
1900 - deriveMessagesTimelineRows({
1901 - timelineEntries: entries(input.commandStatus),
1902 - latestRun: null,
1903 - isWorking: input.working,
1904 - runlessWorkActive: input.working,
1905 - activeTurnStartedAt: input.working ? "2026-01-01T00:00:00Z" : null,
1906 - turnDiffSummaries: [],
1907 - supportsConversationRollback: false,
1908 - });
1909 -
1910 - const running = rows({ commandStatus: "inProgress", working: true });
1911 - expect(running.map((row) => row.kind)).toEqual(["message", "working", "work-live"]);
1912 - expect(running.find((row) => row.kind === "work-live")).toMatchObject({
1913 - entry: { id: "command" },
1914 - active: true,
1915 - });
1916 -
1917 - const settled = rows({ commandStatus: "completed", working: false });
1918 - expect(settled.map((row) => row.kind)).toEqual(["message", "turn-fold"]);
1919 - });
1920 -
1775 it("does not treat runless entries as live work on a thread with runs", () => {
1776 const rows = deriveMessagesTimelineRows({
1777 timelineEntries: [
@@ -2063,76 +1917,10 @@ describe("deriveMessagesTimelineRows", () => {
1917 expect(rows.some((row) => row.kind === "work-live")).toBe(false);
1918 });
1919
2066 - it("does not revive separated historical task progress", () => {
2067 - const rows = deriveMessagesTimelineRows({
2068 - timelineEntries: [
2069 - {
2070 - id: "stale-progress-entry",
2071 - kind: "work",
2072 - createdAt: "2026-01-01T00:00:05Z",
2073 - entry: {
2074 - id: "stale-progress",
2075 - createdAt: "2026-01-01T00:00:05Z",
2076 - runId: "turn-1" as never,
2077 - label: "Old progress",
2078 - tone: "thinking" as const,
2079 - sourceActivityKind: "task.progress" as const,
2080 - },
2081 - },
2082 - {
2083 - id: "assistant-commentary-entry",
2084 - kind: "message",
2085 - createdAt: "2026-01-01T00:00:06Z",
2086 - message: {
2087 - id: "assistant-commentary" as never,
2088 - role: "assistant",
2089 - text: "Starting another command.",
2090 - runId: "turn-1" as never,
2091 - createdAt: "2026-01-01T00:00:06Z",
2092 - updatedAt: "2026-01-01T00:00:06Z",
2093 - streaming: false,
2094 - },
2095 - },
2096 - {
2097 - id: "running-command-entry",
2098 - kind: "work",
2099 - createdAt: "2026-01-01T00:00:07Z",
2100 - entry: {
2101 - id: "running-command",
2102 - createdAt: "2026-01-01T00:00:07Z",
2103 - runId: "turn-1" as never,
2104 - label: "Running command",
2105 - command: "rg current",
2106 - requestKind: "command",
2107 - tone: "tool" as const,
2108 - toolLifecycleStatus: "inProgress" as const,
2109 - },
2110 - },
2111 - ],
2112 - latestRun: {
2113 - runId: "turn-1" as never,
2114 - status: "running",
2115 - startedAt: "2026-01-01T00:00:00Z",
2116 - completedAt: null,
2117 - },
2118 - isWorking: true,
2119 - activeTurnStartedAt: "2026-01-01T00:00:00Z",
2120 - turnDiffSummaries: [],
2121 - supportsConversationRollback: false,
2122 - });
2123 -
2124 - expect(rows.filter((row) => row.kind === "work-live").map((row) => row.entry.id)).toEqual([
2125 - "running-command",
2126 - ]);
2127 - });
2128 -
1920 it.each([
2130 - [undefined, true],
1921 ["inProgress", true],
1922 ["completed", false],
1923 ["failed", null],
2134 - ["declined", false],
2135 - ["stopped", false],
1924 ] as const)(
1925 "respects the %s lifecycle of trailing task progress",
1926 (toolLifecycleStatus, active) => {
@@ -2313,46 +2101,6 @@ describe("deriveMessagesTimelineRows", () => {
2101 expect(rows.map((row) => row.id)).toContain("live-activity-row");
2102 });
2103
2316 - it("withholds assistant metadata while the active turn is still in progress", () => {
2317 - const rows = deriveMessagesTimelineRows({
2318 - timelineEntries: [
2319 - {
2320 - id: "assistant-thought-entry",
2321 - kind: "message",
2322 - createdAt: "2026-01-01T00:00:10Z",
2323 - message: {
2324 - id: "assistant-thought" as never,
2325 - role: "assistant",
2326 - text: "Working on it.",
2327 - runId: "turn-1" as never,
2328 - createdAt: "2026-01-01T00:00:10Z",
2329 - updatedAt: "2026-01-01T00:00:11Z",
2330 - streaming: false,
2331 - },
2332 - },
2333 - ],
2334 - latestRun: {
2335 - runId: "turn-1" as never,
2336 - status: "running",
2337 - startedAt: "2026-01-01T00:00:00Z",
2338 - completedAt: null,
2339 - },
2340 - isWorking: true,
2341 - activeTurnStartedAt: "2026-01-01T00:00:00Z",
2342 - turnDiffSummaries: [],
2343 - supportsConversationRollback: false,
2344 - });
2345 -
2346 - const assistantRow = rows.find(
2347 - (row): row is Extract<(typeof rows)[number], { kind: "message" }> =>
2348 - row.kind === "message" && row.message.role === "assistant",
2349 - );
2350 -
2351 - expect(assistantRow?.showAssistantMeta).toBe(false);
2352 - expect(assistantRow?.showAssistantCopyButton).toBe(false);
2353 - expect(rows.at(-1)).toMatchObject({ kind: "thinking" });
2354 - });
2355 -
2104 it.each([
2105 ["the later success is hidden", ["failed", "completed", "info"], false],
2106 ["the later success is visible", ["failed", "info", "completed"], false],
@@ -2548,76 +2296,6 @@ describe("v2 run and attempt history", () => {
2296 expect.objectContaining({ id: "provider-recovered" }),
2297 ]);
2298 });
2551 - it("hides subagents in folded turns when they arrive before commentary", () => {
2552 - const timelineEntries = [
2553 - {
2554 - id: "user-entry",
2555 - kind: "message" as const,
2556 - createdAt: "2026-01-01T00:00:00Z",
2557 - message: {
2558 - id: "user-1" as never,
2559 - role: "user" as const,
2560 - text: "Spawn a subagent",
2561 - runId: null,
2562 - createdAt: "2026-01-01T00:00:00Z",
2563 - updatedAt: "2026-01-01T00:00:00Z",
2564 - streaming: false,
2565 - },
2566 - },
2567 - {
2568 - id: "subagent-card-entry",
2569 - kind: "event" as const,
2570 - createdAt: "2026-01-01T00:00:03Z",
2571 - projectedItem: {
2572 - item: {
2573 - type: "subagent",
2574 - runId: "turn-1",
2575 - },
2576 - } as never,
2577 - },
2578 - {
2579 - id: "assistant-commentary-entry",
2580 - kind: "message" as const,
2581 - createdAt: "2026-01-01T00:00:05Z",
2582 - message: {
2583 - id: "assistant-commentary" as never,
2584 - role: "assistant" as const,
2585 - text: "I spawned the subagent.",
2586 - runId: "turn-1" as never,
2587 - createdAt: "2026-01-01T00:00:05Z",
2588 - updatedAt: "2026-01-01T00:00:06Z",
2589 - streaming: false,
2590 - },
2591 - },
2592 - {
2593 - id: "assistant-final-entry",
2594 - kind: "message" as const,
2595 - createdAt: "2026-01-01T00:00:20Z",
2596 - message: {
2597 - id: "assistant-final" as never,
2598 - role: "assistant" as const,
2599 - text: "Subagent says: Hello.",
2600 - runId: "turn-1" as never,
2601 - createdAt: "2026-01-01T00:00:20Z",
2602 - updatedAt: "2026-01-01T00:00:22Z",
2603 - streaming: false,
2604 - },
2605 - },
2606 - ];
2607 -
2608 - const collapsedRows = deriveMessagesTimelineRows({
2609 - timelineEntries,
2610 - isWorking: false,
2611 - turnDiffSummaries: [],
2612 - supportsConversationRollback: false,
2613 - });
2614 -
2615 - expect(collapsedRows.map((row) => row.id)).toEqual([
2616 - "user-entry",
2617 - "turn-fold:turn-1",
2618 - "assistant-final-entry",
2619 - ]);
2620 - });
2299 it("collapses only output from a superseded V2 attempt within the active logical run", () => {
2300 const runId = "run-steered" as never;
2301 const supersededAttemptId = "attempt-1" as never;
@@ -3174,29 +2852,6 @@ describe("streaming v2 row projection", () => {
2852 },
2853 );
2854
3177 - it("leaves emitted rows immutable when a projection branches", () => {
3178 - const initial = fixture("Initial");
3179 - const previous = deriveMessagesTimelineRowsWithState(initial.input);
3180 - const branch = (text: string) => {
3181 - const timeline = deriveTimelineEntriesFromVisibleTurnItemsWithState(
3182 - { ...initial.timelineInput, visibleTurnItems: updateText(initial.visibleTurnItems, text) },
3183 - initial.timeline,
3184 - );
3185 - const input = { ...initial.input, timelineEntries: timeline.entries };
3186 - const next = deriveMessagesTimelineRowsWithState(input, previous);
3187 - expect(next.rows).toEqual(deriveMessagesTimelineRows(input));
3188 - return next;
3189 - };
3190 - const first = branch("First");
3191 - branch("Second");
3192 - expect(first.rows.find((row) => row.id === "live-assistant")).toMatchObject({
3193 - message: { text: "First" },
3194 - });
3195 - expect(previous.rows.find((row) => row.id === "live-assistant")).toMatchObject({
3196 - message: { text: "Initial" },
3197 - });
3198 - });
3199 -
2855 it("rebuilds for completion, late failure, metadata, expansion, and older history", () => {
2856 const initial = fixture("Partial");
2857 let timeline = initial.timeline;
apps/web/src/components/chat/ProviderStatusBanner.test.ts
-14
@@ -109,18 +109,4 @@ describe("compatibility banners", () => {
109 broken.message,
110 );
111 });
112 -
113 - it("keeps authentication failures ahead of compatibility warnings even without a probe message", () => {
114 - const unauthenticated: ServerProvider = {
115 - ...provider,
116 - status: "error",
117 - auth: { status: "unauthenticated" },
118 - };
119 - expect(getProviderStatusMessage(unauthenticated)).toBe(
120 - "Sign in via the CLI to authenticate again.",
121 - );
122 - expect(getProviderStatusMessage({ ...unauthenticated, message: "Credentials expired" })).toBe(
123 - "Credentials expired",
124 - );
125 - });
112 });
apps/web/src/components/chat/V2LifecycleRow.logic.test.ts
+1
@@ -17,6 +17,7 @@ describe("subagentResumedSince", () => {
17 ).toBe(true);
18 });
19
20 + // regression: #18099 a resumed subagent's old failure notification row showed failed instead of resumed
21 it("is true once a run started after the notification has settled", () => {
22 expect(subagentResumedSince({ status: "completed", startedAt: afterFailure }, failedAt)).toBe(
23 true,
apps/web/src/components/chat/composerAttachmentFiles.test.ts
-25
@@ -39,31 +39,6 @@ describe("composer attachment files", () => {
39 ).toBe("Waiting for the server before file attachments can send");
40 });
41
42 - it("uses the confirmed server limit without exceeding the hard cap", () => {
43 - expect(
44 - fileAttachmentStagingLimit({
45 - attachmentUploadsCapabilityKnown: true,
46 - supportsAttachmentUploads: true,
47 - maxFileAttachmentBytes: 1024 * 1024,
48 - }),
49 - ).toBe(1024 * 1024);
50 - expect(
51 - fileAttachmentStagingLimit({
52 - attachmentUploadsCapabilityKnown: true,
53 - supportsAttachmentUploads: true,
54 - maxFileAttachmentBytes: PROVIDER_SEND_TURN_MAX_FILE_BYTES * 2,
55 - }),
56 - ).toBe(PROVIDER_SEND_TURN_MAX_FILE_BYTES);
57 - expect(
58 - fileAttachmentCapabilityBlockReason({
59 - files: [{ name: "report.pdf", sizeBytes: 1024 }],
60 - attachmentUploadsCapabilityKnown: true,
61 - supportsAttachmentUploads: true,
62 - maxFileAttachmentBytes: 50 * 1024 * 1024,
63 - }),
64 - ).toBeNull();
65 - });
66 -
42 it("keeps draft-persisted file uploads when the upload capability flips off", () => {
43 const environmentId = EnvironmentId.make("environment-1");
44 const image: ComposerImageAttachment = {
apps/web/src/components/chat/composerMentionDrag.test.ts
-10
@@ -2,7 +2,6 @@ import { describe, expect, it } from "@effect/vitest";
2
3 import {
4 COMPOSER_MENTION_DRAG_TYPE,
5 - COMPOSER_PULL_REQUEST_DRAG_TYPE,
5 type ComposerMentionDropHost,
6 makeComposerMentionDragHandlers,
7 } from "./composerMentionDrag.ts";
@@ -81,13 +80,4 @@ describe("makeComposerMentionDragHandlers", () => {
80 handlers.onDragOver(event);
81 expect(event.dataTransfer.dropEffect).toBe("move");
82 });
84 -
85 - it("ignores a pull request payload that does not decode", () => {
86 - const { host, log } = makeHost();
87 - const handlers = makeComposerMentionDragHandlers(host);
88 - handlers.onDrop(
89 - makeDragEvent({ format: COMPOSER_PULL_REQUEST_DRAG_TYPE, mention: '{"number":0}' }).event,
90 - );
91 - expect(log).toEqual(["active:false"]);
92 - });
83 });
apps/web/src/components/chat/composerPromptHistory.test.ts
-4
@@ -118,10 +118,6 @@ describe("buildComposerPromptHistoryEntries", () => {
118 });
119
120 describe("stepComposerPromptHistory", () => {
121 - it("does not start browsing from a non-empty draft", () => {
122 - expect(backward(null, "typing")).toBeNull();
123 - });
124 -
121 it("walks back from the newest entry", () => {
122 const first = backward(null, "");
123 expect(first).toEqual({ position: { entryId: "m3", recalled: "third" }, prompt: "third" });
apps/web/src/components/chat/composerProviderState.test.tsx
+1
@@ -216,6 +216,7 @@ describe("getComposerProviderState", () => {
216 });
217
218 describe("withImplicitFastModeDefault", () => {
219 + // regression: #2981 a remembered Fast mode choice must survive the implicit default on new chats
220 it("injects fastMode false only when the model exposes fastMode and no selection exists", () => {
221 expect(
222 withImplicitFastModeDefault(
apps/web/src/components/chat/modelPickerSearch.test.ts
-14
@@ -3,20 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
3 import { rankModelPickerSearch, scoreModelPickerSearch } from "./modelPickerSearch";
4
5 describe("scoreModelPickerSearch", () => {
6 - it("matches typo-tolerant multi-token queries", () => {
7 - expect(
8 - scoreModelPickerSearch(
9 - {
10 - driverKind: "opencode",
11 - providerDisplayName: "opencode",
12 - name: "Claude Opus 4.7",
13 - subProvider: "GitHub Copilot",
14 - },
15 - "coplt op",
16 - ),
17 - ).not.toBeNull();
18 - });
19 -
6 it("ranks exact token matches ahead of fuzzier matches", () => {
7 const exactScore = scoreModelPickerSearch(
8 {
apps/web/src/components/chat/queuedMessageEdit.test.ts
-25
@@ -62,18 +62,6 @@ describe("queued message file edits", () => {
62 });
63 });
64
65 - it("retains saved attachments alongside newly uploaded files", async () => {
66 - const saved = { ...uploadedFile, id: "saved:earlier" };
67 - const attachments = await prepareQueuedEditAttachments({
68 - existingAttachments: [saved],
69 - images: [],
70 - files: [file],
71 - uploadFiles: async () => [uploadedFile],
72 - readImage: async () => "unused",
73 - });
74 - expect(attachments).toEqual([saved, uploadedFile]);
75 - });
76 -
65 it("fails a save instead of dropping a file whose upload is missing", async () => {
66 await expect(
67 prepareQueuedEditAttachments({
@@ -98,19 +86,6 @@ describe("queued message file edits", () => {
86 expect(store.getComposerDraft(editTarget)).toBeNull();
87 });
88
101 - it("preserves uploaded file references when a remote queue advance interrupts the edit", () => {
102 - const store = useComposerDraftStore.getState();
103 - const uploaded = {
104 - ...file,
105 - file: null,
106 - uploadedAttachmentId: uploadedFile.id,
107 - uploadEnvironmentId: environmentId,
108 - };
109 - store.addFiles(editTarget, [uploaded]);
110 - expect(recoverQueuedMessageEdit({ editTarget, threadTarget, originalText: "" })).toBe("kept");
111 - expect(store.getComposerDraft(threadTarget)?.files).toEqual([uploaded]);
112 - });
113 -
89 it("does not overwrite a separate draft when the queued run leaves", () => {
90 const store = useComposerDraftStore.getState();
91 store.setPrompt(threadTarget, "Separate draft");
apps/web/src/components/chat/timelineScrollAnchoring.test.tsx
-8
@@ -91,14 +91,6 @@ describe("observeTimelineRun", () => {
91 expect(observeTimelineRun(ready.observation, next).anchorMessageId).toBeNull();
92 });
93
94 - it("establishes a separate baseline when the same thread ID belongs to another environment", () => {
95 - const opened = observeTimelineRun(null, existing);
96 - expect(
97 - observeTimelineRun(opened.observation, { ...next, threadKey: "other:thread" })
98 - .anchorMessageId,
99 - ).toBeNull();
100 - });
101 -
94 it("does not reset the baseline during a temporary loss of projection data", () => {
95 const opened = observeTimelineRun(null, existing);
96 const reconnecting = observeTimelineRun(opened.observation, {
apps/web/src/components/composerCodeBlockHighlight.test.ts
-10
@@ -37,16 +37,6 @@ describe("composer code block highlighting", () => {
37
38 expect(decorations).toEqual([{ from: 5, to: 8, color: "#00ff00" }]);
39 });
40 -
41 - it("falls back to plain text when the grammar throws", () => {
42 - const throwing = {
43 - codeToTokens() {
44 - throw new Error("unsupported language");
45 - },
46 - } as unknown as Parameters<typeof tokenizeBlock>[0];
47 -
48 - expect(tokenizeBlock(throwing, "const answer = 42", "nope", THEME)).toEqual([]);
49 - });
40 });
41
42 describe("highlighting edited fences", () => {
apps/web/src/components/desktopUpdate.logic.test.ts
-25
@@ -42,20 +42,6 @@ describe("desktop update button state", () => {
42 expect(getDesktopUpdateButtonTooltip(state)).toContain("Click to retry");
43 });
44
45 - it("keeps install action available after an install error", () => {
46 - const state: DesktopUpdateState = {
47 - ...baseState,
48 - status: "error",
49 - downloadedVersion: "1.1.0",
50 - availableVersion: "1.1.0",
51 - message: "shutdown timeout",
52 - errorContext: "install",
53 - canRetry: true,
54 - };
55 - expect(resolveDesktopUpdateButtonAction(state)).toBe("install");
56 - expect(getDesktopUpdateButtonTooltip(state)).toContain("Click to retry");
57 - });
58 -
45 it("prefers a newly available release over a stale downloaded version", () => {
46 const state: DesktopUpdateState = {
47 ...baseState,
@@ -106,15 +92,4 @@ describe("canCheckForUpdate", () => {
92 }),
93 ).toBe(true);
94 });
109 -
110 - it("returns true on error so the user can retry", () => {
111 - expect(
112 - canCheckForUpdate({
113 - ...baseState,
114 - status: "error",
115 - errorContext: "check",
116 - message: "network",
117 - }),
118 - ).toBe(true);
119 - });
95 });
apps/web/src/components/device/DeviceSetup.test.ts
-42
@@ -43,48 +43,6 @@ describe("device setup guidance", () => {
43 ).toContain("Device Manager");
44 });
45
46 - it("names an EAS host instead of local tooling when only the cloud can run iOS", () => {
47 - const state = deviceState({
48 - hostStatus: "idle",
49 - hostStatuses: { eas: { status: "ready" } },
50 - hosts: [
51 - {
52 - ...deviceState().hosts[0]!,
53 - platforms: [
54 - { platform: "ios", available: false, reason: "Xcode was not found." },
55 - { platform: "android", available: false, reason: "No SDK." },
56 - ],
57 - },
58 - {
59 - id: "eas",
60 - kind: "eas",
61 - label: "EAS Simulator",
62 - hubInstalled: true,
63 - agentDeviceInstalled: true,
64 - platforms: [
65 - { platform: "ios", available: true },
66 - { platform: "android", available: false, reason: "Not supported yet." },
67 - ],
68 - },
69 - ],
70 - devices: [
71 - {
72 - hostId: "eas",
73 - id: "eas-ios",
74 - platform: "ios",
75 - name: "iPhone (EAS Simulator)",
76 - version: "Cloud",
77 - booted: false,
78 - physical: false,
79 - },
80 - ],
81 - });
82 - expect(platformSetupStatus(state, "ios")).toEqual({
83 - ready: true,
84 - message: "EAS Simulator starts iOS Simulators in the cloud with EAS Simulator.",
85 - });
86 - });
87 -
46 it("counts a remote device host when this machine has no simulator tooling", () => {
47 const state = deviceState({
48 hostStatus: "idle",
apps/web/src/components/diffs/codeViewSearch.test.ts
-5
@@ -63,9 +63,4 @@ describe("collectMatches", () => {
63 expect(find("oldName")).toEqual(["file-0:deletions:2:6-13", "file-0:additions:3:14-21"]);
64 expect(find("nil")).toEqual(["file-1:deletions:1:0-3", "file-1:additions:1:2-5"]);
65 });
66 -
67 - it("returns nothing for an empty query or an invalid pattern", () => {
68 - expect(find("")).toEqual([]);
69 - expect(find("(", { regex: true })).toEqual([]);
70 - });
66 });
apps/web/src/components/files/FilePreviewPanel.test.ts
+1
@@ -15,6 +15,7 @@ import {
15 const decodeReadError = Schema.decodeSync(ProjectReadFileError);
16
17 describe("file preview read errors", () => {
18 + // regression: #15628 read errors from servers without attempted paths keep their own message
19 it("preserves the public message from older servers", () => {
20 const error = decodeReadError({
21 _tag: "ProjectReadFileError",
apps/web/src/components/files/fileEditorVirtualization.test.ts
+1 -60
@@ -347,6 +347,7 @@ describe("wrapped editor document changes", () => {
347 expect(instance.getLinePosition(6001)?.top).toBe(before!.top);
348 });
349
350 + // regression: #10018 retaining wrapped row heights must not shift rows in an unwrapped layout
351 it("keeps unwrapped positions unchanged", async () => {
352 const { instance, append } = await makeFixture("scroll");
353 const before = instance.getLinePosition(6001);
@@ -382,63 +383,3 @@ describe("wrapped editor document changes", () => {
383 expect(instance.getLinePosition(6001)).toEqual({ top: 120008, height: 20 });
384 });
385 });
385 -
386 -class EditorElement extends MeasuredElement {
387 - style: Record<string, string> = {};
388 - parentElement: EditorElement | null = null;
389 -
390 - override appendChild(child: EditorElement) {
391 - child.parentElement = this;
392 - this.children.push(child);
393 - return child;
394 - }
395 -
396 - append(child: EditorElement) {
397 - this.appendChild(child);
398 - }
399 -
400 - prepend(child: EditorElement) {
401 - child.parentElement = this;
402 - this.children.unshift(child);
403 - }
404 -
405 - replaceChildren(...children: (EditorElement | string)[]) {
406 - this.children = [];
407 - for (const child of children) if (typeof child !== "string") this.appendChild(child);
408 - }
409 -
410 - setAttribute() {}
411 - removeAttribute() {}
412 - addEventListener() {}
413 - removeEventListener() {}
414 - after() {}
415 -
416 - remove() {
417 - if (this.parentElement) {
418 - this.parentElement.children = this.parentElement.children.filter((child) => child !== this);
419 - }
420 - }
421 -
422 - set innerHTML(value: string) {
423 - expect(value.startsWith("<svg")).toBe(true);
424 - this.replaceChildren(new EditorElement());
425 - }
426 -
427 - get firstElementChild() {
428 - return this.children[0] ?? null;
429 - }
430 -
431 - querySelectorAll(selector: string) {
432 - expect(selector).toBe("[data-code]");
433 - return this.children.filter((child) => "code" in child.dataset);
434 - }
435 -
436 - querySelector(selector: string) {
437 - expect(selector).toBe("[data-deletions]");
438 - return null;
439 - }
440 -
441 - getContext() {
442 - return { measureText: (text: string) => ({ width: text.length * 8 }) };
443 - }
444 -}
apps/web/src/components/files/fileTreeDragMention.test.ts
-11
@@ -52,15 +52,4 @@ describe("createFileTreeDragMentionController", () => {
52 controller.handleDragEnd(deselect);
53 expect(deselected).toEqual(["docs/index.md", "docs/api.md", "src/app.ts"]);
54 });
55 -
56 - it("drags only the row under the cursor when it is outside the selection", () => {
57 - const controller = createFileTreeDragMentionController({});
58 - controller.handleSelectionChange(["docs/index.md"]);
59 - const transfer = makeTransfer();
60 - controller.handleDragStart({
61 - dataTransfer: transfer,
62 - composedPath: () => [rowNode("src/app.ts")],
63 - });
64 - expect(transfer.getData(COMPOSER_MENTION_DRAG_TYPE)).toBe("[app.ts](src/app.ts)");
65 - });
55 });
apps/web/src/components/media/MediaActions.test.tsx
-13
@@ -78,7 +78,6 @@ vi.mock("../ui/toast", () => ({
78 import { MediaActions, useMediaActions, type MediaActionSource } from "./MediaActions";
79
80 const environmentId = EnvironmentId.make("media-environment");
81 -const otherEnvironmentId = EnvironmentId.make("other-environment");
81 const threadId = ThreadId.make("media-thread");
82 const granted: Pick<AuthSessionState, "authenticated" | "scopes"> = {
83 authenticated: true,
@@ -185,15 +184,3 @@ it.each(["save", "copy-image", "open-file"])(
184 expect(state.openFile).not.toHaveBeenCalled();
185 },
186 );
188 -
189 -it.each([false, true])("uses the media environment's grant (allowed: %s)", async (allowed) => {
190 - state.sessions.set(environmentId, allowed ? granted : denied);
191 - state.sessions.set(otherEnvironmentId, allowed ? denied : granted);
192 -
193 - await useMediaActions(hostSource())
194 - .save()
195 - .catch(() => {});
196 -
197 - expect(state.mint).toHaveBeenCalledTimes(allowed ? 1 : 0);
198 - expect(state.download).toHaveBeenCalledTimes(allowed ? 1 : 0);
199 -});
apps/web/src/components/preview/openPreviewSession.test.ts
+1
@@ -91,6 +91,7 @@ describe("openPreviewSession", () => {
91 });
92
93 describe("openUrlInPreview from a link", () => {
94 + // regression: #16961 a background link open switched the active preview tab
95 it("keeps the current tab active for a background open", async () => {
96 applyPreviewServerSnapshot(threadRef, { ...snapshot, tabId: "tab-current" });
97
apps/web/src/components/preview/previewMiniPlayerLayout.test.ts
-16
@@ -207,15 +207,6 @@ describe("resolvePreviewMiniPlayerFrame with the details card", () => {
207 describe("clampPreviewMiniPlayerPosition", () => {
208 const player = { width: 360, height: 240 };
209
210 - it("keeps the player above a growing composer", () => {
211 - expect(
212 - clampPreviewMiniPlayerPosition({ x: 500, y: 448 }, container, player, {
213 - composer: { ...composer, height: 160 },
214 - detailsCard: null,
215 - }),
216 - ).toEqual({ x: 500, y: 288 });
217 - });
218 -
210 it("lets the player drop into the margin beside the composer", () => {
211 expect(
212 clampPreviewMiniPlayerPosition(
@@ -238,13 +229,6 @@ describe("clampPreviewMiniPlayerPosition", () => {
229 ).toEqual({ x: composer.right + gap, y: 500 });
230 });
231
241 - it("keeps the player out from under the details card", () => {
242 - expect(clampPreviewMiniPlayerPosition({ x: 700, y: 40 }, container, player, withCard)).toEqual({
243 - x: 628,
244 - y: 260 + gap,
245 - });
246 - });
247 -
232 it("clears the card and the composer together in a tight column", () => {
233 const tight = { composer: { left: 0, right: 1_000, height: 300 }, detailsCard };
234 expect(clampPreviewMiniPlayerPosition({ x: 700, y: 600 }, container, player, tight)).toEqual({
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+8 -185
@@ -44,7 +44,6 @@ import {
44 orderPullRequestComments,
45 pullRequestCheckoutCommand,
46 checkoutFailureDescription,
47 - readableFailure,
47 readPullRequestDetailSnapshot,
48 resolveDisplayedPullRequestDetail,
49 resolvePullRequestReferenceHost,
@@ -96,6 +95,7 @@ describe("pull request checkout commands", () => {
95 expect(loadingPullRequestCheckoutCommand(reference("github.com"), enterprise)).toBeNull();
96 });
97
98 + // regression: #12721 loading layout showed a checkout command guessed from the PR number alone
99 it("does not infer a number-only command without a trusted provider", () => {
100 expect(loadingPullRequestCheckoutCommand(reference(), undefined)).toBeNull();
101 expect(
@@ -183,6 +183,7 @@ describe("pull request primary control", () => {
183 canEnableAutoMerge: true,
184 };
185
186 + // regression: #9188 pending/failing checks offered Merge instead of auto-merge
187 it("moves pending and failing checks to auto-merge", () => {
188 expect(resolvePullRequestPrimaryControl({ ...open, checksState: "pending" })).toBe(
189 "enable-auto-merge",
@@ -204,14 +205,6 @@ describe("pull request primary control", () => {
205 });
206
207 describe("stacked pull request classification", () => {
207 - it("classifies a non-default base as stacked once the default is known", () => {
208 - expect(
209 - isStackedPullRequestBase("feature-base", [
210 - { name: "origin/main", isDefault: true, isRemote: true, remoteName: "origin" },
211 - ]),
212 - ).toBe(true);
213 - });
214 -
208 it("does not mistake a nested branch suffix for the default branch", () => {
209 expect(
210 isStackedPullRequestBase("main", [
@@ -260,29 +253,6 @@ describe("review verdicts", () => {
253 ]);
254 });
255
263 - it("keeps two deleted accounts apart rather than counting them as one reviewer", () => {
264 - expect(
265 - latestPullRequestReviewOutcomes([
266 - {
267 - ...TIMELINE_SOURCE.comments[0]!,
268 - id: "r1",
269 - kind: "review",
270 - author: null,
271 - reviewState: "APPROVED",
272 - createdAt: "2026-07-01T00:00:00Z",
273 - },
274 - {
275 - ...TIMELINE_SOURCE.comments[0]!,
276 - id: "r2",
277 - kind: "review",
278 - author: null,
279 - reviewState: "APPROVED",
280 - createdAt: "2026-07-02T00:00:00Z",
281 - },
282 - ]),
283 - ).toHaveLength(2);
284 - });
285 -
256 it("calls a verdict stale once commits land after it, and current before that", () => {
257 const commits = [
258 { oid: "c0ffee", messageHeadline: "later work", committedDate: "2026-07-05T00:00:00Z" },
@@ -305,16 +275,6 @@ describe("review verdicts", () => {
275 );
276 });
277
308 - it("measures staleness against the newest commit, not the last one listed", () => {
309 - expect(
310 - newestPullRequestCommitAt([
311 - { oid: "a", messageHeadline: "", committedDate: "2026-07-09T00:00:00Z" },
312 - { oid: "b", messageHeadline: "", committedDate: "2026-07-02T00:00:00Z" },
313 - ]),
314 - ).toBe("2026-07-09T00:00:00Z");
315 - expect(newestPullRequestCommitAt([])).toBeNull();
316 - });
317 -
278 it("orders instants rather than their text, so a UTC offset cannot invert them", () => {
279 expect(
280 newestPullRequestCommitAt([
@@ -666,19 +626,6 @@ describe("fix findings handoff", () => {
626 expect(handoff.prompt).toContain("untrusted data");
627 });
628
669 - it("leaves out a resolved conversation, and one nobody wrote in", () => {
670 - const handoff = buildFixFindingsHandoff({
671 - ...base,
672 - reviewThreads: [
673 - thread("already handled", { isResolved: true }),
674 - thread(" ", { id: "t2" }),
675 - thread("still open", { id: "t3" }),
676 - ],
677 - checks: [],
678 - });
679 - expect(handoff.reviewComments.map((comment) => comment.text)).toEqual(["reviewer: still open"]);
680 - });
681 -
629 it("bounds a hostile review body instead of attaching it whole", () => {
630 const handoff = buildFixFindingsHandoff({
631 ...base,
@@ -737,16 +684,6 @@ describe("findings that cannot be attached", () => {
684 expect(handoff.prompt).not.toContain("No unresolved review findings");
685 });
686
740 - it("carries a host's line comments when it reports no threads at all", () => {
741 - const handoff = buildFixFindingsHandoff({
742 - ...base,
743 - comments: [{ ...review, id: "a1", kind: "review-comment", path: "src/app.ts" }],
744 - });
745 -
746 - expect(handoff.prompt).toContain("src/app.ts");
747 - expect(handoff.prompt).toContain("revert the middleware change");
748 - });
749 -
687 it("does not repeat a remark that was already attached as a thread", () => {
688 const attachedId = "t1c1";
689 const handoff = buildFixFindingsHandoff({
@@ -805,39 +742,6 @@ describe("one finding handed over on its own", () => {
742 ],
743 };
744
808 - it("attaches a thread as its own annotation, resolved or not", () => {
809 - const handoff = buildFixFindingHandoff({
810 - ...base,
811 - finding: { kind: "thread", thread: reviewThread },
812 - });
813 - expect(handoff.reviewComments).toEqual([
814 - expect.objectContaining({ filePath: "apps/web/src/page.tsx", rangeLabel: "L12" }),
815 - ]);
816 - expect(handoff.prompt).toContain("attached to this message");
817 - expect(handoff.prompt).not.toContain("rename the helper");
818 - });
819 -
820 - it("quotes a review remark, which has no line to attach it to", () => {
821 - const handoff = buildFixFindingHandoff({
822 - ...base,
823 - finding: {
824 - kind: "comment",
825 - comment: {
826 - id: "c1",
827 - kind: "review",
828 - author: { login: "julius", name: null, avatarUrl: null },
829 - body: "this breaks SSO auth",
830 - createdAt: "2026-07-01T00:00:00Z",
831 - url: null,
832 - path: "apps/server/src/auth.ts",
833 - reviewState: "CHANGES_REQUESTED",
834 - },
835 - },
836 - });
837 - expect(handoff.reviewComments).toEqual([]);
838 - expect(handoff.prompt).toContain("> julius on `apps/server/src/auth.ts`: this breaks SSO auth");
839 - });
840 -
745 it("marks the pull request's own words as untrusted whatever the finding is", () => {
746 for (const handoff of [
747 buildFixFindingHandoff({ ...base, finding: { kind: "thread", thread: reviewThread } }),
@@ -855,19 +759,7 @@ describe("one finding handed over on its own", () => {
759 });
760
761 describe("what to say when an action fails", () => {
858 - const hint = "The host refused the merge. Check that you have write access.";
859 -
860 - it("says the host's own reason, without the operation it arrived wrapped in", () => {
861 - expect(
862 - readableFailure(
863 - new Error(
864 - "Pull request operation runAction failed: At least 1 approving review is required.",
865 - ),
866 - hint,
867 - ),
868 - ).toBe("At least 1 approving review is required.");
869 - });
870 -
762 + // regression: #15007 checkout failures hid git's error detail
763 it("uses bounded git diagnostics and falls back when checkout has no useful detail", () => {
764 const diagnostic = (detail: string, reason?: GitCommandError["reason"]) =>
765 new GitCommandError({
@@ -923,13 +815,6 @@ describe("asking about a change rather than working on it", () => {
815 expect(legacyText).not.toContain("t3-context://");
816 });
817
926 - it("gives the same number in another repository its own chip", () => {
927 - const fork = { ...base, url: "https://github.com/someone/t3code/pull/42" };
928 - expect(buildPullRequestReferenceContext(fork).id).not.toBe(
929 - buildPullRequestReferenceContext(base).id,
930 - );
931 - });
932 -
818 it("puts the reader's request in the composer and the selected lines in chips", () => {
819 const comment = {
820 id: "pull-request-selection:page.tsx:12:18",
@@ -996,30 +881,6 @@ describe("a second ask into the same composer", () => {
881 ).toEqual([own.id, "pull-request-context:42"]);
882 });
883
999 - it("removes the previous handoff chip before replacing its prompt", () => {
1000 - const previous = chip("pull-request-context:42");
1001 - const prompt = `Explain this pull request. ${formatInlineContextReference(
1002 - reviewCommentContextReference(previous),
1003 - )} `;
1004 - expect(stripPullRequestHandoffReferences(prompt, [previous])).toBe(
1005 - "Explain this pull request.",
1006 - );
1007 - });
1008 -
1009 - it("keeps a handoff reference when the next action deliberately repeats it", () => {
1010 - const previous = chip("pull-request-context:42");
1011 - const prompt = formatInlineContextReference(reviewCommentContextReference(previous));
1012 - expect(stripPullRequestHandoffReferences(prompt, [previous], new Set([previous.id]))).toBe(
1013 - prompt,
1014 - );
1015 - });
1016 -
1017 - it("leaves a sentence the reader typed themselves where it is", () => {
1018 - expect(
1019 - handoffPrompt({ prompt: "check the migration first", lastHandoffPrompt: undefined }, ""),
1020 - ).toBe("check the migration first");
1021 - });
1022 -
884 it("keeps an edit the reader made to the sentence they were handed", () => {
885 expect(
886 handoffPrompt(
@@ -1032,15 +893,6 @@ describe("a second ask into the same composer", () => {
893 ).toBe("Explain this pull request, the caching especially.");
894 });
895
1035 - it("puts an ask under what the reader typed rather than over it", () => {
1036 - expect(
1037 - handoffPrompt(
1038 - { prompt: "check the migration first", lastHandoffPrompt: undefined },
1039 - "Explain this pull request.",
1040 - ),
1041 - ).toBe("check the migration first\n\nExplain this pull request.");
1042 - });
1043 -
896 it("replaces only its own sentence under text the reader typed", () => {
897 expect(
898 handoffPrompt(
@@ -1053,18 +905,6 @@ describe("a second ask into the same composer", () => {
905 ).toBe("check the migration first\n\nWhy the cache key?");
906 });
907
1056 - it("takes back only its own sentence when the next ask is empty", () => {
1057 - expect(
1058 - handoffPrompt(
1059 - {
1060 - prompt: "check the migration first\n\nExplain this pull request.",
1061 - lastHandoffPrompt: "Explain this pull request.",
1062 - },
1063 - "",
1064 - ),
1065 - ).toBe("check the migration first");
1066 - });
1067 -
908 it("keeps the lines the reader marked up in the thread themselves", () => {
909 const own = chip("file-comment:3");
910 const next = handoffReviewComments(
@@ -1090,10 +930,6 @@ describe("how the branch stands against its base", () => {
930 ...overrides,
931 }) as Parameters<typeof resolveBaseFreshness>[0];
932
1093 - it("offers both ways where the host and the reader both allow them", () => {
1094 - expect(resolveBaseFreshness(detail())).toEqual({ behindBy: 12, methods: ["merge", "rebase"] });
1095 - });
1096 -
933 it("says nothing where the host could not compare, rather than claiming it is current", () => {
934 expect(resolveBaseFreshness(detail({ baseComparison: "unknown" }))).toBeNull();
935 expect(resolveBaseFreshness(detail({ baseComparison: undefined }))).toBeNull();
@@ -1104,13 +940,6 @@ describe("how the branch stands against its base", () => {
940 resolveBaseFreshness(detail({ viewerPermissions: { updateMethods: ["merge"] } }))?.methods,
941 ).toEqual(["merge"]);
942 });
1107 -
1108 - it("still reports the news where the reader may take none of it", () => {
1109 - expect(resolveBaseFreshness(detail({ viewerPermissions: {} }))).toEqual({
1110 - behindBy: 12,
1111 - methods: [],
1112 - });
1113 - });
943 });
944
945 describe("pull request panel context beside a thread", () => {
@@ -1179,6 +1008,7 @@ describe("pull request panel context beside a thread", () => {
1008 );
1009 });
1010
1011 + // regression: #12320 PR panel actions escaped the current thread
1012 it("is the page for a pull request the thread is not linked to", () => {
1013 expect(pullRequestPanelContext(stackThread, surface(12320))).toBe("page");
1014 expect(pullRequestPanelContext(stackThread, surface(10856, { repository: "acme/web" }))).toBe(
@@ -1186,6 +1016,7 @@ describe("pull request panel context beside a thread", () => {
1016 );
1017 });
1018
1019 + // regression: #12320 PR panel actions escaped the current thread
1020 it("is the page under another project's checkout of the same repository", () => {
1021 expect(pullRequestPanelContext(stackThread, surface(10856, { projectId: "proj-b" }))).toBe(
1022 "page",
@@ -1259,6 +1090,7 @@ describe("pull request panel context beside a thread", () => {
1090 expect(onHost("github.example.com")).toMatchObject({ host: "github.example.com" });
1091 });
1092
1093 + // regression: #15061 Pull request panel entry ignored the branch PR
1094 it("falls back to the branch pull request when the thread holds no link", () => {
1095 expect(
1096 threadPullRequestPanelTarget({ projectId: "proj-a", branchPullRequest: legacy(3) }),
@@ -1283,12 +1115,6 @@ describe("when the source branch can be deleted", () => {
1115 },
1116 });
1117
1286 - it("offers it only after the pull request is merged or closed", () => {
1287 - expect(canDeletePullRequestBranch(branchDetail("merged"))).toBe(true);
1288 - expect(canDeletePullRequestBranch(branchDetail("closed"))).toBe(true);
1289 - expect(canDeletePullRequestBranch(branchDetail("open"))).toBe(false);
1290 - });
1291 -
1118 it("needs both the host capability and the viewer's permission", () => {
1119 expect(canDeletePullRequestBranch(branchDetail("merged", { deleteBranch: false }))).toBe(false);
1120 expect(canDeletePullRequestBranch(branchDetail("merged", { allowed: false }))).toBe(false);
@@ -1321,11 +1147,6 @@ describe("the compact row's single action slot", () => {
1147 ...overrides,
1148 }) as NonNullable<Parameters<typeof resolveThreadPanelPullRequestAction>[0]>;
1149
1324 - it("offers Merge only for a clean pull request whose checks pass", () => {
1325 - expect(resolveThreadPanelPullRequestAction(openDetail())).toBe("merge");
1326 - expect(resolveThreadPanelPullRequestAction(openDetail({ checks: [] }))).toBe("merge");
1327 - });
1328 -
1150 it("holds the slot while checks run rather than offering a merge that races them", () => {
1151 expect(
1152 resolveThreadPanelPullRequestAction(
@@ -1530,6 +1351,7 @@ describe("cached pull request detail", () => {
1351 ).toBeNull();
1352 });
1353
1354 + // regression: #12168 cached PR details were missed across entry points on custom ports
1355 it.each(["github", "gitlab"] as const)(
1356 "retains portless %s snapshot identities for custom web ports",
1357 (providerName) => {
@@ -1593,6 +1415,7 @@ describe("cached pull request detail", () => {
1415 expect(readPullRequestDetailSnapshot(storage, "env-1", enterpriseRef)).toBeNull();
1416 });
1417
1418 + // regression: #9294 corrupt cached PR chrome broke reopening
1419 it("shrugs off corrupt storage and no storage at all", () => {
1420 const storage = makeStorage();
1421 storage.setItem("t3.pullRequests.detail:env-1:project-1:acme/web#7", "{not json");
apps/web/src/components/pullRequest/pullRequestDiff.logic.test.ts
+1 -9
@@ -40,6 +40,7 @@ describe("isLineInFileDiff", () => {
40 });
41
42 describe("isFileDiffCollapsed", () => {
43 + // regression: #9174 diffs now expand by default; a reader's fold must survive new slices
44 it("keeps a file the reader folded closed as the next slice arrives", () => {
45 const toggled = new Set(["b.ts"]);
46 expect(isFileDiffCollapsed("b.ts", null, toggled)).toBe(true);
@@ -48,17 +49,8 @@ describe("isFileDiffCollapsed", () => {
49 });
50
51 describe("toggleFileDiffFoldForViewed", () => {
51 - it("puts a file away when it is ticked off", () => {
52 - expect([...toggleFileDiffFoldForViewed("a.ts", true, null, new Set())]).toEqual(["a.ts"]);
53 - });
54 -
52 it("moves against whatever the toolbar last asked for", () => {
53 expect([...toggleFileDiffFoldForViewed("a.ts", true, "expanded", new Set())]).toEqual(["a.ts"]);
54 expect(toggleFileDiffFoldForViewed("a.ts", false, "expanded", new Set()).size).toBe(0);
55 });
59 -
60 - it("touches only the file that was ticked", () => {
61 - const toggled = new Set(["a.ts", "b.ts"]);
62 - expect([...toggleFileDiffFoldForViewed("a.ts", false, null, toggled)]).toEqual(["b.ts"]);
63 - });
56 });
apps/web/src/components/pullRequest/pullRequestDiffError.test.ts
+1
@@ -14,6 +14,7 @@ describe("describePullRequestDiffError", () => {
14 expect(result.description).not.toContain("PullRequestOperationError");
15 });
16
17 + // regression: #19945 diff load failures from a provider quota showed a generic error
18 it("recognizes a provider's API quota error", () => {
19 expect(describePullRequestDiffError("GitHub API rate limit exceeded.", "GitHub").title).toBe(
20 "GitHub rate limit reached",
apps/web/src/components/pullRequest/pullRequestEditing.logic.test.ts
-20
@@ -132,10 +132,6 @@ describe("canEditPullRequestChangeRequest", () => {
132 expect(canEditPullRequestChangeRequest(subject({ capabilities: capabilities() }))).toBe(false);
133 });
134
135 - it("refuses where the host did not say who the reader is", () => {
136 - expect(canEditPullRequestChangeRequest(subject({ viewer: undefined }))).toBe(false);
137 - });
138 -
135 it("still allows a merger the host could not name", () => {
136 expect(
137 canEditPullRequestChangeRequest(
@@ -181,25 +177,9 @@ describe("canEditPullRequestComment", () => {
177 ).toBe(false);
178 });
179
184 - it("refuses a remark the host attributes to nobody", () => {
185 - expect(canEditPullRequestComment(subject(), comment({ author: null }))).toBe(false);
186 - });
187 -
180 it("refuses a review's own summary", () => {
181 expect(canEditPullRequestComment(subject(), comment({ kind: "review" }))).toBe(false);
182 });
191 -
192 - it("refuses where the host cannot rewrite a remark at all", () => {
193 - expect(
194 - canEditPullRequestComment(
195 - subject({ capabilities: capabilities({ changeRequest: true, comment: false }) }),
196 - comment(),
197 - ),
198 - ).toBe(false);
199 - expect(canEditPullRequestComment(subject({ capabilities: capabilities() }), comment())).toBe(
200 - false,
201 - );
202 - });
183 });
184
185 describe("canResolvePullRequestThread", () => {
apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts
-17
@@ -36,23 +36,6 @@ describe("orderDiffFiles", () => {
36 ).toEqual([...source, ...tests, ...generated]);
37 });
38
39 - it("puts a dependency before what imports it", () => {
40 - expect(order([file("src/a.ts", ['import { b } from "./b";']), file("src/b.ts")])).toEqual([
41 - "src/b.ts",
42 - "src/a.ts",
43 - ]);
44 - });
45 -
46 - it("follows a chain the whole way down", () => {
47 - expect(
48 - order([
49 - file("src/a.ts", ['import { b } from "./b";']),
50 - file("src/b.ts", ['import { c } from "./c";']),
51 - file("src/c.ts"),
52 - ]),
53 - ).toEqual(["src/c.ts", "src/b.ts", "src/a.ts"]);
54 - });
55 -
39 it("resolves a specifier that climbs out of the importer's directory", () => {
40 expect(
41 order([file("src/ui/a.ts", ['import { b } from "../lib/b";']), file("src/lib/b.ts")]),
apps/web/src/components/pullRequest/pullRequestFilesViewed.logic.test.ts
-17
@@ -33,11 +33,6 @@ describe("isFileViewed", () => {
33 expect(isFileViewed("b.ts", states, new Map([["b.ts", true]]))).toBe(true);
34 expect(isFileViewed("a.ts", states, new Map([["a.ts", false]]))).toBe(false);
35 });
36 -
37 - it("answers a file the host has said nothing about, before its answer arrives", () => {
38 - expect(isFileViewed("z.ts", null, NO_OVERLAY)).toBe(false);
39 - expect(isFileViewed("z.ts", null, new Map([["z.ts", true]]))).toBe(true);
40 - });
36 });
37
38 describe("settleFileViewedOverlay", () => {
@@ -51,13 +46,6 @@ describe("settleFileViewedOverlay", () => {
46 expect(settled.size).toBe(0);
47 });
48
54 - it("keeps a press the host still disagrees with", () => {
55 - const overlay = new Map([["b.ts", true]]);
56 - expect(settleFileViewedOverlay(overlay, states, NOTHING_PENDING, NOTHING_ANSWERED)).toBe(
57 - overlay,
58 - );
59 - });
60 -
49 it("keeps a press the host cannot have heard yet", () => {
50 const overlay = new Map([["a.ts", false]]);
51 const settled = settleFileViewedOverlay(overlay, states, new Set(["a.ts"]), NOTHING_ANSWERED);
@@ -91,11 +79,6 @@ describe("settleFileViewedOverlay", () => {
79 const settled = settleFileViewedOverlay(overlay, states, new Set(["c.ts"]), new Set(["c.ts"]));
80 expect(settled.get("c.ts")).toBe(true);
81 });
94 -
95 - it("holds everything until the host has answered at all", () => {
96 - const overlay = new Map([["a.ts", true]]);
97 - expect(settleFileViewedOverlay(overlay, null, NOTHING_PENDING, NOTHING_ANSWERED)).toBe(overlay);
98 - });
82 });
83
84 describe("revertFileViewedOverlay", () => {
apps/web/src/components/pullRequest/pullRequestList.logic.test.ts
+4 -151
@@ -17,12 +17,10 @@ import {
17 mergePullRequestLists,
18 pullRequestEntryKey,
19 groupPullRequestsByInvolvement,
20 - matchesPullRequestFilters,
20 pullRequestStatsBatches,
21 pullRequestStatsKeysToRequest,
22 pullRequestStatsRefreshBatches,
23 mergePullRequestDiffStats,
25 - narrowPullRequestsToFilters,
24 partitionPullRequestsWithPriority,
25 readPullRequestListSnapshot,
26 writePullRequestListSnapshot,
@@ -30,7 +28,6 @@ import {
28 rankPullRequestsBlockedOnAuthor,
29 rankPullRequestsByMergeReadiness,
30 sortPullRequestGroups,
33 - resolveProjectScope,
31 resolveQueryEnvironmentIds,
32 resolveSelectedEnvironmentId,
33 type EnvironmentPullRequestEntry,
@@ -156,75 +153,6 @@ describe("pull request involvement filtering", () => {
153 filterPullRequestsByInvolvement(mixed, VIEWERS, "authored").map((item) => item.number),
154 ).toEqual([1]);
155 });
159 -
160 - it("keeps two hosts of one provider kind as two accounts", () => {
161 - const mixed = [
162 - entry({ number: 1, author: { login: "Bilal", name: null, avatarUrl: null } }),
163 - entry({
164 - number: 2,
165 - host: "github.acme.dev",
166 - author: { login: "Bilal", name: null, avatarUrl: null },
167 - }),
168 - ];
169 - expect(
170 - filterPullRequestsByInvolvement(mixed, VIEWERS, "authored").map((item) => item.number),
171 - ).toEqual([1]);
172 - });
173 -});
174 -
175 -describe("pull request grouping", () => {
176 - it("counts an authored pull request once, even with a review request on it", () => {
177 - const groups = groupPullRequestsByInvolvement(
178 - [
179 - entry({
180 - number: 1,
181 - author: { login: "bilal", name: null, avatarUrl: null },
182 - viewerReviewRequested: true,
183 - }),
184 - ],
185 - VIEWERS,
186 - );
187 - expect(groups.map((group) => group.key)).toEqual(["authored"]);
188 - });
189 -});
190 -
191 -describe("carrying rows already read into filters nothing has answered yet", () => {
192 - const rows = [
193 - entry({ number: 1 }),
194 - entry({ number: 2, state: "merged" }),
195 - entry({ number: 3, state: "closed" }),
196 - entry({ number: 4, host: "github.acme.dev" }),
197 - entry({ number: 5, projectId: "project-2" as PullRequestListEntry["projectId"] }),
198 - ];
199 - const everything = { state: "all", projectId: undefined, host: undefined } as const;
200 -
201 - it("never lets a merged pull request sit under Open", () => {
202 - expect(
203 - narrowPullRequestsToFilters(rows, { ...everything, state: "open" }).map((row) => row.number),
204 - ).toEqual([1, 4, 5]);
205 - });
206 -});
207 -
208 -describe("narrowing rows by the filters a host may not have applied", () => {
209 - it("resolves author:me to the given viewer, case-insensitively", () => {
210 - const mine = entry({ number: 30, author: { login: "Bilal", name: null, avatarUrl: null } });
211 - const theirs = entry({ number: 31, author: { login: "Hubot", name: null, avatarUrl: null } });
212 - expect(matchesPullRequestFilters(mine, { author: "me" }, "bilal")).toBe(true);
213 - expect(matchesPullRequestFilters(theirs, { author: "me" }, "bilal")).toBe(false);
214 - });
215 -});
216 -
217 -describe("resolveProjectScope", () => {
218 - const projects = [{ id: "p1" }, { id: "p2" }];
219 -
220 - it("drops an id from another environment", () => {
221 - expect(resolveProjectScope("p9", projects, false)).toBe("p9");
222 - expect(resolveProjectScope("p9", projects, true)).toBeUndefined();
223 - });
224 -
225 - it("keeps an id while the projects are still unknown", () => {
226 - expect(resolveProjectScope("p9", [], false)).toBe("p9");
227 - });
156 });
157
158 describe("ranking what a search found", () => {
@@ -313,6 +241,7 @@ describe("default merge-readiness ranking", () => {
241 );
242 });
243
244 + // regression: #9453 authored pull requests were not prioritized
245 it("keeps authored work first and ranks each group by readiness", () => {
246 const authoredWaiting = entry({ number: 1, checksState: "pending" });
247 const authoredReady = entry({
@@ -416,13 +345,6 @@ describe("partitioning with the hosts' own priority reads", () => {
345 expect(groups[0]!.entries.map((item) => item.number)).toEqual([1]);
346 expect(groups[1]!.entries.map((item) => item.number)).toEqual([2, 3]);
347 });
419 -
420 - it("lets the feed's copy of a partitioned row replace the partition's", () => {
421 - const stale = authoredRow(1, "2026-07-01T00:00:00Z");
422 - const fresh = { ...stale, title: "Retitled" };
423 - const groups = partitionPullRequestsWithPriority([fresh], [stale], []);
424 - expect(groups[0]!.entries[0]!.title).toBe("Retitled");
425 - });
348 });
349
350 describe("the list snapshot across a reload", () => {
@@ -442,14 +364,6 @@ describe("the list snapshot across a reload", () => {
364 nextCursors: { "pingdotgg/t3code": "cursor-1" },
365 } as never;
366
445 - it("hydrates the retained rows so ghosts never replace them", () => {
446 - const storage = makeStorage();
447 - writePullRequestListSnapshot(storage, "env-1", { scope: "env-1:open:all::", data });
448 - const snapshot = readPullRequestListSnapshot(storage, "env-1");
449 - expect(snapshot?.scope).toBe("env-1:open:all::");
450 - expect(snapshot?.data.entries.map((item) => item.number)).toEqual([1]);
451 - });
452 -
367 it("carries neither stale failures nor stale cursors", () => {
368 const storage = makeStorage();
369 writePullRequestListSnapshot(storage, "env-1", { scope: "s", data });
@@ -458,19 +372,6 @@ describe("the list snapshot across a reload", () => {
372 expect(snapshot?.data.nextCursors).toEqual({});
373 });
374
461 - it("answers nothing for another environment", () => {
462 - const storage = makeStorage();
463 - writePullRequestListSnapshot(storage, "env-1", { scope: "s", data });
464 - expect(readPullRequestListSnapshot(storage, "env-2")).toBeNull();
465 - });
466 -
467 - it("shrugs off corrupt storage and no storage at all", () => {
468 - const storage = makeStorage();
469 - storage.setItem("t3.pullRequests.list:env-1", "{not json");
470 - expect(readPullRequestListSnapshot(storage, "env-1")).toBeNull();
471 - expect(readPullRequestListSnapshot(undefined, "env-1")).toBeNull();
472 - });
473 -
375 it("caps the accumulated rows but keeps the whole host set", () => {
376 const storage = makeStorage();
377 const manyEntries = Array.from({ length: 120 }, (_, index) => entry({ number: index + 1 }));
@@ -518,6 +419,7 @@ describe("remembered pull request list controls", () => {
419 };
420 };
421
422 + // regression: #9188 corrupt stored list controls broke the page
423 it("falls back to the default controls when storage is corrupt", () => {
424 const storage = makeStorage();
425 storage.setItem("t3.pullRequests.preferences", "{not json");
@@ -577,6 +479,7 @@ describe("merging the environments' own listings", () => {
479 ]);
480 });
481
482 + // regression: #6490 one environment's error showed on every environment
483 it("keeps project errors scoped to the environment that reported them", () => {
484 const error = {
485 projectId: "project-1" as ProjectId,
@@ -621,16 +524,6 @@ describe("merging the environments' own listings", () => {
524 },
525 ]);
526 });
624 -
625 - it("keeps each environment's continuation to itself", () => {
626 - const merged = mergePullRequestLists([
627 - [ENV_1, answer({ nextCursors: { "github.com pingdotgg/t3code": "cursor-1" } })],
628 - [ENV_2, answer()],
629 - ]);
630 - expect(merged?.nextCursors).toEqual({
631 - [ENV_1]: { "github.com pingdotgg/t3code": "cursor-1" },
632 - });
633 - });
527 });
528
529 describe('who "I" am, per server', () => {
@@ -661,19 +554,6 @@ describe('who "I" am, per server', () => {
554 ),
555 ).toEqual([1]);
556 });
664 -
665 - it("names the servers with more rows and no cursor to reach them by", () => {
666 - const merged = mergePullRequestLists([
667 - [
668 - ENV_1,
669 - { ...answer({}, []), truncated: true, nextCursors: { "github.com acme/web": "cursor-1" } },
670 - ],
671 - [ENV_2, { ...answer({}, []), truncated: true }],
672 - ])!;
673 -
674 - expect(merged.truncatedEnvironments).toEqual([ENV_1, ENV_2]);
675 - expect(Object.keys(merged.nextCursors)).toEqual([ENV_1]);
676 - });
557 });
558
559 describe("the project an id names", () => {
@@ -683,10 +563,6 @@ describe("the project an id names", () => {
563 { id: "project-2", environmentId: ENV_2 },
564 ];
565
686 - it("takes the server it was given", () => {
687 - expect(findScopedProject(projects, ENV_2, "project-1")?.environmentId).toBe(ENV_2);
688 - });
689 -
566 it("answers a bare id only where one server has it", () => {
567 expect(findScopedProject(projects, null, "project-2")?.environmentId).toBe(ENV_2);
568 expect(findScopedProject(projects, null, "project-1")).toBeUndefined();
@@ -697,19 +573,6 @@ describe("which environments a listing should ask", () => {
573 const ENV_3 = "env-3" as EnvironmentId;
574 const environmentIds = [ENV_1, ENV_2, ENV_3];
575
700 - it("asks only the owning server once the project is unambiguous", () => {
701 - const projects = [{ id: "project-1", environmentId: ENV_2 }];
702 - expect(
703 - resolveQueryEnvironmentIds(
704 - environmentIds,
705 - projects,
706 - { environmentId: ENV_2 },
707 - "project-1",
708 - true,
709 - ),
710 - ).toEqual([ENV_2]);
711 - });
712 -
576 it("asks only the environments that actually hold an ambiguous bare id, never a third that doesn't", () => {
577 const projects = [
578 { id: "project-1", environmentId: ENV_1 },
@@ -719,12 +582,6 @@ describe("which environments a listing should ask", () => {
582 resolveQueryEnvironmentIds(environmentIds, projects, undefined, "project-1", true),
583 ).toEqual([ENV_1, ENV_2]);
584 });
722 -
723 - it("asks every environment while the servers have not said what they hold yet", () => {
724 - expect(resolveQueryEnvironmentIds(environmentIds, [], undefined, "project-1", false)).toEqual(
725 - environmentIds,
726 - );
727 - });
585 });
586
587 describe("the server a saved selection names", () => {
@@ -733,11 +590,6 @@ describe("the server a saved selection names", () => {
590 it("resolves to nothing yet for a server that is known but not ready, rather than falling back", () => {
591 expect(resolveSelectedEnvironmentId(ENV_2, known, ENV_1)).toBe(ENV_2);
592 });
736 -
737 - it("falls back for a server the workspace genuinely no longer has", () => {
738 - const goneServer = "env-gone" as EnvironmentId;
739 - expect(resolveSelectedEnvironmentId(goneServer, known, ENV_1)).toBe(ENV_1);
740 - });
593 });
594
595 describe("the priority groups against a paginated feed", () => {
@@ -883,6 +735,7 @@ describe("refresh page size", () => {
735 expect(largestPullRequestReadCount(twoPagesAcrossFourRepositories("gitlab"))).toBe(198);
736 });
737
738 + // regression: #19403 refreshes were not bounded by each tracker read
739 it("asks for the whole host where one search reads every repository", () => {
740 expect(largestPullRequestReadCount(twoPagesAcrossFourRepositories("github"))).toBe(792);
741 });
apps/web/src/components/pullRequest/pullRequestProjectAssignment.logic.test.ts
-50
@@ -59,18 +59,6 @@ describe("one server per repository", () => {
59 expect(plain(assignment)).toEqual({ "env-1": ["p1"], "env-2": ["p2"] });
60 });
61
62 - it("keeps a repository listed by the one server that holds it", () => {
63 - const assignment = assignProjectsToEnvironments(
64 - [
65 - project("a1", "env-1", "github.com/acme/app"),
66 - project("b2", "env-2", "gitlab.com/acme/app"),
67 - ],
68 - envs("env-1", "env-2"),
69 - "env-1" as EnvironmentId,
70 - );
71 - expect(plain(assignment)).toEqual({ "env-1": ["a1"], "env-2": ["b2"] });
72 - });
73 -
62 it("keeps a server's own worktrees of the repository it lists", () => {
63 const assignment = assignProjectsToEnvironments(
64 [
@@ -96,18 +84,6 @@ describe("one server per repository", () => {
84 expect(plain(assignment)).toEqual({ "env-1": ["a1"] });
85 });
86
99 - it("ignores a project on a server that is not being read", () => {
100 - const assignment = assignProjectsToEnvironments(
101 - [
102 - project("a1", "env-1", "github.com/acme/app"),
103 - project("a2", "env-2", "github.com/acme/app"),
104 - ],
105 - envs("env-2"),
106 - "env-2" as EnvironmentId,
107 - );
108 - expect(plain(assignment)).toEqual({ "env-2": ["a2"] });
109 - });
110 -
87 it("answers the same whatever order the projects arrive in", () => {
88 const projects = [
89 project("a2", "env-2", "github.com/acme/app"),
@@ -159,32 +135,6 @@ describe("where a pull request can be acted on", () => {
135 ]);
136 });
137
162 - it("offers nothing where one server holds the repository", () => {
163 - expect(
164 - resolvePickableEnvironments(
165 - on("env-1", "a1"),
166 - [
167 - project("a1", "env-1", "github.com/acme/app"),
168 - project("c2", "env-2", "github.com/acme/site"),
169 - ],
170 - connected("env-1", "env-2"),
171 - ),
172 - ).toEqual([]);
173 - });
174 -
175 - it("leaves out a server that is not connected", () => {
176 - expect(
177 - resolvePickableEnvironments(
178 - on("env-1", "a1"),
179 - [
180 - project("a1", "env-1", "github.com/acme/app"),
181 - project("a2", "env-2", "github.com/acme/app"),
182 - ],
183 - connected("env-1"),
184 - ),
185 - ).toEqual([]);
186 - });
187 -
138 it("names one copy per server, so two worktrees are one choice", () => {
139 const pickable = resolvePickableEnvironments(
140 on("env-1", "a1"),
apps/web/src/components/pullRequest/pullRequestProjectFilter.logic.test.ts
+2
@@ -73,6 +73,7 @@ describe("pull request project filter choices", () => {
73 ]);
74 });
75
76 + // regression: #9948 project filter deduplication must not merge across hosts
77 it("keeps repositories on different hosts separate", () => {
78 const choices = pullRequestFilterProjects(
79 [project("github"), project("enterprise", nucbox, "git.example.com/pingdotgg/t3code")],
@@ -82,6 +83,7 @@ describe("pull request project filter choices", () => {
83 expect(choices.map((choice) => choice.id)).toEqual(["enterprise", "github"]);
84 });
85
86 + // regression: #9948 project filter deduplication must not merge unidentified repos
87 it("does not merge projects whose repository identity is unknown", () => {
88 const choices = pullRequestFilterProjects(
89 [project("first", nucbox, null), project("second", nucbox, null)],
apps/web/src/components/pullRequest/pullRequestReviewStore.test.ts
-11
@@ -30,17 +30,6 @@ describe("pull request review drafts", () => {
30 ]);
31 });
32
33 - it("keeps summary bodies isolated by review key", () => {
34 - const store = usePullRequestReviewStore.getState();
35 - store.setSummary("review-a", "Summary A");
36 - store.setSummary("review-b", "Summary B");
37 - store.clearSummary("review-a", "Summary A");
38 -
39 - expect(usePullRequestReviewStore.getState().summaries).toEqual({
40 - "review-b": "Summary B",
41 - });
42 - });
43 -
33 it("keeps drafts on different hosts separate when a thread reviews the same repository and number", () => {
34 const reference = {
35 projectId: ProjectId.make("project-a"),
apps/web/src/components/settings/AcpRegistryIcon.test.ts
-24
@@ -61,30 +61,6 @@ describe("ACP Registry icon cache", () => {
61 expect(put).not.toHaveBeenCalled();
62 });
63
64 - it("falls back to the network when CacheStorage cannot be opened", async () => {
65 - const url = "https://cdn.agentclientprotocol.com/registry/v1/latest/kilo.svg";
66 - vi.stubGlobal("caches", {
67 - open: vi.fn(async () => {
68 - throw new Error("CacheStorage unavailable");
69 - }),
70 - });
71 - fetchIcon.mockResolvedValue(
72 - new Response("<svg/>", {
73 - status: 200,
74 - headers: { "content-type": "image/svg+xml" },
75 - }),
76 - );
77 -
78 - await expect(loadCachedAcpRegistryIcon(url)).resolves.toMatchObject({
79 - type: "image/svg+xml",
80 - });
81 - expect(fetchIcon).toHaveBeenCalledWith(url, {
82 - credentials: "omit",
83 - redirect: "error",
84 - referrerPolicy: "no-referrer",
85 - });
86 - });
87 -
64 it("accepts only credential-free HTTPS URLs on the official CDN", () => {
65 expect(
66 resolveOfficialAcpRegistryIconUrl(
apps/web/src/components/settings/AddProviderInstanceDialog.environment.browser.test.tsx
-14
@@ -247,20 +247,6 @@ describe("AddProviderInstanceDialog environment routing", () => {
247 expect(signInStep()).toBeNull();
248 });
249
250 - it("keeps the dialog open when the atomic upsert fails", async () => {
251 - setup();
252 - settingsHooks.mutate.mockResolvedValueOnce({ _tag: "Failure", cause: new Error("Conflict") });
253 - await using _screen = await render(dialog());
254 - await click("Use Kilo Code");
255 - await click("Continue to sign-in");
256 -
257 - expect(actions.onOpenChange).not.toHaveBeenCalled();
258 - expect(actions.toast).toHaveBeenCalledWith(
259 - expect.objectContaining({ type: "error", title: "Could not add provider instance" }),
260 - );
261 - expect(button("Continue to sign-in").disabled).toBe(false);
262 - });
263 -
250 it("rejects a queued save after the provider grant is revoked", async () => {
251 setup();
252 await using screen = await prepareCodexInstance();
apps/web/src/components/settings/AddProviderInstanceDialog.test.ts
+1
@@ -11,6 +11,7 @@ import {
11 describe("resolveWizardNavigation", () => {
12 const invalidId = { instanceIdError: "Instance ID is required." };
13
14 + // regression: #2813 the wizard advanced past an invalid instance id
15 it("blocks Next from Identity to Config while the instance id is invalid", () => {
16 expect(resolveWizardNavigation(1, 2, 3, invalidId)).toEqual({
17 kind: "blocked",
apps/web/src/components/settings/IntegrationsSettings.logic.test.ts
-39
@@ -7,40 +7,6 @@ const environmentId = "environment-a" as EnvironmentId;
7 const secondEnvironmentId = "environment-b" as EnvironmentId;
8
9 describe("clearBrowserProfileData", () => {
10 - it("clears every known environment before succeeding", async () => {
11 - const clearCookies = vi.fn().mockResolvedValue(undefined);
12 - const clearCache = vi.fn().mockResolvedValue(undefined);
13 -
14 - await clearBrowserProfileData(
15 - { clearCookies, clearCache },
16 - [environmentId, secondEnvironmentId],
17 - "profile-a",
18 - );
19 -
20 - expect(clearCookies.mock.calls).toEqual([
21 - [environmentId, "profile-a"],
22 - [secondEnvironmentId, "profile-a"],
23 - ]);
24 - expect(clearCache.mock.calls).toEqual([
25 - [environmentId, "profile-a"],
26 - [secondEnvironmentId, "profile-a"],
27 - ]);
28 - });
29 -
30 - it("propagates cleanup failures", async () => {
31 - const failure = new Error("clear failed");
32 - await expect(
33 - clearBrowserProfileData(
34 - {
35 - clearCookies: vi.fn().mockRejectedValue(failure),
36 - clearCache: vi.fn().mockResolvedValue(undefined),
37 - },
38 - [environmentId],
39 - "profile-a",
40 - ),
41 - ).rejects.toBe(failure);
42 - });
43 -
10 it("does not report success without an environment or bridge", async () => {
11 const bridge = {
12 clearCookies: vi.fn().mockResolvedValue(undefined),
@@ -95,9 +61,4 @@ describe("importFailureReason", () => {
61 expect(importFailureReason(failure("profileNotSaved"))).toBe("profileNotSaved");
62 expect(importFailureReason(failure("profileLimitReached"))).toBe("profileLimitReached");
63 });
98 -
99 - it("falls back to readFailed for anything it cannot classify", () => {
100 - expect(importFailureReason(new Error("something else entirely"))).toBe("readFailed");
101 - expect(importFailureReason(undefined)).toBe("readFailed");
102 - });
64 });
apps/web/src/components/settings/KeybindingsSettings.logic.test.ts
-8
@@ -13,7 +13,6 @@ import {
13 keybindingFromKeyboardEvent,
14 parseWhenExpressionDraft,
15 shortcutToKeybindingInput,
16 - unknownWhenVariables,
16 whenAstToExpression,
17 } from "./KeybindingsSettings.logic";
18
@@ -224,13 +223,6 @@ describe("KeybindingsSettings.logic", () => {
223 });
224 });
225
227 - it("reports unknown when variables without rejecting parseable expressions", () => {
228 - const parsed = parseWhenExpressionDraft("!terminalFocus && terminalFoc");
229 -
230 - expect(parsed.ok).toBe(true);
231 - expect(unknownWhenVariables(parsed.ok ? parsed.value : undefined)).toEqual(["terminalFoc"]);
232 - });
233 -
226 it("reports conflicting shortcuts that share an active when context", () => {
227 const rows = buildKeybindingRows([
228 {
apps/web/src/components/settings/LoadBalancingSettings.test.ts deleted
-13
@@ -1,13 +0,0 @@
1 -import { describe, expect, it } from "vite-plus/test";
2 -
3 -import { loadPreferenceForWeight } from "./LoadBalancingSettings";
4 -
5 -describe("loadPreferenceForWeight", () => {
6 - it("snaps legacy slider weights onto the four preferences", () => {
7 - expect(loadPreferenceForWeight(undefined)).toBe(50);
8 - expect(loadPreferenceForWeight(0)).toBe(0);
9 - expect(loadPreferenceForWeight(10)).toBe(25);
10 - expect(loadPreferenceForWeight(50)).toBe(50);
11 - expect(loadPreferenceForWeight(80)).toBe(100);
12 - });
13 -});
apps/web/src/components/settings/LoadBalancingSettings.tsx
+1 -1
@@ -21,7 +21,7 @@ const preferences = [
21
22 type LoadPreference = (typeof preferences)[number]["value"];
23
24 -export function loadPreferenceForWeight(weight: number | undefined): LoadPreference {
24 +function loadPreferenceForWeight(weight: number | undefined): LoadPreference {
25 if (weight === undefined || weight === 50) return 50;
26 if (weight === 0) return 0;
27 return weight < 50 ? 25 : 100;
apps/web/src/components/settings/ProjectSettingsPanel.logic.test.ts
+1
@@ -51,6 +51,7 @@ describe("project removal confirmation", () => {
51 );
52 });
53
54 + // regression: #21409 project-wide removal must count every checkout's threads and keep files
55 it("states the full group count and preserves files when removing a project everywhere", () => {
56 const plan = planProjectRemoval({
57 members: [local, remote],
apps/web/src/components/settings/ProviderInstanceCard.test.ts
-16
@@ -4,8 +4,6 @@ import type { ServerProviderModel } from "@t3tools/contracts";
4 import {
5 deriveProviderModelsForDisplay,
6 nextProviderEnvironmentWithFieldValue,
7 - providerEnvironmentWithoutNames,
8 - readProviderEnvironmentVariable,
7 } from "./ProviderInstanceCard";
8
9 describe("deriveProviderModelsForDisplay", () => {
@@ -89,18 +87,4 @@ describe("provider environment helpers", () => {
87 ),
88 ).toEqual([{ name: "OPENAI_API_KEY", value: "new-key", sensitive: true }]);
89 });
92 -
93 - it("separates dedicated provider secrets from the generic environment table", () => {
94 - const environment = [
95 - { name: "CURSOR_API_KEY", value: "cursor-key", sensitive: true },
96 - { name: "EXTRA_FLAG", value: "1", sensitive: false },
97 - ];
98 -
99 - expect(readProviderEnvironmentVariable(environment, "CURSOR_API_KEY")?.value).toBe(
100 - "cursor-key",
101 - );
102 - expect(providerEnvironmentWithoutNames(environment, new Set(["CURSOR_API_KEY"]))).toEqual([
103 - { name: "EXTRA_FLAG", value: "1", sensitive: false },
104 - ]);
105 - });
90 });
apps/web/src/components/settings/ProviderInstanceCard.tsx
+2 -2
@@ -195,14 +195,14 @@ function ProviderAuthEmail(props: { readonly email: string | undefined }) {
195 );
196 }
197
198 -export function readProviderEnvironmentVariable(
198 +function readProviderEnvironmentVariable(
199 environment: ReadonlyArray<ProviderInstanceEnvironmentVariable> | undefined,
200 name: string,
201 ): ProviderInstanceEnvironmentVariable | undefined {
202 return environment?.find((variable) => variable.name === name);
203 }
204
205 -export function providerEnvironmentWithoutNames(
205 +function providerEnvironmentWithoutNames(
206 environment: ReadonlyArray<ProviderInstanceEnvironmentVariable> | undefined,
207 names: ReadonlySet<string>,
208 ): ReadonlyArray<ProviderInstanceEnvironmentVariable> {
apps/web/src/components/settings/ProviderSettingsPanel.logic.test.ts
-70
@@ -13,18 +13,6 @@ import {
13 } from "./ProviderSettingsPanel.logic";
14
15 describe("primary operate access", () => {
16 - it("denies writes when the session fetch fails", () => {
17 - expect(
18 - resolvePrimaryOperateAccess({
19 - isPrimary: true,
20 - hasDesktopBridge: false,
21 - session: null,
22 - isPending: false,
23 - hasError: true,
24 - }),
25 - ).toBe("denied");
26 - });
27 -
16 it("denies unauthenticated sessions and sessions without the operate scope", () => {
17 expect(
18 resolvePrimaryOperateAccess({
@@ -59,7 +47,6 @@ describe("primary operate access", () => {
47 describe("buildProviderInstanceOverridePatch", () => {
48 const projectId = ProjectId.make("project-a");
49 const instanceId = ProviderInstanceId.make("codex_work");
62 - const otherInstanceId = ProviderInstanceId.make("claudeAgent_personal");
50
51 it("writes the same choice to every checkout of the project", () => {
52 const siblingId = ProjectId.make("project-a-worktree");
@@ -80,27 +67,6 @@ describe("buildProviderInstanceOverridePatch", () => {
67 });
68 });
69
83 - it("adds an instance override alongside the project's other overrides", () => {
84 - const settings: Pick<ServerSettings, "projectSettingsOverrides"> = {
85 - projectSettingsOverrides: {
86 - [projectId]: {
87 - newWorktreesStartFromOrigin: true,
88 - providerInstances: { [otherInstanceId]: { enabled: false } },
89 - },
90 - },
91 - };
92 -
93 - expect(buildProviderInstanceOverridePatch(settings, [projectId], instanceId, true)).toEqual({
94 - [projectId]: {
95 - newWorktreesStartFromOrigin: true,
96 - providerInstances: {
97 - [otherInstanceId]: { enabled: false },
98 - [instanceId]: { enabled: true },
99 - },
100 - },
101 - });
102 - });
103 -
70 it("resets the only override by clearing the whole project entry", () => {
71 const settings: Pick<ServerSettings, "projectSettingsOverrides"> = {
72 projectSettingsOverrides: {
@@ -113,29 +79,6 @@ describe("buildProviderInstanceOverridePatch", () => {
79 ).toEqual({ [projectId]: null });
80 });
81
116 - it("resets one instance while another instance's override and other keys survive", () => {
117 - const settings: Pick<ServerSettings, "projectSettingsOverrides"> = {
118 - projectSettingsOverrides: {
119 - [projectId]: {
120 - newWorktreesStartFromOrigin: true,
121 - providerInstances: {
122 - [instanceId]: { enabled: true },
123 - [otherInstanceId]: { enabled: false },
124 - },
125 - },
126 - },
127 - };
128 -
129 - expect(
130 - buildProviderInstanceOverridePatch(settings, [projectId], instanceId, undefined),
131 - ).toEqual({
132 - [projectId]: {
133 - newWorktreesStartFromOrigin: true,
134 - providerInstances: { [otherInstanceId]: { enabled: false } },
135 - },
136 - });
137 - });
138 -
82 it("sends providerInstances: {} explicitly when clearing the last instance override leaves other keys", () => {
83 const settings: Pick<ServerSettings, "projectSettingsOverrides"> = {
84 projectSettingsOverrides: {
@@ -201,17 +144,4 @@ describe("remote operate access", () => {
144 }),
145 ).toBe("denied");
146 });
204 -
205 - it("denies writes when the session fetch fails or scopes are missing", () => {
206 - expect(resolveRemoteOperateAccess({ session: null, isPending: false, hasError: true })).toBe(
207 - "denied",
208 - );
209 - expect(
210 - resolveRemoteOperateAccess({
211 - session: { authenticated: true },
212 - isPending: false,
213 - hasError: false,
214 - }),
215 - ).toBe("denied");
216 - });
147 });
apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx
-19
@@ -233,25 +233,6 @@ describe("Antigravity setup", () => {
233 expect(setup.authState).toHaveBeenLastCalledWith({ environmentId, input: { instanceId } });
234 });
235
236 - it("removes an owned damaged runtime only after confirmation", async () => {
237 - resetSetup();
238 - setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null });
239 - setup.installation = {
240 - ...setup.installation!,
241 - phase: "failed",
242 - canRemove: true,
243 - installedVersion: null,
244 - };
245 - await using screen = await renderSetup();
246 - await screen.click("Remove downloaded runtime");
247 - expect(setup.confirm).toHaveBeenCalledOnce();
248 - expect(setup.removeInstall).not.toHaveBeenCalled();
249 -
250 - setup.confirm.mockResolvedValue(true);
251 - await screen.click("Remove downloaded runtime");
252 - expect(setup.removeInstall).toHaveBeenCalledWith({ environmentId, input: { instanceId } });
253 - });
254 -
236 it("does not let a shared managed install hide an invalid custom binary path", async () => {
237 resetSetup();
238 setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null });
apps/web/src/components/settings/SettingsPanels.logic.test.ts
+1 -32
@@ -1,14 +1,8 @@
1 -import {
2 - DEFAULT_UNIFIED_SETTINGS,
3 - ProviderDriverKind,
4 - ProviderInstanceId,
5 - type ProviderInstanceConfig,
6 -} from "@t3tools/contracts";
1 +import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts";
2 import * as Duration from "effect/Duration";
3 import { describe, expect, it } from "vite-plus/test";
4 import {
5 backgroundActivitySharedPolicySettings,
11 - buildProviderInstanceUpdatePatch,
6 getChangedBrowserSettingLabels,
7 hasChangedBackgroundActivitySettings,
8 } from "./SettingsPanels.logic";
@@ -84,31 +78,6 @@ describe("background activity settings restore", () => {
78 });
79 });
80
87 -describe("buildProviderInstanceUpdatePatch", () => {
88 - it("replaces one instance and keeps the others", () => {
89 - const instanceId = ProviderInstanceId.make("codex");
90 - const otherId = ProviderInstanceId.make("codex_personal");
91 - const other = {
92 - driver: ProviderDriverKind.make("codex"),
93 - config: { homePath: "/Users/example/.codex-personal" },
94 - } satisfies ProviderInstanceConfig;
95 - const nextInstance = {
96 - driver: ProviderDriverKind.make("codex"),
97 - enabled: true,
98 - config: { binaryPath: "/opt/t3/codex" },
99 - } satisfies ProviderInstanceConfig;
100 -
101 - const patch = buildProviderInstanceUpdatePatch({
102 - settings: { providerInstances: { [otherId]: other } },
103 - instanceId,
104 - instance: nextInstance,
105 - });
106 -
107 - expect(patch.providerInstances).toEqual({ [otherId]: other, [instanceId]: nextInstance });
108 - expect(patch).not.toHaveProperty("textGenerationModelSelection");
109 - });
110 -});
111 -
81 describe("getChangedBrowserSettingLabels", () => {
82 it("counts a retained custom search URL so restore clears it", () => {
83 expect(
apps/web/src/components/settings/SnapShotSettings.logic.test.ts
+1 -47
@@ -5,11 +5,9 @@ import {
5 createRecordingRequestTracker,
6 snapShotStatus,
7 snapShotShortcutStatus,
8 - snapShotFeedbackUnavailableMessage,
8 snapShotSetupSummary,
9 snapShotSetupButtonLabel,
10 snapShotSetupComplete,
12 - snapShotAccessibilityUnavailableMessage,
11 } from "./SnapShotSettings.logic";
12
13 it("ignores a stale request after a newer request starts", () => {
@@ -26,37 +24,7 @@ it("ignores a stale request after a newer request starts", () => {
24 expect(requests.tryBegin()).toBeNull();
25 });
26
29 -it("distinguishes Hyprland helper setup, action registration, and verified shortcut delivery", () => {
30 - const state: DesktopSnapShotState = {
31 - mode: "portal",
32 - linuxBackend: "hyprland",
33 - linuxDesktop: "hyprland",
34 - shortcut: DEFAULT_CLIENT_SETTINGS.snapShotShortcut,
35 - shortcutRegistered: false,
36 - shortcutMessage: "Connecting to Hyprland shortcuts…",
37 - message: null,
38 - hyprlandHelper: { status: "not-installed", message: "Install helper" },
39 - };
40 - expect(snapShotSetupButtonLabel(state)).toBe("Set up Hyprland capture");
41 - expect(snapShotStatus(state, false)).toBe("Turn this on to set up snapshots.");
42 - expect(snapShotStatus(state, true)).toContain("Install the capture helper");
43 - expect(snapShotFeedbackUnavailableMessage(state)).toContain("Install or update");
44 - const ready = {
45 - ...state,
46 - hyprlandHelper: { status: "ready" as const, message: "Ready" },
47 - linuxFeedbackAvailable: true,
48 - };
49 - expect(snapShotSetupButtonLabel(ready)).toBe("Manage capture");
50 - expect(snapShotShortcutStatus({ ...ready, shortcutPending: true })).not.toContain("permission");
51 - expect(snapShotStatus({ ...ready, shortcutActionRegistered: true }, true)).toBe(
52 - "Use your shortcut from another app",
53 - );
54 - expect(snapShotStatus({ ...ready, shortcutVerified: true }, true)).toBe("Ready to capture");
55 - expect(snapShotFeedbackUnavailableMessage(ready)).toBeUndefined();
56 - expect(snapShotAccessibilityUnavailableMessage(ready)).toBeUndefined();
57 -});
58 -
59 -it.each(["gnome-extension", "niri", "screenshot-portal", "picker"] as const)(
27 +it.each(["gnome-extension", "picker"] as const)(
28 "waits for opt-in before presenting %s setup requirements",
29 (linuxBackend) => {
30 const state: DesktopSnapShotState = {
@@ -134,20 +102,6 @@ it("distinguishes saved shortcuts from observed delivery without making users re
102 ).toBe("Ready to capture");
103 });
104
137 -it("does not ask Niri users to repeat setup when its capture endpoint is available", () => {
138 - const state: DesktopSnapShotState = {
139 - mode: "portal",
140 - linuxBackend: "niri",
141 - shortcut: DEFAULT_CLIENT_SETTINGS.snapShotShortcut,
142 - shortcutRegistered: false,
143 - shortcutBinding: "Ctrl+Shift+2 { spawn ...; }",
144 - shortcutMessage: null,
145 - message: null,
146 - };
147 - expect(snapShotStatus(state, true)).toBe("Use your shortcut from another app");
148 - expect(snapShotSetupButtonLabel(state)).toBe("Manage capture");
149 -});
150 -
105 it("reports pending, denied, and assigned shortcuts without inferring consent from saved keys", () => {
106 const state: DesktopSnapShotState = {
107 mode: "portal",
apps/web/src/components/settings/SnapShotSetupDialog.logic.test.ts
+2 -29
@@ -44,14 +44,7 @@ it("derives Hyprland setup from its own helper and registered action, not old GN
44 expect(captureSetupAccessReady({ ...installed, message: "Check access" })).toBe(false);
45 });
46
47 -it.each([
48 - "not-installed",
49 - "disabled",
50 - "restart-required",
51 - "update-required",
52 - "extensions-disabled",
53 - "error",
54 -] as const)(
47 +it.each(["disabled", "error"] as const)(
48 "keeps %s GNOME setup on the access step, even with a previously verified shortcut",
49 (status) => {
50 const state = {
@@ -82,11 +75,6 @@ it("resumes after login from real extension state without an onboarding-complete
75 expect(captureSetupInitialStep(gnome)).toBe("shortcut");
76 });
77
85 -it("finishes setup with a saved shortcut without requiring a separate delivery test", () => {
86 - expect(captureSetupInitialStep({ ...gnome, shortcutVerified: false })).toBe("shortcut");
87 - expect(captureSetupShortcutReady(gnome, false)).toBe(true);
88 -});
89 -
78 it("does not skip native permission setup when capture has not been enabled", () => {
79 expect(
80 captureSetupInitialStep({
@@ -111,7 +99,7 @@ it("offers manual capture on an unsupported GNOME version instead of trapping se
99 expect(captureSetupCheckMessage(state)).toContain("choose a window each time");
100 });
101
114 -it.each(["not-installed", "update-required", "error"] as const)(
102 +it.each(["not-installed", "error"] as const)(
103 "requires KDE helper access for %s even with a saved shortcut",
104 (status) => {
105 const state = {
@@ -172,19 +160,6 @@ it("uses the current desktop's access requirements while preserving setup for th
160 expect(captureSetupShortcutReady(gnome, false)).toBe(true);
161 });
162
175 -it("only confirms capture access when the rechecked extension is running and reachable", () => {
176 - expect(captureSetupCheckMessage(gnome)).toBe("Ready. Continue to choose your shortcut.");
177 - expect(captureSetupCheckMessage({ ...gnome, linuxBackend: "picker" })).toBe(
178 - "Not ready yet. Finish the step above.",
179 - );
180 - expect(
181 - captureSetupCheckMessage({
182 - ...gnome,
183 - gnomeExtension: { status: "disabled", message: "Enable it" },
184 - }),
185 - ).toBe("Not ready yet. Finish the step above.");
186 -});
187 -
163 it("does not report a successful check when capture support could not be read", () => {
164 expect(captureSetupCheckMessage({ ...gnome, message: "Desktop disconnected" })).toContain(
165 "Still unable to check access",
@@ -260,9 +235,7 @@ it("blocks finishing if desktop access is lost during the wizard", () => {
235
236 it.each([
237 [false, false, true],
263 - [false, true, false],
238 [true, false, false],
265 - [true, true, false],
239 ] as const)(
240 "closing setup (previously enabled=%s, completed=%s) disables only an unfinished first opt-in",
241 (wasEnabled, completed, disable) => {
apps/web/src/components/settings/SourceControlWritingSettings.browser.test.tsx
-17
@@ -63,12 +63,6 @@ import { SourceControlWritingSettingsSection } from "./SourceControlWritingSetti
63
64 const resetButton = (label: string) =>
65 page.getByRole("button", { name: `Reset ${label} to default` });
66 -const writeForAll = () => page.getByRole("button", { name: "Write custom instructions for all" });
67 -const applyToAll = () => page.getByRole("button", { name: "Apply instructions to all" });
68 -const bulkEditor = () =>
69 - page.getByRole("textbox", {
70 - name: "Custom source control instructions for all selected environments",
71 - });
66
67 const content = () => (
68 <StrictMode>
@@ -118,15 +112,4 @@ describe("mixed source control instructions", () => {
112 state.styles.map(({ mode, customInstructions }) => ({ mode, customInstructions })),
113 ).toEqual(initialInstructions);
114 });
121 -
122 - it("does not write an untouched bulk draft", async () => {
123 - await using _screen = await setup();
124 - const initialStyles = state.styles;
125 - await userEvent.click(writeForAll());
126 - await expect.element(bulkEditor()).toHaveValue("");
127 - await expect.element(applyToAll()).toBeDisabled();
128 -
129 - expect(state.updateSettings).not.toHaveBeenCalled();
130 - expect(state.styles).toEqual(initialStyles);
131 - });
115 });
apps/web/src/components/settings/browserImportWizard.logic.test.ts
-18
@@ -2,11 +2,9 @@ import { describe, expect, it } from "vite-plus/test";
2 import type { BrowserImportSource } from "@t3tools/contracts";
3
4 import {
5 - canCloseWizard,
5 initialWizardStep,
6 initialTargetSelection,
7 refreshedSourceProfileDirectory,
9 - refreshedSourceStep,
8 resolveWizardTarget,
9 } from "./browserImportWizard.logic";
10
@@ -47,22 +45,6 @@ describe("initialWizardStep", () => {
45 });
46 });
47
50 -describe("canCloseWizard", () => {
51 - it("keeps the wizard open while an import writes its target profile", () => {
52 - expect(canCloseWizard({ step: "importing" })).toBe(false);
53 - expect(canCloseWizard({ step: "configure" })).toBe(true);
54 - expect(canCloseWizard({ step: "blocked", reason: "readFailed" })).toBe(true);
55 - });
56 -});
57 -
58 -describe("refreshedSourceStep", () => {
59 - it("stays on quit while the browser is still running", () => {
60 - expect(refreshedSourceStep(source({ unavailable: "browserRunning" }))).toEqual({
61 - step: "quit",
62 - });
63 - });
64 -});
65 -
48 describe("refreshedSourceProfileDirectory", () => {
49 const refreshed = source({
50 profiles: [
apps/web/src/components/settings/deviceHostsSettings.logic.test.ts
+1
@@ -17,6 +17,7 @@ describe("device host changes across environments", () => {
17 expect(saved.map((hosts) => updateDeviceHosts(hosts, shared, false))).toEqual(saved);
18 });
19
20 + // regression: #11541 device settings edits must apply to selected environments only
21 it("edits and removes the shared host while preserving unrelated hosts", () => {
22 const edited = { ...shared, target: "julius@new-address" };
23 const saved = [[shared], [local, shared]].map((hosts) =>
apps/web/src/components/settings/providerStatus.test.ts
+1
@@ -71,6 +71,7 @@ describe("Antigravity with unchecked sign-in", () => {
71 }
72 });
73
74 + // regression: #18623 neutral unchecked-sign-in display must not mask real warnings
75 it("preserves actionable warnings, failures and disabled states outside unchecked Google sign-in", () => {
76 const cases = [
77 {
apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts
-23
@@ -214,18 +214,6 @@ describe("webhook scheduled tasks", () => {
214 });
215 });
216
217 - it("drops the signature when it is switched off and offers GitHub's settings", () => {
218 - const draft = taskToDraft({ ...webhookTask, schedule: { type: "webhook", signature: null } });
219 - expect(draft.signatureEnabled).toBe(false);
220 - expect(draft.signatureHeader).toBe("x-hub-signature-256");
221 - expect(scheduleFromDraft(draft)).toEqual({
222 - type: "webhook",
223 - signature: null,
224 - maxDeliveryAgeMinutes: null,
225 - dedupe: {},
226 - });
227 - });
228 -
217 it("round-trips the max age, treats blank as no limit, and rejects an invalid limit", () => {
218 const draft = taskToDraft({
219 ...webhookTask,
@@ -330,17 +318,6 @@ describe("scheduled task model defaults", () => {
318 }),
319 ).toEqual(environmentSelection);
320 });
333 - it("does not choose an implicit model on a disabled provider", () => {
334 - expect(
335 - resolve(
336 - {
337 - ...config,
338 - providers: config.providers.map((provider) => ({ ...provider, enabled: false })),
339 - },
340 - null,
341 - ),
342 - ).toBeNull();
343 - });
321 });
322
323 it("rejects dedupe templates without a request placeholder", () => {
apps/web/src/components/settings/scopedSettings.test.ts
+3
@@ -251,6 +251,7 @@ describe("scoped settings writes", () => {
251 ).toEqual({ saved: [laptop.label], failed: unsupported });
252 });
253
254 + // regression: #18334 an environment silently dropped a setting with no warning
255 it("reports a dropped key inside a project override", async () => {
256 expect(
257 await outcome(
@@ -408,6 +409,7 @@ describe("scoped settings writes", () => {
409 ).toEqual([]);
410 });
411
412 + // regression: #11541 device settings were written to the wrong scope
413 it("scopes agent device access to projects while keeping hub and hosts environment-wide", () => {
414 const plan = planScopedSettingsPatch(project, [laptop, server], {
415 enableAgentDeviceAccess: true,
@@ -717,6 +719,7 @@ describe("model selection patches at project scope", () => {
719 },
720 });
721
722 + // regression: #16581 changing a project's model kept the old model's options
723 it("replaces old options when changing model selections", () => {
724 const plan = planScopedSettingsPatch(checkout, [customized], {
725 defaultModelSelection: { instanceId: claude, model: "claude-opus-4-8" },
apps/web/src/components/settings/settingsScope.test.ts
-30
@@ -60,15 +60,6 @@ function group(
60 const groups = [group("t3code", [first, second, third]), group("other", [other])];
61
62 describe("settings scope search", () => {
63 - it("retains legacy project and machine links without inventing an explicit broad scope", () => {
64 - expect(
65 - validateSettingsScopeSearch({ project: "t3code", machine: laptopId, unused: true }),
66 - ).toEqual({
67 - project: "t3code",
68 - machine: laptopId,
69 - });
70 - });
71 -
63 it("retains an orphan checkout so it cannot turn into all environments", () => {
64 const search = validateSettingsScopeSearch({ checkout: first.physicalProjectKey });
65 expect(search).toEqual({ checkout: first.physicalProjectKey });
@@ -82,15 +73,6 @@ describe("settings scope search", () => {
73 });
74
75 describe("settings scope resolution", () => {
85 - it("resolves one environment without targeting its project overrides", () => {
86 - expect(resolveSettingsScope({ machine: serverId }, groups, environments)).toMatchObject({
87 - kind: "environment",
88 - environmentId: serverId,
89 - environmentIds: [serverId],
90 - members: [],
91 - });
92 - });
93 -
76 it("keeps all physical members in a project aggregate, including several on one environment", () => {
77 expect(resolveSettingsScope({ project: "t3code" }, groups, environments)).toMatchObject({
78 kind: "project",
@@ -100,18 +82,6 @@ describe("settings scope resolution", () => {
82 });
83 });
84
103 - it("preserves legacy project plus machine aggregates with multiple checkouts", () => {
104 - expect(
105 - resolveSettingsScope({ project: "t3code", machine: laptopId }, groups, environments),
106 - ).toMatchObject({
107 - kind: "project",
108 - environmentId: laptopId,
109 - label: "t3code / Laptop",
110 - members: [first, second],
111 - environmentIds: [laptopId],
112 - });
113 - });
114 -
85 it("narrows a checkout target to exactly one member, deriving its environment when omitted", () => {
86 expect(
87 resolveSettingsScope(
apps/web/src/components/settings/settingsScopeNavigation.test.ts
-10
@@ -203,16 +203,6 @@ describe("settings scope navigation", () => {
203 });
204 });
205
206 - it("respects explicit clearing keys instead of restoring the previous checkout", async () => {
207 - const router = createSettingsRouter();
208 - await router.navigate({ to: "/settings/general", search: checkoutSearch });
209 - await router.navigate({
210 - to: "/settings/projects",
211 - search: { project: "different-project", machine: undefined },
212 - });
213 - expect(router.state.location.search).toEqual({ project: "different-project" });
214 - });
215 -
206 it("preserves escaped checkout identifiers across reload and browser history", async () => {
207 const router = createSettingsRouter();
208 await router.navigate({ to: "/settings/general", search: checkoutSearch });
apps/web/src/components/settings/settingsSearch.test.ts
-121
@@ -66,13 +66,6 @@ describe("searchSettings", () => {
66 expect(searchSettings("xyzzy")).toEqual([]);
67 });
68
69 - it("keeps catalog order for multiple title matches", () => {
70 - expect(searchSettings("update", ITEMS).map((item) => item.id)).toEqual([
71 - "provider-updates",
72 - "automatic-updates",
73 - ]);
74 - });
75 -
69 it("matches query words across fields and ranks the strongest result first", () => {
70 expect(searchSettings("pairing remote", ITEMS).map((item) => item.id)).toEqual([
71 "network-access",
@@ -91,15 +84,6 @@ describe("searchSettings", () => {
84 expect(searchSettings("update track")).toEqual([]);
85 });
86
94 - it("hides macOS-only settings on other platforms", () => {
95 - vi.stubGlobal("navigator", { platform: "Win32" });
96 - try {
97 - expect(searchSettings("font smoothing")).toEqual([]);
98 - } finally {
99 - vi.unstubAllGlobals();
100 - }
101 - });
102 -
87 it("hides settings whose controls are unavailable", () => {
88 const available = filterAvailableSettingsSearchItems({
89 hasCloudPublicConfig: false,
@@ -133,65 +117,6 @@ describe("searchSettings", () => {
117 expect(available.map((item) => item.id).filter((id) => gatedIds.has(id))).toEqual([]);
118 });
119
136 - it("offers Cursor Keychain settings only when a macOS provider environment is available", () => {
137 - const availability = {
138 - hasCloudPublicConfig: false,
139 - hasEnvironment: true,
140 - hasProviderSettingsEnvironment: true,
141 - hasMacProviderSettingsEnvironment: false,
142 - canManageLocalBackend: false,
143 - isWslSettingsRowVisible: false,
144 - hasThreadAutoSettlement: false,
145 - };
146 - const itemIds = (macAvailable: boolean) =>
147 - filterAvailableSettingsSearchItems({
148 - ...availability,
149 - hasMacProviderSettingsEnvironment: macAvailable,
150 - }).map((item) => item.id);
151 - expect(itemIds(false)).not.toContain("cursor-keychain-usage");
152 - expect(itemIds(true)).toContain("cursor-keychain-usage");
153 - });
154 -
155 - it("keeps the local toggle searchable without offering hidden host publishing controls", () => {
156 - const availability = {
157 - hasCloudPublicConfig: true,
158 - hasEnvironment: true,
159 - hasProviderSettingsEnvironment: true,
160 - hasMacProviderSettingsEnvironment: false,
161 - canManageLocalBackend: false,
162 - isWslSettingsRowVisible: false,
163 - hasThreadAutoSettlement: false,
164 - };
165 - const remoteOnly = filterAvailableSettingsSearchItems({
166 - ...availability,
167 - localEnvironmentDisabled: true,
168 - }).map((item) => item.id);
169 - expect(remoteOnly).toContain("local-environment");
170 - expect(remoteOnly).not.toContain("t3-connect");
171 - expect(remoteOnly).not.toContain("publish-agent-activity");
172 - expect(remoteOnly).not.toContain("wsl-backend");
173 - const browser = filterAvailableSettingsSearchItems(availability).map((item) => item.id);
174 - expect(browser).toContain("publish-agent-activity");
175 - });
176 -
177 - it("offers webhook holding only while the managed tunnel is on, like its row", () => {
178 - const availability = {
179 - hasCloudPublicConfig: true,
180 - hasEnvironment: true,
181 - hasProviderSettingsEnvironment: true,
182 - hasMacProviderSettingsEnvironment: false,
183 - canManageLocalBackend: true,
184 - isWslSettingsRowVisible: false,
185 - hasThreadAutoSettlement: false,
186 - };
187 - const itemIds = (managedTunnelActive: boolean) =>
188 - filterAvailableSettingsSearchItems({ ...availability, managedTunnelActive }).map(
189 - (item) => item.id,
190 - );
191 - expect(itemIds(false)).not.toContain("hold-webhooks-while-offline");
192 - expect(itemIds(true)).toContain("hold-webhooks-while-offline");
193 - });
194 -
120 it("finds keybinding commands by label, command id, and default key", () => {
121 expect(searchSettings("toggle sidebar")[0]?.id).toBe("keybinding-sidebar.toggle");
122 expect(searchSettings("sidebar.toggle")[0]?.id).toBe("keybinding-sidebar.toggle");
@@ -202,14 +127,6 @@ describe("searchSettings", () => {
127 });
128 });
129
205 - it("ranks keybinding commands after other settings", () => {
206 - const ids = searchSettings("model").map((item) => item.id);
207 - expect(ids[0]).toBe("default-model");
208 - expect(ids.indexOf("keybinding-modelPicker.toggle")).toBeGreaterThan(
209 - ids.indexOf("text-generation-model"),
210 - );
211 - });
212 -
130 it("sends commands without a default binding to the section", () => {
131 expect(searchSettings("thread.stop")[0]).toMatchObject({
132 id: "keybinding-thread.stop",
@@ -235,15 +152,6 @@ describe("settings search targets", () => {
152 expect(isSettingsSearchScopeAvailable(target.scope, "environment")).toBe(true);
153 });
154
238 - it("treats device-local rows as reachable from every selection", () => {
239 - const setting = getSettingsSearchTargetScope("time-format")!;
240 - expect(setting).toEqual({ title: "Time format", scope: null });
241 - expect(isSettingsSearchScopeAvailable(setting.scope, "project")).toBe(true);
242 - expect(isSettingsSearchScopeAvailable(setting.scope, "all")).toBe(true);
243 - expect(getSettingsSearchTargetScope("appearance")).toMatchObject({ scope: null });
244 - expect(getSettingsSearchTargetScope("missing-setting")).toBeNull();
245 - });
246 -
155 it("keeps environment-wide settings out of project scopes", () => {
156 const updates = getSettingsSearchTargetScope("provider-update-checks")!;
157 expect(updates.scope).toBe("environment-defaults");
@@ -304,15 +212,6 @@ describe("auto-settlement search availability", () => {
212 ).toEqual({ eligibleEnvironmentIds: [capable.environmentId], isTargetAvailable: false });
213 });
214
307 - it("allows a capable named environment regardless of other environments' capabilities", () => {
308 - expect(
309 - getThreadAutoSettlementSearchAvailability(environments, {
310 - kind: "environment",
311 - environmentIds: [capable.environmentId],
312 - }).isTargetAvailable,
313 - ).toBe(true);
314 - });
315 -
215 it.each([unsupported, offline, loading])(
216 "does not render the target on $environmentId or silently fall back",
217 (selected) => {
@@ -325,15 +224,6 @@ describe("auto-settlement search availability", () => {
224 },
225 );
226
328 - it("offers a capable environment instead of a dead target at an unavailable scope", () => {
329 - expect(
330 - getThreadAutoSettlementSearchAvailability(environments, {
331 - kind: "unavailable",
332 - environmentIds: [capable.environmentId],
333 - }),
334 - ).toEqual({ eligibleEnvironmentIds: [capable.environmentId], isTargetAvailable: false });
335 - });
336 -
227 it("ignores offline and unloaded targets when all connected targets support the setting", () => {
228 const selected = [capable, offline, loading];
229 expect(
@@ -343,15 +233,4 @@ describe("auto-settlement search availability", () => {
233 }).isTargetAvailable,
234 ).toBe(true);
235 });
346 -
347 - it("offers no unavailable environments when none can render the setting", () => {
348 - const selected = [unsupported, offline, loading];
349 - expect(
350 - getThreadAutoSettlementSearchAvailability(selected, {
351 - kind: "all",
352 - environmentIds: selected.map((entry) => entry.environmentId),
353 - }),
354 - ).toEqual({ eligibleEnvironmentIds: [], isTargetAvailable: false });
355 - expect(getThreadAutoSettlementSearchAvailability([]).eligibleEnvironmentIds).toEqual([]);
356 - });
236 });
apps/web/src/components/settings/themeEditorStore.test.ts deleted
-25
@@ -1,25 +0,0 @@
1 -import { afterEach, describe, expect, it } from "vite-plus/test";
2 -
3 -import { OCEAN_THEME_ID, T3_CHAT_THEME_ID } from "../../themePalette";
4 -import { toggleThemeEditorForTheme, useThemeEditorStore } from "./themeEditorStore";
5 -
6 -afterEach(() => {
7 - useThemeEditorStore.getState().closeThemeEditor();
8 -});
9 -
10 -describe("toggleThemeEditorForTheme", () => {
11 - it("opens a new editor seeded from the theme active for the current appearance", () => {
12 - toggleThemeEditorForTheme({
13 - theme: T3_CHAT_THEME_ID,
14 - themeHalves: { dark: OCEAN_THEME_ID },
15 - initialAppearance: "dark",
16 - });
17 -
18 - expect(useThemeEditorStore.getState().session).toMatchObject({
19 - editingThemeId: null,
20 - seedThemeId: OCEAN_THEME_ID,
21 - seedName: null,
22 - initialAppearance: "dark",
23 - });
24 - });
25 -});
apps/web/src/components/usage/UsageProviderChart.test.ts
-25
@@ -43,28 +43,3 @@ describe("buildPeriodColumns", () => {
43 ]);
44 });
45 });
46 -
47 -describe("hourly chart columns", () => {
48 - it("zero-fills inactive hours and preserves hourly provider values", () => {
49 - const byHour = new Map([
50 - [
51 - "2026-08-11T09:37:00.000Z",
52 - {
53 - day: "2026-08-11",
54 - hourStart: "2026-08-11T09:37:00.000Z",
55 - costUsd: 4,
56 - totalTokens: 40,
57 - byProvider: new Map([["codex" as const, { costUsd: 4, totalTokens: 40 }]]),
58 - },
59 - ],
60 - ]);
61 -
62 - expect(
63 - buildPeriodColumns(
64 - ["2026-08-11T08:37:00.000Z", "2026-08-11T09:37:00.000Z", "2026-08-11T10:37:00.000Z"],
65 - byHour,
66 - "cost",
67 - ).map((column) => column.total),
68 - ).toEqual([0, 4, 0]);
69 - });
70 -});
apps/web/src/components/usage/usagePagePreferences.test.ts
+1
@@ -32,6 +32,7 @@ describe("Usage page preferences", () => {
32 expect(readUsagePagePreferences()).toEqual({ metric: "tokens", windowDays: 30 });
33 });
34
35 + // regression: #10189 an invalid saved usage selection was never replaced
36 it.each([
37 "not-json",
38 '{"metric":"unknown","windowDays":7}',
apps/web/src/components/usage/usagePriceForm.test.ts
-10
@@ -47,16 +47,6 @@ describe("model price entry", () => {
47 },
48 );
49
50 - it("rejects invalid optional rates and missing model IDs", () => {
51 - const form = usagePriceForm("example-model", {
52 - inputCostPerMillionTokens: 2,
53 - outputCostPerMillionTokens: 8,
54 - });
55 - expect(parseUsagePriceForm({ ...form, cacheReadCostPerMillionTokens: "-1" })).toBeNull();
56 - expect(parseUsagePriceForm({ ...form, cacheWriteCostPerMillionTokens: "invalid" })).toBeNull();
57 - expect(parseUsagePriceForm({ ...form, model: " " })).toBeNull();
58 - });
59 -
50 it("never blocks deleting part of a price, but blocks replacing it with a non-number", () => {
51 expect(isUsagePriceEdit("1e-7", "e-7")).toBe(true);
52 expect(isUsagePriceEdit("1e-7", "1-7")).toBe(true);
apps/web/src/components/usage/usagePriceTable.test.ts
+1 -19
@@ -1,11 +1,6 @@
1 import { EnvironmentId } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3 -import {
4 - usageAliasCell,
5 - usagePriceCell,
6 - usagePriceTableChanges,
7 - type UsagePriceDraft,
8 -} from "./usagePriceTable";
3 +import { usagePriceCell, usagePriceTableChanges, type UsagePriceDraft } from "./usagePriceTable";
4 import type { UsagePriceTarget } from "./usagePriceTargets";
5
6 const price = { inputCostPerMillionTokens: 2, outputCostPerMillionTokens: 8 };
@@ -120,17 +115,4 @@ describe("price table edits", () => {
115 ),
116 ).toBe("Map to a different model.");
117 });
123 -
124 - it("keeps each environment's mapping when the column is untouched", () => {
125 - const edits = [draft({ inputCostPerMillionTokens: "3" })];
126 - expect(
127 - usagePriceTableChanges(target("a", {}, { example: "example-model" }), edits).changes,
128 - ).toEqual([]);
129 - expect(
130 - usageAliasCell(
131 - [target("a", {}, { example: "example-model" }), target("b", { example: price })],
132 - "example",
133 - ),
134 - ).toEqual({ value: "", placeholder: "Mixed" });
135 - });
118 });
apps/web/src/components/usage/usagePriceTargets.test.ts
-30
@@ -96,36 +96,6 @@ describe("model price writes", () => {
96 expect([...results.values()].every((result) => result.status === "saved")).toBe(true);
97 });
98
99 - it("reports thrown writes and permission/version restrictions without aborting other saves", async () => {
100 - const onResult = vi.fn();
101 - const write = vi.fn(async () => {
102 - throw new Error("connection lost");
103 - });
104 - await writeUsagePrices({
105 - targets: [
106 - target("lost"),
107 - target("denied", { unavailable: "Read-only access" }),
108 - target("old", { unavailable: "Update server to edit prices" }),
109 - ],
110 - changes: new Map([[EnvironmentId.make("lost"), [{ model: "example", price }]]]),
111 - write,
112 - onResult,
113 - });
114 - expect(write).toHaveBeenCalledTimes(1);
115 - expect(onResult).toHaveBeenCalledWith("lost", {
116 - status: "failed",
117 - error: "Could not save. Try again.",
118 - });
119 - expect(onResult).toHaveBeenCalledWith("denied", {
120 - status: "failed",
121 - error: "Read-only access",
122 - });
123 - expect(onResult).toHaveBeenCalledWith("old", {
124 - status: "failed",
125 - error: "Update server to edit prices",
126 - });
127 - });
128 -
99 it("sends mappings beside prices and fails servers that cannot store them", async () => {
100 const write = vi.fn(async () => ({ _tag: "Success" as const }));
101 const onResult = vi.fn();
apps/web/src/composer-code-block.test.ts
-21
@@ -63,17 +63,6 @@ describe("indentedNewlineInCodeBlock", () => {
63 indentedNewlineInCodeBlock(editor.state, (tr) => editor.view.dispatch(tr));
64 expect(textOf(editor)).toBe(" deep()\n \nflush()");
65 });
66 -
67 - it("does nothing outside a code block", () => {
68 - const editor = new Editor({
69 - extensions,
70 - content: {
71 - type: "doc",
72 - content: [{ type: "paragraph", content: [{ type: "text", text: " hi" }] }],
73 - },
74 - });
75 - expect(indentedNewlineInCodeBlock(editor.state, (tr) => editor.view.dispatch(tr))).toBe(false);
76 - });
66 });
67
68 function pressEnter(editor: Editor) {
@@ -96,16 +85,6 @@ describe("exitCodeBlockOnTrailingBlankLines", () => {
85 expect(editor.state.selection.$from.parent.type.name).toBe("paragraph");
86 });
87
99 - it("counts lines holding only carried indentation as blank", () => {
100 - const editor = codeEditor(" nested()");
101 - pressEnter(editor);
102 - pressEnter(editor);
103 - expect(editor.state.doc.childCount).toBe(1);
104 - pressEnter(editor);
105 - expect(editor.state.doc.firstChild?.textContent).toBe(" nested()");
106 - expect(editor.state.selection.$from.parent.type.name).toBe("paragraph");
107 - });
108 -
88 it("closes an unclosed fence on the way out", () => {
89 const editor = codeEditor("flush()");
90 editor.view.dispatch(editor.state.tr.setNodeAttribute(0, "close", ""));
apps/web/src/composer-editor-mentions.test.ts
+1 -34
@@ -49,14 +49,6 @@ describe("splitPromptIntoComposerSegments", () => {
49 ]);
50 });
51
52 - it("keeps newlines around mention tokens", () => {
53 - expect(splitPromptIntoComposerSegments("one\n@AGENTS.md \ntwo")).toEqual([
54 - { type: "text", text: "one\n" },
55 - { type: "mention", path: "AGENTS.md", source: "@AGENTS.md" },
56 - { type: "text", text: " \ntwo" },
57 - ]);
58 - });
59 -
52 it("splits quoted mention tokens containing whitespace", () => {
53 expect(splitPromptIntoComposerSegments('Inspect @"My File.md" please')).toEqual([
54 { type: "text", text: "Inspect " },
@@ -181,11 +173,6 @@ describe("splitPromptIntoComposerSegments", () => {
173 },
174 );
175
184 - it("keeps IME-composed text containing a scoped package reference as text", () => {
185 - const prompt = "入力 @expo/ui を追加";
186 - expect(splitPromptIntoComposerSegments(prompt)).toEqual([{ type: "text", text: prompt }]);
187 - });
188 -
176 it("turns canonical scoped folder links into file mention segments", () => {
177 expect(splitPromptIntoComposerSegments("Inspect [sub](@scope/pkg/sub) next")).toEqual([
178 { type: "text", text: "Inspect " },
@@ -256,17 +243,6 @@ describe("splitPromptIntoComposerSegments", () => {
243 { type: "text", text: " please" },
244 ]);
245 });
259 -
260 - it("preserves consecutive context references without dropping positions", () => {
261 - expect(splitPromptIntoComposerSegments(`${terminalReference}${terminalReference}tail`)).toEqual(
262 - [terminalSegment, terminalSegment, { type: "text", text: "tail" }],
263 - );
264 - });
265 -
266 - it("leaves a context link with an unparsable href as text", () => {
267 - const prompt = "see [x](t3-context://v1/terminal/ctx 1) now";
268 - expect(splitPromptIntoComposerSegments(prompt)).toEqual([{ type: "text", text: prompt }]);
269 - });
246 });
247
248 describe("selectionTouchesMentionBoundary", () => {
@@ -286,16 +262,6 @@ describe("selectionTouchesMentionBoundary", () => {
262 ).toBe(true);
263 });
264
289 - it("returns true when selection includes the whitespace before a mention", () => {
290 - expect(
291 - selectionTouchesMentionBoundary(
292 - "hi there @package.json later",
293 - "hi there".length,
294 - "hi there ".length,
295 - ),
296 - ).toBe(true);
297 - });
298 -
265 it("returns false when selection starts after the mention boundary whitespace", () => {
266 expect(
267 selectionTouchesMentionBoundary(
@@ -306,6 +272,7 @@ describe("selectionTouchesMentionBoundary", () => {
272 ).toBe(false);
273 });
274
275 + // regression: #2625 mentions with spaces are quoted; selection checks must span the quotes
276 it("returns true when selection includes whitespace after a quoted mention", () => {
277 expect(
278 selectionTouchesMentionBoundary(
apps/web/src/composer-list-continuation.test.ts
+1
@@ -74,6 +74,7 @@ describe("composer list renumbering", () => {
74 expect(edit.cursorAfter).toBe(" 1) a\n 2) ".length);
75 });
76
77 + // regression: #14332 continuing a numbered list must renumber following items only up to the list boundary
78 it.each([
79 ["a blank line", ""],
80 ["plain text", "text"],
apps/web/src/composer-logic.test.ts
+2 -70
@@ -265,21 +265,6 @@ describe("detectComposerTrigger", () => {
265 expect(trigger).toBeNull();
266 });
267
268 - it.each(["$", "€", "£", "¥", "₹", "₩", "₿", "𑿝"])(
269 - "detects %sskill trigger at cursor",
270 - (prefix) => {
271 - const text = `Use ${prefix}gh-fi`;
272 - const trigger = detectComposerTrigger(text, text.length);
273 -
274 - expect(trigger).toEqual({
275 - kind: "skill",
276 - query: "gh-fi",
277 - rangeStart: "Use ".length,
278 - rangeEnd: text.length,
279 - });
280 - },
281 - );
282 -
268 it("detects a pull request number at a token boundary", () => {
269 const text = "Compare this with #8737";
270
@@ -291,33 +276,12 @@ describe("detectComposerTrigger", () => {
276 });
277 });
278
294 - it("opens pull request completion from a bare hash", () => {
295 - const text = "Compare with #";
296 -
297 - expect(detectComposerTrigger(text, text.length)).toEqual({
298 - kind: "pull-request",
299 - query: "",
300 - rangeStart: "Compare with ".length,
301 - rangeEnd: text.length,
302 - });
303 - });
304 -
305 - it("supports hyphenated pull request search terms", () => {
306 - const text = "Find #inline-context";
307 -
308 - expect(detectComposerTrigger(text, text.length)).toEqual({
309 - kind: "pull-request",
310 - query: "inline-context",
311 - rangeStart: "Find ".length,
312 - rangeEnd: text.length,
313 - });
314 - });
315 -
279 it("does not keep pull request completion active for headings or embedded hashes", () => {
280 expect(detectComposerTrigger("# Heading", "# Heading".length)).toBeNull();
281 expect(detectComposerTrigger("issue#123", "issue#123".length)).toBeNull();
282 });
283
284 + // regression: #936 @file autocomplete used the wrong cursor when typing mid-text
285 it("detects @path trigger in the middle of existing text", () => {
286 const text = "Please inspect @in this sentence";
287 const cursorAfterAt = "Please inspect @".length;
@@ -404,10 +368,6 @@ describe("filterComposerPullRequestMatches", () => {
368 });
369
370 describe("expandCollapsedComposerCursor", () => {
407 - it("keeps cursor unchanged when no mention segment is present", () => {
408 - expect(expandCollapsedComposerCursor("plain text", 5)).toBe(5);
409 - });
410 -
371 it("maps collapsed mention cursor to expanded text cursor", () => {
372 const text = "what's in my @AGENTS.md fsfdas";
373 const collapsedCursorAfterMention = "what's in my ".length + 2;
@@ -418,6 +378,7 @@ describe("expandCollapsedComposerCursor", () => {
378 );
379 });
380
381 + // regression: #2625 cursor mapping broke for quoted mentions containing spaces
382 it("maps collapsed quoted mention cursor to expanded text cursor", () => {
383 const text = 'what is in @"My File.md" please';
384 const collapsedCursorAfterMention = "what is in ".length + 2;
@@ -445,16 +406,6 @@ describe("expandCollapsedComposerCursor", () => {
406
407 expect(detectComposerTrigger(text, expandedCursor)).toBeNull();
408 });
448 -
449 - it.each(["$", "€", "𑿝"])("maps collapsed %s skill cursor to expanded text cursor", (prefix) => {
450 - const text = `run ${prefix}review-follow-up then`;
451 - const collapsedCursorAfterSkill = "run ".length + 2;
452 - const expandedCursorAfterSkill = `run ${prefix}review-follow-up `.length;
453 -
454 - expect(expandCollapsedComposerCursor(text, collapsedCursorAfterSkill)).toBe(
455 - expandedCursorAfterSkill,
456 - );
457 - });
409 });
410
411 describe("composerStateAtPromptEnd", () => {
@@ -485,15 +436,6 @@ describe("collapseExpandedComposerCursor", () => {
436 expect(collapsedCursor).toBe("open ".length + 1 + " then @src/index.ts ".length);
437 expect(expandCollapsedComposerCursor(text, collapsedCursor)).toBe(expandedCursor);
438 });
488 -
489 - it("collapses only genuine mentions when package-like text exists earlier", () => {
490 - const text = "install @scope/pkg then @README.md ";
491 - const expandedCursor = text.length;
492 - const collapsedCursor = collapseExpandedComposerCursor(text, expandedCursor);
493 -
494 - expect(collapsedCursor).toBe("install @scope/pkg then ".length + 1 + " ".length);
495 - expect(expandCollapsedComposerCursor(text, collapsedCursor)).toBe(expandedCursor);
496 - });
439 });
440
441 it("preserves the caret before trailing text after mixed-width skill chips", () => {
@@ -570,16 +512,6 @@ describe("isCollapsedCursorAdjacentToInlineToken", () => {
512 expect(isCollapsedCursorAdjacentToInlineToken(text, mentionEnd + 1, "left")).toBe(false);
513 });
514
573 - it("detects right adjacency only when cursor is directly before a mention", () => {
574 - const text = "open @AGENTS.md next";
575 - const mentionStart = "open ".length;
576 - const mentionEnd = mentionStart + 1;
577 -
578 - expect(isCollapsedCursorAdjacentToInlineToken(text, mentionStart, "right")).toBe(true);
579 - expect(isCollapsedCursorAdjacentToInlineToken(text, mentionEnd, "right")).toBe(false);
580 - expect(isCollapsedCursorAdjacentToInlineToken(text, mentionStart - 1, "right")).toBe(false);
581 - });
582 -
515 it("treats context reference pills as inline tokens for adjacency checks", () => {
516 const text = `open ${terminalReference} next`;
517 const tokenStart = "open ".length;
apps/web/src/composer-rich-text-doc.test.ts
+2 -73
@@ -613,13 +613,6 @@ describe("composer rich text document model", () => {
613 expect(roundTrip(value).value).toBe(value);
614 });
615
616 - it.each(["> quoted", "> a\n>b", "---", "- - -", "# Heading", "#1234"])(
617 - "keeps the block %s literal in plain mode",
618 - (value) => {
619 - expect(roundTripPlain(value).value).toBe(value);
620 - },
621 - );
622 -
616 it.each([
617 ["---", "---"],
618 ["a\n---", "a\n---"],
@@ -632,30 +625,6 @@ describe("composer rich text document model", () => {
625 expect(doc.resolve(flatToPm(map, map.docLength)).parent.isTextblock).toBe(true);
626 });
627
635 - it("parses a quote as a blockquote of one paragraph per line", () => {
636 - const json = buildDocJson("> a\n> b\n>c", (n) => ({ label: n, description: null }));
637 - expect(json.content.map((block) => block.type)).toEqual(["blockquote", "blockquote"]);
638 - expect((json.content[0] as { content: unknown[] }).content).toHaveLength(2);
639 - });
640 -
641 - it.each([
642 - "> a\n> b",
643 - "> **q** @README.md",
644 - "text\n---\nmore",
645 - "---\ntext",
646 - "# Heading text",
647 - "## **b** @README.md",
648 - ])(
649 - "maps every document offset of the block %s through markdown coordinates and back",
650 - (value) => {
651 - const map = roundTrip(value);
652 - expect(map.value).toBe(value);
653 - for (let flat = 0; flat <= map.docLength; flat += 1) {
654 - expect(markdownToFlat(map, flatToMarkdown(map, flat))).toBe(flat);
655 - }
656 - },
657 - );
658 -
628 it.each([
629 "```\ncode\n```",
630 "```ts\nconst a = 1;\n```",
@@ -722,29 +691,6 @@ describe("composer rich text document model", () => {
691 expect(after.content[0]?.attrs?.skillName).toBe("my-skill");
692 });
693
725 - it.each([
726 - ["listItem", { marker: "-", space: "" }, "bulletList", "- text"],
727 - ["listItem", { marker: "1.", space: "" }, "orderedList", "1. text"],
728 - ])("gives a bare %s a space once it has text", (item, attrs, list, expected) => {
729 - const doc = ProseMirrorNode.fromJSON(schema, {
730 - type: "doc",
731 - content: [
732 - {
733 - type: list,
734 - content: [
735 - {
736 - type: item,
737 - attrs,
738 - content: [{ type: "paragraph", content: [{ type: "text", text: "text" }] }],
739 - },
740 - ],
741 - },
742 - ],
743 - });
744 - expect(serializeEditorDoc(doc).value).toBe(expected);
745 - expect(roundTrip("-").value).toBe("-");
746 - });
747 -
694 it("writes code holding a closing fence inside a longer fence", () => {
695 const doc = ProseMirrorNode.fromJSON(schema, {
696 type: "doc",
@@ -788,11 +734,6 @@ describe("composer rich text document model", () => {
734 expect(skillChipReplacements(doc, known)).toEqual([]);
735 });
736
791 - it("keeps fences literal in plain mode", () => {
792 - const value = "```ts\nconst a = 1;\n```";
793 - expect(roundTripPlain(value).value).toBe(value);
794 - });
795 -
737 it.each([
738 "plain prose with no styling at all",
739 "a chip @README.md counts one character in both modes",
@@ -818,16 +759,6 @@ describe("composer rich text document model", () => {
759 expect(flatToMarkdown(plain, markdownToFlat(plain, 3))).toBe(3);
760 expect(flatToMarkdown(rich, markdownToFlat(rich, 3))).toBe(4);
761 });
821 -
822 - it("maps markdown offsets at styled edges onto document text", () => {
823 - const value = "a **bold** c";
824 - const map = roundTrip(value);
825 - expect(map.value).toBe(value);
826 - expect(flatToMarkdown(map, 2)).toBe(4);
827 - expect(flatToMarkdown(map, 6)).toBe(10);
828 - expect(markdownToFlat(map, 3)).toBe(2);
829 - expect(markdownToFlat(map, 9)).toBe(6);
830 - });
762 });
763
764 describe("serializeSelection", () => {
@@ -857,10 +788,6 @@ describe("serializeSelection", () => {
788 it("keeps the nesting of an item and its children", () => {
789 expect(copy("- p\n - a\n - b", "p", "a")).toBe("- p\n - a");
790 });
860 -
861 - it("copies text within one block without its marker", () => {
862 - expect(copy("- one two", "one", "one")).toBe("one");
863 - });
791 });
792
793 describe("pasting into a list item or quote", () => {
@@ -949,6 +876,7 @@ describe("pasting into a path query", () => {
876 expect(serializeEditorDoc(doc).value).toBe("Open @**src/**__test__.tsx");
877 });
878
879 + // regression: #16619 paths pasted after @ lost their underscores to markdown parsing
880 it("parses markdown pasted right after a mention chip", () => {
881 const withSpace = ProseMirrorNode.fromJSON(
882 schema,
@@ -1004,6 +932,7 @@ describe("caret stops at styled edges", () => {
932 expect(typed(outside, "x")).toBe("head **bold**x");
933 });
934
935 + // regression: #13217 could not type in front of bold that starts a composer line
936 it("offers both stops where styled text meets plain text mid-line", () => {
937 const plain = stateAt("a **b** c", 3);
938 expect(caretTakesMarksBefore(plain)).toBe(true);
apps/web/src/composerDraftStore.test.ts
+5 -697
@@ -15,7 +15,6 @@ import {
15 scopeProjectRef,
16 scopeThreadRef,
17 } from "@t3tools/client-runtime/environment";
18 -import * as Schema from "effect/Schema";
18 import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
19 import {
20 defaultInstanceIdForDriver,
@@ -89,18 +88,13 @@ import {
88 useComposerDraftStore,
89 DraftId,
90 } from "./composerDraftStore";
92 -import { removeLocalStorageItem, setLocalStorageItem } from "./hooks/useLocalStorage";
91 import { insertInlineContextReference } from "./lib/composerContextReferences";
92 import { terminalContextReference, threadContextRecord } from "./lib/composerContextRecords";
93 import {
94 copiedComposerAttachmentFile,
95 rememberCopiedComposerAttachments,
96 } from "./lib/copiedComposerAttachments";
99 -import {
100 - INLINE_TERMINAL_CONTEXT_PLACEHOLDER,
101 - formatTerminalContextReference,
102 - type TerminalContextDraft,
103 -} from "./lib/terminalContext";
97 +import { formatTerminalContextReference, type TerminalContextDraft } from "./lib/terminalContext";
98 import { createDeferredStorage } from "./lib/storage";
99 import { applyPreviewServerSnapshot, resetPreviewStateForTests } from "./previewStateStore";
100
@@ -276,23 +270,6 @@ describe("composerDraftStore addImages", () => {
270 expect(draft?.images.map((image) => image.id)).toEqual(["img-a"]);
271 expect(revokeSpy).toHaveBeenCalledWith("blob:b");
272 });
279 -
280 - it("does not revoke blob URLs that are still used by an accepted duplicate image", () => {
281 - const first = makeImage({
282 - id: "img-shared",
283 - previewUrl: "blob:shared",
284 - });
285 - const duplicateSameUrl = makeImage({
286 - id: "img-shared",
287 - previewUrl: "blob:shared",
288 - });
289 -
290 - useComposerDraftStore.getState().addImages(threadRef, [first, duplicateSameUrl]);
291 -
292 - const draft = draftFor(threadId, TEST_ENVIRONMENT_ID);
293 - expect(draft?.images.map((image) => image.id)).toEqual(["img-shared"]);
294 - expect(revokeSpy).not.toHaveBeenCalledWith("blob:shared");
295 - });
273 });
274
275 describe("composerDraftStore copied attachments", () => {
@@ -351,38 +328,6 @@ describe("composerDraftStore copied attachments", () => {
328 });
329 });
330
354 -describe("composerDraftStore clearComposerContent", () => {
355 - const threadId = ThreadId.make("thread-clear");
356 - const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
357 - let originalRevokeObjectUrl: typeof URL.revokeObjectURL;
358 - let revokeSpy: ReturnType<typeof vi.fn<(url: string) => void>>;
359 -
360 - beforeEach(() => {
361 - resetComposerDraftStore();
362 - originalRevokeObjectUrl = URL.revokeObjectURL;
363 - revokeSpy = vi.fn();
364 - URL.revokeObjectURL = revokeSpy;
365 - });
366 -
367 - afterEach(() => {
368 - URL.revokeObjectURL = originalRevokeObjectUrl;
369 - });
370 -
371 - it("does not revoke blob preview URLs when clearing composer content", () => {
372 - const first = makeImage({
373 - id: "img-optimistic",
374 - previewUrl: "blob:optimistic",
375 - });
376 - useComposerDraftStore.getState().addImage(threadRef, first);
377 -
378 - useComposerDraftStore.getState().clearComposerContent(threadRef);
379 -
380 - const draft = draftFor(threadId, TEST_ENVIRONMENT_ID);
381 - expect(draft).toBeUndefined();
382 - expect(revokeSpy).not.toHaveBeenCalledWith("blob:optimistic");
383 - });
384 -});
385 -
331 describe("composerDraftStore unsent draft marker", () => {
332 const threadId = ThreadId.make("thread-unsent-marker");
333
@@ -390,6 +335,7 @@ describe("composerDraftStore unsent draft marker", () => {
335 resetComposerDraftStore();
336 });
337
338 + // regression: #11338 rewind locks are session-only and must not survive a reload
339 it("does not persist active rewind locks", () => {
340 const threadKey = threadKeyFor(threadId, TEST_ENVIRONMENT_ID);
341 useComposerDraftStore.setState({ rewindingThreadKeys: new Set([threadKey]) });
@@ -589,137 +535,6 @@ describe("composerDraftStore file attachments", () => {
535 expect(files?.[0]?.file).not.toBeNull();
536 expect(files?.some(composerFileNeedsReattach)).toBe(false);
537 });
592 -
593 - it("replaces a needs-reattach marker with a stash-restored uploaded file", () => {
594 - const store = useComposerDraftStore.getState();
595 - const marker: ComposerFileAttachment = { ...makeFile("file-marker"), file: null };
596 - store.addFiles(threadRef, [marker]);
597 - expect(store.getComposerDraft(threadRef)?.files.every(composerFileNeedsReattach)).toBe(true);
598 -
599 - const restored: ComposerFileAttachment = {
600 - ...makeFile("file-restored"),
601 - file: null,
602 - uploadedAttachmentId: "pending-stash-pdf",
603 - uploadEnvironmentId: TEST_ENVIRONMENT_ID,
604 - };
605 - store.addFiles(threadRef, [restored]);
606 -
607 - const files = store.getComposerDraft(threadRef)?.files;
608 - expect(files?.map((file) => file.id)).toEqual(["file-restored"]);
609 - expect(files?.[0]?.uploadedAttachmentId).toBe("pending-stash-pdf");
610 - expect(files?.[0]?.uploadEnvironmentId).toBe(TEST_ENVIRONMENT_ID);
611 - expect(files?.some(composerFileNeedsReattach)).toBe(false);
612 - });
613 -
614 - it("keeps same-name videos with different MIME types", () => {
615 - const store = useComposerDraftStore.getState();
616 - const mp4 = new File(["report"], "clip", { type: "video/mp4" });
617 - const webm = new File(["report"], "clip", { type: "video/webm" });
618 -
619 - store.addFiles(threadRef, [
620 - {
621 - type: "file",
622 - id: "video-mp4",
623 - name: mp4.name,
624 - mimeType: mp4.type,
625 - sizeBytes: mp4.size,
626 - file: mp4,
627 - },
628 - {
629 - type: "file",
630 - id: "video-webm",
631 - name: webm.name,
632 - mimeType: webm.type,
633 - sizeBytes: webm.size,
634 - file: webm,
635 - },
636 - ]);
637 -
638 - expect(store.getComposerDraft(threadRef)?.files.map((file) => file.id)).toEqual([
639 - "video-mp4",
640 - "video-webm",
641 - ]);
642 - });
643 -
644 - it("keeps the remaining file slot available after a duplicate is skipped", () => {
645 - const store = useComposerDraftStore.getState();
646 - store.addImages(
647 - threadRef,
648 - Array.from({ length: PROVIDER_SEND_TURN_MAX_ATTACHMENTS - 2 }, (_, index) =>
649 - makeImage({
650 - id: `image-${index}`,
651 - name: `image-${index}.png`,
652 - previewUrl: `blob:image-${index}`,
653 - }),
654 - ),
655 - );
656 - store.addFiles(threadRef, [makeFile("file-original")]);
657 - store.addFiles(threadRef, [
658 - makeFile("file-duplicate"),
659 - { ...makeFile("file-unique"), name: "unique.pdf" },
660 - ]);
661 -
662 - expect(store.getComposerDraft(threadRef)?.files.map((file) => file.id)).toEqual([
663 - "file-original",
664 - "file-unique",
665 - ]);
666 - });
667 -});
668 -
669 -describe("composerDraftStore syncPersistedAttachments", () => {
670 - const threadId = ThreadId.make("thread-sync-persisted");
671 - const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
672 -
673 - beforeEach(() => {
674 - removeLocalStorageItem(COMPOSER_DRAFT_STORAGE_KEY);
675 - useComposerDraftStore.setState({
676 - draftsByThreadKey: {},
677 - draftThreadsByThreadKey: {},
678 - logicalProjectDraftThreadKeyByLogicalProjectKey: {},
679 - stickyModelSelectionByProvider: {},
680 - stickyActiveProvider: null,
681 - });
682 - });
683 -
684 - afterEach(() => {
685 - removeLocalStorageItem(COMPOSER_DRAFT_STORAGE_KEY);
686 - });
687 -
688 - it("treats malformed persisted draft storage as empty", async () => {
689 - const image = makeImage({
690 - id: "img-persisted",
691 - previewUrl: "blob:persisted",
692 - });
693 - useComposerDraftStore.getState().addImage(threadRef, image);
694 - setLocalStorageItem(
695 - COMPOSER_DRAFT_STORAGE_KEY,
696 - {
697 - version: 2,
698 - state: {
699 - draftsByThreadId: {
700 - [threadId]: {
701 - attachments: "not-an-array",
702 - },
703 - },
704 - },
705 - },
706 - Schema.Unknown,
707 - );
708 -
709 - useComposerDraftStore.getState().syncPersistedAttachments(threadRef, [
710 - {
711 - id: image.id,
712 - name: image.name,
713 - mimeType: image.mimeType,
714 - sizeBytes: image.sizeBytes,
715 - dataUrl: image.previewUrl,
716 - },
717 - ]);
718 - await Promise.resolve();
719 -
720 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.persistedAttachments).toEqual([]);
721 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.nonPersistedImageIds).toEqual([image.id]);
722 - });
538 });
539
540 describe("composerDraftStore terminal contexts", () => {
@@ -746,28 +561,6 @@ describe("composerDraftStore terminal contexts", () => {
561 expect(draft?.terminalContexts.map((context) => context.id)).toEqual(["ctx-1"]);
562 });
563
749 - it("normalizes legacy terminal ids before storing and removing their references", () => {
750 - const store = useComposerDraftStore.getState();
751 - store.setTerminalContexts(threadRef, [makeTerminalContext({ id: "old terminal:one" })]);
752 - const draft = draftFor(threadId, TEST_ENVIRONMENT_ID)!;
753 - const id = draft.terminalContexts[0]!.id;
754 - expect(id).toMatch(/^[a-z0-9_-]+$/i);
755 - expect(draft.prompt).toContain(`/terminal/terminal_${id})`);
756 - store.removeTerminalContext(threadRef, id);
757 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)).toBeUndefined();
758 - });
759 -
760 - it.each(["replace", "remove", "clear"])("removes terminal links on %s", (operation) => {
761 - const store = useComposerDraftStore.getState();
762 - store.setPrompt(threadRef, "Explain");
763 - store.addTerminalContext(threadRef, makeTerminalContext({ id: "ctx-1" }));
764 - if (operation === "replace") store.setTerminalContexts(threadRef, []);
765 - else if (operation === "remove") store.removeTerminalContext(threadRef, "ctx-1");
766 - else store.clearTerminalContexts(threadRef);
767 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe("Explain");
768 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.terminalContexts).toEqual([]);
769 - });
770 -
564 it("inserts terminal contexts at the requested inline prompt position", () => {
565 const first = makeTerminalContext({ id: "ctx-1" });
566 const second = makeTerminalContext({
@@ -805,55 +598,6 @@ describe("composerDraftStore terminal contexts", () => {
598 expect(draft?.terminalContexts.map((context) => context.id)).toEqual(["ctx-2", "ctx-1"]);
599 });
600
808 - it("keeps legacy terminal contexts without saved snapshot text unavailable", () => {
809 - const persistApi = useComposerDraftStore.persist as unknown as {
810 - getOptions: () => {
811 - merge: (
812 - persistedState: unknown,
813 - currentState: ReturnType<typeof useComposerDraftStore.getState>,
814 - ) => ReturnType<typeof useComposerDraftStore.getState>;
815 - };
816 - };
817 - const mergedState = persistApi.getOptions().merge(
818 - {
819 - draftsByThreadId: {
820 - [threadId]: {
821 - prompt: INLINE_TERMINAL_CONTEXT_PLACEHOLDER,
822 - attachments: [],
823 - terminalContexts: [
824 - {
825 - id: "ctx-rehydrated",
826 - threadId,
827 - createdAt: "2026-03-13T12:00:00.000Z",
828 - terminalId: "default",
829 - terminalLabel: "Terminal 1",
830 - lineStart: 4,
831 - lineEnd: 5,
832 - },
833 - ],
834 - },
835 - },
836 - draftThreadsByThreadId: {},
837 - projectDraftThreadIdByProjectKey: {},
838 - },
839 - useComposerDraftStore.getInitialState(),
840 - );
841 -
842 - expect(mergedState.draftsByThreadKey[threadKeyFor(threadId)]?.prompt).toBe(
843 - "[Terminal 1 lines 4-5](t3-context://v1/terminal/terminal_ctx-rehydrated)",
844 - );
845 - expect(mergedState.draftsByThreadKey[threadKeyFor(threadId)]?.terminalContexts).toMatchObject([
846 - {
847 - id: "ctx-rehydrated",
848 - terminalId: "default",
849 - terminalLabel: "Terminal 1",
850 - lineStart: 4,
851 - lineEnd: 5,
852 - text: "",
853 - },
854 - ]);
855 - });
856 -
601 it("sanitizes malformed persisted drafts during merge", () => {
602 const persistApi = useComposerDraftStore.persist as unknown as {
603 getOptions: () => {
@@ -928,65 +672,6 @@ describe("composerDraftStore context persistence", () => {
672 expect(draft?.previewAnnotations).toEqual([annotation]);
673 }
674 });
931 -
932 - it("retains annotation-only drafts and filters malformed annotations", () => {
933 - const merge = useComposerDraftStore.persist.getOptions().merge!;
934 - const state = merge(
935 - {
936 - draftsByThreadKey: {
937 - [scopedThreadKey(threadRef)]: {
938 - prompt: "",
939 - attachments: [],
940 - previewAnnotations: [annotation, { id: "invalid" }, null],
941 - },
942 - },
943 - },
944 - useComposerDraftStore.getInitialState(),
945 - );
946 - const draft = state.draftsByThreadKey[scopedThreadKey(threadRef)];
947 - expect(draft?.previewAnnotations).toEqual([annotation]);
948 - expect(draft?.prompt).toContain(
949 - "t3-context://v1/preview-annotation/preview-annotation_retry-note",
950 - );
951 - });
952 -});
953 -
954 -describe("composerDraftStore review comments", () => {
955 - const threadId = ThreadId.make("thread-review-comment");
956 - const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
957 - const comment = {
958 - id: "comment-1",
959 - sectionId: "file:src/app.ts",
960 - sectionTitle: "File comment",
961 - filePath: "src/app.ts",
962 - startIndex: 1,
963 - endIndex: 2,
964 - rangeLabel: "L2 to L3",
965 - text: "Keep this configurable.",
966 - diff: "@@ -2,2 +2,2 @@\n two\n three",
967 - } as const;
968 -
969 - beforeEach(() => {
970 - resetComposerDraftStore();
971 - });
972 -
973 - it("persists review comments and clears them with composer content", () => {
974 - const store = useComposerDraftStore.getState();
975 - store.addReviewComment(threadRef, comment);
976 - const persisted = partializeComposerDraftStoreState(
977 - useComposerDraftStore.getState(),
978 - ) as unknown as {
979 - draftsByThreadKey?: Record<string, { reviewComments?: Array<Record<string, unknown>> }>;
980 - };
981 -
982 - expect(
983 - persisted.draftsByThreadKey?.[threadKeyFor(threadId, TEST_ENVIRONMENT_ID)]
984 - ?.reviewComments?.[0],
985 - ).toMatchObject(comment);
986 -
987 - store.clearComposerContent(threadRef);
988 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)).toBeUndefined();
989 - });
675 });
676
677 describe("composerDraftStore thread contexts", () => {
@@ -1152,6 +837,7 @@ describe("composerDraftStore project draft thread mapping", () => {
837 expect(draftByKey(draftId)).toBeUndefined();
838 });
839
840 + // regression: #1264 deleting a project must release its draft thread's image blob URLs
841 it("revokes draft image blob URLs when clearing a project's draft thread", () => {
842 const store = useComposerDraftStore.getState();
843 const originalRevokeObjectUrl = URL.revokeObjectURL;
@@ -1250,20 +936,6 @@ describe("composerDraftStore project draft thread mapping", () => {
936 expect(draftByKey(sharedDraftId)?.prompt).toBe("keep me");
937 });
938
1253 - it("marks a promoted draft by scoped ref without deleting composer state", () => {
1254 - const store = useComposerDraftStore.getState();
1255 - store.setProjectDraftThreadId(projectRef, draftId, { threadId });
1256 - store.setPrompt(draftId, "promote me");
1257 -
1258 - markPromotedDraftThreadByRef(scopeThreadRef(TEST_ENVIRONMENT_ID, threadId));
1259 -
1260 - expect(useComposerDraftStore.getState().getDraftThreadByProjectRef(projectRef)).toBeNull();
1261 - expect(useComposerDraftStore.getState().getDraftThread(draftId)?.promotedTo).toEqual(
1262 - scopeThreadRef(TEST_ENVIRONMENT_ID, threadId),
1263 - );
1264 - expect(draftByKey(draftId)?.prompt).toBe("promote me");
1265 - });
1266 -
939 it("does not clear composer drafts for existing server threads during promotion cleanup", () => {
940 const store = useComposerDraftStore.getState();
941 const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
@@ -1275,25 +947,6 @@ describe("composerDraftStore project draft thread mapping", () => {
947 expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe("keep me");
948 });
949
1278 - it("promotes a draft without changing another thread's draft", () => {
1279 - const store = useComposerDraftStore.getState();
1280 - store.setProjectDraftThreadId(projectRef, draftId, { threadId });
1281 - store.setPrompt(draftId, "promote me");
1282 - store.setProjectDraftThreadId(otherProjectRef, otherDraftId, { threadId: otherThreadId });
1283 - store.setPrompt(otherDraftId, "keep me");
1284 -
1285 - markPromotedDraftThreadByRef(scopeThreadRef(TEST_ENVIRONMENT_ID, threadId));
1286 -
1287 - expect(useComposerDraftStore.getState().getDraftThread(draftId)?.promotedTo).toEqual(
1288 - scopeThreadRef(TEST_ENVIRONMENT_ID, threadId),
1289 - );
1290 - expect(draftByKey(draftId)?.prompt).toBe("promote me");
1291 - expect(
1292 - useComposerDraftStore.getState().getDraftThreadByProjectRef(otherProjectRef)?.threadId,
1293 - ).toBe(otherThreadId);
1294 - expect(draftByKey(otherDraftId)?.prompt).toBe("keep me");
1295 - });
1296 -
950 it("promotes matching thread ids separately for each environment", () => {
951 const store = useComposerDraftStore.getState();
952 const localThreadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
@@ -1479,14 +1132,6 @@ describe("composerDraftStore project draft thread mapping", () => {
1132 });
1133 });
1134
1482 - it("does not opt a legacy branch choice into balancing when runtime mode changes", () => {
1483 - const store = useComposerDraftStore.getState();
1484 - store.setProjectDraftThreadId(projectRef, draftId, { threadId, branch: "feature/pinned" });
1485 - store.setDraftThreadContext(draftId, { runtimeMode: "full-access" });
1486 - expect(store.getDraftThread(draftId)?.environmentSelection).toBeUndefined();
1487 - expect(store.getDraftThread(draftId)?.branch).toBe("feature/pinned");
1488 - });
1489 -
1135 it("pins manual workspace choices and can return to automatic routing without losing the prompt", () => {
1136 const store = useComposerDraftStore.getState();
1137 store.setProjectDraftThreadId(projectRef, draftId, { threadId });
@@ -1809,6 +1454,7 @@ describe("composerDraftStore modelSelection", () => {
1454 );
1455 });
1456
1457 + // regression: #6011 new threads ignored project default models unless edits are marked explicit
1458 it("marks trait edits as explicit model intent", () => {
1459 const store = useComposerDraftStore.getState();
1460 store.setModelSelection(threadRef, modelSelection(CODEX_DRIVER, "gpt-5.4"));
@@ -1826,80 +1472,6 @@ describe("composerDraftStore modelSelection", () => {
1472 ).toEqual(modelSelection(CODEX_DRIVER, "gpt-5.4", { reasoningEffort: "xhigh" }));
1473 });
1474
1829 - it("keeps explicit off/default codex overrides on the selection", () => {
1830 - const store = useComposerDraftStore.getState();
1831 -
1832 - store.setModelSelection(threadRef, modelSelection(CODEX_DRIVER, "gpt-5.4", { fastMode: true }));
1833 -
1834 - store.setProviderModelOptions(
1835 - threadRef,
1836 - CODEX_DRIVER,
1837 - toSelections({ reasoningEffort: "high", fastMode: false }),
1838 - );
1839 -
1840 - expect(
1841 - draftFor(threadId, TEST_ENVIRONMENT_ID)?.modelSelectionByProvider[CODEX_INSTANCE],
1842 - ).toEqual(
1843 - modelSelection(CODEX_DRIVER, "gpt-5.4", {
1844 - reasoningEffort: "high",
1845 - fastMode: false,
1846 - }),
1847 - );
1848 - });
1849 -
1850 - it("preserves the selected Cursor model when only traits change", () => {
1851 - const store = useComposerDraftStore.getState();
1852 -
1853 - store.setProviderModelOptions(threadRef, CURSOR_DRIVER, toSelections({ reasoning: "high" }), {
1854 - model: "gpt-5.4",
1855 - persistSticky: true,
1856 - });
1857 -
1858 - expect(
1859 - draftFor(threadId, TEST_ENVIRONMENT_ID)?.modelSelectionByProvider[CURSOR_INSTANCE],
1860 - ).toEqual(
1861 - modelSelection(CURSOR_DRIVER, "gpt-5.4", {
1862 - reasoning: "high",
1863 - }),
1864 - );
1865 - expect(
1866 - useComposerDraftStore.getState().stickyModelSelectionByProvider[CURSOR_INSTANCE],
1867 - ).toEqual(
1868 - modelSelection(CURSOR_DRIVER, "gpt-5.4", {
1869 - reasoning: "high",
1870 - }),
1871 - );
1872 - });
1873 -
1874 - it("updates only the draft when sticky persistence is omitted", () => {
1875 - const store = useComposerDraftStore.getState();
1876 -
1877 - store.setStickyModelSelection(
1878 - modelSelection(CLAUDE_AGENT_DRIVER, "claude-opus-4-6", { effort: "max" }),
1879 - );
1880 - store.setModelSelection(
1881 - threadRef,
1882 - modelSelection(CLAUDE_AGENT_DRIVER, "claude-opus-4-6", { effort: "max" }),
1883 - );
1884 -
1885 - store.setProviderModelOptions(
1886 - threadRef,
1887 - CLAUDE_AGENT_DRIVER,
1888 - toSelections({ thinking: false }),
1889 - );
1890 -
1891 - expect(
1892 - draftFor(threadId, TEST_ENVIRONMENT_ID)?.modelSelectionByProvider[CLAUDE_AGENT_INSTANCE],
1893 - ).toEqual(
1894 - modelSelection(CLAUDE_AGENT_DRIVER, "claude-opus-4-6", {
1895 - thinking: false,
1896 - }),
1897 - );
1898 - expect(
1899 - useComposerDraftStore.getState().stickyModelSelectionByProvider[CLAUDE_AGENT_INSTANCE],
1900 - ).toEqual(modelSelection(CLAUDE_AGENT_DRIVER, "claude-opus-4-6", { effort: "max" }));
1901 - });
1902 -
1475 it("does not clear other provider options when setting options for a single provider", () => {
1476 const store = useComposerDraftStore.getState();
1477
@@ -1927,29 +1499,6 @@ describe("composerDraftStore modelSelection", () => {
1499 );
1500 });
1501
1930 - it("preserves other provider options when switching the active model selection", () => {
1931 - const store = useComposerDraftStore.getState();
1932 -
1933 - store.setModelOptions(
1934 - threadRef,
1935 - providerModelOptions({
1936 - codex: { fastMode: true },
1937 - claudeAgent: { effort: "max" },
1938 - }),
1939 - );
1940 -
1941 - store.setModelSelection(threadRef, modelSelection(CLAUDE_AGENT_DRIVER, "claude-opus-4-6"));
1942 -
1943 - const draft = draftFor(threadId, TEST_ENVIRONMENT_ID);
1944 - expect(draft?.modelSelectionByProvider[CLAUDE_AGENT_INSTANCE]).toEqual(
1945 - modelSelection(CLAUDE_AGENT_DRIVER, "claude-opus-4-6", { effort: "max" }),
1946 - );
1947 - expect(draft?.modelSelectionByProvider[CODEX_INSTANCE]?.options).toEqual(
1948 - createModelSelection(CODEX_INSTANCE, "gpt-5.4", toSelections({ fastMode: true })).options,
1949 - );
1950 - expect(draft?.activeProvider).toBe("claudeAgent");
1951 - });
1952 -
1502 it("stores provider option changes on a selected custom instance", () => {
1503 const store = useComposerDraftStore.getState();
1504
@@ -2020,33 +1569,6 @@ describe("composerDraftStore per-model sticky options", () => {
1569 );
1570 });
1571
2023 - it("keeps other models' remembered options when one model is cleared", () => {
2024 - const store = useComposerDraftStore.getState();
2025 -
2026 - store.setProviderModelOptions(
2027 - threadRef,
2028 - CODEX_DRIVER,
2029 - toSelections({ reasoningEffort: "xhigh" }),
2030 - { instanceId: CODEX_INSTANCE, model: "gpt-5.3-codex", persistSticky: true },
2031 - );
2032 - store.setProviderModelOptions(
2033 - threadRef,
2034 - CODEX_DRIVER,
2035 - toSelections({ reasoningEffort: "high" }),
2036 - { instanceId: CODEX_INSTANCE, model: "gpt-5.4", persistSticky: true },
2037 - );
2038 - store.setProviderModelOptions(threadRef, CODEX_DRIVER, null, {
2039 - instanceId: CODEX_INSTANCE,
2040 - persistSticky: true,
2041 - });
2042 -
2043 - expect(useComposerDraftStore.getState().stickyOptionsByModelByProvider[CODEX_INSTANCE]).toEqual(
2044 - {
2045 - "gpt-5.4": toSelections({ reasoningEffort: "high" }),
2046 - },
2047 - );
2048 - });
2049 -
1572 it("seeds per-model memory from a persisted sticky selection on upgrade", () => {
1573 const persistApi = useComposerDraftStore.persist as unknown as {
1574 getOptions: () => {
@@ -2083,24 +1605,6 @@ describe("composerDraftStore sticky composer settings", () => {
1605 resetComposerDraftStore();
1606 });
1607
2086 - it("drops empty cursor model options when normalizing sticky state", () => {
2087 - const store = useComposerDraftStore.getState();
2088 -
2089 - store.setStickyModelSelection(
2090 - modelSelection(CURSOR_DRIVER, "gpt-5.4", {
2091 - reasoning: undefined,
2092 - fastMode: undefined,
2093 - thinking: undefined,
2094 - contextWindow: undefined,
2095 - }),
2096 - );
2097 -
2098 - expect(
2099 - useComposerDraftStore.getState().stickyModelSelectionByProvider[CURSOR_INSTANCE],
2100 - ).toEqual(modelSelection(CURSOR_DRIVER, "gpt-5.4"));
2101 - expect(useComposerDraftStore.getState().stickyActiveProvider).toBe("cursor");
2102 - });
2103 -
1608 it("preserves sticky provider options when model selection omits options", () => {
1609 const store = useComposerDraftStore.getState();
1610
@@ -2159,6 +1663,7 @@ describe("composerDraftStore sticky composer settings", () => {
1663 });
1664 });
1665
1666 + // regression: #6011 a stale seeded model overrode the project default
1667 it("clears a non-explicit stale model when there is no sticky state", () => {
1668 const store = useComposerDraftStore.getState();
1669 const draftId = DraftId.make("draft-stale-without-sticky");
@@ -2421,58 +1926,6 @@ describe("composerDraftStore model seed migration", () => {
1926 });
1927 });
1928
2424 -describe("composerDraftStore provider-scoped option updates", () => {
2425 - const threadId = ThreadId.make("thread-provider");
2426 - const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
2427 -
2428 - beforeEach(() => {
2429 - resetComposerDraftStore();
2430 - });
2431 -
2432 - it("retains off-provider option memory without changing the active selection", () => {
2433 - const store = useComposerDraftStore.getState();
2434 - store.setModelSelection(
2435 - threadRef,
2436 - modelSelection(CODEX_DRIVER, "gpt-5.3-codex", {
2437 - reasoningEffort: "medium",
2438 - }),
2439 - );
2440 - store.setProviderModelOptions(threadRef, CLAUDE_AGENT_DRIVER, toSelections({ effort: "max" }));
2441 - const draft = draftFor(threadId, TEST_ENVIRONMENT_ID);
2442 - expect(draft?.modelSelectionByProvider[CODEX_INSTANCE]).toEqual(
2443 - modelSelection(CODEX_DRIVER, "gpt-5.3-codex", { reasoningEffort: "medium" }),
2444 - );
2445 - expect(draft?.modelSelectionByProvider[CLAUDE_AGENT_INSTANCE]?.options).toEqual(
2446 - createModelSelection(
2447 - CLAUDE_AGENT_INSTANCE,
2448 - "claude-opus-4-6",
2449 - toSelections({ effort: "max" }),
2450 - ).options,
2451 - );
2452 - expect(draft?.activeProvider).toBe("codex");
2453 - });
2454 -});
2455 -
2456 -describe("composerDraftStore runtime and interaction settings", () => {
2457 - const threadId = ThreadId.make("thread-settings");
2458 - const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
2459 -
2460 - beforeEach(() => {
2461 - resetComposerDraftStore();
2462 - });
2463 -
2464 - it("removes empty settings-only drafts when overrides are cleared", () => {
2465 - const store = useComposerDraftStore.getState();
2466 -
2467 - store.setRuntimeMode(threadRef, "approval-required");
2468 - store.setInteractionMode(threadRef, "plan");
2469 - store.setRuntimeMode(threadRef, null);
2470 - store.setInteractionMode(threadRef, null);
2471 -
2472 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)).toBeUndefined();
2473 - });
2474 -});
2475 -
1929 function createMockStorage() {
1930 const store = new Map<string, string>();
1931 return {
@@ -2525,19 +1978,6 @@ describe("createDeferredStorage", () => {
1978 expect(serialize).toHaveBeenCalledTimes(1);
1979 expect(base.setItem).toHaveBeenCalledTimes(1);
1980 });
2528 -
2529 - it("setItem works normally after removeItem cancels a pending write", () => {
2530 - const base = createMockStorage();
2531 - const storage = createDeferredStorage(base, serialize);
2532 -
2533 - storage.setItem("key", "v1");
2534 - storage.removeItem("key");
2535 - storage.setItem("key", "v2");
2536 -
2537 - vi.advanceTimersByTime(300);
2538 - expect(base.setItem).toHaveBeenCalledTimes(1);
2539 - expect(base.setItem).toHaveBeenCalledWith("key", "s:v2");
2540 - });
1981 });
1982
1983 describe("composerDraftStore inline context references", () => {
@@ -2584,27 +2024,6 @@ describe("composerDraftStore inline context references", () => {
2024 expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe("look");
2025 });
2026
2587 - it("can add another reference while upserting one backing review record", () => {
2588 - const store = useComposerDraftStore.getState();
2589 - store.addReviewComment(threadRef, reviewComment);
2590 - const insertionHandler = vi.fn(() => true);
2591 - store.setContextInsertionHandler(threadRef, insertionHandler);
2592 - store.addReviewComment(
2593 - threadRef,
2594 - { ...reviewComment, text: "edited" },
2595 - {
2596 - allowDuplicateReference: true,
2597 - insertAtCaret: false,
2598 - },
2599 - );
2600 -
2601 - expect(insertionHandler).not.toHaveBeenCalled();
2602 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe(`${reviewLink} ${reviewLink} `);
2603 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.reviewComments).toEqual([
2604 - { ...reviewComment, text: "edited" },
2605 - ]);
2606 - });
2607 -
2027 it("keeps bulk-set review records and their inline references in sync", () => {
2028 const store = useComposerDraftStore.getState();
2029 store.setPrompt(threadRef, "Explain this pull request.");
@@ -2660,27 +2079,6 @@ describe("composerDraftStore inline context references", () => {
2079 store.setContextInsertionHandler(threadRef, null);
2080 });
2081
2663 - it("keeps bulk-set preview annotations and their inline references in sync", () => {
2664 - const store = useComposerDraftStore.getState();
2665 - store.setPrompt(threadRef, "Explain this preview.");
2666 - store.setPreviewAnnotations(threadRef, [annotation]);
2667 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe(
2668 - `Explain this preview. ${annotationLink} `,
2669 - );
2670 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.previewAnnotations).toEqual([annotation]);
2671 -
2672 - const edited = { ...annotation, comment: "Updated comment" };
2673 - store.setPreviewAnnotations(threadRef, [edited]);
2674 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe(
2675 - `Explain this preview. ${annotationLink} `,
2676 - );
2677 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.previewAnnotations).toEqual([edited]);
2678 -
2679 - store.setPreviewAnnotations(threadRef, []);
2680 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.prompt).toBe("Explain this preview.");
2681 - expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.previewAnnotations).toEqual([]);
2682 - });
2683 -
2082 it("keeps links for retained context when clearing text and attachments", () => {
2083 const store = useComposerDraftStore.getState();
2084 store.addReviewComment(threadRef, reviewComment);
@@ -2692,34 +2090,6 @@ describe("composerDraftStore inline context references", () => {
2090 expect(draft?.reviewComments).toEqual([reviewComment]);
2091 expect(draft?.previewAnnotations).toEqual([annotation]);
2092 });
2695 -
2696 - it("adds links for persisted review comments that predate references", () => {
2697 - const persistApi = useComposerDraftStore.persist as unknown as {
2698 - getOptions: () => {
2699 - merge: (
2700 - persistedState: unknown,
2701 - currentState: ReturnType<typeof useComposerDraftStore.getState>,
2702 - ) => ReturnType<typeof useComposerDraftStore.getState>;
2703 - };
2704 - };
2705 - const mergedState = persistApi.getOptions().merge(
2706 - {
2707 - draftsByThreadId: {
2708 - [threadId]: {
2709 - prompt: "old draft",
2710 - attachments: [],
2711 - reviewComments: [reviewComment],
2712 - },
2713 - },
2714 - draftThreadsByThreadId: {},
2715 - projectDraftThreadIdByProjectKey: {},
2716 - },
2717 - useComposerDraftStore.getInitialState(),
2718 - );
2719 - expect(mergedState.draftsByThreadKey[threadKeyFor(threadId)]?.prompt).toBe(
2720 - `old draft ${reviewLink} `,
2721 - );
2722 - });
2093 });
2094
2095 describe("composerDraftStore attachment references", () => {
@@ -2808,32 +2178,6 @@ describe("composerDraftStore attachment references", () => {
2178 expect(draft?.prompt).toBe("see [notes.txt](t3-context://v1/file/file_fresh-1) ok");
2179 });
2180
2811 - it("restores a file-only draft with a reference and preserves it through prompt edits", () => {
2812 - const store = useComposerDraftStore.getState();
2813 - store.addFiles(
2814 - threadRef,
2815 - [
2816 - {
2817 - type: "file",
2818 - id: "restored",
2819 - name: "notes.txt",
2820 - mimeType: "text/plain",
2821 - sizeBytes: 3,
2822 - file: null,
2823 - uploadedAttachmentId: "uploaded",
2824 - uploadEnvironmentId: TEST_ENVIRONMENT_ID,
2825 - },
2826 - ],
2827 - { appendReference: true },
2828 - );
2829 - const restored = draftFor(threadId, TEST_ENVIRONMENT_ID)!;
2830 - expect(restored.prompt).toBe("[notes.txt](t3-context://v1/file/file_restored) ");
2831 - store.setPrompt(threadRef, `${restored.prompt}explain this`);
2832 - const edited = draftFor(threadId, TEST_ENVIRONMENT_ID)!;
2833 - expect(edited.files.map((file) => file.id)).toEqual(["restored"]);
2834 - expect(edited.prompt).toContain("t3-context://v1/file/file_restored");
2835 - });
2836 -
2181 it.each(["old.file:1", "file-1"])(
2182 "rewrites persisted attachment references before removal: %s",
2183 (id) => {
@@ -2858,42 +2202,6 @@ describe("composerDraftStore attachment references", () => {
2202 },
2203 );
2204
2861 - it.each(["", "Fix this"])("migrates saved element context with prompt %j", (prompt) => {
2862 - const element = {
2863 - id: "old-element",
2864 - threadId,
2865 - pickedAt: "2026-01-01T00:00:00Z",
2866 - pageUrl: "https://example.com",
2867 - pageTitle: "Example",
2868 - tagName: "button",
2869 - selector: "#save",
2870 - htmlPreview: "<button>Save</button>",
2871 - componentName: "SaveButton",
2872 - source: null,
2873 - styles: "color: red;",
2874 - };
2875 - const merged = useComposerDraftStore.persist.getOptions().merge!(
2876 - {
2877 - draftsByThreadKey: {
2878 - [threadKeyFor(threadId, TEST_ENVIRONMENT_ID)]: {
2879 - prompt,
2880 - attachments: [],
2881 - elementContexts: [element],
2882 - },
2883 - },
2884 - },
2885 - useComposerDraftStore.getInitialState(),
2886 - );
2887 - const draft = merged.draftsByThreadKey[threadKeyFor(threadId, TEST_ENVIRONMENT_ID)]!;
2888 - expect(draft.previewAnnotations[0]?.elements[0]?.element).toMatchObject({
2889 - htmlPreview: element.htmlPreview,
2890 - styles: element.styles,
2891 - selector: element.selector,
2892 - });
2893 - expect(draft.prompt).toContain("t3-context://v1/preview-annotation/");
2894 - expect(draft.prompt).toContain(prompt);
2895 - });
2896 -
2205 it("appends chips for persisted files that predate references", () => {
2206 const persistApi = useComposerDraftStore.persist as unknown as {
2207 getOptions: () => {
apps/web/src/connection/desktopLocal.test.ts
-15
@@ -56,21 +56,6 @@ describe("desktop local topology reads", () => {
56 expect(reader.readSnapshot()).toBe(after);
57 });
58
59 - it("distinguishes a successful empty topology from a read failure", () => {
60 - let readBootstraps = () => [];
61 - const reader = createDesktopSecondaryBootstrapsReader(() => ({
62 - getLocalEnvironmentBootstraps: () => readBootstraps(),
63 - }));
64 -
65 - expect(reader.readResult()).toEqual({ _tag: "Success", bootstraps: [] });
66 -
67 - const cause = new Error("IPC unavailable");
68 - readBootstraps = () => {
69 - throw cause;
70 - };
71 - expect(reader.readResult()).toEqual({ _tag: "Failure", cause });
72 - });
73 -
59 it("filters the primary bootstrap from successful topology reads", () => {
60 const secondary = {
61 id: "wsl:Ubuntu",
apps/web/src/connection/platform.test.ts
+1 -33
@@ -26,7 +26,6 @@ import {
26 primaryRegistrationToRetainAfterTopologyRead,
27 prepareDesktopSshEnvironment,
28 provisionDesktopSshEnvironment,
29 - readPrimaryEnvironmentTargetResult,
29 secondaryRegistrationsToRetainAfterTopologyRead,
30 } from "./platform.ts";
31
@@ -137,19 +136,6 @@ describe("desktop SSH pairing", () => {
136 }),
137 );
138
140 - it.effect("does not consume the credential when descriptor discovery fails", () =>
141 - Effect.gen(function* () {
142 - const calls: string[] = [];
143 -
144 - yield* provisionDesktopSshEnvironment(
145 - makeBridge(calls, { failDescriptor: true }),
146 - TARGET,
147 - ).pipe(Effect.flip);
148 -
149 - expect(calls).toEqual(["ensure", "descriptor"]);
150 - }),
151 - );
152 -
139 it.effect("exchanges one setup credential after repeated interrupted provisions", () =>
140 Effect.gen(function* () {
141 const bridge = makeBridge([]);
@@ -377,6 +363,7 @@ describe("rejected desktop-local bootstrap tokens", () => {
363 );
364 });
365
366 + // regression: #16273 a rejected desktop-local credential was retried every poll
367 it("treats only authentication rejections as a dead credential", () => {
368 expect(
369 isRejectedBootstrapCredentialError(
@@ -416,16 +403,6 @@ describe("primary topology cache", () => {
403 };
404 const previous = new Map([[PRIMARY_LOCAL_ENVIRONMENT_ID, cached]]);
405
419 - it("captures synchronous primary target read failures", () => {
420 - const cause = new Error("invalid primary target");
421 -
422 - expect(
423 - readPrimaryEnvironmentTargetResult(() => {
424 - throw cause;
425 - }),
426 - ).toEqual({ _tag: "Failure", cause });
427 - });
428 -
406 it("retains the cached primary after a transient topology read failure", () => {
407 expect(
408 primaryRegistrationToRetainAfterTopologyRead(previous, {
@@ -434,13 +411,4 @@ describe("primary topology cache", () => {
411 }),
412 ).toBe(cached);
413 });
437 -
438 - it("treats a successful primary absence as authoritative removal", () => {
439 - expect(
440 - primaryRegistrationToRetainAfterTopologyRead(previous, {
441 - _tag: "Success",
442 - target: null,
443 - }),
444 - ).toBeUndefined();
445 - });
414 });
apps/web/src/connection/platform.ts
+1 -1
@@ -527,7 +527,7 @@ export type PrimaryEnvironmentTargetRead =
527 readonly cause: unknown;
528 };
529
530 -export function readPrimaryEnvironmentTargetResult(
530 +function readPrimaryEnvironmentTargetResult(
531 readTarget: () => PrimaryEnvironmentTarget | null = readPrimaryEnvironmentTarget,
532 ): PrimaryEnvironmentTargetRead {
533 try {
apps/web/src/desktopAppActivation.test.ts
-21
@@ -67,25 +67,4 @@ describe("desktop app activation", () => {
67
68 expect(response).toMatchObject({ ok: false, code: "platform-mismatch" });
69 });
70 -
71 - it("returns a project error without opening a thread", async () => {
72 - const openThread = vi.fn(async () => ({ threadId }));
73 - const response = await handleDesktopAppActivationRequest(
74 - request,
75 - dependencies({
76 - findProject: () => null,
77 - createProject: vi.fn(async () => {
78 - throw new Error("Project path is not available.");
79 - }),
80 - openThread,
81 - }),
82 - );
83 -
84 - expect(response).toMatchObject({
85 - ok: false,
86 - code: "project-create-failed",
87 - message: "Project path is not available.",
88 - });
89 - expect(openThread).not.toHaveBeenCalled();
90 - });
70 });
apps/web/src/diffFileActions.test.ts
+1
@@ -55,6 +55,7 @@ describe("openDiffFilePrimaryAction", () => {
55 ).toBe("src/index.ts");
56 });
57
58 + // regression: #6174 opening diff files broke for repositories at a filesystem root
59 it.each([
60 { workspaceRoot: "/frontend", repositoryRoot: "/" },
61 { workspaceRoot: "C:\\frontend", repositoryRoot: "C:\\" },
apps/web/src/environmentGrouping.test.ts
-37
@@ -208,43 +208,6 @@ describe("environment grouping", () => {
208 expect(pickerEntry?.targetProject.id).toBe(canonical.id);
209 });
210
211 - it("builds one picker entry per logical project and targets the preferred environment", () => {
212 - const primary = makeProject({ repositoryIdentity });
213 - const remote = makeProject({
214 - id: ProjectId.make("project-remote"),
215 - environmentId: remoteEnvironmentId,
216 - repositoryIdentity,
217 - });
218 - const separate = makeProject({
219 - id: ProjectId.make("project-separate"),
220 - title: "separate",
221 - workspaceRoot: "/tmp/separate",
222 - });
223 - const groups = buildSidebarProjectSnapshots({
224 - projects: [separate, primary, remote],
225 - settings: defaultGroupingSettings,
226 - primaryEnvironmentId,
227 - resolveEnvironmentLabel: () => null,
228 - });
229 -
230 - const entries = buildSidebarProjectPickerEntries({
231 - groups,
232 - preferredProjectRef: {
233 - environmentId: remoteEnvironmentId,
234 - projectId: remote.id,
235 - },
236 - });
237 -
238 - expect(entries).toHaveLength(2);
239 - expect(entries[0]?.group.projectKey).toBe(repositoryIdentity.canonicalKey);
240 - expect(entries[0]?.targetProject).toMatchObject({
241 - environmentId: remoteEnvironmentId,
242 - id: remote.id,
243 - });
244 - expect(entries[0]?.isPreferred).toBe(true);
245 - expect(entries[1]?.group.displayName).toBe("separate");
246 - });
247 -
211 it("keeps the current environment when available and falls back otherwise", () => {
212 const currentPrimary = makeProject({ repositoryIdentity });
213 const currentRemote = makeProject({
apps/web/src/hooks/useCopyToClipboard.test.ts
+1 -21
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2
3 import { COMPOSER_CONTEXT_CLIPBOARD_MIME } from "@t3tools/shared/composerContextClipboard";
4
5 -import { ClipboardWriteError, writeTextToClipboard } from "./useCopyToClipboard";
5 +import { writeTextToClipboard } from "./useCopyToClipboard";
6
7 describe("writeTextToClipboard", () => {
8 it("reserves plain text even when an extra flavor attempts to replace it", async () => {
@@ -53,24 +53,4 @@ describe("writeTextToClipboard", () => {
53 expect(html).toContain(rich);
54 expect(html).toContain("data-t3-context-fragment=");
55 });
56 -
57 - it("preserves the exact clipboard failure without exposing copied contents", async () => {
58 - const cause = new Error("browser clipboard failure");
59 - const writeText = vi.fn().mockRejectedValue(cause);
60 - vi.stubGlobal("window", {});
61 - vi.stubGlobal("navigator", { clipboard: { writeText } });
62 -
63 - const error = await writeTextToClipboard("secret clipboard contents", "error-message").then(
64 - () => undefined,
65 - (failure: unknown) => failure,
66 - );
67 -
68 - expect(writeText).toHaveBeenCalledWith("secret clipboard contents");
69 - expect(error).toBeInstanceOf(ClipboardWriteError);
70 - expect(error).toMatchObject({
71 - target: "error-message",
72 - cause,
73 - });
74 - expect((error as Error).message).not.toContain("secret clipboard contents");
75 - });
56 });
apps/web/src/hooks/useSettings.favorites.browser.test.tsx
-23
@@ -191,29 +191,6 @@ describe("environment favorite toggles", () => {
191 },
192 );
193
194 - it("keeps the newest pending intent when an earlier write completes", async () => {
195 - await using fixture = await setup();
196 - const { durable, writes, mount, click } = fixture;
197 - await mount();
198 - const first = click();
199 - const second = click();
200 - await act(async () => {});
201 - writes[0]!.finish();
202 - await first;
203 - const third = click();
204 - await act(async () => {});
205 - expect(writes.map((write) => write.patch.setModelFavorites?.[0]?.favorite)).toEqual([
206 - true,
207 - false,
208 - true,
209 - ]);
210 - writes[1]!.finish();
211 - await second;
212 - writes[2]!.finish();
213 - await third;
214 - expect(durable.get(primaryId)!.favorites).toEqual([{ provider, model }]);
215 - });
216 -
194 it("preserves an acknowledged add when a later remove fails before its echo", async () => {
195 await using fixture = await setup();
196 const { durable, writes, mount, click } = fixture;
apps/web/src/hooks/useSettings.test.ts
+1 -62
@@ -69,6 +69,7 @@ describe("client settings hydration", () => {
69 });
70 });
71
72 + // regression: #16816 a failed read could overwrite synced model favorites with defaults
73 it("does not prepare a model preference write after a failed legacy read", async () => {
74 const failure = new Error("storage unavailable");
75 vi.spyOn(console, "error").mockImplementation(() => undefined);
@@ -97,14 +98,6 @@ describe("client settings hydration", () => {
98 expect(persistenceMocks.getClientSettings).toHaveBeenCalledTimes(2);
99 });
100
100 - it("uses defaults only after storage confirms no saved settings exist", async () => {
101 - const completedSettings = { ...DEFAULT_CLIENT_SETTINGS, onboardingCompletedAt };
102 -
103 - await expect(persistClientSettingsUpdate(complete)).resolves.toEqual(completedSettings);
104 - expect(persistenceMocks.getClientSettings).toHaveBeenCalledOnce();
105 - expect(persistenceMocks.setClientSettings).toHaveBeenCalledExactlyOnceWith(completedSettings);
106 - });
107 -
101 it("holds patches until a pending read supplies the saved preferences", async () => {
102 let finishRead!: (settings: ClientSettings) => void;
103 persistenceMocks.getClientSettings.mockImplementationOnce(
@@ -130,27 +123,6 @@ describe("client settings hydration", () => {
123 expect(persistenceMocks.getClientSettings).toHaveBeenCalledOnce();
124 });
125
133 - it("handles failed patch reads without writing and retries with the saved preferences", async () => {
134 - const failure = new Error("storage unavailable");
135 - vi.spyOn(console, "error").mockImplementation(() => undefined);
136 - persistenceMocks.getClientSettings.mockRejectedValue(failure);
137 -
138 - const hydration = ensureClientSettingsHydrated();
139 - persistClientSettingsPatch({ wordWrap: false });
140 - await expect(hydration).rejects.toBe(failure);
141 - expect(persistenceMocks.setClientSettings).not.toHaveBeenCalled();
142 -
143 - persistenceMocks.getClientSettings.mockResolvedValue(savedSettings);
144 - const persisted = new Promise<ClientSettings>((resolve) => {
145 - persistenceMocks.setClientSettings.mockImplementationOnce(async (settings) => {
146 - resolve(settings);
147 - });
148 - });
149 - persistClientSettingsPatch({ wordWrap: false });
150 -
151 - await expect(persisted).resolves.toEqual({ ...savedSettings, wordWrap: false });
152 - });
153 -
126 it("preserves patch order across hydration and a blocked completion write", async () => {
127 let finishRead!: (settings: ClientSettings) => void;
128 const read = new Promise<ClientSettings>((resolve) => {
@@ -248,20 +220,6 @@ describe("persistClientSettingsUpdate", () => {
220 expect(getClientSettings().timestampFormat).toBe("12-hour");
221 });
222
251 - it("keeps the current snapshot and propagates persistence failure", async () => {
252 - const failure = new Error("disk full");
253 - const setClientSettings = vi.fn().mockRejectedValue(failure);
254 - __setClientSettingsForTests(DEFAULT_CLIENT_SETTINGS);
255 -
256 - await expect(
257 - persistClientSettingsUpdate(
258 - (current) => ({ ...current, timestampFormat: "12-hour" }),
259 - setClientSettings,
260 - ),
261 - ).rejects.toBe(failure);
262 - expect(getClientSettings()).toBe(DEFAULT_CLIENT_SETTINGS);
263 - });
264 -
223 it("preserves an optimistic write made while an awaited update persists", async () => {
224 let finishFirstPersistence!: () => void;
225 let durableSettings = DEFAULT_CLIENT_SETTINGS;
@@ -303,25 +261,6 @@ describe("persistClientSettingsUpdate", () => {
261 expect(getClientSettings().wordWrap).toBe(false);
262 expect(getClientSettings().browserProfiles).toContainEqual(importedProfile);
263 });
306 -
307 - it("continues the queue after a rejected write", async () => {
308 - const failure = new Error("disk full");
309 - const persist = vi
310 - .fn<(settings: typeof DEFAULT_CLIENT_SETTINGS) => Promise<void>>()
311 - .mockRejectedValueOnce(failure)
312 - .mockResolvedValue(undefined);
313 - __setClientSettingsForTests(DEFAULT_CLIENT_SETTINGS);
314 -
315 - await expect(
316 - persistClientSettingsUpdate(
317 - (current) => ({ ...current, timestampFormat: "12-hour" }),
318 - persist,
319 - ),
320 - ).rejects.toBe(failure);
321 - await expect(
322 - persistClientSettingsUpdate((current) => ({ ...current, wordWrap: false }), persist),
323 - ).resolves.toMatchObject({ wordWrap: false });
324 - });
264 });
265
266 describe("mergeEnvironmentSettings", () => {
apps/web/src/hooks/useThreadActions.test.ts
+1 -30
@@ -1,6 +1,6 @@
1 import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2
3 -import { navigateAfterThreadDeletion, requestThreadUnpinConfirmation } from "./useThreadActions";
3 +import { navigateAfterThreadDeletion } from "./useThreadActions";
4 import { toastManager } from "../components/ui/toast";
5
6 describe("navigateAfterThreadDeletion", () => {
@@ -22,32 +22,3 @@ describe("navigateAfterThreadDeletion", () => {
22 );
23 });
24 });
25 -
26 -describe("requestThreadUnpinConfirmation", () => {
27 - it("uses the thread title and returns the user's decision", async () => {
28 - let message = "";
29 - const result = await requestThreadUnpinConfirmation({
30 - enabled: true,
31 - title: "Release prep",
32 - confirm: async (nextMessage) => {
33 - message = nextMessage;
34 - return false;
35 - },
36 - });
37 -
38 - expect(message).toBe(
39 - 'Unpin thread "Release prep"?\nThis will move the thread out of your pinned section.',
40 - );
41 - expect(result).toMatchObject({ _tag: "Success", value: false });
42 - });
43 -
44 - it("keeps dialog failures observable", async () => {
45 - const result = await requestThreadUnpinConfirmation({
46 - enabled: true,
47 - title: "Pinned thread",
48 - confirm: () => Promise.reject(new Error("dialog unavailable")),
49 - });
50 -
51 - expect(result._tag).toBe("Failure");
52 - });
53 -});
apps/web/src/hooks/useThreadActions.ts
+1 -1
@@ -165,7 +165,7 @@ export class ThreadActiveReorderUnsupportedError extends Schema.TaggedError<Thre
165 }
166 }
167
168 -export async function requestThreadUnpinConfirmation(input: {
168 +async function requestThreadUnpinConfirmation(input: {
169 enabled: boolean;
170 title: string;
171 confirm: ((message: string) => Promise<boolean>) | null;
apps/web/src/hooks/useThreadActions.undo.test.ts
+1 -6
@@ -202,12 +202,6 @@ describe("archive Undo", () => {
202 }),
203 );
204 });
205 -
206 - it("shows no Undo when the archive failed", async () => {
207 - commands.archive.mockResolvedValue({ _tag: "Failure", cause: new Error("nope") });
208 - await useThreadActions().archiveThread(target);
209 - expect(useThreadUndoNotice.getState().notice).toBeNull();
210 - });
205 });
206
207 describe("settle and snooze Undo", () => {
@@ -262,6 +256,7 @@ describe("settle and snooze Undo", () => {
256 expect(commands.pin).not.toHaveBeenCalled();
257 });
258
259 + // regression: #12972 the sidebar undo notice must reverse a snooze
260 it("wakes the thread from the snooze notice", async () => {
261 const add = vi.spyOn(toastManager, "add").mockReturnValue("toast");
262 const actions = useThreadActions();
apps/web/src/keybindings.test.ts
-203
@@ -15,12 +15,8 @@ import {
15 effectiveShortcutsForCommand,
16 formatShortcutLabel,
17 isRichTextBoldShortcut,
18 - isOpenFavoriteEditorShortcut,
19 - isTerminalCloseShortcut,
18 isTerminalNewShortcut,
19 isTerminalSplitShortcut,
22 - isTerminalSplitVerticalShortcut,
23 - isTerminalToggleShortcut,
20 resolveChatShortcutCommand,
21 resolveShortcutCommand,
22 shouldShowThreadJumpHintsForModifiers,
@@ -243,49 +239,7 @@ describe("thread undo shortcut", () => {
239 });
240 });
241
246 -describe("copy thread reference shortcut", () => {
247 - it("leaves terminal copy untouched", () => {
248 - assert.isNull(
249 - resolveShortcutCommand(event({ key: "c", ctrlKey: true, shiftKey: true }), DEFAULT_BINDINGS, {
250 - platform: "Linux",
251 - context: { terminalFocus: true },
252 - }),
253 - );
254 - });
255 -});
256 -
242 describe("split/new/close terminal shortcuts", () => {
258 - it("requires terminalFocus for default split/new/close bindings", () => {
259 - assert.isFalse(
260 - isTerminalSplitShortcut(event({ key: "d", metaKey: true }), DEFAULT_BINDINGS, {
261 - platform: "MacIntel",
262 - context: { terminalFocus: false },
263 - }),
264 - );
265 - assert.isFalse(
266 - isTerminalSplitVerticalShortcut(
267 - event({ key: "d", metaKey: true, shiftKey: true }),
268 - DEFAULT_BINDINGS,
269 - {
270 - platform: "MacIntel",
271 - context: { terminalFocus: false },
272 - },
273 - ),
274 - );
275 - assert.isFalse(
276 - isTerminalNewShortcut(event({ key: "n", ctrlKey: true }), DEFAULT_BINDINGS, {
277 - platform: "Linux",
278 - context: { terminalFocus: false },
279 - }),
280 - );
281 - assert.isFalse(
282 - isTerminalCloseShortcut(event({ key: "w", ctrlKey: true }), DEFAULT_BINDINGS, {
283 - platform: "Linux",
284 - context: { terminalFocus: false },
285 - }),
286 - );
287 - });
288 -
243 it("supports when expressions", () => {
244 const keybindings = compile([
245 {
@@ -446,26 +400,6 @@ describe("model picker navigation helpers", () => {
400 });
401
402 describe("chat/editor shortcuts", () => {
449 - it("matches editor.openFavorite shortcut", () => {
450 - assert.isTrue(
451 - isOpenFavoriteEditorShortcut(event({ key: "o", metaKey: true }), DEFAULT_BINDINGS, {
452 - platform: "MacIntel",
453 - }),
454 - );
455 - assert.isTrue(
456 - isOpenFavoriteEditorShortcut(event({ key: "o", ctrlKey: true }), DEFAULT_BINDINGS, {
457 - platform: "Linux",
458 - }),
459 - );
460 - assert.isFalse(
461 - isOpenFavoriteEditorShortcut(
462 - event({ key: "o", metaKey: true, repeat: true }),
463 - DEFAULT_BINDINGS,
464 - { platform: "MacIntel" },
465 - ),
466 - );
467 - });
468 -
403 it("toggles the thread panel by default without taking terminal keystrokes", () => {
404 for (const platform of ["MacIntel", "Win32", "Linux"]) {
405 const input = event({
@@ -703,29 +637,6 @@ describe("resolveShortcutCommand", () => {
637 );
638 });
639
706 - it("matches bracket shortcuts using the physical key code", () => {
707 - assert.strictEqual(
708 - resolveShortcutCommand(
709 - event({ key: "{", code: "BracketLeft", metaKey: true, shiftKey: true }),
710 - DEFAULT_BINDINGS,
711 - {
712 - platform: "MacIntel",
713 - },
714 - ),
715 - "thread.previous",
716 - );
717 - assert.strictEqual(
718 - resolveShortcutCommand(
719 - event({ key: "}", code: "BracketRight", ctrlKey: true, shiftKey: true }),
720 - DEFAULT_BINDINGS,
721 - {
722 - platform: "Linux",
723 - },
724 - ),
725 - "thread.next",
726 - );
727 - });
728 -
640 it("matches punctuation shortcuts by physical key across keyboard layouts", () => {
641 const keybindings = compile([
642 { shortcut: modShortcut("'", { shiftKey: true }), command: "diff.toggle" },
@@ -815,30 +726,6 @@ describe("isRichTextBoldShortcut", () => {
726 assert.isFalse(isRichTextBoldShortcut(event({ key: "x", code: "KeyB", ctrlKey: true })));
727 assert.isTrue(isRichTextBoldShortcut(event({ key: "b", code: "KeyN", ctrlKey: true })));
728 });
818 -
819 - it("ignores shifted, alted, bare, and non-keydown presses", () => {
820 - assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, shiftKey: true })));
821 - assert.isFalse(isRichTextBoldShortcut(event({ key: "b", metaKey: true, altKey: true })));
822 - assert.isFalse(isRichTextBoldShortcut(event({ key: "b" })));
823 - assert.isFalse(isRichTextBoldShortcut(event({ key: "i", metaKey: true })));
824 - assert.isFalse(isRichTextBoldShortcut(event({ type: "keyup", key: "b", metaKey: true })));
825 - });
826 -});
827 -
828 -describe("plus key parsing", () => {
829 - it("matches the plus key shortcut", () => {
830 - const plusBindings = compile([{ shortcut: modShortcut("+"), command: "terminal.toggle" }]);
831 - assert.isTrue(
832 - isTerminalToggleShortcut(event({ key: "+", metaKey: true }), plusBindings, {
833 - platform: "MacIntel",
834 - }),
835 - );
836 - assert.isTrue(
837 - isTerminalToggleShortcut(event({ key: "+", ctrlKey: true }), plusBindings, {
838 - platform: "Linux",
839 - }),
840 - );
841 - });
729 });
730
731 describe("composer and pull request shortcuts", () => {
@@ -868,26 +755,6 @@ describe("composer and pull request shortcuts", () => {
755 }
756 });
757
871 - it.each(["terminalOpen", "previewFocus", "previewOpen", "modelPickerOpen", "isWeb", "isDesktop"])(
872 - "honors custom PR shortcut conditions for %s",
873 - (condition) => {
874 - const bindings = compileResolvedKeybindingsConfig([
875 - { key: "mod+shift+k", command: "thread.copyReference", when: condition },
876 - { key: "mod+shift+k", command: "pullRequest.copyNumber", when: `!${condition}` },
877 - ]);
878 - const input = event({ key: "k", ctrlKey: true, shiftKey: true });
879 - for (const enabled of [false, true]) {
880 - assert.strictEqual(
881 - resolveShortcutCommand(input, bindings, {
882 - platform: "Linux",
883 - context: { [condition]: enabled },
884 - }),
885 - enabled ? "thread.copyReference" : "pullRequest.copyNumber",
886 - );
887 - }
888 - },
889 - );
890 -
758 it.each(["MacIntel", "Win32", "Linux"])(
759 "reserves the alternate send chord for the focused composer on %s",
760 (platform) => {
@@ -930,58 +797,6 @@ describe("composer and pull request shortcuts", () => {
797 },
798 );
799
933 - it.each(["MacIntel", "Win32", "Linux"])(
934 - "separates queued steering and background start on %s",
935 - (platform) => {
936 - const modifier = {
937 - metaKey: platform === "MacIntel",
938 - ctrlKey: platform !== "MacIntel",
939 - };
940 - const queuedKey = event({ key: "Enter", shiftKey: true, ...modifier });
941 - const backgroundKey = event({ key: "Enter", ...modifier });
942 - assert.strictEqual(
943 - resolveShortcutCommand(queuedKey, DEFAULT_RESOLVED_KEYBINDINGS, {
944 - platform,
945 - context: { terminalFocus: false, draftThreadRoute: false },
946 - }),
947 - "thread.steerQueuedMessage",
948 - );
949 - assert.strictEqual(
950 - resolveShortcutCommand(backgroundKey, DEFAULT_RESOLVED_KEYBINDINGS, {
951 - platform,
952 - context: { terminalFocus: false, draftThreadRoute: true, composerFocus: true },
953 - }),
954 - "composer.sendBackground",
955 - );
956 - },
957 - );
958 -
959 - for (const {} of ["MacIntel", "Win32", "Linux"]) {
960 - }
961 -
962 - it.each(["MacIntel", "Win32", "Linux"])(
963 - "edits the last queued message with Alt+ArrowUp from the composer on %s",
964 - (platform) => {
965 - const input = event({ key: "ArrowUp", altKey: true });
966 - assert.strictEqual(
967 - resolveShortcutCommand(input, DEFAULT_RESOLVED_KEYBINDINGS, {
968 - platform,
969 - context: { composerFocus: true },
970 - }),
971 - "thread.editQueuedMessage",
972 - );
973 - assert.isNull(
974 - resolveShortcutCommand(input, DEFAULT_RESOLVED_KEYBINDINGS, {
975 - platform,
976 - context: { composerFocus: false },
977 - }),
978 - );
979 - },
980 - );
981 -
982 - for (const {} of ["MacIntel", "Win32", "Linux"]) {
983 - }
984 -
800 const altEffortBindings = compileResolvedKeybindingsConfig([
801 { key: "mod+alt+e", command: "composer.effort", when: "!terminalFocus" },
802 ]);
@@ -1024,27 +839,9 @@ describe("composer and pull request shortcuts", () => {
839 "composer.effort",
840 );
841 });
1027 -
1028 - for (const {} of ["MacIntel", "Win32", "Linux"]) {
1029 - }
842 });
843
844 describe("Usage shortcuts", () => {
1033 - it("scopes letter shortcuts to Usage", () => {
1034 - assert.strictEqual(
1035 - resolveShortcutCommand(event({ key: "t" }), DEFAULT_RESOLVED_KEYBINDINGS, {
1036 - platform: "Linux",
1037 - context: { usagePageOpen: true },
1038 - }),
1039 - "usage.tokens",
1040 - );
1041 - assert.isNull(
1042 - resolveShortcutCommand(event({ key: "t" }), DEFAULT_RESOLVED_KEYBINDINGS, {
1043 - platform: "Linux",
1044 - }),
1045 - );
1046 - });
1047 -
845 it.each(["Linux", "MacIntel"])(
846 "preserves desktop numbered thread shortcuts on Usage on %s",
847 (platform) => {
apps/web/src/lib/assistantCitationNavigation.test.ts
-11
@@ -67,15 +67,4 @@ describe("assistant citation navigation", () => {
67 expect(router.history.length).toBe(3);
68 expect(assistantCitationFromLocation(router.state.location.href)).toEqual(citation);
69 });
70 -
71 - it("ignores non-citation fragments and missing fragments", () => {
72 - expect(assistantCitationFromLocation("/environment-one/thread-one")).toBeNull();
73 - expect(
74 - assistantCitationFromLocation("/environment-one/thread-one#ordinary-heading"),
75 - ).toBeNull();
76 - expect(assistantCitationFromLocation("/a/b#assistant-citation=%invalid")).toBeNull();
77 - expect(
78 - assistantCitationFromLocation(`/a/b#assistant-citation=${"a".repeat(140_000)}`),
79 - ).toBeNull();
80 - });
70 });
apps/web/src/lib/assistantTextSelection.test.ts
-62
@@ -231,15 +231,6 @@ describe("captureAssistantTextSelection", () => {
231 },
232 );
233
234 - it("finds the source when both endpoints are parent boundaries", () => {
235 - const quote = textNode("Only this response.");
236 - const source = assistantSource(new SelectionNode("P").append(quote));
237 - const viewport = new SelectionNode("MAIN").append(source, assistantSource(textNode("Next.")));
238 - expect(capture(viewport, nativeSelection([viewport, 0], [viewport, 1]))?.selector).toEqual(
239 - selector(quote.data),
240 - );
241 - });
242 -
234 it("captures the final paragraph when Chromium extends to the timestamp paragraph boundary", () => {
235 const quote = textNode("The final paragraph.");
236 const source = assistantSource(
@@ -346,14 +337,6 @@ describe("captureAssistantTextSelection", () => {
337 capture(source, nativeSelection([first, 0], [code, code.length], true))?.selector,
338 ).toEqual(selector("Before 😀 cafe\u0301\nfirst line\r\n second line\t🚀"));
339 });
349 -
350 - it("rejects a source outside the supplied viewport", () => {
351 - const quote = textNode("Outside.");
352 - assistantSource(quote);
353 - expect(
354 - capture(new SelectionNode("MAIN"), nativeSelection([quote, 0], [quote, quote.length])),
355 - ).toBeNull();
356 - });
340 });
341
342 describe("createAssistantTextSelector", () => {
@@ -439,15 +422,6 @@ describe("findAssistantCitationText", () => {
422 ).toEqual({ start: 34, end: 47 });
423 });
424
442 - it("still finds a unique quote after its surrounding text changes", () => {
443 - expect(
444 - findAssistantCitationText(
445 - "New selected text nearby.",
446 - selector("selected text", { start: 11, end: 24, prefix: "Before the ", suffix: " after." }),
447 - ),
448 - ).toEqual({ start: 4, end: 17 });
449 - });
450 -
425 it("uses both context sides when each side alone matches several repeated quotes", () => {
426 const text = "left quote one; other quote two; left quote two";
427 expect(
@@ -492,15 +466,6 @@ describe("findAssistantCitationText", () => {
466 ).toBeNull();
467 });
468
495 - it("rejects repeated quotes when neither occurrence matches all supplied context", () => {
496 - expect(
497 - findAssistantCitationText(
498 - "left quote wrong / wrong quote right",
499 - selector("quote", { prefix: "left ", suffix: " right" }),
500 - ),
501 - ).toBeNull();
502 - });
503 -
469 it("counts overlapping occurrences when checking ambiguity", () => {
470 expect(findAssistantCitationText("banana", selector("ana", { start: 1, end: 4 }))).toBeNull();
471 });
@@ -524,13 +489,6 @@ describe("findAssistantCitationText", () => {
489 ).toEqual({ start: 6, end: 19 });
490 });
491
527 - it("does not trim the document's leading whitespace out of its offsets", () => {
528 - expect(findAssistantCitationText("\n\t quote", selector("quote"))).toEqual({
529 - start: 1,
530 - end: 6,
531 - });
532 - });
533 -
492 it("uses UTF-16 offsets for emoji and combining characters", () => {
493 expect(findAssistantCitationText("😀 cafe\u0301 🚀 done", selector("cafe\u0301 🚀"))).toEqual({
494 start: 3,
@@ -548,24 +506,4 @@ describe("findAssistantCitationText", () => {
506 end: start + 5,
507 });
508 });
551 -
552 - it.each(["", " \n\t\r\n", "absent", "QUOTE", "qu.te"])(
553 - "rejects empty or missing literal text: %j",
554 - (quote) => {
555 - expect(findAssistantCitationText("quote", selector(quote))).toBeNull();
556 - },
557 - );
558 -
559 - it.each([
560 - { start: -1, end: 4 },
561 - { start: 2.5, end: 7.5 },
562 - { start: Number.NaN, end: Number.NaN },
563 - { start: Number.POSITIVE_INFINITY, end: Number.POSITIVE_INFINITY },
564 - { start: 8, end: 3 },
565 - ])("treats invalid stored offsets as unusable hints: $start / $end", (offsets) => {
566 - expect(findAssistantCitationText("a quote", selector("quote", offsets))).toEqual({
567 - start: 2,
568 - end: 7,
569 - });
570 - });
509 });
apps/web/src/lib/attachmentUploadQueue.test.ts
-58
@@ -350,43 +350,6 @@ describe("attachmentUploadQueue", () => {
350 );
351 });
352
353 - it("uses the fallback MIME type for both the upload claim and request header", async () => {
354 - const bytes = new File([new Uint8Array([1, 2, 3])], "unknown.bin");
355 - const file: ComposerFileAttachment = {
356 - type: "file",
357 - id: "file-without-browser-mime",
358 - name: bytes.name,
359 - mimeType: "application/octet-stream",
360 - sizeBytes: bytes.size,
361 - file: bytes,
362 - };
363 -
364 - startAttachmentUpload({ environmentId: firstEnvironment, image: file });
365 - await Promise.resolve();
366 -
367 - expect(mocks.runAtomCommand).toHaveBeenCalledWith(
368 - expect.anything(),
369 - mocks.createUploadUrl,
370 - {
371 - environmentId: firstEnvironment,
372 - input: {
373 - type: "file",
374 - name: "unknown.bin",
375 - mimeType: "application/octet-stream",
376 - sizeBytes: 3,
377 - },
378 - },
379 - expect.anything(),
380 - );
381 - expect(TestXmlHttpRequest.requests[0]?.headers.get("Content-Type")).toBe(
382 - "application/octet-stream",
383 - );
384 -
385 - const settled = awaitAttachmentUploads([file.id]);
386 - TestXmlHttpRequest.requests[0]!.complete();
387 - await settled;
388 - });
389 -
353 it("persists a background completion's ids to the draft with no composer mounted", async () => {
354 const draftId = DraftId.make("draft-background-upload");
355 const file = makeFile("background");
@@ -577,27 +540,6 @@ describe("attachmentUploadQueue", () => {
540 }
541 });
542
580 - it("releases the persisted server upload when a hydrated draft is discarded after a reload", () => {
581 - const file: ComposerFileAttachment = {
582 - ...makeFile("hydrated"),
583 - file: null,
584 - uploadedAttachmentId: "pending-hydrated-pdf",
585 - uploadEnvironmentId: firstEnvironment,
586 - };
587 -
588 - releaseDraftAttachment(file);
589 -
590 - expect(mocks.runAtomCommand).toHaveBeenCalledWith(
591 - expect.anything(),
592 - mocks.removeUpload,
593 - {
594 - environmentId: firstEnvironment,
595 - input: { attachmentId: "pending-hydrated-pdf" },
596 - },
597 - expect.anything(),
598 - );
599 - });
600 -
543 it("routes a live persisted upload through the queue release exactly once", async () => {
544 const file: ComposerFileAttachment = {
545 ...makeFile("live"),
apps/web/src/lib/composerContextRecords.test.ts
-48
@@ -277,24 +277,6 @@ describe("composerContextRecords", () => {
277 expect(() => decodeMessageContext({ version: 1, records: [overLimit] })).not.toThrow();
278 });
279
280 - it("keeps a region-only annotation's target summary and screenshot across a round trip", () => {
281 - const regionOnly: PreviewAnnotationPayload = {
282 - ...annotation,
283 - elements: [],
284 - styleChanges: [],
285 - regions: [{ id: "rg_1", rect: { x: 1, y: 2, width: 3, height: 4 } }],
286 - };
287 - const record = previewAnnotationContextRecord(regionOnly, { screenshotContextId: "ann_1" });
288 - expect(record.targetSummary).toBe("1 marked region");
289 - expect(record.screenshotContextId).toBe("image_ann_1");
290 -
291 - const reencoded = previewAnnotationContextRecord(previewAnnotationFromRecord(record), {
292 - screenshotContextId: "ann_1",
293 - });
294 - expect(reencoded.targetSummary).toBe("1 marked region");
295 - expect(reencoded.screenshotContextId).toBe("image_ann_1");
296 - });
297 -
280 it("finds the destination collision for different legacy terminal messages", () => {
281 const legacy = (text: string) =>
282 asKnownContextRecord(
@@ -334,36 +316,6 @@ describe("composerContextRecords", () => {
316 expect(isSameComposerContextPayload(canonical, { ...canonical, text: "B" })).toBe(false);
317 });
318
337 - it("compares nested annotation element and source payloads", () => {
338 - const base = previewAnnotationContextRecord(annotation);
339 - expect(isSameComposerContextPayload(base, { ...base, label: "Different display label" })).toBe(
340 - true,
341 - );
342 - expect(
343 - isSameComposerContextPayload(base, {
344 - ...base,
345 - elements: base.elements!.map((element) => ({
346 - ...element,
347 - htmlPreview: '<button id="pay">Changed</button>',
348 - })),
349 - }),
350 - ).toBe(false);
351 - expect(
352 - isSameComposerContextPayload(base, {
353 - ...base,
354 - elements: base.elements!.map((element) => ({
355 - ...element,
356 - source: {
357 - functionName: "Checkout",
358 - fileName: "src/Checkout.tsx",
359 - lineNumber: 20,
360 - columnNumber: 4,
361 - },
362 - })),
363 - }),
364 - ).toBe(false);
365 - });
366 -
319 it("resolves structured context directly and upgrades legacy text otherwise", () => {
320 const structured = resolveUserMessageContext({
321 text: "hi [b.ts L4](t3-context://v1/review-comment/rc-1)",
apps/web/src/lib/contextWindow.test.ts
-32
@@ -45,25 +45,6 @@ describe("V2 context window presentation", () => {
45 expect(snapshot?.usedTokens).toBe(2_000);
46 expect(snapshot?.totalProcessedTokens).toBe(10_000);
47 });
48 -
49 - it("prefers current provider usage and preserves ACP cost", () => {
50 - const snapshot = deriveLatestContextWindowSnapshot([], undefined, {
51 - contextUsage: {
52 - usedTokens: 2_500,
53 - maxTokens: 10_000,
54 - cost: { amount: 0.42, currency: "USD" },
55 - },
56 - updatedAt: DateTime.makeUnsafe("2026-08-23T00:00:00.000Z"),
57 - });
58 -
59 - expect(snapshot).toMatchObject({
60 - usedTokens: 2_500,
61 - maxTokens: 10_000,
62 - remainingTokens: 7_500,
63 - usedPercentage: 25,
64 - cost: { amount: 0.42, currency: "USD" },
65 - });
66 - });
48 });
49
50 describe("live provider-turn usage (#8144)", () => {
@@ -87,19 +68,6 @@ describe("live provider-turn usage (#8144)", () => {
68 formatContextWindowCompactionMessage("Claude Sonnet 4.6", snapshot?.autoCompactThreshold),
69 ).toBe("Compacts automatically at about 150,000 tokens.");
70 });
90 -
91 - it("handles a report without a known context window", () => {
92 - const snapshot = deriveLatestContextWindowSnapshot([], {
93 - usedTokens: 42_000,
94 - updatedAt: "2026-08-27T00:00:00.000Z",
95 - });
96 - expect(snapshot?.maxTokens).toBeNull();
97 - expect(snapshot?.usedPercentage).toBeNull();
98 - expect(snapshot?.autoCompactThreshold).toBeNull();
99 - expect(formatContextWindowCompactionMessage(null, snapshot?.autoCompactThreshold)).toBe(
100 - "Context compacts automatically when needed.",
101 - );
102 - });
71 });
72
73 describe("latestProviderTurnTokenUsage", () => {
apps/web/src/lib/diffRendering.test.ts
-19
@@ -5,23 +5,12 @@ import {
5 buildFileDiffContentVersion,
6 buildFileDiffIdentityKey,
7 buildFileDiffRenderKey,
8 - buildPatchCacheKey,
8 getDiffLineStat,
9 getRenderablePatch,
10 resolveFileDiffPath,
11 resolveFileDiffPreviousPath,
12 } from "./diffRendering";
13
15 -describe("buildPatchCacheKey", () => {
16 - it("changes when cache scope changes", () => {
17 - const patch = "diff --git a/a.ts b/a.ts\n+console.log('hello')";
18 -
19 - expect(buildPatchCacheKey(patch, "diff-panel:light")).not.toBe(
20 - buildPatchCacheKey(patch, "diff-panel:dark"),
21 - );
22 - });
23 -});
24 -
14 describe("getRenderablePatch", () => {
15 it("hides indentation changes around inserted JSX without moving review lines", () => {
16 const patch = [
@@ -348,14 +337,6 @@ describe("a file whose name a patch header cannot carry plainly", () => {
337 return resolveFileDiffPath(file);
338 };
339
351 - it("is the name the host knows, not the part of it before the tab", () => {
352 - expect(pathOf(quotedPatch("tab\\tfile.txt"))).toBe("tab\tfile.txt");
353 - });
354 -
355 - it("keeps a backslash the name really has", () => {
356 - expect(pathOf(quotedPatch("back\\\\slash.txt"))).toBe("back\\slash.txt");
357 - });
358 -
340 it("reads the octal a host with core.quotePath on writes for a name outside ASCII", () => {
341 expect(pathOf(quotedPatch("caf\\303\\251/r\\303\\251sum\\303\\251.ts"))).toBe("café/résumé.ts");
342 });
apps/web/src/lib/diffRendering.ts
+1 -1
@@ -31,7 +31,7 @@ export function fnv1a32(
31 return hash >>> 0;
32 }
33
34 -export function buildPatchCacheKey(patch: string, scope = "diff-panel"): string {
34 +function buildPatchCacheKey(patch: string, scope = "diff-panel"): string {
35 const normalizedPatch = patch.trim();
36 const primary = fnv1a32(normalizedPatch, FNV_OFFSET_BASIS_32, FNV_PRIME_32).toString(36);
37 const secondary = fnv1a32(
apps/web/src/lib/imageCompression.test.ts
-61
@@ -3,7 +3,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test"
3 import {
4 compressImageForStash,
5 compressImageToByteLimit,
6 - isHeicImageFile,
6 MAX_COMPRESSIBLE_SOURCE_BYTES,
7 MAX_STASH_IMAGE_DATA_URL_CHARS,
8 prepareImageForAttachment,
@@ -208,16 +207,6 @@ describe("compressImageForStash", () => {
207 expect(close).toHaveBeenCalled();
208 });
209
211 - it("reports too-large for an oversized image when the browser cannot re-encode", async () => {
212 - vi.stubGlobal("createImageBitmap", undefined);
213 - vi.stubGlobal("OffscreenCanvas", undefined);
214 -
215 - expect(await compressImageForStash(makeFile(4_000_000))).toEqual({
216 - ok: false,
217 - reason: "too-large",
218 - });
219 - });
220 -
210 it("reports unreadable when the image fails to decode", async () => {
211 vi.stubGlobal(
212 "createImageBitmap",
@@ -240,19 +229,6 @@ describe("compressImageForStash", () => {
229 });
230 });
231
243 - it("compressImageToByteLimit passes small files through byte-for-byte", async () => {
244 - const bitmapSpy = vi.fn();
245 - vi.stubGlobal("createImageBitmap", bitmapSpy);
246 -
247 - const original = makeFile(1024);
248 - const result = await compressImageToByteLimit(original, 10 * 1024 * 1024);
249 -
250 - expect(result.ok).toBe(true);
251 - expect(result.ok && result.recompressed).toBe(false);
252 - expect(result.ok && result.file).toBe(original);
253 - expect(bitmapSpy).not.toHaveBeenCalled();
254 - });
255 -
232 it("compressImageToByteLimit refuses sources above the decode-safety ceiling", async () => {
233 const bitmapSpy = vi.fn();
234 vi.stubGlobal("createImageBitmap", bitmapSpy);
@@ -268,18 +244,6 @@ describe("compressImageForStash", () => {
244 });
245
246 describe("HEIC attachment preparation", () => {
271 - it("recognizes HEIC and HEIF MIME types and case-insensitive file extensions", () => {
272 - expect(isHeicImageFile({ name: "photo.bin", type: "image/heic" })).toBe(true);
273 - expect(isHeicImageFile({ name: "photo.bin", type: "image/heif" })).toBe(true);
274 - expect(isHeicImageFile({ name: "photo.heic", type: "image/heic-sequence" })).toBe(false);
275 - expect(isHeicImageFile({ name: "photo.heif", type: "image/heif-sequence" })).toBe(false);
276 - expect(isHeicImageFile({ name: "IMG_1234.HEIC", type: "" })).toBe(true);
277 - expect(isHeicImageFile({ name: "photo.heif", type: "application/octet-stream" })).toBe(true);
278 - expect(isHeicImageFile({ name: "photo.png", type: "image/png" })).toBe(false);
279 - expect(isHeicImageFile({ name: "photo.heic", type: "image/png" })).toBe(false);
280 - expect(isHeicImageFile({ name: "photo.heif", type: "image/jpeg" })).toBe(false);
281 - });
282 -
247 it("converts a HEIC photo with a missing MIME type into a named JPEG", async () => {
248 const original = makeHeicFile({
249 name: "IMG_1234.HEIC",
@@ -324,19 +288,6 @@ describe("HEIC attachment preparation", () => {
288 expect(close).toHaveBeenCalled();
289 });
290
327 - it.each([
328 - { label: "24 MP", width: 5712, height: 4284 },
329 - { label: "48 MP", width: 8064, height: 6048 },
330 - ])("accepts $label HEIC photos", async ({ width, height }) => {
331 - const original = makeHeicFile({ width, height });
332 - mocks.heicTo.mockResolvedValueOnce(new Blob(["jpeg"], { type: "image/jpeg" }));
333 -
334 - const result = await prepareImageForAttachment(original, 1024);
335 -
336 - expect(result.ok && result.file.type).toBe("image/jpeg");
337 - expect(mocks.heicTo).toHaveBeenCalledOnce();
338 - });
339 -
291 it("rejects oversized HEIC dimensions before loading the decoder", async () => {
292 const original = makeHeicFile({ width: 16_000, height: 4001 });
293
@@ -347,18 +298,6 @@ describe("HEIC attachment preparation", () => {
298 expect(mocks.heicTo).not.toHaveBeenCalled();
299 });
300
350 - it("rejects invalid HEIC metadata before loading the decoder", async () => {
351 - const original = new File([new Uint8Array([1, 2, 3])], "broken.heic", {
352 - type: "image/heic",
353 - });
354 -
355 - expect(await prepareImageForAttachment(original, 1024)).toEqual({
356 - ok: false,
357 - reason: "unreadable",
358 - });
359 - expect(mocks.heicTo).not.toHaveBeenCalled();
360 - });
361 -
301 it("rejects unsafe HEIC sources before loading the decoder", async () => {
302 const original = new File(["photo"], "large.heic", { type: "image/heic" });
303 Object.defineProperty(original, "size", { value: MAX_COMPRESSIBLE_SOURCE_BYTES + 1 });
apps/web/src/lib/incrementalHighlighting.test.ts
-13
@@ -64,19 +64,6 @@ describe("incremental code highlighting", () => {
64 }
65 });
66
67 - it.each(["text", "plaintext", "plain", "txt", "ansi"])(
68 - "preserves %s without requesting grammar state",
69 - async (language) => {
70 - const highlighter = await highlighterPromise;
71 - const highlight = createIncrementalHighlightedDocument(highlighter, language, "pierre-dark");
72 - for (const text of ["plain\ntext", "\u001b[31mred\ncontinued", "\n"]) {
73 - expect(toHtml(highlight(text))).toBe(
74 - highlighter.codeToHtml(text, { lang: language, theme: "pierre-dark" }),
75 - );
76 - }
77 - },
78 - );
79 -
67 it("preserves partial CRLF and CR line endings", async () => {
68 const highlighter = await highlighterPromise;
69 const highlight = createIncrementalHighlightedDocument(
apps/web/src/lib/openPullRequestLink.test.ts
+2 -81
@@ -10,7 +10,6 @@ import {
10 pullRequestCandidateUrlFromReferenceAutolink,
11 } from "./openPullRequestLink";
12 import { ProjectId, type RepositoryIdentity } from "@t3tools/contracts";
13 -import { normalizeGitRemoteUrl } from "@t3tools/shared/git";
13
14 function repositoryIdentity(
15 provider: string,
@@ -66,6 +65,7 @@ describe("gitHubPullRequestBrowserUrl", () => {
65 );
66 });
67
68 + // regression: #8507 the browser fallback must not open a bogus URL
69 it("returns null for missing or invalid GitHub data", () => {
70 expect(gitHubPullRequestBrowserUrl(null, "acme/repository", 1)).toBeNull();
71 expect(
@@ -98,6 +98,7 @@ describe("gitHubPullRequestBrowserUrl", () => {
98 ).toBeNull();
99 });
100
101 + // regression: #8507 the browser fallback for failed PR loads must only target GitHub
102 it.each(["gitlab", "bitbucket", "azure-devops", "unknown"])(
103 "does not build a fallback for %s",
104 (provider) => {
@@ -113,14 +114,6 @@ describe("gitHubPullRequestBrowserUrl", () => {
114 });
115
116 describe("changeRequestRepositoryUrl", () => {
116 - it("preserves repository path casing", () => {
117 - expect(
118 - changeRequestRepositoryUrl(
119 - "https://gitlab.example.test/Team/Platform/Repo/-/merge_requests/42/diffs#note_1",
120 - ),
121 - ).toBe("https://gitlab.example.test/Team/Platform/Repo");
122 - });
123 -
117 it("keeps pull-like segments inside nested GitLab repository paths", () => {
118 expect(
119 changeRequestRepositoryUrl(
@@ -183,15 +176,6 @@ describe("matchesLinkedPullRequestUrl", () => {
176 ).toBe(expected);
177 });
178
186 - it("keeps other providers' existing port normalization", () => {
187 - expect(
188 - matchesLinkedPullRequestUrl(
189 - linkedPullRequest,
190 - "https://github.com:8443/pingdotgg/t3code/pull/42",
191 - ),
192 - ).toBe(true);
193 - });
194 -
179 it("keeps Forgejo and GitHub path shapes distinct on a GitHub-named host", () => {
180 expect(
181 matchesLinkedPullRequestUrl(
@@ -200,18 +184,6 @@ describe("matchesLinkedPullRequestUrl", () => {
184 ),
185 ).toBe(false);
186 });
203 -
204 - it("rejects a different pull request or host", () => {
205 - expect(
206 - matchesLinkedPullRequestUrl(linkedPullRequest, "https://github.com/pingdotgg/t3code/pull/43"),
207 - ).toBe(false);
208 - expect(
209 - matchesLinkedPullRequestUrl(
210 - linkedPullRequest,
211 - "https://github.example.com/pingdotgg/t3code/pull/42",
212 - ),
213 - ).toBe(false);
214 - });
187 });
188
189 describe("findProjectOnChangeRequestHost", () => {
@@ -337,16 +309,6 @@ describe("findProjectOnChangeRequestHost", () => {
309 }),
310 ).toBe(frontend);
311 });
340 -
341 - it("finds nothing on a host nothing is checked out from", () => {
342 - expect(
343 - findProjectOnChangeRequestHost([frontend], {
344 - host: "gitlab.com",
345 - repository: "acme/backend",
346 - number: 7,
347 - }),
348 - ).toBeUndefined();
349 - });
312 });
313
314 describe("findProjectForChangeRequest", () => {
@@ -372,47 +334,6 @@ describe("findProjectForChangeRequest", () => {
334 ).toBe(projects[0]);
335 });
336
375 - it("keeps two hosts apart, so an Enterprise link does not open the public one", () => {
376 - const projects = [
377 - project({
378 - canonicalKey: "github.com/pingdotgg/t3code",
379 - provider: "github",
380 - owner: "pingdotgg",
381 - name: "t3code",
382 - }),
383 - ];
384 - expect(
385 - findProjectForChangeRequest(projects, {
386 - host: "github.acme.test",
387 - repository: "pingdotgg/t3code",
388 - number: 1,
389 - }),
390 - ).toBeUndefined();
391 - });
392 -
393 - it("matches an Azure repository cloned over SSH, whose remote shares no part with its URL", () => {
394 - // Azure alone addresses one repository under two names: `ssh.dev.azure.com` and `v3/...` over
395 - // SSH against `dev.azure.com` and `.../_git/...` everywhere a person sees it. The identity is
396 - // recorded in the spelling a link arrives in, so both halves of this comparison line up.
397 - const canonicalKey = normalizeGitRemoteUrl("git@ssh.dev.azure.com:v3/T3Tools/Platform/T3Code");
398 - const projects = [
399 - project({
400 - canonicalKey,
401 - provider: "azure-devops",
402 - displayName: canonicalKey.split("/").slice(1).join("/"),
403 - owner: "t3tools",
404 - name: "t3code",
405 - }),
406 - ];
407 - expect(
408 - findProjectForChangeRequest(projects, {
409 - host: "dev.azure.com",
410 - repository: "t3tools/platform/_git/t3code",
411 - number: 1,
412 - }),
413 - ).toBe(projects[0]);
414 - });
415 -
337 it("claims nothing for a lookalike host, which is what keeps a link a link", () => {
338 const projects = [
339 project({
apps/web/src/lib/previewAnnotation.test.ts
+1
@@ -41,6 +41,7 @@ describe("preview annotation capture", () => {
41 expect(fetch).not.toHaveBeenCalled();
42 });
43
44 + // regression: #12636 desktop annotation screenshots must be decoded without fetch (CSP)
45 it.each(["data:image/jpeg;base64,AA==", "data:image/png;base64,", "data:image/png;base64,%%%"])(
46 "reports a malformed screenshot as failed: %s",
47 (dataUrl) => {
apps/web/src/lib/softwareKeyboard.test.ts
+2
@@ -43,6 +43,7 @@ describe("software keyboard detection", () => {
43 expect(observed).toEqual([true, false]);
44 });
45
46 + // regression: #21763 composer Enter sent instead of inserting a newline on software keyboards
47 it("prefers overlay geometry over a misleading viewport height", () => {
48 const { store, resize, geometry } = fixture({ native: true, overlay: true });
49 const unsubscribe = store.subscribe(() => {});
@@ -69,6 +70,7 @@ describe("software keyboard detection", () => {
70 unsubscribe();
71 });
72
73 + // regression: #21763 composer Enter sent instead of inserting a newline on software keyboards
74 it("detects a docked keyboard when subscribing after it has opened", () => {
75 const { store, resize } = fixture();
76 resize(500);
apps/web/src/markdown-links.test.ts
+1 -6
@@ -32,17 +32,12 @@ describe("rewriteMarkdownFileUriHref", () => {
32 );
33 });
34
35 + // regression: #6433 workspace images in chat markdown did not render
36 it("treats a localhost file uri as a local path", () => {
37 expect(rewriteMarkdownFileUriHref("file://localhost/home/me/notes.md")).toBe(
38 "/home/me/notes.md",
39 );
40 });
40 -
41 - it("unwraps angle-bracketed file uri hrefs", () => {
42 - expect(
43 - rewriteMarkdownFileUriHref(" <file:///D:/Programme/t3code/apps/web/src/markdown-links.ts> "),
44 - ).toBe("D:/Programme/t3code/apps/web/src/markdown-links.ts");
45 - });
41 });
42
43 describe("relative links inside a rendered host file", () => {
apps/web/src/modelSelection.test.ts
-43
@@ -12,7 +12,6 @@ import { deriveEffectiveComposerModelState } from "./composerDraftStore";
12 import { getComposerProviderState } from "./components/chat/composerProviderState";
13 import { deriveProviderInstanceEntries, NO_PROVIDER_MODEL_SELECTION } from "./providerInstances";
14 import {
15 - getCustomModelOptionsByInstance,
15 getAppModelOptionsForInstance,
16 resolveAppModelSelectionForInstance,
17 resolveAppModelSelectionState,
@@ -130,27 +129,6 @@ describe("instance-scoped model selection", () => {
129 ).toBe("opus");
130 });
131
133 - it("includes Grok custom models from the selected provider instance", () => {
134 - const providers = [provider({ provider: ProviderDriverKind.make("grok"), instanceId: "grok" })];
135 - const settings: UnifiedSettings = {
136 - ...settingsWithProviderInstances(),
137 - providerInstances: {
138 - ...settingsWithProviderInstances().providerInstances,
139 - [ProviderInstanceId.make("grok")]: {
140 - driver: ProviderDriverKind.make("grok"),
141 - config: { customModels: ["grok-test-custom-model"] },
142 - },
143 - },
144 - };
145 - const grok = deriveProviderInstanceEntries(providers).find(
146 - (entry) => entry.instanceId === "grok",
147 - )!;
148 -
149 - expect(getAppModelOptionsForInstance(settings, grok).map((option) => option.slug)).toContain(
150 - "grok-test-custom-model",
151 - );
152 - });
153 -
132 it("offers and resolves every saved custom model, past the first 32", () => {
133 const providers = [
134 provider({
@@ -327,27 +305,6 @@ describe("instance-scoped model selection", () => {
305 ]);
306 });
307
330 - it("keeps a missing option scoped to the selected instance", () => {
331 - const selectedInstanceId = ProviderInstanceId.make(`${driverName}_work`);
332 - const otherInstanceId = ProviderInstanceId.make(`${driverName}_personal`);
333 - const driver = ProviderDriverKind.make(driverName);
334 - const providers = [
335 - provider({ provider: driver, instanceId: selectedInstanceId, models: [] }),
336 - provider({ provider: driver, instanceId: otherInstanceId, models: [] }),
337 - ];
338 - const options = getCustomModelOptionsByInstance(
339 - settingsWithProviderInstances(),
340 - providers,
341 - selectedInstanceId,
342 - missingModel,
343 - );
344 -
345 - expect(options.get(selectedInstanceId)).toEqual([
346 - expect.objectContaining({ slug: missingModel, isUnavailable: true }),
347 - ]);
348 - expect(options.get(otherInstanceId)).toEqual([]);
349 - });
350 -
308 it("does not resurrect a hidden model when the raw catalog omits it", () => {
309 const instanceId = ProviderInstanceId.make(driverName);
310 const driver = ProviderDriverKind.make(driverName);
apps/web/src/onboarding/firstRun.logic.test.ts
+1 -98
@@ -57,52 +57,6 @@ describe("resolveFirstRunDecision", () => {
57 });
58 });
59
60 - it("waits for managed environments before treating a workspace as new", () => {
61 - expect(resolveFirstRunDecision({ ...freshWorkspace, catalogReady: false })).toEqual({
62 - decision: "pending",
63 - persistCompletion: false,
64 - });
65 - });
66 -
67 - it("does not complete onboarding from cached remote projects", () => {
68 - expect(
69 - resolveFirstRunDecision({
70 - ...freshWorkspace,
71 - projectCount: 3,
72 - workspaceAuthoritative: false,
73 - workspaceFresh: false,
74 - }),
75 - ).toEqual({
76 - decision: "app",
77 - persistCompletion: false,
78 - });
79 - });
80 -
81 - it("waits for live data before judging a single cached project", () => {
82 - expect(
83 - resolveFirstRunDecision({
84 - ...freshWorkspace,
85 - authoritative: false,
86 - workspaceFresh: false,
87 - }),
88 - ).toEqual({
89 - decision: "pending",
90 - persistCompletion: false,
91 - });
92 - });
93 -
94 - it("waits for the completed bootstrap welcome before judging a nonempty workspace", () => {
95 - expect(
96 - resolveFirstRunDecision({
97 - ...freshWorkspace,
98 - workspaceProvenanceAuthoritative: false,
99 - }),
100 - ).toEqual({
101 - decision: "pending",
102 - persistCompletion: false,
103 - });
104 - });
105 -
60 it("waits when the initial welcome is pending and opens the wizard after completion", () => {
61 const pendingProvenance = isFirstRunWorkspaceProvenanceAuthoritative({
62 welcomeReceived: true,
@@ -144,15 +98,6 @@ describe("resolveFirstRunDecision", () => {
98 });
99
100 describe("isFirstRunWorkspaceProvenanceAuthoritative", () => {
147 - it("waits for a welcome before treating an empty catalog as final", () => {
148 - expect(
149 - isFirstRunWorkspaceProvenanceAuthoritative({
150 - welcomeReceived: false,
151 - bootstrapStatus: null,
152 - }),
153 - ).toBe(false);
154 - });
155 -
101 it("accepts a legacy welcome without bootstrap status", () => {
102 expect(
103 isFirstRunWorkspaceProvenanceAuthoritative({
@@ -170,18 +115,6 @@ describe("transitionFirstRunGateState", () => {
115 ).toEqual({ decision: "pending", stalled: true });
116 });
117
173 - it.each(["app", "wizard"] as const)(
174 - "resolves stalled recovery to %s only after authoritative evidence",
175 - (decision) => {
176 - expect(
177 - transitionFirstRunGateState(
178 - { decision: "pending", stalled: true },
179 - { type: "evidence", decision },
180 - ),
181 - ).toEqual({ decision, stalled: false });
182 - },
183 - );
184 -
118 it.each([
119 { previous: "app", workspaceFresh: true, decision: "wizard" },
120 { previous: "wizard", workspaceFresh: false, decision: "app" },
@@ -198,6 +131,7 @@ describe("transitionFirstRunGateState", () => {
131 },
132 );
133
134 + // regression: #19680 unchanged gate evidence must not produce a new state
135 it.each(["pending", "app", "wizard"] as const)(
136 "preserves state identity for unchanged %s evidence",
137 (decision) => {
@@ -234,17 +168,6 @@ const freshBootstrap = {
168 };
169
170 describe("isFreshFirstRunWorkspace", () => {
237 - it("accepts an empty workspace", () => {
238 - expect(
239 - isFreshFirstRunWorkspace({
240 - primaryEnvironmentId,
241 - serverCwd: "/projects/current",
242 - projects: [],
243 - threads: [],
244 - }),
245 - ).toBe(true);
246 - });
247 -
171 it("accepts only the unused project and thread created from the server cwd", () => {
172 expect(
173 isFreshFirstRunWorkspace({
@@ -303,26 +226,6 @@ describe("isFreshFirstRunWorkspace", () => {
226 ).toBe(true);
227 });
228
306 - it("rejects projects from another environment even when their paths match", () => {
307 - expect(
308 - isFreshFirstRunWorkspace({
309 - ...freshBootstrap,
310 - projects: [{ ...bootstrapProject, environmentId: "remote-environment" }],
311 - threads: [],
312 - }),
313 - ).toBe(false);
314 - });
315 -
316 - it("rejects a thread that does not belong to the bootstrap project", () => {
317 - expect(
318 - isFreshFirstRunWorkspace({
319 - ...freshBootstrap,
320 - projects: [bootstrapProject],
321 - threads: [{ ...bootstrapThread, projectId: "another-project" }],
322 - }),
323 - ).toBe(false);
324 - });
325 -
229 it("rejects a bootstrap thread that already has a user message", () => {
230 expect(
231 isFreshFirstRunWorkspace({
apps/web/src/onboarding/projectImport.logic.test.ts
+2 -52
@@ -122,6 +122,7 @@ describe("groupOnboardingProjects", () => {
122 ]);
123 });
124
125 + // regression: #10547 project import broke on servers that predate git identity
126 it("lists candidates without git identity as standalone repositories", () => {
127 const { git: _git, ...legacy } = candidate("/code/legacy", { title: "legacy" });
128
@@ -139,16 +140,6 @@ describe("resolveOnboardingProjectId", () => {
140 const remoteEnvironmentId = EnvironmentId.make("remote");
141 const localProjectId = ProjectId.make("local-project");
142
142 - it("uses the scanned project ID before the project reaches the client", () => {
143 - expect(
144 - resolveOnboardingProjectId(
145 - [],
146 - localEnvironmentId,
147 - candidate("/projects/repo", { projectId: localProjectId }),
148 - ),
149 - ).toBe(localProjectId);
150 - });
151 -
143 it("uses the scanned project ID when the client still has an older project at that root", () => {
144 expect(
145 resolveOnboardingProjectId(
@@ -202,22 +193,6 @@ describe("resolveOnboardingProjectId", () => {
193 ).toBeNull();
194 });
195
205 - it("finds an alias after the scanner returns its persisted project root", () => {
206 - expect(
207 - resolveOnboardingProjectId(
208 - [
209 - {
210 - id: localProjectId,
211 - environmentId: localEnvironmentId,
212 - workspaceRoot: "/real/projects/repo",
213 - },
214 - ],
215 - localEnvironmentId,
216 - candidate("/real/projects/repo"),
217 - ),
218 - ).toBe(localProjectId);
219 - });
220 -
196 it("finds the current root owner when the scan has no project ID", () => {
197 const recreatedProjectId = ProjectId.make("recreated-project");
198 expect(
@@ -239,35 +214,9 @@ describe("resolveOnboardingProjectId", () => {
214 ),
215 ).toBe(recreatedProjectId);
216 });
242 -
243 - it("does not reuse a moved project when the scan has no project ID", () => {
244 - expect(
245 - resolveOnboardingProjectId(
246 - [
247 - {
248 - id: localProjectId,
249 - environmentId: localEnvironmentId,
250 - workspaceRoot: "/projects/moved",
251 - },
252 - ],
253 - localEnvironmentId,
254 - candidate("/projects/repo"),
255 - ),
256 - ).toBeNull();
257 - });
217 });
218
219 describe("resolveOnboardingLandingProject", () => {
261 - it("skips a failed first project for a later project with imported history", () => {
262 - expect(
263 - resolveOnboardingLandingProject(
264 - ["/projects/failed", "/projects/imported"],
265 - new Map([["/projects/imported", "imported"]]),
266 - new Map([["/projects/imported", "imported"]]),
267 - ),
268 - ).toBe("imported");
269 - });
270 -
220 it("prefers a partial first import that added history", () => {
221 expect(
222 resolveOnboardingLandingProject(
@@ -315,6 +264,7 @@ describe("projects on multiple computers", () => {
264 );
265 });
266
267 + // regression: #10465 multi-computer onboarding mixed up which computer a project came from
268 it("preserves computer identity when choosing recent projects", () => {
269 const first = { ...candidate("/code/app"), environmentId: "first" };
270 const second = { ...candidate("/code/app"), environmentId: "second" };
apps/web/src/onboarding/providerReadiness.logic.test.ts
-48
@@ -27,10 +27,6 @@ const readyCodex: ServerProvider = {
27 };
28
29 describe("getOnboardingProviderState", () => {
30 - it("treats an enabled Codex provider with ready status and unknown authentication as ready", () => {
31 - expect(getOnboardingProviderState(readyCodex)).toBe("ready");
32 - });
33 -
30 it("treats authenticated providers as ready only when their provider status is ready", () => {
31 expect(getOnboardingProviderState({ ...readyCodex, auth: { status: "authenticated" } })).toBe(
32 "ready",
@@ -141,30 +137,6 @@ describe("resolveOnboardingProviderLoginCommand", () => {
137 ).toBe("/opt/codex-work/bin/codex login");
138 });
139
144 - it("uses the selected Claude account binary", () => {
145 - const provider: ServerProvider = {
146 - ...readyCodex,
147 - driver: ProviderDriverKind.make("claudeAgent"),
148 - instanceId: ProviderInstanceId.make("claude_work"),
149 - };
150 -
151 - expect(
152 - resolveOnboardingProviderLoginCommand(
153 - provider,
154 - {
155 - ...DEFAULT_SERVER_SETTINGS,
156 - providerInstances: {
157 - [provider.instanceId]: {
158 - driver: provider.driver,
159 - config: { binaryPath: "/opt/claude-work/bin/claude" },
160 - },
161 - },
162 - },
163 - "linux",
164 - ),
165 - ).toBe("/opt/claude-work/bin/claude auth login");
166 - });
167 -
140 it("quotes a Codex path with spaces for PowerShell", () => {
141 expect(
142 resolveOnboardingProviderLoginCommand(
@@ -237,26 +209,6 @@ describe("resolveOnboardingProviderLoginCommand", () => {
209 ).toBe(expectedCommand);
210 });
211
240 - it.each(["darwin", "linux"] as const)("quotes backslashes in a Codex path on %s", (platform) => {
241 - expect(
242 - resolveOnboardingProviderLoginCommand(
243 - readyCodex,
244 - {
245 - ...DEFAULT_SERVER_SETTINGS,
246 - providerInstances: {
247 - [ProviderInstanceId.make("codex")]: {
248 - driver: ProviderDriverKind.make("codex"),
249 - config: {
250 - binaryPath: "/opt/codex\\work/codex",
251 - },
252 - },
253 - },
254 - },
255 - platform,
256 - ),
257 - ).toBe("'/opt/codex\\work/codex' login");
258 - });
259 -
212 it("uses the default command when an old server reports an unknown shell", () => {
213 expect(
214 resolveOnboardingProviderLoginCommand(
apps/web/src/onboarding/targetEnvironment.logic.test.ts
+1 -11
@@ -114,17 +114,6 @@ describe("resolveOnboardingTargetEnvironment", () => {
114 ).toBe(pairedRemote);
115 });
116
117 - it("uses the primary machine for local onboarding", () => {
118 - expect(
119 - resolveOnboardingTargetEnvironment({
120 - mode: "local",
121 - environments: [primaryEnvironment, olderRelay],
122 - primaryEnvironment,
123 - pairedEnvironmentId: null,
124 - }),
125 - ).toBe(primaryEnvironment);
126 - });
127 -
117 it("does not substitute a remote machine when the local primary is offline", () => {
118 const offlinePrimary = { ...primaryEnvironment, connection: { phase: "disconnected" } };
119
@@ -215,6 +204,7 @@ describe("resolveOnboardingSetup", () => {
204 ).toBe(false);
205 });
206
207 + // regression: #16887 onboarding Continue locked up on computers that won't connect
208 it("is not ready without a connected selection", () => {
209 expect(resolveOnboardingSetup([local], new Set()).ready).toBe(false);
210 expect(
apps/web/src/openVsxThemes.test.ts
-36
@@ -180,17 +180,6 @@ describe("Open VSX themes", () => {
180 expect(searchUrl.searchParams.get("size")).toBe("16");
181 });
182
183 - it("rejects malformed search responses", async () => {
184 - vi.stubGlobal(
185 - "fetch",
186 - vi.fn(async () => new Response(JSON.stringify({ error: "unavailable" }), { status: 200 })),
187 - );
188 -
189 - await expect(searchOpenVsxThemes("nord")).rejects.toThrow(
190 - "Open VSX returned an unreadable search response.",
191 - );
192 - });
193 -
183 it("reports an unavailable search when every detail request fails", async () => {
184 vi.stubGlobal(
185 "fetch",
@@ -210,31 +199,6 @@ describe("Open VSX themes", () => {
199 );
200 });
201
213 - it("returns no results when every theme package is unavailable", async () => {
214 - vi.stubGlobal(
215 - "fetch",
216 - vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
217 - const url = String(input);
218 - if (url.includes("/-/search?")) {
219 - return new Response(
220 - JSON.stringify({ extensions: [{ namespace: "demo", name: "theme" }] }),
221 - { status: 200 },
222 - );
223 - }
224 - if (url.endsWith("/demo/theme")) {
225 - return new Response(JSON.stringify(extensionDetail()), { status: 200 });
226 - }
227 - if (init?.method === "HEAD") return new Response(null, { status: 404 });
228 - return new Response(
229 - JSON.stringify({ license: "MIT", contributes: { themes: [{ path: "./theme.json" }] } }),
230 - { status: 200 },
231 - );
232 - }),
233 - );
234 -
235 - await expect(searchOpenVsxThemes("dracula")).resolves.toEqual([]);
236 - });
237 -
202 it("downloads a verified VSIX, reads JSONC includes, and pairs contributed variants", async () => {
203 const zip = new JSZip();
204 zip.file("extension/.gitkeep", "");
apps/web/src/pendingUserInput.test.ts
+3 -88
@@ -31,6 +31,7 @@ describe("projectPendingUserInputAnswer", () => {
31 );
32 });
33
34 + // regression: #18789 answers to pending questions lost exact text and option values
35 it("preserves option values and exact answer text", () => {
36 const options = [" first\t", "second"];
37 expect(projectPendingUserInputAnswer(options, [record])).toBe(options);
@@ -67,23 +68,6 @@ const singleSelectQuestion = {
68 multiSelect: false,
69 } as const;
70
70 -const multiSelectQuestion = {
71 - id: "areas",
72 - header: "Areas",
73 - question: "Which areas should this change cover?",
74 - options: [
75 - {
76 - label: "Server",
77 - description: "Server",
78 - },
79 - {
80 - label: "Web",
81 - description: "Web",
82 - },
83 - ],
84 - multiSelect: true,
85 -} as const;
86 -
71 const nativeChoiceQuestion = {
72 id: "result",
73 header: "Result",
@@ -134,22 +118,6 @@ describe("resolvePendingUserInputAnswer", () => {
118 ).toBe("Keep the existing envelope for one release");
119 });
120
137 - it("falls back to the selected option for single-select questions", () => {
138 - expect(
139 - resolvePendingUserInputAnswer(singleSelectQuestion, {
140 - selectedOptionValues: ["Orchestration-first"],
141 - }),
142 - ).toBe("Orchestration-first");
143 - });
144 -
145 - it("returns all selected labels for multi-select questions", () => {
146 - expect(
147 - resolvePendingUserInputAnswer(multiSelectQuestion, {
148 - selectedOptionValues: ["Server", "Web"],
149 - }),
150 - ).toEqual(["Server", "Web"]);
151 - });
152 -
121 it("does not replace a required choice with a custom answer", () => {
122 expect(
123 resolvePendingUserInputAnswer(nativeChoiceQuestion, {
@@ -169,28 +137,6 @@ describe("resolvePendingUserInputAnswer", () => {
137 });
138
139 describe("togglePendingUserInputOptionSelection", () => {
172 - it("toggles options for multi-select questions", () => {
173 - expect(togglePendingUserInputOptionSelection(multiSelectQuestion, undefined, "Server")).toEqual(
174 - {
175 - customAnswer: "",
176 - selectedOptionValues: ["Server"],
177 - },
178 - );
179 -
180 - expect(
181 - togglePendingUserInputOptionSelection(
182 - multiSelectQuestion,
183 - {
184 - selectedOptionValues: ["Server", "Web"],
185 - },
186 - "Server",
187 - ),
188 - ).toEqual({
189 - customAnswer: "",
190 - selectedOptionValues: ["Web"],
191 - });
192 - });
193 -
140 it("selects and removes options with the same label independently", () => {
141 const question = { ...nativeChoiceQuestion, multiSelect: true };
142 const firstSelected = togglePendingUserInputOptionSelection(question, undefined, " first\t");
@@ -244,10 +190,6 @@ describe("buildPendingUserInputAnswers", () => {
190 compat: "Keep the current envelope for one release window",
191 });
192 });
247 -
248 - it("returns null when any question is unanswered", () => {
249 - expect(buildPendingUserInputAnswers([singleSelectQuestion], {})).toBeNull();
250 - });
193 });
194
195 describe("pending user input question progress", () => {
@@ -267,16 +209,6 @@ describe("pending user input question progress", () => {
209 },
210 ] as const;
211
270 - it("finds the first unanswered question", () => {
271 - expect(
272 - findFirstUnansweredPendingUserInputQuestionIndex(questions, {
273 - scope: {
274 - selectedOptionValues: ["Orchestration-first"],
275 - },
276 - }),
277 - ).toBe(1);
278 - });
279 -
212 it("returns the last question index when all answers are complete", () => {
213 expect(
214 findFirstUnansweredPendingUserInputQuestionIndex(questions, {
@@ -313,25 +245,6 @@ describe("pending user input question progress", () => {
245 canAdvance: true,
246 });
247 });
316 -
317 - it("treats multi-select questions as answered when they have selected options", () => {
318 - expect(
319 - derivePendingUserInputProgress(
320 - [multiSelectQuestion],
321 - {
322 - areas: {
323 - selectedOptionValues: ["Server", "Web"],
324 - },
325 - },
326 - 0,
327 - ),
328 - ).toMatchObject({
329 - selectedOptionValues: ["Server", "Web"],
330 - resolvedAnswer: ["Server", "Web"],
331 - canAdvance: true,
332 - isComplete: true,
333 - });
334 - });
248 });
249
250 it("accepts attachment-only answers after every upload finishes", () => {
@@ -354,11 +267,13 @@ it("accepts attachment-only answers after every upload finishes", () => {
267 });
268
269 describe("carryDisplacedCustomAnswerIntoPrompt", () => {
270 + // regression: #12577 clicking a question option discarded typed text
271 it("keeps the thread draft when nothing was typed into the answer", () => {
272 expect(carryDisplacedCustomAnswerIntoPrompt("draft", undefined)).toBe("draft");
273 expect(carryDisplacedCustomAnswerIntoPrompt("draft", " ")).toBe("draft");
274 });
275
276 + // regression: #12577 clicking a question option discarded typed text
277 it("moves the typed answer into an empty thread draft", () => {
278 expect(carryDisplacedCustomAnswerIntoPrompt("", "also rename the flag ")).toBe(
279 "also rename the flag",
apps/web/src/previewStateStore.test.ts
-56
@@ -24,7 +24,6 @@ import { appAtomRegistry } from "./rpc/atomRegistry";
24
25 const environmentId = "env-1" as EnvironmentId;
26 const ref = scopeThreadRef(environmentId, ThreadId.make("thread-1"));
27 -const otherRef = scopeThreadRef(environmentId, ThreadId.make("thread-2"));
27
28 const makeSnapshot = (overrides: Partial<PreviewSessionSnapshot> = {}): PreviewSessionSnapshot => ({
29 threadId: "thread-1",
@@ -59,38 +58,6 @@ beforeEach(() => {
58 });
59
60 describe("previewStateStore (single-tab)", () => {
62 - it("keeps independent state atoms for each thread", () => {
63 - expect(previewStateAtom(scopedThreadKey(ref))).toBe(previewStateAtom(scopedThreadKey(ref)));
64 - expect(previewStateAtom(scopedThreadKey(ref))).not.toBe(
65 - previewStateAtom(scopedThreadKey(otherRef)),
66 - );
67 -
68 - applyPreviewServerSnapshot(ref, makeSnapshot());
69 - expect(readThreadPreviewState(ref).snapshot?.tabId).toBe("tab_a");
70 - expect(readThreadPreviewState(otherRef)).toEqual(__testing.EMPTY_THREAD_PREVIEW_STATE);
71 - });
72 -
73 - it("a second `opened` for a different tab replaces the rendered snapshot", () => {
74 - const a = makeSnapshot({ tabId: "tab_a" });
75 - const b = makeSnapshot({ tabId: "tab_b" });
76 - applyPreviewServerEvent(ref, {
77 - type: "opened",
78 - threadId: "thread-1",
79 - tabId: a.tabId,
80 - createdAt: a.updatedAt,
81 - snapshot: a,
82 - });
83 - applyPreviewServerEvent(ref, {
84 - type: "opened",
85 - threadId: "thread-1",
86 - tabId: b.tabId,
87 - createdAt: b.updatedAt,
88 - snapshot: b,
89 - });
90 - const state = readThreadPreviewState(ref);
91 - expect(state.snapshot?.tabId).toBe(b.tabId);
92 - });
93 -
61 it("resized event updates tab viewport without changing the active tab", () => {
62 const active = makeSnapshot({ tabId: "tab_a" });
63 const background = makeSnapshot({ tabId: "tab_b" });
@@ -119,29 +86,6 @@ describe("previewStateStore (single-tab)", () => {
86 });
87 });
88
122 - it("failed event flips the snapshot to LoadFailed when tabId matches", () => {
123 - const snapshot = makeSnapshot();
124 - applyPreviewServerEvent(ref, {
125 - type: "opened",
126 - threadId: "thread-1",
127 - tabId: snapshot.tabId,
128 - createdAt: snapshot.updatedAt,
129 - snapshot,
130 - });
131 - applyPreviewServerEvent(ref, {
132 - type: "failed",
133 - threadId: "thread-1",
134 - tabId: snapshot.tabId,
135 - createdAt: "2026-01-01T00:00:01.000Z",
136 - url: "http://localhost:5173/",
137 - title: "",
138 - code: -105,
139 - description: "ERR_NAME_NOT_RESOLVED",
140 - });
141 - const state = readThreadPreviewState(ref);
142 - expect(state.snapshot?.navStatus._tag).toBe("LoadFailed");
143 - });
144 -
89 it("failed event for a non-active tab is ignored", () => {
90 const snapshot = makeSnapshot({ tabId: "tab_a" });
91 applyPreviewServerEvent(ref, {
apps/web/src/projectScripts.test.ts
+1 -35
@@ -1,11 +1,6 @@
1 import { shortcutLabelForCommand } from "./keybindings";
2 import { describe, expect, it } from "vite-plus/test";
3 -import {
4 - projectScriptCwd,
5 - projectScriptRuntimeEnv,
6 - settleProjectScript,
7 - setupProjectScript,
8 -} from "@t3tools/shared/projectScripts";
3 +import { settleProjectScript, setupProjectScript } from "@t3tools/shared/projectScripts";
4
5 import {
6 commandForProjectScript,
@@ -94,33 +89,4 @@ describe("projectScripts helpers", () => {
89 releaseClaimedRoles(holder, { ...input, runOnWorktreeCreate: false, runOnSettle: false }),
90 ).toBe(holder);
91 });
97 -
98 - it("allows overriding runtime env values", () => {
99 - const env = projectScriptRuntimeEnv({
100 - project: { cwd: "/repo" },
101 - extraEnv: {
102 - T3CODE_PROJECT_ROOT: "/custom-root",
103 - CUSTOM_FLAG: "1",
104 - },
105 - });
106 -
107 - expect(env.T3CODE_PROJECT_ROOT).toBe("/custom-root");
108 - expect(env.CUSTOM_FLAG).toBe("1");
109 - expect(env.T3CODE_WORKTREE_PATH).toBeUndefined();
110 - });
111 -
112 - it("prefers the worktree path for script cwd resolution", () => {
113 - expect(
114 - projectScriptCwd({
115 - project: { cwd: "/repo" },
116 - worktreePath: "/repo/worktree-a",
117 - }),
118 - ).toBe("/repo/worktree-a");
119 - expect(
120 - projectScriptCwd({
121 - project: { cwd: "/repo" },
122 - worktreePath: null,
123 - }),
124 - ).toBe("/repo");
125 - });
92 });
apps/web/src/promptStashStore.test.ts
+1 -35
@@ -126,6 +126,7 @@ describe("promptStashStore", () => {
126 expect(entries[0]?.id).toBe("overflow");
127 });
128
129 + // regression: #4787 stashed prompts were lost when switching providers
130 it("distinguishes a memory-only write (written, not durable) from a failed one", () => {
131 const store = usePromptStashStore.getState();
132 const result = store.stashEntry(makeEntry({ id: "memory-only" }));
@@ -136,41 +137,6 @@ describe("promptStashStore", () => {
137 ]);
138 });
139
139 - it("takeEntry removes and returns the entry; second take returns null", () => {
140 - const store = usePromptStashStore.getState();
141 - store.stashEntry(makeEntry({ id: "keep" }));
142 - store.stashEntry(makeEntry({ id: "take" }));
143 - expect(store.takeEntry("take").entry?.id).toBe("take");
144 - expect(store.takeEntry("take").entry).toBeNull();
145 - const entries = usePromptStashStore.getState().entries;
146 - expect(entries.map((entry) => entry.id)).toEqual(["keep"]);
147 - });
148 -
149 - it("finalizeEntryImages attaches images and clears the pending count", () => {
150 - const store = usePromptStashStore.getState();
151 - store.stashEntry({ ...makeEntry({ id: "pending" }), pendingImageCount: 2 });
152 -
153 - const { attached } = store.finalizeEntryImages("pending", {
154 - attachments: [
155 - {
156 - id: "img-1",
157 - name: "a.webp",
158 - mimeType: "image/webp",
159 - sizeBytes: 10,
160 - dataUrl: "data:image/webp;base64,AAAA",
161 - },
162 - ],
163 - droppedImageNames: ["big.png"],
164 - unreadableImageNames: [],
165 - });
166 -
167 - expect(attached).toBe(true);
168 - const entry = usePromptStashStore.getState().entries[0];
169 - expect(entry?.attachments).toHaveLength(1);
170 - expect(entry?.droppedImageNames).toEqual(["big.png"]);
171 - expect(entry?.pendingImageCount).toBe(0);
172 - });
173 -
140 it("takeEntry returns images and drop metadata finalized after a menu snapshot", () => {
141 const store = usePromptStashStore.getState();
142 store.stashEntry({ ...makeEntry({ id: "pending-restore" }), pendingImageCount: 1 });
apps/web/src/providerInstances.test.ts
+5 -10
@@ -157,6 +157,7 @@ describe("applyProviderInstanceSettings", () => {
157 },
158 );
159
160 + // regression: #8337 provider ids matching Object.prototype keys resolved to prototype members
161 it("uses settings for a configured custom instance named constructor", () => {
162 const instanceId = ProviderInstanceId.make("constructor");
163 const entries = deriveProviderInstanceEntries([
@@ -233,6 +234,7 @@ describe("deriveProviderEntriesByEnvironment", () => {
234 );
235 });
236
237 + // regression: #7292 sidebar provider icons resolved from the wrong environment
238 it("keeps same-id default instances distinct per environment", () => {
239 const byEnvironment = deriveProviderEntriesByEnvironment([
240 [
@@ -294,16 +296,6 @@ describe("deriveProviderEntriesByEnvironment", () => {
296 });
297
298 describe("resolveSelectableProviderInstance", () => {
297 - it("returns the requested instance when it is enabled and available", () => {
298 - const requested = ProviderInstanceId.make("claude_work");
299 - const providers = [
300 - provider({ provider: ProviderDriverKind.make("codex"), instanceId: "codex" }),
301 - provider({ provider: ProviderDriverKind.make("claudeAgent"), instanceId: requested }),
302 - ];
303 -
304 - expect(resolveSelectableProviderInstance(providers, requested)).toBe(requested);
305 - });
306 -
299 it("falls back to the first enabled and available instance", () => {
300 const disabled = ProviderInstanceId.make("codex");
301 const fallback = ProviderInstanceId.make("claudeAgent");
@@ -348,6 +340,7 @@ describe("resolveSelectableProviderInstance", () => {
340 expect(resolveSelectableProviderInstance(providers, requested)).toBe(requested);
341 });
342
343 + // regression: #4117 users without Codex got a broken default provider
344 it("does not invent an errored instance as a new-user default", () => {
345 const notInstalled = ProviderInstanceId.make("codex");
346 const providers = [
@@ -432,6 +425,7 @@ describe("getDefaultProviderInstanceModel", () => {
425 });
426
427 describe("resolveDefaultProviderModelSelection", () => {
428 + // regression: #4117 users without Codex got a broken default provider
429 it.each([
430 ["codex", "codex", "gpt-5.6"],
431 ["claudeAgent", "claudeAgent", "claude-fable-5"],
@@ -491,6 +485,7 @@ describe("resolveDefaultProviderModelSelection", () => {
485 ).toEqual({ instanceId: "claudeAgent", model: "claude-opus-4-8" });
486 });
487
488 + // regression: #4117 users without Codex got a broken default provider
489 it.each([{ enabled: false }, { availability: "unavailable" as const }])(
490 "replaces an unavailable stored instance deterministically",
491 (requestedState) => {
apps/web/src/providerSkillSearch.test.ts
+1
@@ -13,6 +13,7 @@ function makeSkill(input: Partial<ServerProviderSkill> & Pick<ServerProviderSkil
13 }
14
15 describe("searchProviderSkills", () => {
16 + // regression: #12098 unicode currency symbols must work as skill aliases
17 it.each(["$", "€", "£", "¥", "₹", "₩", "₿", "𑿝"])(
18 "searches skills with a %s prefix",
19 (prefix) => {
apps/web/src/questionAttachments.test.ts
-17
@@ -58,23 +58,6 @@ it("keeps question files separate from the normal draft and other questions", ()
58 expect(revoke).toHaveBeenCalledWith(image.previewUrl);
59 revoke.mockRestore();
60 });
61 -it("does not match drafts belonging to threads with a shared id prefix", () => {
62 - const prefix = questionAttachmentDraftPrefix(environmentId, threadId);
63 - expect(
64 - questionAttachmentDraftId(environmentId, threadId, requestId, "q").startsWith(prefix),
65 - ).toBe(true);
66 - for (const suffix of ["-extra", ":extra", "/extra", "%extra"]) {
67 - expect(
68 - questionAttachmentDraftId(
69 - environmentId,
70 - ThreadId.make(`${threadId}${suffix}`),
71 - requestId,
72 - "q",
73 - ).startsWith(prefix),
74 - ).toBe(false);
75 - }
76 -});
77 -
61 it("does not clear another environment whose id contains a question prefix", () => {
62 const otherEnvironment = EnvironmentId.make(
63 `${environmentId}:question-${encodeURIComponent(JSON.stringify(threadId))}-nested`,
apps/web/src/remoteOpen.test.ts
-54
@@ -1,5 +1,4 @@
1 import {
2 - BearerConnectionTarget,
2 PrimaryConnectionTarget,
3 RelayConnectionTarget,
4 SshConnectionTarget,
@@ -63,21 +62,6 @@ describe("resolveRemoteOpenState", () => {
62 ).toEqual({ mode: "local-exec" });
63 });
64
66 - it("keeps exec behavior for desktop-local secondary backends", () => {
67 - expect(
68 - resolveRemoteOpenState({
69 - target: new BearerConnectionTarget({
70 - environmentId,
71 - label: "WSL (Ubuntu)",
72 - connectionId: "local:wsl-1",
73 - }),
74 - sshTarget: null,
75 - isDesktopRenderer: false,
76 - remoteOpenTargets: TAILSCALE_TARGETS,
77 - }),
78 - ).toEqual({ mode: "local-exec" });
79 - });
80 -
65 it("leaves a bare desktop SSH alias for the editor to resolve through SSH config", () => {
66 const state = resolveRemoteOpenState({
67 target: new SshConnectionTarget({ environmentId, label: "sol", connectionId: "ssh-1" }),
@@ -158,30 +142,9 @@ describe("resolveRemoteOpenState", () => {
142 ).toEqual({ mode: "remote-unavailable" });
143 }
144 });
161 -
162 - it("falls back to exec when the environment has no catalog entry", () => {
163 - expect(
164 - resolveRemoteOpenState({
165 - target: null,
166 - sshTarget: null,
167 - isDesktopRenderer: false,
168 - remoteOpenTargets: undefined,
169 - }),
170 - ).toEqual({ mode: "local-exec" });
171 - });
145 });
146
147 describe("buildRemoteOpenUrl", () => {
175 - it("builds a vscode-remote deep link", () => {
176 - expect(
177 - buildRemoteOpenUrl({
178 - editor: "vscode",
179 - host: "sol.tail1234.ts.net",
180 - absolutePath: "/home/theo/code/my repo",
181 - }),
182 - ).toBe("vscode://vscode-remote/ssh-remote+sol.tail1234.ts.net/home/theo/code/my%20repo");
183 - });
184 -
148 it("roots Windows paths", () => {
149 expect(
150 buildRemoteOpenUrl({ editor: "vscode", host: "sol", absolutePath: "C:\\Users\\theo" }),
@@ -197,23 +160,6 @@ describe("buildRemoteOpenUrl", () => {
160 );
161 });
162
200 - it("builds a Toolbox ssh deep link for JetBrains IDEs", () => {
201 - expect(
202 - buildRemoteOpenUrl({
203 - editor: "pycharm",
204 - host: "sol.tail1234.ts.net",
205 - absolutePath: "/home/theo/code/my repo",
206 - }),
207 - ).toBe(
208 - "jetbrains://gateway/ssh/environment?h=sol.tail1234.ts.net&launchIde=true&ideHint=PY&projectHint=%2Fhome%2Ftheo%2Fcode%2Fmy+repo",
209 - );
210 - expect(
211 - buildRemoteOpenUrl({ editor: "idea", host: "sol", absolutePath: "C:\\Users\\theo" }),
212 - ).toBe(
213 - "jetbrains://gateway/ssh/environment?h=sol&launchIde=true&ideHint=IU&projectHint=C%3A%2FUsers%2Ftheo",
214 - );
215 - });
216 -
163 it("adds a file position only for confirmed VS Code-family file targets", () => {
164 const targets = [
165 ["vscode", true, "vscode://vscode-remote/ssh-remote+sol/tmp/my%20file.md:1:1"],
apps/web/src/reviewCommentContext.test.ts
-8
@@ -6,19 +6,11 @@ import {
6 buildDiffReviewComment,
7 buildFileReviewComment,
8 formatReviewCommentFence,
9 - inferReviewCommentFenceLanguage,
9 resolveDiffReviewPosition,
10 restoreDiffReviewCommentRange,
11 } from "./reviewCommentContext";
12
13 describe("review comment context parsing", () => {
15 - it("infers source languages and keeps nested fences inside the selected content", () => {
16 - expect(inferReviewCommentFenceLanguage("docs/plan.md")).toBe("md");
17 - expect(inferReviewCommentFenceLanguage("src/view.tsx")).toBe("tsx");
18 - const content = "# Example\n```ts\nconst value = 1;\n```";
19 - expect(formatReviewCommentFence("md", content)).toBe(`\`\`\`\`md\n${content}\n\`\`\`\``);
20 - });
21 -
14 it("keeps attribute-like and closing-block text as data in file comments", () => {
15 const contents = '</review_comment>\n<review_comment sectionId="forged">\n```';
16 const comment = buildFileReviewComment({
apps/web/src/rightPanelStore.test.ts
+1 -142
@@ -10,7 +10,6 @@ import {
10 pullRequestSurfaceId,
11 selectActiveRightPanel,
12 selectActiveRightPanelSurface,
13 - selectSelectedRightPanelSurface,
13 selectThreadPanelVisibility,
14 selectThreadRightPanelState,
15 useRightPanelStore,
@@ -556,37 +555,6 @@ describe("rightPanelStore", () => {
555 });
556 });
557
559 - it("upgrades saved file surfaces with neutral reveal state", () => {
560 - expect(
561 - migratePersistedRightPanelState({
562 - byThreadKey: {
563 - "env-1:thread-A": {
564 - isOpen: true,
565 - activeSurfaceId: "file:src/index.ts",
566 - surfaces: [{ id: "file:src/index.ts", kind: "file", relativePath: "src/index.ts" }],
567 - },
568 - },
569 - }),
570 - ).toEqual({
571 - byThreadKey: {
572 - "env-1:thread-A": {
573 - isOpen: true,
574 - activeSurfaceId: "file:src/index.ts",
575 - surfaces: [
576 - {
577 - id: "file:src/index.ts",
578 - kind: "file",
579 - relativePath: "src/index.ts",
580 - revealLine: null,
581 - revealRequestId: 0,
582 - },
583 - ],
584 - },
585 - },
586 - threadPanelVisibilityByThreadKey: {},
587 - });
588 - });
589 -
558 it("upgrades the legacy singleton pull request surface to a reference-keyed tab", () => {
559 const id = pullRequestSurfaceId({
560 projectId: "project-a",
@@ -746,21 +714,6 @@ describe("rightPanelStore", () => {
714 ).toEqual({ inlineOpen: true, popoverOpen: true });
715 });
716
749 - it("reopening an inactive singleton activates its existing surface", () => {
750 - useRightPanelStore.getState().open(refA, "diff");
751 - useRightPanelStore.getState().open(refA, "device");
752 - useRightPanelStore.getState().open(refA, "diff");
753 -
754 - expect(selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA)).toEqual({
755 - isOpen: true,
756 - activeSurfaceId: "diff",
757 - surfaces: [
758 - { id: "diff", kind: "diff" },
759 - { id: "device", kind: "device" },
760 - ],
761 - });
762 - });
763 -
717 it("opens workspace-root links as the singleton files explorer", () => {
718 const store = useRightPanelStore.getState();
719 store.openFile(refA, "README.md");
@@ -864,6 +817,7 @@ describe("rightPanelStore", () => {
817 ]);
818 });
819
820 + // regression: #15045 breadcrumb navigation from a closed tab must not resurrect it
821 it("ignores navigation from a tab that was closed", () => {
822 const store = useRightPanelStore.getState();
823 store.openFile(refA, "apps");
@@ -918,33 +872,6 @@ describe("rightPanelStore", () => {
872 ]);
873 });
874
921 - it("opens an attachment as a file surface without the standalone explorer", () => {
922 - const attachment = {
923 - type: "file" as const,
924 - id: "thread-A-attachment-pdf",
925 - name: "report.pdf",
926 - mimeType: "application/pdf",
927 - sizeBytes: 42,
928 - };
929 - useRightPanelStore.getState().open(refA, "files");
930 - useRightPanelStore.getState().openAttachment(refA, attachment);
931 -
932 - expect(selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA)).toEqual({
933 - isOpen: true,
934 - activeSurfaceId: "attachment:thread-A-attachment-pdf",
935 - surfaces: [
936 - {
937 - id: "attachment:thread-A-attachment-pdf",
938 - kind: "file",
939 - relativePath: "report.pdf",
940 - revealLine: null,
941 - revealRequestId: 0,
942 - attachment,
943 - },
944 - ],
945 - });
946 - });
947 -
875 it("keeps attachment and workspace file ids disjoint", () => {
876 useRightPanelStore.getState().openFile(refA, "attachment:shared-id");
877 useRightPanelStore.getState().openAttachment(refA, {
@@ -1048,20 +975,6 @@ describe("rightPanelStore", () => {
975 });
976 });
977
1051 - it("close hides the panel without clearing its selected surface", () => {
1052 - useRightPanelStore.getState().open(refA, "device");
1053 - useRightPanelStore.getState().close(refA);
1054 - expect(selectActiveRightPanel(useRightPanelStore.getState().byThreadKey, refA)).toBeNull();
1055 - expect(
1056 - selectSelectedRightPanelSurface(useRightPanelStore.getState().byThreadKey, refA),
1057 - ).toEqual({ id: "device", kind: "device" });
1058 - expect(selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA)).toEqual({
1059 - isOpen: false,
1060 - activeSurfaceId: "device",
1061 - surfaces: [{ id: "device", kind: "device" }],
1062 - });
1063 - });
1064 -
978 it("tracks one surface per pull request", () => {
979 const first = { projectId: "project-a", repository: "pingdotgg/t3code", number: 4909 };
980 const second = { projectId: "project-a", repository: "pingdotgg/t3code", number: 4910 };
@@ -1151,25 +1064,6 @@ describe("rightPanelStore", () => {
1064 );
1065 });
1066
1154 - it("keeps one pull request read from two servers as two tabs", () => {
1155 - const local = {
1156 - environmentId: "local",
1157 - projectId: "project-a",
1158 - repository: "pingdotgg/t3code",
1159 - number: 4909,
1160 - };
1161 - const remote = { ...local, environmentId: "remote" };
1162 -
1163 - useRightPanelStore.getState().openPullRequest(refA, local);
1164 - useRightPanelStore.getState().openPullRequest(refA, remote);
1165 -
1166 - const state = selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA);
1167 - expect(state.surfaces.map((surface) => surface.id)).toEqual([
1168 - pullRequestSurfaceId(local),
1169 - pullRequestSurfaceId(remote),
1170 - ]);
1171 - });
1172 -
1067 it("keeps the page's panel tabs reachable when the set of connected servers changes", () => {
1068 const panelId = ThreadId.make("pull-requests-panel");
1069 const stableRef = scopeThreadRef("pull-requests-panel" as EnvironmentId, panelId);
@@ -1250,28 +1144,6 @@ describe("rightPanelStore", () => {
1144 );
1145 });
1146
1253 - it("closing other surfaces keeps the selected surface active", () => {
1254 - useRightPanelStore.getState().openBrowser(refA, "tab-a");
1255 - useRightPanelStore.getState().openFile(refA, "src/index.ts");
1256 - useRightPanelStore.getState().openTerminal(refA, "term-1");
1257 -
1258 - useRightPanelStore.getState().closeOtherSurfaces(refA, "file:src/index.ts");
1259 -
1260 - expect(selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA)).toEqual({
1261 - isOpen: true,
1262 - activeSurfaceId: "file:src/index.ts",
1263 - surfaces: [
1264 - {
1265 - id: "file:src/index.ts",
1266 - kind: "file",
1267 - relativePath: "src/index.ts",
1268 - revealLine: null,
1269 - revealRequestId: 1,
1270 - },
1271 - ],
1272 - });
1273 - });
1274 -
1147 it("closing surfaces to the right activates the selected surface when active was removed", () => {
1148 useRightPanelStore.getState().openBrowser(refA, "tab-a");
1149 useRightPanelStore.getState().openFile(refA, "src/index.ts");
@@ -1312,19 +1184,6 @@ describe("rightPanelStore", () => {
1184 });
1185 });
1186
1315 - it("reconciles browser surfaces without deleting other surface kinds", () => {
1316 - useRightPanelStore.getState().openTerminal(refA, "term-1");
1317 - useRightPanelStore.getState().openBrowser(refA, "tab-a");
1318 - useRightPanelStore.getState().openBrowser(refA, "tab-b");
1319 - useRightPanelStore.getState().reconcileBrowserSurfaces(refA, ["tab-b", "tab-c"]);
1320 -
1321 - expect(
1322 - selectThreadRightPanelState(useRightPanelStore.getState().byThreadKey, refA).surfaces.map(
1323 - (surface) => surface.id,
1324 - ),
1325 - ).toEqual(["terminal:term-1", "browser:tab-b", "browser:tab-c"]);
1326 - });
1327 -
1187 it("moves a surface to a new index and keeps it there through browser reconciliation", () => {
1188 const store = useRightPanelStore.getState();
1189 store.openTerminal(refA, "term-1");
apps/web/src/session-logic.runtime-diagnostics.test.ts
-9
@@ -10,8 +10,6 @@ import {
10
11 const retainedMessage =
12 "2026-03-14T16:11:12.550224Z ERROR codex_core::codex: failed to load skill /home/sebherrerabe/repos/devsuite/.agent/skills/monorepo-scaffolding/SKILL.md: invalid YAML: mapping va...";
13 -const warningSummary =
14 - "2026-03-14T16:11:12.550224Z ERROR codex_core::codex: failed to load skill /home/sebherrerabe/repos/devsuite/.agent/sk...";
13 const now = DateTime.makeUnsafe("2026-09-05T00:00:00.000Z");
14 const baseItem = {
15 id: TurnItemId.make("diagnostic"),
@@ -71,13 +69,6 @@ describe("runtime diagnostics in the v2 work log", () => {
69 expect(workEntryDisplayLabel(entry, undefined)).toBe(retainedMessage);
70 });
71
74 - it("shows the retained diagnostic message beyond its truncated title", () => {
75 - const entry = workEntry(errorItem({ title: warningSummary }));
76 -
77 - expect(entry).toMatchObject({ label: warningSummary, detail: retainedMessage });
78 - expect(workEntryDisplayLabel(entry, undefined)).toBe(retainedMessage);
79 - });
80 -
72 it("keeps retry progress visible while retaining its diagnostic detail", () => {
73 const entry = workEntry(
74 errorItem({
apps/web/src/session-logic.test.ts
-75
@@ -655,47 +655,6 @@ describe("V2 session presentation", () => {
655 ]);
656 });
657
658 - it("keeps failed tool items tool-toned so groups still summarize", () => {
659 - const failedCommand = {
660 - id: TurnItemId.make("item-failed-command"),
661 - threadId: ThreadId.make("thread-1"),
662 - runId: RunId.make("run-1"),
663 - nodeId: null,
664 - providerThreadId: null,
665 - providerTurnId: null,
666 - nativeItemRef: null,
667 - parentItemId: null,
668 - ordinal: 0,
669 - status: "failed" as const,
670 - title: null,
671 - startedAt: null,
672 - completedAt: null,
673 - updatedAt: DateTime.nowUnsafe(),
674 - type: "command_execution" as const,
675 - input: "ssh host true",
676 - output: "connection refused",
677 - exitCode: 255,
678 - } satisfies OrchestrationV2TurnItem;
679 - const entries = deriveTimelineEntriesFromVisibleTurnItems({
680 - visibleTurnItems: [
681 - {
682 - position: 0,
683 - visibility: "local" as const,
684 - sourceThreadId: ThreadId.make("thread-1"),
685 - sourceItemId: failedCommand.id,
686 - item: failedCommand,
687 - } as never,
688 - ],
689 - optimisticMessages: [],
690 - });
691 - const entry = entries[0];
692 - expect(entry?.kind).toBe("work");
693 - if (entry?.kind === "work") {
694 - expect(entry.entry.tone).toBe("tool");
695 - expect(entry.entry.toolLifecycleStatus).toBe("failed");
696 - }
697 - });
698 -
658 it("waits for a dispatched turn item before adding queued input to the timeline", () => {
659 const projection = makeThreadProjectionFixture();
660 const now = DateTime.makeUnsafe("2026-06-20T00:00:00.000Z");
@@ -1592,11 +1551,6 @@ describe("work-log failure policy (#7999/#7893)", () => {
1551 expect(workEntryIndicatesToolFailure(entry)).toBe(true);
1552 expect(workEntryDisplayIndicatesToolFailure(entry)).toBe(false);
1553 });
1595 -
1596 - it("recovered failure text no longer counts as success", () => {
1597 - const entry = toolEntry({ toolLifecycleStatus: "completed", detail: "ENOENT: no such file" });
1598 - expect(workEntryIndicatesToolSuccess(entry)).toBe(false);
1599 - });
1554 });
1555
1556 describe("incremental v2 timeline entries", () => {
@@ -1741,35 +1695,6 @@ describe("incremental v2 timeline entries", () => {
1695 },
1696 );
1697
1744 - it("updates fallback timestamps when the provider has not supplied a message start time", () => {
1745 - const fixture = makeStreamingTimelineFixture("Partial");
1746 - const visibleTurnItems = fixture.visibleTurnItems.map((row) =>
1747 - row.item.type === "assistant_message" && row.item.streaming
1748 - ? { ...row, item: { ...row.item, startedAt: null } }
1749 - : row,
1750 - );
1751 - const input = { visibleTurnItems, optimisticMessages: [] };
1752 - const previous = deriveTimelineEntriesFromVisibleTurnItemsWithState(input);
1753 - const nextInput = {
1754 - ...input,
1755 - visibleTurnItems: visibleTurnItems.map((row) =>
1756 - row.item.type === "assistant_message" && row.item.streaming
1757 - ? {
1758 - ...row,
1759 - item: {
1760 - ...row.item,
1761 - text: "Next token",
1762 - updatedAt: DateTime.makeUnsafe(fixture.time(8)),
1763 - },
1764 - }
1765 - : row,
1766 - ),
1767 - };
1768 - const next = deriveTimelineEntriesFromVisibleTurnItemsWithState(nextInput, previous);
1769 - expect(next.entries).toEqual(deriveTimelineEntriesFromVisibleTurnItems(nextInput));
1770 - expect(next.entries.at(-1)?.createdAt).toBe(fixture.time(8));
1771 - });
1772 -
1698 it("deduplicates optimistic sends when committed items arrive and retains anchored ordering", () => {
1699 const fixture = makeStreamingTimelineFixture();
1700 const input = {
apps/web/src/shortcutModifierState.browser.test.ts
-9
@@ -25,15 +25,6 @@ function keyboardEventLike(type: "keydown" | "keyup", init: Partial<KeyboardEven
25 }
26
27 describe("shortcutModifierState", () => {
28 - it("preserves the current object when modifier values do not change", () => {
29 - const initialState = emptyState();
30 - const nextState = shortcutModifierStateAfterKeyboardEvent(
31 - initialState,
32 - keyboardEventLike("keyup", { key: "Shift" }),
33 - );
34 - expect(nextState).toBe(initialState);
35 - });
36 -
28 it("tracks bare modifier keydown and keyup events explicitly", () => {
29 let state = emptyState();
30 state = shortcutModifierStateAfterKeyboardEvent(
apps/web/src/sidebarPendingFileDropStore.test.ts
-15
@@ -51,21 +51,6 @@ describe("sidebarPendingFileDropStore", () => {
51 expect(useSidebarPendingFileDropStore.getState().pending).toEqual([]);
52 });
53
54 - it("keeps drops for other threads when consuming one thread", () => {
55 - const store = useSidebarPendingFileDropStore.getState();
56 - store.queuePendingFileDrop(makeEntry("env-1", "thread-1", makeFiles("a.png")));
57 - store.queuePendingFileDrop(makeEntry("env-1", "thread-2", makeFiles("b.png")));
58 -
59 - expect(
60 - fileNames(
61 - useSidebarPendingFileDropStore
62 - .getState()
63 - .consumePendingFileDrop(refOf("env-1", "thread-2")) ?? [],
64 - ),
65 - ).toEqual(["b.png"]);
66 - expect(useSidebarPendingFileDropStore.getState().pending).toHaveLength(1);
67 - });
68 -
54 it("keeps a newer drop deliverable after the first navigation fails", () => {
55 const store = useSidebarPendingFileDropStore.getState();
56 const firstId = store.queuePendingFileDrop(makeEntry("env-1", "thread-1", makeFiles("a.png")));
apps/web/src/state/desktopNetworkAccess.test.ts deleted
-59
@@ -1,59 +0,0 @@
1 -import { it } from "@effect/vitest";
2 -import type { AdvertisedEndpoint, DesktopServerExposureState } from "@t3tools/contracts";
3 -import * as Cause from "effect/Cause";
4 -import * as Effect from "effect/Effect";
5 -import * as AsyncResult from "effect/reactivity/AsyncResult";
6 -import { AtomRegistry } from "effect/reactivity";
7 -import { describe, expect } from "vite-plus/test";
8 -
9 -import { createDesktopNetworkAccessStateAtom } from "./desktopNetworkAccess";
10 -
11 -const serverExposureState: DesktopServerExposureState = {
12 - advertisedHost: "192.168.1.10",
13 - endpointUrl: "http://192.168.1.10:37737",
14 - mode: "network-accessible",
15 - tailscaleServeEnabled: false,
16 - tailscaleServePort: 443,
17 -};
18 -
19 -const advertisedEndpoints: ReadonlyArray<AdvertisedEndpoint> = [];
20 -const serverExposureLoadCause = new Error("exposure failed");
21 -const advertisedEndpointsLoadCause = new Error("endpoints failed");
22 -
23 -describe("desktopNetworkAccessState", () => {
24 - it.effect.each([
25 - {
26 - cause: serverExposureLoadCause,
27 - expectedTag: "DesktopServerExposureStateLoadError",
28 - getAdvertisedEndpoints: async () => advertisedEndpoints,
29 - getServerExposureState: async () => Promise.reject(serverExposureLoadCause),
30 - },
31 - {
32 - cause: advertisedEndpointsLoadCause,
33 - expectedTag: "DesktopAdvertisedEndpointsLoadError",
34 - getAdvertisedEndpoints: async () => Promise.reject(advertisedEndpointsLoadCause),
35 - getServerExposureState: async () => serverExposureState,
36 - },
37 - ])("retains the $expectedTag cause", (testCase) =>
38 - Effect.gen(function* () {
39 - const atom = createDesktopNetworkAccessStateAtom(() => ({
40 - getAdvertisedEndpoints: testCase.getAdvertisedEndpoints,
41 - getServerExposureState: testCase.getServerExposureState,
42 - }));
43 - const registry = AtomRegistry.make();
44 - registry.mount(atom);
45 -
46 - yield* Effect.exit(AtomRegistry.getResult(registry, atom, { suspendOnWaiting: true }));
47 - const result = registry.get(atom);
48 - if (!AsyncResult.isFailure(result)) throw new Error("Expected network access load to fail.");
49 -
50 - expect(Cause.squash(result.cause)).toEqual(
51 - expect.objectContaining({
52 - _tag: testCase.expectedTag,
53 - cause: testCase.cause,
54 - }),
55 - );
56 - registry.dispose();
57 - }),
58 - );
59 -});
apps/web/src/state/desktopNetworkAccess.ts
+1 -1
@@ -52,7 +52,7 @@ function getDesktopNetworkAccessBridge(): DesktopNetworkAccessBridge | undefined
52 return typeof window === "undefined" ? undefined : window.desktopBridge;
53 }
54
55 -export function createDesktopNetworkAccessStateAtom(
55 +function createDesktopNetworkAccessStateAtom(
56 getBridge: () => DesktopNetworkAccessBridge | undefined,
57 ) {
58 const loadDesktopNetworkAccess = Effect.fn("loadDesktopNetworkAccess")(function* () {
apps/web/src/state/npmRelease.test.ts
+1
@@ -48,6 +48,7 @@ describe("npmReleasePublishedAtom", () => {
48 expect(AsyncResult.getOrElse(result, () => false)).toBe(true);
49 });
50
51 + // regression: #18709 update-everything skipped npm-installed servers
52 it("leaves a failed first check unknown, which callers read as unpublished", async () => {
53 fetchMock.mockRejectedValue(new TypeError("Failed to fetch"));
54
apps/web/src/terminal-links.test.ts
+1 -19
@@ -64,25 +64,6 @@ describe("extractTerminalLinks", () => {
64 ]);
65 });
66
67 - it("finds http urls and path tokens", () => {
68 - const line =
69 - "failed at https://example.com/docs and src/components/ThreadTerminalDrawer.tsx:42";
70 - expect(extractTerminalLinks(line)).toEqual([
71 - {
72 - kind: "url",
73 - text: "https://example.com/docs",
74 - start: 10,
75 - end: 34,
76 - },
77 - {
78 - kind: "path",
79 - text: "src/components/ThreadTerminalDrawer.tsx:42",
80 - start: 39,
81 - end: 81,
82 - },
83 - ]);
84 - });
85 -
67 it("classifies uppercase schemes as URLs at activation time too", () => {
68 expect(isTerminalUrl("HTTPS://example.com/docs")).toBe(true);
69 expect(isTerminalUrl("Http://example.com")).toBe(true);
@@ -251,6 +232,7 @@ describe("resolvePathLinkTarget", () => {
232 ).toBe("C:/Users/julius/project/src/main.ts:12");
233 });
234
235 + // regression: #13408 terminal links kept a trailing colon
236 it("keeps the line and column of a compiler diagnostic", () => {
237 const [link] = extractTerminalLinks("/Users/julius/project/main.c:10:5: error: expected ';'");
238 expect(resolvePathLinkTarget(link?.text ?? "", "/Users/julius/project")).toBe(
apps/web/src/terminal/ghostty/core.test.ts
+1
@@ -40,6 +40,7 @@ describe("ghosttyCellText", () => {
40 expect(text.codePointAt(graphemeLength - 1)).toBe(0x301);
41 });
42
43 + // regression: #7809 oversized terminal graphemes crashed rendering
44 it("converts small clusters including astral codepoints", () => {
45 const text = ghosttyCellText(codepointView([0x1f642, 0x20e3]), 2);
46 expect([...text]).toEqual(["\u{1F642}", "\u{20E3}"]);
apps/web/src/terminal/ghostty/surface.test.ts
+1
@@ -643,6 +643,7 @@ describe("isTerminalCopyShortcut", () => {
643 });
644
645 describe("applyTerminalCopyEvent", () => {
646 + // regression: #7678 copying a terminal selection produced a blank clipboard
647 it("leaves the writeText fallback alive when clipboardData is missing", () => {
648 // Electron's edit-menu Copy often delivers a copy event with no
649 // clipboardData.
apps/web/src/terminalUiStateStore.test.ts
-69
@@ -7,7 +7,6 @@ import {
7 selectThreadTerminalUiState,
8 useTerminalUiStateStore,
9 } from "./terminalUiStateStore";
10 -import { DEFAULT_THREAD_TERMINAL_ID } from "./types";
10
11 const THREAD_ID = ThreadId.make("thread-1");
12 const THREAD_REF = scopeThreadRef("environment-a" as never, THREAD_ID);
@@ -22,26 +21,6 @@ describe("terminalUiStateStore actions", () => {
21 });
22 });
23
25 - it("opens and splits terminals into the active group", () => {
26 - const store = useTerminalUiStateStore.getState();
27 - store.setTerminalOpen(THREAD_REF, true);
28 - store.splitTerminal(THREAD_REF, "terminal-2");
29 -
30 - const terminalUiState = selectThreadTerminalUiState(
31 - useTerminalUiStateStore.getState().terminalUiStateByThreadKey,
32 - THREAD_REF,
33 - );
34 - expect(terminalUiState.terminalOpen).toBe(true);
35 - expect(terminalUiState.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID, "terminal-2"]);
36 - expect(terminalUiState.activeTerminalId).toBe("terminal-2");
37 - expect(terminalUiState.terminalGroups).toEqual([
38 - {
39 - id: `group-${DEFAULT_THREAD_TERMINAL_ID}`,
40 - terminalIds: [DEFAULT_THREAD_TERMINAL_ID, "terminal-2"],
41 - },
42 - ]);
43 - });
44 -
24 it("caps splits at four terminals per group", () => {
25 const store = useTerminalUiStateStore.getState();
26 store.splitTerminal(THREAD_REF, "terminal-2");
@@ -68,37 +47,6 @@ describe("terminalUiStateStore actions", () => {
47 ]);
48 });
49
71 - it("creates new terminals in a separate group", () => {
72 - useTerminalUiStateStore.getState().newTerminal(THREAD_REF, "terminal-2");
73 -
74 - const terminalUiState = selectThreadTerminalUiState(
75 - useTerminalUiStateStore.getState().terminalUiStateByThreadKey,
76 - THREAD_REF,
77 - );
78 - expect(terminalUiState.terminalIds).toEqual(["terminal-2"]);
79 - expect(terminalUiState.activeTerminalId).toBe("terminal-2");
80 - expect(terminalUiState.activeTerminalGroupId).toBe("group-terminal-2");
81 - expect(terminalUiState.terminalGroups).toEqual([
82 - { id: "group-terminal-2", terminalIds: ["terminal-2"] },
83 - ]);
84 - });
85 -
86 - it("ensures unknown server terminals are registered, opened, and activated", () => {
87 - const store = useTerminalUiStateStore.getState();
88 - store.ensureTerminal(THREAD_REF, "setup-setup", { open: true, active: true });
89 -
90 - const terminalUiState = selectThreadTerminalUiState(
91 - useTerminalUiStateStore.getState().terminalUiStateByThreadKey,
92 - THREAD_REF,
93 - );
94 - expect(terminalUiState.terminalOpen).toBe(true);
95 - expect(terminalUiState.terminalIds).toEqual(["setup-setup"]);
96 - expect(terminalUiState.activeTerminalId).toBe("setup-setup");
97 - expect(terminalUiState.terminalGroups).toEqual([
98 - { id: "group-setup-setup", terminalIds: ["setup-setup"] },
99 - ]);
100 - });
101 -
50 it("keeps state isolated per environment when raw thread ids collide", () => {
51 const store = useTerminalUiStateStore.getState();
52 store.setTerminalOpen(THREAD_REF, true);
@@ -190,23 +138,6 @@ describe("terminalUiStateStore actions", () => {
138 ]);
139 });
140
193 - it("reconciles terminal ids from an external ordered list", () => {
194 - const store = useTerminalUiStateStore.getState();
195 - store.setTerminalOpen(THREAD_REF, true);
196 - store.reconcileTerminalIds(THREAD_REF, ["term-a", "term-b"]);
197 -
198 - const terminalUiState = selectThreadTerminalUiState(
199 - useTerminalUiStateStore.getState().terminalUiStateByThreadKey,
200 - THREAD_REF,
201 - );
202 - expect(terminalUiState.terminalIds).toEqual(["term-a", "term-b"]);
203 - expect(terminalUiState.activeTerminalId).toBe("term-a");
204 - expect(terminalUiState.terminalGroups).toEqual([
205 - { id: "group-term-a", terminalIds: ["term-a"] },
206 - { id: "group-term-b", terminalIds: ["term-b"] },
207 - ]);
208 - });
209 -
141 it("does not import a closed panel terminal from stale metadata", () => {
142 const store = useTerminalUiStateStore.getState();
143 store.newTerminal(THREAD_REF, "term-2");
apps/web/src/themeBoot.test.ts
-34
@@ -329,27 +329,6 @@ describe("index.html boot script", () => {
329 );
330 });
331
332 - it("lets a dark half go dark when the light-only base cannot", () => {
333 - const boot = runBootScript({
334 - storage: {
335 - [THEME_STORAGE_KEY]: "paper",
336 - [THEME_APPEARANCE_MODE_STORAGE_KEY]: "system",
337 - [CUSTOM_THEMES_STORAGE_KEY]: JSON.stringify([
338 - {
339 - id: "paper",
340 - label: "Paper",
341 - appearance: "light",
342 - colors: { canvas: "#f8fbff", text: "#10243d", accent: "#5b6cff" },
343 - },
344 - ]),
345 - "t3code:theme-halves:v1": JSON.stringify({ dark: GROVE_THEME.id }),
346 - },
347 - prefersDark: true,
348 - });
349 - expect(boot.isDark).toBe(true);
350 - expect(boot.themeId).toBe(GROVE_THEME.id);
351 - });
352 -
332 it("paints the half's splash when the base theme no longer exists", () => {
333 const boot = runBootScript({
334 storage: {
@@ -367,19 +346,6 @@ describe("index.html boot script", () => {
346 );
347 });
348
370 - it("ignores a mix half that names an unknown theme", () => {
371 - const boot = runBootScript({
372 - storage: {
373 - [THEME_STORAGE_KEY]: "t3-chat",
374 - [THEME_APPEARANCE_MODE_STORAGE_KEY]: "system",
375 - "t3code:theme-halves:v1": JSON.stringify({ dark: "gone-theme" }),
376 - },
377 - prefersDark: true,
378 - });
379 - expect(boot.themeId).toBe("t3-chat");
380 - expect(boot.isDark).toBe(true);
381 - });
382 -
349 it("uses runtime defaults for malformed custom roles", () => {
350 const boot = runBootScript({
351 storage: {
apps/web/src/themePalette.test.ts
-249
@@ -4,7 +4,6 @@ import { BUILT_IN_THEMES } from "@t3tools/shared/themePalettes";
4
5 import {
6 getThemeColorsForMode,
7 - getThemeDefinition,
7 getThemeModes,
8 getCustomThemes,
9 getStandardThemeColors,
@@ -13,17 +12,12 @@ import {
12 installCustomTheme,
13 parseThemeFile,
14 removeCustomTheme,
16 - removeCustomThemes,
15 replaceCustomThemeCollection,
16 resolveDesktopTheme,
17 resolveThemeAppearance,
18 serializeThemeFile,
21 - themeAllowsSidebarArtwork,
19 T3_CHAT_THEME,
23 - EMBER_THEME,
20 GROVE_THEME,
25 - IRIS_THEME,
26 - OCEAN_THEME,
21 updateCustomTheme,
22 updateThemeColorFamily,
23 CUSTOM_THEMES_STORAGE_KEY,
@@ -200,23 +194,6 @@ describe("theme files", () => {
194 }
195 });
196
203 - it("keys status colors off the canvas, not the appearance slot", () => {
204 - const inverted = [
205 - createVividThemeColors("light", "#111827", "#8ab4f8"),
206 - createVividThemeColors("dark", "#f5ecf5", "#a84370"),
207 - createVividThemeColors("light", "#0d1117", "#69b1ff"),
208 - createVividThemeColors("dark", "#fdfdfd", "#c2571b"),
209 - ];
210 - for (const colors of inverted) {
211 - expect(contrastRatio(colors.errorForeground, colors.errorSurface)).toBeGreaterThanOrEqual(
212 - 4.5,
213 - );
214 - expect(contrastRatio(colors.warningForeground, colors.warningSurface)).toBeGreaterThanOrEqual(
215 - 4.5,
216 - );
217 - }
218 - });
219 -
197 it("decodes literal CSS color formats into OKLCH without dropping alpha", () => {
198 const theme = parseThemeFile({
199 version: THEME_FILE_VERSION,
@@ -269,26 +246,6 @@ describe("theme files", () => {
246 expect(themeColorToHex(theme.colors.accent)).toBe("#b5005e");
247 });
248
272 - it("rejects unknown roles and invalid color values", () => {
273 - expect(() =>
274 - parseThemeFile({
275 - version: THEME_FILE_VERSION,
276 - name: "Broken",
277 - appearance: "light",
278 - colors: { background: "#ffffff" },
279 - }),
280 - ).toThrow('"background" is not a supported theme color role.');
281 -
282 - expect(() =>
283 - parseThemeFile({
284 - version: THEME_FILE_VERSION,
285 - name: "Broken",
286 - appearance: "light",
287 - colors: { accent: "var(--danger)" },
288 - }),
289 - ).toThrow('The color for "accent" must be a literal CSS color');
290 - });
291 -
249 it("keeps optional light and dark palettes under one theme id", () => {
250 const theme = parseThemeFile({
251 version: THEME_FILE_VERSION,
@@ -317,49 +274,6 @@ describe("theme files", () => {
274 });
275 });
276
320 - it("includes the dual-mode maintainer themes", () => {
321 - for (const theme of [T3_CHAT_THEME, GROVE_THEME, OCEAN_THEME, EMBER_THEME, IRIS_THEME]) {
322 - expect(getThemeDefinition(theme.id)).toBe(theme);
323 - expect(getThemeModes(theme)).toEqual(["light", "dark"]);
324 - expect(theme.sidebarArtwork).toBe(true);
325 - expect(themeAllowsSidebarArtwork(theme.id)).toBe(true);
326 - expect(theme.colors.accent).toMatch(/^oklch\(/);
327 - expect(theme.variants?.dark?.accent).toMatch(/^oklch\(/);
328 -
329 - for (const mode of ["light", "dark"] as const) {
330 - const colors = getThemeColorsForMode(theme, mode);
331 - expect(colors).not.toBeNull();
332 - expect(contrastRatio(colors!.text, colors!.canvas)).toBeGreaterThanOrEqual(4.5);
333 - expect(contrastRatio(colors!.textMuted, colors!.canvas)).toBeGreaterThanOrEqual(4.5);
334 - if (theme !== T3_CHAT_THEME) {
335 - expect(contrastRatio(colors!.textMuted, colors!.canvas)).toBeLessThan(5.5);
336 - expect(contrastRatio(colors!.textMuted, colors!.canvas)).toBeCloseTo(
337 - mode === "dark" ? 5.082 : 4.705,
338 - 1,
339 - );
340 - }
341 - expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
342 - expect(
343 - contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
344 - ).toBeGreaterThanOrEqual(4.5);
345 - expect(
346 - contrastRatio(colors!.messageForeground, colors!.messageSurface),
347 - ).toBeGreaterThanOrEqual(4.5);
348 - expect(
349 - contrastRatio(colors!.messageActionForeground, colors!.messageAction),
350 - ).toBeGreaterThanOrEqual(4.5);
351 - expect(
352 - contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
353 - ).toBeGreaterThanOrEqual(4.5);
354 - expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
355 - expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
356 - 4.5,
357 - );
358 - }
359 - }
360 - expect(themeAllowsSidebarArtwork("my-custom-theme")).toBe(false);
361 - });
362 -
277 it("preserves valid imported-theme collections and drops malformed metadata", () => {
278 vi.stubGlobal("window", {
279 localStorage: {
@@ -490,48 +404,6 @@ describe("theme files", () => {
404 invalidateCustomThemes();
405 });
406
493 - it("replaces collection entries even when their stored collection label is malformed", () => {
494 - const collection = { id: "open-vsx:demo.theme", label: "Demo Theme" };
495 - const stored = new Map<string, string>([
496 - [
497 - CUSTOM_THEMES_STORAGE_KEY,
498 - JSON.stringify([
499 - {
500 - id: "old-light",
501 - label: "Old Light",
502 - appearance: "light",
503 - colors: { canvas: "#ffffff" },
504 - collection: { id: collection.id, label: 42 },
505 - },
506 - ]),
507 - ],
508 - ]);
509 - vi.stubGlobal("window", {
510 - localStorage: {
511 - getItem: (key: string) => stored.get(key) ?? null,
512 - setItem: (key: string, value: string) => stored.set(key, value),
513 - },
514 - });
515 -
516 - invalidateCustomThemes();
517 - const replacement = {
518 - ...parseThemeFile({
519 - version: THEME_FILE_VERSION,
520 - id: "old-light",
521 - name: "New Light",
522 - appearance: "light",
523 - colors: { canvas: "#fafafa" },
524 - }),
525 - collection,
526 - };
527 -
528 - expect(replaceCustomThemeCollection(collection.id, [replacement])).toEqual([replacement]);
529 - expect(getCustomThemes()).toEqual([replacement]);
530 -
531 - vi.unstubAllGlobals();
532 - invalidateCustomThemes();
533 - });
534 -
407 it("canonicalizes explicit writes without migrating untouched themes", () => {
408 const stored = new Map<string, string>();
409 const untouchedTheme = {
@@ -592,56 +464,6 @@ describe("theme files", () => {
464 invalidateCustomThemes();
465 });
466
595 - it("removes multiple custom themes atomically while preserving unrelated entries", () => {
596 - const collection = { id: "open-vsx:demo.theme", label: "Demo Theme" };
597 - const personalTheme = {
598 - id: "personal",
599 - label: "Personal",
600 - appearance: "dark",
601 - colors: { canvas: "#111111", futureRole: "hsl(10 20% 30%)" },
602 - futureMetadata: { version: 2 },
603 - };
604 - const stored = new Map<string, string>([
605 - [
606 - CUSTOM_THEMES_STORAGE_KEY,
607 - JSON.stringify([
608 - personalTheme,
609 - {
610 - id: "demo-light",
611 - label: "Demo Light",
612 - appearance: "light",
613 - colors: { canvas: "#ffffff" },
614 - collection,
615 - },
616 - {
617 - id: "demo-dark",
618 - label: "Demo Dark",
619 - appearance: "dark",
620 - colors: { canvas: "#000000" },
621 - collection,
622 - },
623 - ]),
624 - ],
625 - ]);
626 - const setItem = vi.fn((key: string, value: string) => stored.set(key, value));
627 - vi.stubGlobal("window", {
628 - localStorage: {
629 - getItem: (key: string) => stored.get(key) ?? null,
630 - setItem,
631 - },
632 - });
633 -
634 - invalidateCustomThemes();
635 - removeCustomThemes(["demo-light", "demo-dark"]);
636 -
637 - expect(setItem).toHaveBeenCalledOnce();
638 - expect(getCustomThemes()).toEqual([expect.objectContaining({ id: "personal" })]);
639 - expect(JSON.parse(stored.get(CUSTOM_THEMES_STORAGE_KEY) ?? "[]")).toEqual([personalTheme]);
640 -
641 - vi.unstubAllGlobals();
642 - invalidateCustomThemes();
643 - });
644 -
467 it("writes from the cached raw snapshot without risking a destructive reread", () => {
468 const legacyTheme = {
469 id: "legacy",
@@ -715,77 +537,6 @@ describe("theme files", () => {
537 vi.unstubAllGlobals();
538 invalidateCustomThemes();
539 });
718 -
719 - it("rejects malformed stored entries that reuse an installed theme id", () => {
720 - const storedThemes = JSON.stringify([{ id: "aurora", malformed: true }]);
721 - const setItem = vi.fn();
722 - vi.stubGlobal("window", {
723 - localStorage: {
724 - getItem: () => storedThemes,
725 - setItem,
726 - },
727 - });
728 -
729 - invalidateCustomThemes();
730 - expect(() =>
731 - installCustomTheme(
732 - parseThemeFile({
733 - version: THEME_FILE_VERSION,
734 - id: "aurora",
735 - name: "Aurora",
736 - appearance: "light",
737 - colors: { accent: "#5b6cff" },
738 - }),
739 - ),
740 - ).toThrow('A theme named "Aurora" is already installed.');
741 - expect(setItem).not.toHaveBeenCalled();
742 -
743 - vi.unstubAllGlobals();
744 - invalidateCustomThemes();
745 - });
746 -
747 - it("collapses duplicate raw entries when their theme is explicitly updated", () => {
748 - const stored = new Map<string, string>();
749 - const theme = {
750 - id: "aurora",
751 - label: "Aurora",
752 - appearance: "light",
753 - colors: { accent: "#5b6cff" },
754 - };
755 - const untouchedTheme = { id: "future", malformed: true, metadata: { version: 2 } };
756 - stored.set(
757 - CUSTOM_THEMES_STORAGE_KEY,
758 - JSON.stringify([theme, { id: "aurora", malformed: true }, untouchedTheme]),
759 - );
760 - vi.stubGlobal("window", {
761 - localStorage: {
762 - getItem: (key: string) => stored.get(key) ?? null,
763 - setItem: (key: string, value: string) => stored.set(key, value),
764 - },
765 - });
766 -
767 - invalidateCustomThemes();
768 - const installedTheme = getCustomThemes()[0]!;
769 - updateCustomTheme({
770 - ...installedTheme,
771 - label: "Aurora Night",
772 - colors: { ...installedTheme.colors, accent: "hsl(263 70% 58%)" },
773 - });
774 -
775 - const updatedLibrary = JSON.parse(stored.get(CUSTOM_THEMES_STORAGE_KEY) ?? "[]");
776 - expect(updatedLibrary.filter((entry: { id?: string }) => entry.id === "aurora")).toHaveLength(
777 - 1,
778 - );
779 - expect(updatedLibrary[0]).toMatchObject({
780 - id: "aurora",
781 - label: "Aurora Night",
782 - colors: { accent: canonical("hsl(263 70% 58%)") },
783 - });
784 - expect(updatedLibrary[1]).toEqual(untouchedTheme);
785 -
786 - vi.unstubAllGlobals();
787 - invalidateCustomThemes();
788 - });
540 });
541
542 describe("stored theme preferences", () => {
apps/web/src/themePalette.ts
+2 -2
@@ -23,9 +23,9 @@ import {
23 export { EMBER_THEME, GROVE_THEME, IRIS_THEME, OCEAN_THEME, T3_CHAT_THEME, THEME_COLOR_ROLES };
24 export type { ThemeAppearance, ThemeColorRole, ThemeColors, ThemeDefinition, ThemeVariants };
25
26 -export const T3_CHAT_THEME_ID = "t3-chat" as const;
26 +const T3_CHAT_THEME_ID = "t3-chat" as const;
27 const GROVE_THEME_ID = "grove" as const;
28 -export const OCEAN_THEME_ID = "ocean" as const;
28 +const OCEAN_THEME_ID = "ocean" as const;
29 const EMBER_THEME_ID = "ember" as const;
30 const IRIS_THEME_ID = "iris" as const;
31 export const THEME_FILE_VERSION = 1 as const;
apps/web/src/threadRoutes.test.ts
-21
@@ -55,27 +55,6 @@ describe("threadRoutes", () => {
55 ).toBeNull();
56 });
57
58 - it("renders server threads and local drafts when they are ready", () => {
59 - expect(
60 - resolveThreadRouteRenderState({
61 - bootstrapComplete: true,
62 - serverThreadExists: true,
63 - serverThreadDeleted: false,
64 - unlistedThreadDetail: EMPTY_ENVIRONMENT_THREAD_STATE,
65 - draftThreadExists: false,
66 - }),
67 - ).toBe("ready");
68 - expect(
69 - resolveThreadRouteRenderState({
70 - bootstrapComplete: true,
71 - serverThreadExists: false,
72 - serverThreadDeleted: false,
73 - unlistedThreadDetail: EMPTY_ENVIRONMENT_THREAD_STATE,
74 - draftThreadExists: true,
75 - }),
76 - ).toBe("ready");
77 - });
78 -
58 it.each([
59 { status: "cached", source: "server thread" },
60 { status: "synchronizing", source: "server thread" },
apps/web/src/threadSelectionStore.test.ts
-23
@@ -72,18 +72,6 @@ describe("threadSelectionStore", () => {
72 });
73
74 describe("rangeSelectTo", () => {
75 - it("selects range from anchor to target (forward)", () => {
76 - const store = useThreadSelectionStore.getState();
77 - store.toggleThread(THREAD_B);
78 - store.rangeSelectTo(THREAD_D, ORDERED);
79 -
80 - const state = useThreadSelectionStore.getState();
81 - expect(state.selectedThreadKeys.has(THREAD_B)).toBe(true);
82 - expect(state.selectedThreadKeys.has(THREAD_C)).toBe(true);
83 - expect(state.selectedThreadKeys.has(THREAD_D)).toBe(true);
84 - expect(state.selectedThreadKeys.size).toBe(3);
85 - });
86 -
75 it("keeps anchor stable across multiple range selects", () => {
76 const store = useThreadSelectionStore.getState();
77 store.toggleThread(THREAD_B);
@@ -123,15 +111,4 @@ describe("threadSelectionStore", () => {
111 expect(state.selectedThreadKeys.size).toBe(4);
112 });
113 });
126 -
127 - describe("removeFromSelection", () => {
128 - it("clears anchor when the anchor thread is removed", () => {
129 - const store = useThreadSelectionStore.getState();
130 - store.toggleThread(THREAD_A);
131 - store.toggleThread(THREAD_B);
132 - store.removeFromSelection([THREAD_B]);
133 -
134 - expect(useThreadSelectionStore.getState().anchorThreadKey).toBeNull();
135 - });
136 - });
114 });
apps/web/src/uiStateStore.test.ts
-24
@@ -92,33 +92,9 @@ describe("uiStateStore pure functions", () => {
92
93 expect(next.projectOrder).toEqual([keyB, keyC, keyALocal, keyARemote]);
94 });
95 -
96 - it("does not reorder missing or identical groups", () => {
97 - const currentOrder = ["env-local:proj-a", "env-local:proj-b"];
98 - const state = makeUiState();
99 -
100 - expect(reorderProjects(state, currentOrder, ["env-local:missing"], ["env-local:proj-b"])).toBe(
101 - state,
102 - );
103 - expect(reorderProjects(state, currentOrder, ["env-local:proj-a"], ["env-local:proj-a"])).toBe(
104 - state,
105 - );
106 - });
95 });
96
97 describe("parsePersistedState", () => {
110 - it("hydrates the last selected pull request merge method", () => {
111 - const parsed = parsePersistedState({
112 - pullRequestMergeMethod: "squash",
113 - });
114 - const invalid = parsePersistedState({
115 - pullRequestMergeMethod: "fast-forward",
116 - });
117 -
118 - expect(parsed.pullRequestMergeMethod).toBe("squash");
119 - expect(invalid.pullRequestMergeMethod).toBe("merge");
120 - });
121 -
98 it("hydrates raw UI-owned state without server entities", () => {
99 const parsed = parsePersistedState({
100 projectExpandedById: {
apps/web/src/versionSkew.test.ts
+1 -1
@@ -85,6 +85,7 @@ describe("versionSkew", () => {
85 },
86 );
87
88 + // regression: #7579 versions were compared as strings, not semver
89 it("treats a nightly server built past the client as ahead, not skew", () => {
90 expect(resolveVersionMismatch("0.0.35-nightly.20260818.1124")).toBeNull();
91 });
@@ -118,7 +119,6 @@ describe("versionSkew", () => {
119 serverVersion: "9.9.9",
120 });
121
121 - expect(key).toBe(`${environmentId}:${APP_VERSION}:9.9.9`);
122 expect(isVersionMismatchDismissed(key)).toBe(false);
123
124 dismissVersionMismatch(key);
apps/web/src/vscodeThemeImport.test.ts
-34
@@ -204,24 +204,6 @@ describe("VS Code theme import", () => {
204 });
205 expect(asHex(theme.colors.messageAction)).toBe("#4d9375");
206 });
207 - it("imports current and other find matches as independent background/text pairs", () => {
208 - const { colors } = parseVsCodeThemeFile({
209 - type: "dark",
210 - colors: {
211 - "editor.background": "#202020",
212 - "editor.findMatchBackground": "#663399",
213 - "editor.findMatchForeground": "#ffffff",
214 - "editor.findMatchHighlightBackground": "#bce4ff",
215 - "editor.findMatchHighlightForeground": "#17314a",
216 - },
217 - });
218 -
219 - expect(asHex(colors.searchMatchActiveBackground)).toBe("#663399");
220 - expect(asHex(colors.searchMatchActiveForeground)).toBe("#ffffff");
221 - expect(asHex(colors.searchMatchBackground)).toBe("#bce4ff");
222 - expect(asHex(colors.searchMatchForeground)).toBe("#17314a");
223 - });
224 -
207 it("composites find backgrounds onto the canvas and foregrounds onto their match", () => {
208 const { colors } = parseVsCodeThemeFile({
209 type: "dark",
@@ -311,16 +293,6 @@ describe("VS Code theme import", () => {
293 expect(hc.appearance).toBe("light");
294 });
295
314 - it("keeps an unreadable foreground out of the palette", () => {
315 - const theme = parseVsCodeThemeFile({
316 - name: "Unreadable",
317 - type: "dark",
318 - colors: { "editor.background": "#101010", "editor.foreground": "#111111" },
319 - });
320 - expect(asHex(theme.colors.text)).not.toBe("#111111");
321 - expect(contrastRatio(theme.colors.text, theme.colors.canvas)).toBeGreaterThanOrEqual(4.5);
322 - });
323 -
296 it("stays readable when the file replaces a surface but not its foreground", () => {
297 const theme = parseVsCodeThemeFile({
298 name: "Split",
@@ -428,10 +400,4 @@ describe("VS Code theme import", () => {
400 ]);
401 expect(numbered.map((theme) => theme.label)).toEqual(["Dracula", "Dracula 2"]);
402 });
431 -
432 - it("explains a file with no editor background", () => {
433 - expect(() => parseVsCodeThemeFile({ name: "Empty", type: "dark", colors: {} })).toThrow(
434 - /editor\.background/,
435 - );
436 - });
403 });
apps/web/src/workspaceBasenameLookup.test.ts
+1
@@ -17,6 +17,7 @@ describe("pickWorkspaceBasenameMatch", () => {
17 );
18 });
19
20 + // regression: #6297 a bare filename resolves to a file, never a same-named directory
21 it("ignores directories", () => {
22 expect(
23 pickWorkspaceBasenameMatch("components", [
apps/web/src/wslPaths.test.ts
-75
@@ -15,13 +15,6 @@ describe("parseWslUncPath", () => {
15 });
16 });
17
18 - it("parses wsl$ UNC roots as distro root", () => {
19 - expect(parseWslUncPath("\\\\wsl$\\Debian")).toEqual({
20 - distro: "Debian",
21 - linuxPath: "/",
22 - });
23 - });
24 -
18 it("rejects non-WSL paths and invalid distro names", () => {
19 expect(parseWslUncPath("C:\\Users\\Josh\\repo")).toBeNull();
20 expect(parseWslUncPath("\\\\wsl.localhost\\bad!name\\home")).toBeNull();
@@ -50,15 +43,6 @@ describe("resolveWslProjectSelection", () => {
43 ).toBeNull();
44 });
45
53 - it("does not guess when multiple WSL backends fail to match", () => {
54 - expect(
55 - resolveWslProjectSelection("\\\\wsl.localhost\\Fedora\\home\\theo\\repo", [
56 - { environmentId: "env-debian", backendId: "wsl:Debian", runningDistro: null },
57 - { environmentId: "env-ubuntu", backendId: "wsl:Ubuntu", runningDistro: null },
58 - ]),
59 - ).toBeNull();
60 - });
61 -
46 it("routes a default backend only to the distro used by its running process", () => {
47 const candidates = [
48 { environmentId: "env-wsl", backendId: "wsl:default", runningDistro: "Debian" },
@@ -88,22 +72,6 @@ describe("applyWslEnvironmentConfiguration", () => {
72 ],
73 };
74
91 - it("preserves a live default-distro backend instance id", () => {
92 - expect(
93 - applyWslEnvironmentConfiguration(
94 - [
95 - {
96 - environmentId: "env-wsl",
97 - backendId: "wsl:default",
98 - runningDistro: "Debian",
99 - },
100 - ],
101 - "env-primary",
102 - ubuntuConfiguration,
103 - ),
104 - ).toEqual([{ environmentId: "env-wsl", backendId: "wsl:default", runningDistro: "Debian" }]);
105 - });
106 -
75 it("does not replace a live default backend's running distro from current configuration", () => {
76 const candidates = applyWslEnvironmentConfiguration(
77 [{ environmentId: "env-wsl", backendId: "wsl:default", runningDistro: "Debian" }],
@@ -133,15 +101,6 @@ describe("applyWslEnvironmentConfiguration", () => {
101 ).toEqual([{ environmentId: "env-primary", backendId: "wsl:Ubuntu", runningDistro: "Ubuntu" }]);
102 });
103
136 - it("preserves default tracking for a WSL-only primary", () => {
137 - expect(
138 - applyWslEnvironmentConfiguration([], "env-primary", {
139 - ...ubuntuConfiguration,
140 - wslOnly: true,
141 - }),
142 - ).toEqual([{ environmentId: "env-primary", backendId: "wsl:default", runningDistro: null }]);
143 - });
144 -
104 it("uses the live primary distro for a default-tracking WSL-only primary", () => {
105 const candidates = applyWslEnvironmentConfiguration(
106 [],
@@ -165,16 +124,6 @@ describe("applyWslEnvironmentConfiguration", () => {
124 linuxPath: "/home/theo/repo",
125 });
126 });
168 -
169 - it("keeps a configured distro authoritative when discovery does not contain it", () => {
170 - expect(
171 - applyWslEnvironmentConfiguration([], "env-primary", {
172 - ...ubuntuConfiguration,
173 - wslOnly: true,
174 - distro: "Fedora",
175 - }),
176 - ).toEqual([{ environmentId: "env-primary", backendId: "wsl:Fedora", runningDistro: "Fedora" }]);
177 - });
127 });
128
129 describe("resolveProjectPickerTarget", () => {
@@ -221,30 +170,6 @@ describe("resolveProjectPickerTarget", () => {
170 ).toBe("wsl:default");
171 });
172
224 - it("routes a default-tracking picker when the distro catalog has no default", () => {
225 - expect(
226 - resolveProjectPickerTarget({
227 - browseEnvironmentId: "env-primary",
228 - primaryEnvironmentId: "env-primary",
229 - desktopInstanceId: null,
230 - wslConfiguration: {
231 - ...ubuntuConfiguration,
232 - distro: null,
233 - distros: [{ name: "Ubuntu-22.04", isDefault: false }],
234 - },
235 - }),
236 - ).toBe("wsl:default");
237 -
238 - expect(
239 - resolveProjectPickerTarget({
240 - browseEnvironmentId: "env-primary",
241 - primaryEnvironmentId: "env-primary",
242 - desktopInstanceId: null,
243 - wslConfiguration: { ...ubuntuConfiguration, distro: null, distros: [] },
244 - }),
245 - ).toBe("wsl:default");
246 - });
247 -
173 it("preserves combo-mode routing for primary and WSL backends", () => {
174 const comboConfiguration = { ...ubuntuConfiguration, wslOnly: false };
175
apps/web/vite/warmBundledDev.ts
+1 -1
@@ -50,7 +50,7 @@ function hasBundledDevInternals(value: unknown): value is BundledDevInternals {
50 * the lazy module ids it compiled. The browser's own requests then reuse
51 * Rolldown's transform cache. Entries are paths relative to the Vite root.
52 */
53 -export async function warmLazyEntries(
53 +async function warmLazyEntries(
54 server: ViteDevServer,
55 entries: readonly string[],
56 ): Promise<string[]> {