Skip to content
TypeScript

test(packages): prune low-value tests in packages (second pass) (#22593)

Julius Marminge8feddd668758
diff --git a/packages/client-runtime/src/connection/presentation.test.ts b/packages/client-runtime/src/connection/presentation.test.ts
index d7c4920a75c..f293d0a8091 100644
--- a/packages/client-runtime/src/connection/presentation.test.ts
+++ b/packages/client-runtime/src/connection/presentation.test.ts
@@ -86,6 +86,7 @@ describe("connection presentation", () => {
expect(environmentMcpUrl({ entry })).toBe("http://192.168.4.53:3773/mcp");
});
+ // regression: #16909 Copy MCP URL falls back to an alternate route when the relay route has no address
it("passes over routes without an address of their own", () => {
const relay = new RelayConnectionTarget({
environmentId: TARGET.environmentId,
diff --git a/packages/client-runtime/src/device/duoControl.test.ts b/packages/client-runtime/src/device/duoControl.test.ts
index a70ce517fbe..12145ffe956 100644
--- a/packages/client-runtime/src/device/duoControl.test.ts
+++ b/packages/client-runtime/src/device/duoControl.test.ts
@@ -85,6 +85,7 @@ it("pinches only a hit device, accumulates independently of native readback, cla
expect(pinch.active).toBe(false);
});
+// regression: #16630 fold controls follow the phone's orientation on each screen
it.each([
[
"vertical phone, closed",
diff --git a/packages/client-runtime/src/errors/transport.test.ts b/packages/client-runtime/src/errors/transport.test.ts
index 67e40116c48..862b1fbdd72 100644
--- a/packages/client-runtime/src/errors/transport.test.ts
+++ b/packages/client-runtime/src/errors/transport.test.ts
@@ -4,10 +4,6 @@ import { NETWORK_BLOCKING_HINT } from "./network.ts";
import { isTransportConnectionErrorMessage, sanitizeThreadErrorMessage } from "./transport.ts";
describe("isTransportConnectionErrorMessage", () => {
- it("returns true for SocketCloseError", () => {
- expect(isTransportConnectionErrorMessage("SocketCloseError: connection reset")).toBe(true);
- });
-
it("returns true for React Native disconnected socket errors", () => {
expect(
isTransportConnectionErrorMessage(
diff --git a/packages/client-runtime/src/markdownImages.test.ts b/packages/client-runtime/src/markdownImages.test.ts
index b87a196fdcb..039eb75345c 100644
--- a/packages/client-runtime/src/markdownImages.test.ts
+++ b/packages/client-runtime/src/markdownImages.test.ts
@@ -5,24 +5,12 @@ import { classifyMarkdownImageSource } from "./markdownImages.js";
describe("classifyMarkdownImageSource", () => {
it.each([
["images/result.png", "/workspace/project", "/workspace/project/images/result.png"],
- ["./images/result.png", "/workspace/project", "/workspace/project/./images/result.png"],
- [
- "images/result.png",
- "C:\\Users\\dara\\project",
- "C:\\Users\\dara\\project\\images\\result.png",
- ],
[
"images\\result.png",
"C:\\Users\\dara\\project",
"C:\\Users\\dara\\project\\images\\result.png",
],
- ["/workspace/project/image.png", null, "/workspace/project/image.png"],
- ["/C:/Users/dara/project/image.png", null, "C:/Users/dara/project/image.png"],
- ["C:/Users/dara/project/image.png", null, "C:/Users/dara/project/image.png"],
- ["\\\\server\\share\\image.png", null, "\\\\server\\share\\image.png"],
["file:///workspace/project/image%20one.png", null, "/workspace/project/image one.png"],
- ["file:///C:/Users/dara/project/image.png", null, "C:/Users/dara/project/image.png"],
- ["file://localhost/C:/Users/dara/project/image.png", null, "C:/Users/dara/project/image.png"],
["file://server/share/image.png", null, "\\\\server\\share\\image.png"],
])("maps %s to a workspace file", (source, workspaceRoot, path) => {
expect(classifyMarkdownImageSource(source, workspaceRoot)).toEqual({
@@ -31,19 +19,10 @@ describe("classifyMarkdownImageSource", () => {
});
});
- it.each([
- null,
- "",
- "#image",
- "?image=1",
- "image.png",
- "~/image.png",
- "javascript:alert(1)",
- "ftp://example.com/image.png",
- "content://media/image/1",
- "custom:image.png",
- "file://%",
- ])("blocks unsupported or unresolved source %s", (source) => {
- expect(classifyMarkdownImageSource(source)).toEqual({ _tag: "Blocked" });
- });
+ it.each(["image.png", "javascript:alert(1)", "file://%"])(
+ "blocks unsupported or unresolved source %s",
+ (source) => {
+ expect(classifyMarkdownImageSource(source)).toEqual({ _tag: "Blocked" });
+ },
+ );
});
diff --git a/packages/client-runtime/src/mediaReference.test.ts b/packages/client-runtime/src/mediaReference.test.ts
index 236953ad8b1..190ecfd2a6b 100644
--- a/packages/client-runtime/src/mediaReference.test.ts
+++ b/packages/client-runtime/src/mediaReference.test.ts
@@ -5,17 +5,9 @@ import { mediaFileReference, mediaReferenceFileName } from "./mediaReference.ts"
describe("mediaFileReference", () => {
it.each([
["/work/project/./media/../clip.mp4", "/work/project/", "clip.mp4"],
- ["/work/project/../outside.mp4", "/work/project", undefined],
["/work/project-other/clip.mp4", "/work/project", undefined],
- ["/work/Project/clip.mp4", "/work/project", undefined],
- ["/work/project/a\\b.mp4", "/work/project", "a\\b.mp4"],
- ["/work/clip.mp4", "/work/other/..", "clip.mp4"],
- ["/clip.mp4", "/", "clip.mp4"],
["C:\\WORK\\project\\media\\..\\Clip.mp4", "c:/work/project/", "Clip.mp4"],
- ["D:\\work\\clip.mp4", "C:\\work", undefined],
["\\\\Server\\Share\\Project\\Clip.mp4", "//server/share/project", "Clip.mp4"],
- ["\\\\server\\other\\clip.mp4", "\\\\server\\share", undefined],
- ["../clip.mp4", "/work/project", undefined],
])("preserves %s and only labels paths inside %s as relative", (path, root, relativePath) => {
expect(mediaFileReference(path, root)).toEqual({
kind: "file",
@@ -28,10 +20,7 @@ describe("mediaFileReference", () => {
describe("mediaReferenceFileName", () => {
it.each([
[{ kind: "file", path: "/tmp/take\\one%20.mp4" }, "take\\one%20.mp4"],
- [{ kind: "file", path: "C:\\clips/take\\one.mp4" }, "one.mp4"],
- [{ kind: "file", path: "\\\\server\\share\\one.mp4" }, "one.mp4"],
[{ kind: "url", url: "//cdn.example/clip%20one%2Emp4?sig=a+b#t=2" }, "clip one.mp4"],
- [{ kind: "url", url: "https://cdn.example/clip%2520.mp4" }, "clip%20.mp4"],
[{ kind: "url", url: "https://cdn.example/clip%20%oops.mp4" }, "clip%20%oops.mp4"],
] as const)("preserves filename semantics for %j", (reference, name) => {
expect(mediaReferenceFileName(reference)).toBe(name);
diff --git a/packages/client-runtime/src/mediaSource.test.ts b/packages/client-runtime/src/mediaSource.test.ts
index a3771b30d8d..612008c5be5 100644
--- a/packages/client-runtime/src/mediaSource.test.ts
+++ b/packages/client-runtime/src/mediaSource.test.ts
@@ -34,13 +34,8 @@ describe("resolveMediaSource", () => {
describe("host paths", () => {
it.each([
["/tmp/frame%23one.png:12", "/tmp/frame#one.png"],
- ["/tmp/frame%3Fone.png:12:3", "/tmp/frame?one.png"],
["/tmp/frame%2523one.png:12", "/tmp/frame%23one.png"],
- ["C:\\Users\\demo\\frame.png", "C:\\Users\\demo\\frame.png"],
- ["/C:/Users/demo/frame.png", "C:/Users/demo/frame.png"],
- ["file:///C:/Users/demo/frame.png", "C:/Users/demo/frame.png"],
["file://server/share/frame.png", "\\\\server\\share\\frame.png"],
- ["\\\\server\\share\\frame.png", "\\\\server\\share\\frame.png"],
])("resolves %s through the environment", (href, path) => {
expect(resolveMediaSource(href, { threadId, workspaceRoot: "/repo" })).toEqual({
kind: "image",
diff --git a/packages/client-runtime/src/operations/commands.test.ts b/packages/client-runtime/src/operations/commands.test.ts
index 41fbb2b7699..d559e6216c3 100644
--- a/packages/client-runtime/src/operations/commands.test.ts
+++ b/packages/client-runtime/src/operations/commands.test.ts
@@ -395,80 +395,75 @@ describe("V2 environment commands", () => {
}).pipe(Effect.provide(layerTestCrypto)),
);
- it.effect.each([
- "waiting",
- "completed",
- "failed",
- "interrupted",
- "cancelled",
- "rolled_back",
- ] as const)("dispatches Stop for %s runs with background commands except rollback", (status) =>
- Effect.gen(function* () {
- const waitingRunId = RunId.make("run-waiting");
- const projection: OrchestrationV2ThreadProjection = {
- ...v2Projection,
- runs: [
- {
- id: waitingRunId,
- threadId: v2ThreadId,
- ordinal: 1,
- providerInstanceId: v2Projection.thread.providerInstanceId,
- modelSelection: v2Projection.thread.modelSelection,
- providerThreadId: null,
- userMessageId: MessageId.make("message-waiting"),
- rootNodeId: null,
- activeAttemptId: null,
- status,
- requestedAt: v2Now,
- startedAt: v2Now,
- completedAt: null,
- checkpointId: null,
- contextHandoffId: null,
- },
- ],
- turnItems: [
- {
- id: TurnItemId.make("background-command"),
- threadId: v2ThreadId,
- runId: waitingRunId,
- nodeId: null,
- providerThreadId: null,
- providerTurnId: null,
- nativeItemRef: null,
- parentItemId: null,
- ordinal: 1,
- status: "running",
- title: null,
- startedAt: v2Now,
- completedAt: null,
- updatedAt: v2Now,
- type: "command_execution",
- input: "vp run dev",
- },
- ],
- };
- const commands: OrchestrationV2Command[] = [];
- const supervisor = yield* makeSupervisor({ commands, projects: [], projection });
-
- const result = yield* interruptThreadTurn({ threadId: v2ThreadId }).pipe(
- Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor),
- );
-
- expect(result).toEqual({ sequence: status === "rolled_back" ? 0 : 1 });
- expect(commands).toEqual(
- status === "rolled_back"
- ? []
- : [
- {
- type: "run.interrupt",
- commandId: expect.any(String),
- threadId: v2ThreadId,
- runId: waitingRunId,
- holdQueue: true,
- },
- ],
- );
- }).pipe(Effect.provide(layerTestCrypto)),
+ it.effect.each(["waiting", "completed", "rolled_back"] as const)(
+ "dispatches Stop for %s runs with background commands except rollback",
+ (status) =>
+ Effect.gen(function* () {
+ const waitingRunId = RunId.make("run-waiting");
+ const projection: OrchestrationV2ThreadProjection = {
+ ...v2Projection,
+ runs: [
+ {
+ id: waitingRunId,
+ threadId: v2ThreadId,
+ ordinal: 1,
+ providerInstanceId: v2Projection.thread.providerInstanceId,
+ modelSelection: v2Projection.thread.modelSelection,
+ providerThreadId: null,
+ userMessageId: MessageId.make("message-waiting"),
+ rootNodeId: null,
+ activeAttemptId: null,
+ status,
+ requestedAt: v2Now,
+ startedAt: v2Now,
+ completedAt: null,
+ checkpointId: null,
+ contextHandoffId: null,
+ },
+ ],
+ turnItems: [
+ {
+ id: TurnItemId.make("background-command"),
+ threadId: v2ThreadId,
+ runId: waitingRunId,
+ nodeId: null,
+ providerThreadId: null,
+ providerTurnId: null,
+ nativeItemRef: null,
+ parentItemId: null,
+ ordinal: 1,
+ status: "running",
+ title: null,
+ startedAt: v2Now,
+ completedAt: null,
+ updatedAt: v2Now,
+ type: "command_execution",
+ input: "vp run dev",
+ },
+ ],
+ };
+ const commands: OrchestrationV2Command[] = [];
+ const supervisor = yield* makeSupervisor({ commands, projects: [], projection });
+
+ const result = yield* interruptThreadTurn({ threadId: v2ThreadId }).pipe(
+ Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor),
+ );
+
+ expect(result).toEqual({ sequence: status === "rolled_back" ? 0 : 1 });
+ expect(commands).toEqual(
+ status === "rolled_back"
+ ? []
+ : [
+ {
+ type: "run.interrupt",
+ commandId: expect.any(String),
+ threadId: v2ThreadId,
+ runId: waitingRunId,
+ holdQueue: true,
+ },
+ ],
+ );
+ }).pipe(Effect.provide(layerTestCrypto)),
);
it.effect("validates identified checkpoints locally for older servers", () =>
diff --git a/packages/client-runtime/src/pullRequestLinkInput.test.ts b/packages/client-runtime/src/pullRequestLinkInput.test.ts
index 2788811c117..e8b0d36e604 100644
--- a/packages/client-runtime/src/pullRequestLinkInput.test.ts
+++ b/packages/client-runtime/src/pullRequestLinkInput.test.ts
@@ -120,20 +120,10 @@ describe("parsePullRequestReference", () => {
expect(parsePullRequestReference("gh pr checkout 42")).toBe("42");
});
- it("accepts gh pr checkout commands with GitHub pull request URLs", () => {
- expect(
- parsePullRequestReference("gh pr checkout https://github.com/pingdotgg/t3code/pull/42"),
- ).toBe("https://github.com/pingdotgg/t3code/pull/42");
- });
-
it("accepts glab mr checkout commands with raw numbers", () => {
expect(parsePullRequestReference("glab mr checkout 42")).toBe("42");
});
- it("accepts az repos pr checkout commands with raw numbers", () => {
- expect(parsePullRequestReference("az repos pr checkout --id 42")).toBe("42");
- });
-
it("accepts az repos pr checkout commands with equals-style ids", () => {
expect(parsePullRequestReference("az repos pr checkout --id=42")).toBe("42");
});
diff --git a/packages/client-runtime/src/pullRequestQuery.test.ts b/packages/client-runtime/src/pullRequestQuery.test.ts
index 08fe02f6a0d..33eddb7f1a6 100644
--- a/packages/client-runtime/src/pullRequestQuery.test.ts
+++ b/packages/client-runtime/src/pullRequestQuery.test.ts
@@ -78,6 +78,7 @@ describe("colon-namespaced labels typed as a search", () => {
expect(parsePullRequestQuery("size:S,size:XS").filters.labels).toEqual([["size:S", "size:XS"]]);
});
+ // regression: #19934 negated key:value qualifiers become namespaced label exclusions
it("excludes one the same way", () => {
expect(parsePullRequestQuery("-size:XXL").filters.excludedLabels).toEqual(["size:XXL"]);
expect(parsePullRequestQuery("-size:S,XS").filters.excludedLabels).toEqual([
diff --git a/packages/client-runtime/src/relay/managedRelay.test.ts b/packages/client-runtime/src/relay/managedRelay.test.ts
index 9c1f8dc470c..0506609229a 100644
--- a/packages/client-runtime/src/relay/managedRelay.test.ts
+++ b/packages/client-runtime/src/relay/managedRelay.test.ts
@@ -455,74 +455,4 @@ describe("ManagedRelayClient", () => {
}
}).pipe(Effect.provide(layerManagedRelayTest(fetchFn)));
});
-
- it.effect("lists account devices through the v2 Clerk bearer client endpoint", () => {
- const fetchFn = ((input, init) => {
- expect(String(input)).toBe("https://relay.example.test/v2/client/devices");
- expect(init?.headers).toMatchObject({
- authorization: "Bearer clerk-token",
- });
- return Promise.resolve(
- Response.json({
- devices: [
- {
- deviceId: "device-1",
- label: "Julius's iPhone",
- platform: "ios",
- iosMajorVersion: 18,
- appVersion: "1.0.0",
- notifications: {
- enabled: false,
- notifyOnApproval: true,
- notifyOnInput: true,
- notifyOnCompletion: true,
- notifyOnFailure: true,
- },
- liveActivities: {
- enabled: true,
- },
- updatedAt: "2026-06-01T00:00:00.000Z",
- },
- {
- deviceId: "device-2",
- label: "Android phone",
- platform: "android",
- iosMajorVersion: null,
- androidApiLevel: 36,
- appVersion: "1.0.0",
- notifications: {
- enabled: true,
- notifyOnApproval: true,
- notifyOnInput: true,
- notifyOnCompletion: true,
- notifyOnFailure: true,
- },
- liveActivities: { enabled: true },
- updatedAt: "2026-06-01T00:00:00.000Z",
- },
- ],
- }),
- );
- }) satisfies typeof globalThis.fetch;
-
- return Effect.gen(function* () {
- const relayClient = yield* ManagedRelay.ManagedRelayClient;
- const devices = yield* relayClient.listDevices({ clerkToken: "clerk-token" });
- expect(devices).toMatchObject([
- {
- deviceId: "device-1",
- label: "Julius's iPhone",
- notifications: {
- enabled: false,
- },
- },
- {
- deviceId: "device-2",
- platform: "android",
- iosMajorVersion: null,
- androidApiLevel: 36,
- },
- ]);
- }).pipe(Effect.provide(layerManagedRelayTest(fetchFn)));
- });
});
diff --git a/packages/client-runtime/src/state/commandPermissions.test.ts b/packages/client-runtime/src/state/commandPermissions.test.ts
index cdaf40ffd41..09927e38398 100644
--- a/packages/client-runtime/src/state/commandPermissions.test.ts
+++ b/packages/client-runtime/src/state/commandPermissions.test.ts
@@ -115,27 +115,6 @@ describe("command permissions", () => {
),
);
- it.effect("requires the destination settings grant to check OTLP endpoints", () =>
- Effect.scoped(
- Effect.gen(function* () {
- const registry = yield* setup;
- const check = createCommandPermissions(runtime, WS_METHODS.serverCheckOtlpEndpoint);
- registry.set(sessions(env), AsyncResult.success(grant(true)));
- expect(registry.get(check.permissionAtom(env))).toBe(false);
- registry.set(
- sessions(env),
- AsyncResult.success({
- ...grant(false),
- scopes: [AuthSettingsWriteScope],
- permissions: [AuthSettingsWriteScope],
- }),
- );
- expect(registry.get(check.permissionAtom(env))).toBe(true);
- yield* check.authorize(registry, env);
- }),
- ),
- );
-
it.effect("uses the target grant for both availability and execution", () =>
Effect.scoped(
Effect.gen(function* () {
diff --git a/packages/client-runtime/src/state/customSnooze.test.ts b/packages/client-runtime/src/state/customSnooze.test.ts
index 208b2b485be..7ca5c850fbb 100644
--- a/packages/client-runtime/src/state/customSnooze.test.ts
+++ b/packages/client-runtime/src/state/customSnooze.test.ts
@@ -9,13 +9,8 @@ afterEach(() => vi.unstubAllEnvs());
describe("custom snooze", () => {
it.each([
["2026-09-14", "14:30"],
- ["2026-09-13", "09:00"],
["2027-02-29", "09:00"],
- ["2026-13-01", "09:00"],
["2026-09-15", "24:00"],
- ["2026-09-15", "09:60"],
- ["", "09:00"],
- ["2026-09-15", ""],
])("rejects invalid or non-future calendar input %s %s", (date, time) => {
expect(resolveCustomSnooze({ mode: "date", date, time }, now)).toBeNull();
});
@@ -31,7 +26,7 @@ describe("custom snooze", () => {
);
});
- it.each(["", "0", "-1", "NaN", "Infinity", "1e300"])("rejects invalid duration %s", (amount) => {
+ it.each(["0", "NaN", "1e300"])("rejects invalid duration %s", (amount) => {
expect(resolveCustomSnooze({ mode: "duration", amount, unit: "hours" }, now)).toBeNull();
});
diff --git a/packages/client-runtime/src/state/entities.test.ts b/packages/client-runtime/src/state/entities.test.ts
index c82c1d449a1..0b89a79b2ad 100644
--- a/packages/client-runtime/src/state/entities.test.ts
+++ b/packages/client-runtime/src/state/entities.test.ts
@@ -12,10 +12,6 @@ import {
import * as DateTime from "effect/DateTime";
import { describe, expect, it } from "vite-plus/test";
-import {
- InvalidScopedProjectRefCollectionKeyError,
- parseProjectRefCollectionKey,
-} from "./entities.ts";
import { presentThreadShell, resolveThreadWorkingStartedAt } from "./models.ts";
import { v2Projection, v2ThreadShell } from "./orchestrationV2TestFixtures.ts";
import { deriveLatestThreadRun, deriveThreadRuntime } from "./threadExecution.ts";
@@ -25,16 +21,6 @@ import { canSnooze, effectiveSnoozed } from "./threadSettled.ts";
const environmentId = EnvironmentId.make("environment-v2");
-describe("scoped entity keys", () => {
- it("rejects invalid project reference collection shapes", () => {
- const key = JSON.stringify([["environment-1"]]);
-
- expect(() => parseProjectRefCollectionKey(key)).toThrowError(
- InvalidScopedProjectRefCollectionKeyError,
- );
- });
-});
-
describe("V2 client presentation", () => {
it("keeps async questions in Working until the run completes", () => {
const runId = RunId.make("run-async-question");
@@ -86,26 +72,6 @@ describe("V2 client presentation", () => {
}
});
- it("parks presented runtime at idle when a settled shell has pending background tasks", () => {
- const runId = RunId.make("run-completed");
- const shell = presentThreadShell(environmentId, {
- ...v2ThreadShell,
- latestRunId: runId,
- activeRunId: null,
- status: "completed",
- pendingBackgroundTasks: [{ taskId: "bg-1", description: "Watch build", kind: "monitor" }],
- });
-
- expect(shell.latestRun).toMatchObject({ runId, status: "completed" });
- expect(shell.runtime).toMatchObject({
- status: "idle",
- activeRunId: null,
- });
- expect(shell.pendingBackgroundTasks).toEqual([
- { taskId: "bg-1", description: "Watch build", kind: "monitor" },
- ]);
- });
-
it("parks a thread that never ran at idle while a pull request watch holds it", () => {
const watch = { taskId: "pull-request-watch:github.com/acme/app#1", kind: "monitor" as const };
const watched = presentThreadShell(environmentId, {
diff --git a/packages/client-runtime/src/state/orchestrationV2Projection.test.ts b/packages/client-runtime/src/state/orchestrationV2Projection.test.ts
index ed6479b24e8..9d96d800143 100644
--- a/packages/client-runtime/src/state/orchestrationV2Projection.test.ts
+++ b/packages/client-runtime/src/state/orchestrationV2Projection.test.ts
@@ -188,18 +188,6 @@ describe("applyOrchestrationV2ProjectionEvent", () => {
expect(next?.updatedAt).toEqual(archivedAt);
});
- it("ignores events for another thread", () => {
- const event = {
- id: "event-other",
- type: "thread.deleted",
- threadId: ThreadId.make("thread-other"),
- occurredAt: now,
- payload: { ...emptyProjection.thread, id: ThreadId.make("thread-other"), deletedAt: now },
- } as OrchestrationV2DomainEvent;
-
- expect(applyOrchestrationV2ProjectionEvent(emptyProjection, event)).toBe(emptyProjection);
- });
-
it("preserves visible row identity when run updates do not change membership", () => {
const item = commandItem("item-stable");
const visibleTurnItems = [
diff --git a/packages/client-runtime/src/state/providerInstanceDisplay.test.ts b/packages/client-runtime/src/state/providerInstanceDisplay.test.ts
index 643759a5862..7068a761605 100644
--- a/packages/client-runtime/src/state/providerInstanceDisplay.test.ts
+++ b/packages/client-runtime/src/state/providerInstanceDisplay.test.ts
@@ -19,6 +19,7 @@ describe("providerInstanceInitials", () => {
});
describe("normalizeProviderAccentColor", () => {
+ // regression: #9899 a non-hex accent must not render as the account badge color
it("rejects a non-hex value", () => {
expect(normalizeProviderAccentColor("blue")).toBeUndefined();
});
diff --git a/packages/client-runtime/src/state/pullRequestDiffHttp.test.ts b/packages/client-runtime/src/state/pullRequestDiffHttp.test.ts
deleted file mode 100644
index fd873cb7045..00000000000
--- a/packages/client-runtime/src/state/pullRequestDiffHttp.test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { EnvironmentId, ProjectId } from "@t3tools/contracts";
-import { describe, expect, it } from "@effect/vitest";
-import * as Effect from "effect/Effect";
-import * as Option from "effect/Option";
-
-import { PrimaryConnectionTarget, type PreparedConnection } from "../connection/model.ts";
-import * as RpcHttp from "../rpc/http.ts";
-import { fetchEnvironmentPullRequestDiff } from "./pullRequestDiffHttp.ts";
-
-const TARGET = new PrimaryConnectionTarget({
- environmentId: EnvironmentId.make("environment-1"),
- label: "Test environment",
- httpBaseUrl: "https://environment.example.test/base",
- wsBaseUrl: "wss://environment.example.test",
-});
-
-const PREPARED: PreparedConnection = {
- environmentId: TARGET.environmentId,
- label: TARGET.label,
- httpBaseUrl: TARGET.httpBaseUrl,
- socketUrl: "wss://environment.example.test/ws",
- httpAuthorization: null,
- target: TARGET,
-};
-
-describe("fetchEnvironmentPullRequestDiff", () => {
- it.effect("posts the diff input to the prepared environment over authenticated HTTP", () =>
- Effect.gen(function* () {
- const calls: Array<readonly [RequestInfo | URL, RequestInit]> = [];
- const fetchFn = ((request, init) => {
- calls.push([request, init ?? {}]);
- return Promise.resolve(
- Response.json({
- patch: "diff --git a/file.ts b/file.ts",
- truncated: false,
- nextCursor: null,
- }),
- );
- }) satisfies typeof fetch;
-
- const result = yield* fetchEnvironmentPullRequestDiff({
- prepared: PREPARED,
- signer: Option.none(),
- diff: {
- projectId: ProjectId.make("project-1"),
- repository: "owner/repository",
- number: 42,
- cursor: "next-page",
- },
- }).pipe(Effect.provide(RpcHttp.layerRemoteHttpClient(fetchFn)));
-
- expect(result).toEqual({
- patch: "diff --git a/file.ts b/file.ts",
- truncated: false,
- nextCursor: null,
- });
- expect(calls).toHaveLength(1);
- const [request, init] = calls[0]!;
- expect(String(request)).toBe("https://environment.example.test/api/pull-requests/diff");
- expect(init.method).toBe("POST");
- expect(init.credentials).toBe("include");
-
- const body =
- typeof init.body === "string"
- ? init.body
- : init.body instanceof Uint8Array
- ? new TextDecoder().decode(init.body)
- : "";
- expect(JSON.parse(body)).toEqual({
- projectId: "project-1",
- repository: "owner/repository",
- number: 42,
- cursor: "next-page",
- });
- }),
- );
-});
diff --git a/packages/client-runtime/src/state/runtime.test.ts b/packages/client-runtime/src/state/runtime.test.ts
index c97454135c2..b563bd8a04a 100644
--- a/packages/client-runtime/src/state/runtime.test.ts
+++ b/packages/client-runtime/src/state/runtime.test.ts
@@ -44,7 +44,6 @@ import {
createRuntimeCommand,
scheduleAtomCommandEffect,
executeAtomQuery,
- settleAsyncResult,
} from "./runtime.ts";
const QUERY_ENVIRONMENT = new PrimaryConnectionTarget({
@@ -180,28 +179,6 @@ const mountEnvironmentQuery = Effect.fn("TestEnvironmentQuery.mount")(function*
return registry;
});
-describe("settleAsyncResult", () => {
- it("encodes thrown and rejected promises as defects", async () => {
- const thrownDefect = new Error("thrown defect");
- const thrown = await settleAsyncResult<void, never>(() => {
- throw thrownDefect;
- });
- expect(AsyncResult.isFailure(thrown)).toBe(true);
- if (AsyncResult.isFailure(thrown)) {
- expect(Cause.hasDies(thrown.cause)).toBe(true);
- expect(Cause.squash(thrown.cause)).toBe(thrownDefect);
- }
-
- const rejectedDefect = new Error("rejected defect");
- const rejected = await settleAsyncResult<void, never>(() => Promise.reject(rejectedDefect));
- expect(AsyncResult.isFailure(rejected)).toBe(true);
- if (AsyncResult.isFailure(rejected)) {
- expect(Cause.hasDies(rejected.cause)).toBe(true);
- expect(Cause.squash(rejected.cause)).toBe(rejectedDefect);
- }
- });
-});
-
describe("preview event subscriptions", () => {
it.effect("delivers every open and close when RPC events arrive in batches", () =>
Effect.scoped(
diff --git a/packages/client-runtime/src/state/threadExecution.test.ts b/packages/client-runtime/src/state/threadExecution.test.ts
index 1eb32eebd7c..8ef37f959cd 100644
--- a/packages/client-runtime/src/state/threadExecution.test.ts
+++ b/packages/client-runtime/src/state/threadExecution.test.ts
@@ -98,6 +98,7 @@ describe("thread execution presentation", () => {
).toMatchObject({ status: "running", lastError: null, lastErrorClass: null });
});
+ // regression: #15029 working timers no longer reset on every background wake
it("counts a wake run's activity from the start of the work it continues", () => {
const workStartedAt = DateTime.makeUnsafe("2026-07-28T09:20:00.000Z");
const wake = { ...run("wake", 2, "running"), workStartedAt };
@@ -341,14 +342,6 @@ describe("deriveProviderSubagentStatus", () => {
nodes: [root],
});
- it("reports the provider's own subagent from its runless root turn", () => {
- expect(deriveProviderSubagentStatus(child("provider"))).toEqual({
- status: "completed",
- startedAt: "2026-07-28T10:00:00.000Z",
- completedAt: "2026-07-28T10:00:00.000Z",
- });
- });
-
it("leaves T3 delegated tasks and ordinary threads alone", () => {
expect(deriveProviderSubagentStatus(child("mcp"))).toBeNull();
expect(deriveProviderSubagentStatus({ ...v2Projection, nodes: [root] })).toBeNull();
diff --git a/packages/client-runtime/src/state/threadFeedback.test.ts b/packages/client-runtime/src/state/threadFeedback.test.ts
index 085ce14650b..640826526bd 100644
--- a/packages/client-runtime/src/state/threadFeedback.test.ts
+++ b/packages/client-runtime/src/state/threadFeedback.test.ts
@@ -6,7 +6,6 @@ import { AsyncResult } from "effect/reactivity";
import {
beginCodexFeedbackSubmission,
codexFeedbackNotice,
- parseCodexFeedbackCommand,
submitCodexFeedback,
type CodexFeedbackSubmission,
} from "./threadFeedback.ts";
@@ -25,13 +24,6 @@ describe("beginCodexFeedbackSubmission", () => {
});
});
-describe("parseCodexFeedbackCommand", () => {
- it("ignores other slash commands and ordinary messages", () => {
- expect(parseCodexFeedbackCommand("/feedback-status")).toBeNull();
- expect(parseCodexFeedbackCommand("Please send /feedback")).toBeNull();
- });
-});
-
describe("submitCodexFeedback", () => {
const submission = {
id: MessageId.make("feedback-message-1"),
diff --git a/packages/client-runtime/src/state/threadRelationships.test.ts b/packages/client-runtime/src/state/threadRelationships.test.ts
index 981e7fa1a91..a475c29157f 100644
--- a/packages/client-runtime/src/state/threadRelationships.test.ts
+++ b/packages/client-runtime/src/state/threadRelationships.test.ts
@@ -16,10 +16,6 @@ describe("thread relationships", () => {
it.each([
["running", "completed"],
["completed", "running"],
- ["running", "running"],
- ["completed", "completed"],
- ["waiting", "failed"],
- ["interrupted", "pending"],
])("keeps parent %s independent of child %s", (parentStatus, childStatus) => {
const parent = ThreadId.make("parent");
const child = ThreadId.make("child");
diff --git a/packages/client-runtime/src/state/threadSnoozed.test.ts b/packages/client-runtime/src/state/threadSnoozed.test.ts
index c8b0cf69fe0..3c9d6fded5d 100644
--- a/packages/client-runtime/src/state/threadSnoozed.test.ts
+++ b/packages/client-runtime/src/state/threadSnoozed.test.ts
@@ -168,16 +168,6 @@ describe("threadRaisedHandWhileSnoozed", () => {
});
describe("canSnooze", () => {
- it("allows snoozing quiet and working threads alike", () => {
- expect(canSnooze({ ...makeShell({}), latestUserMessageAt: null }, { now: NOW })).toBe(true);
- expect(
- canSnooze(
- { ...makeShell({ sessionStatus: "running" }), latestUserMessageAt: null },
- { now: NOW },
- ),
- ).toBe(true);
- });
-
it("refuses blocked-on-you work", () => {
expect(
canSnooze({ ...makeShell({ pending: "approval" }), latestUserMessageAt: null }, { now: NOW }),
diff --git a/packages/client-runtime/src/state/threadSort.test.ts b/packages/client-runtime/src/state/threadSort.test.ts
index e88c2571126..b089f736c57 100644
--- a/packages/client-runtime/src/state/threadSort.test.ts
+++ b/packages/client-runtime/src/state/threadSort.test.ts
@@ -74,16 +74,6 @@ describe("sortSettledThreads", () => {
updatedAt: input.updatedAt ?? "2026-03-09T09:00:00.000Z",
});
- it("falls back to last activity for auto-settled threads without a settledAt stamp", () => {
- const sorted = sortSettledThreads([
- settled({ id: "auto-old", latestUserMessageAt: "2026-03-09T08:00:00.000Z" }),
- settled({ id: "explicit", settledAt: "2026-03-09T10:00:00.000Z" }),
- settled({ id: "auto-recent", latestUserMessageAt: "2026-03-09T11:00:00.000Z" }),
- ]);
-
- expect(sorted.map((thread) => thread.id)).toEqual(["auto-recent", "explicit", "auto-old"]);
- });
-
it("counts a turn completion as activity for auto-settled threads", () => {
const sorted = sortSettledThreads([
settled({ id: "message-only", latestUserMessageAt: "2026-03-09T10:04:00.000Z" }),
diff --git a/packages/client-runtime/src/state/threadSubagents.test.ts b/packages/client-runtime/src/state/threadSubagents.test.ts
index 8c7cf6fa17a..e5e7d8d6dac 100644
--- a/packages/client-runtime/src/state/threadSubagents.test.ts
+++ b/packages/client-runtime/src/state/threadSubagents.test.ts
@@ -183,24 +183,3 @@ describe("deriveThreadTurnSubagents", () => {
expect(turn?.subagents).toHaveLength(3);
});
});
-
-describe("resolveSubagentPillSegment", () => {
- it("hides itself once the turn is over and nothing is working", () => {
- const turn = deriveThreadTurnSubagents({
- runs: [finishedRun],
- subagents: [subagent({ id: "a", status: "completed" })],
- });
-
- expect(resolveSubagentPillSegment(turn)).toBeNull();
- expect(resolveSubagentPillSegment(null)).toBeNull();
- });
-
- it("stays visible after the turn ends while an agent is still working", () => {
- const turn = deriveThreadTurnSubagents({
- runs: [finishedRun],
- subagents: [subagent({ id: "a", status: "running" })],
- });
-
- expect(resolveSubagentPillSegment(turn)?.label).toBe("1/1");
- });
-});
diff --git a/packages/client-runtime/src/state/threads-sync.test.ts b/packages/client-runtime/src/state/threads-sync.test.ts
index 3c20d7a2319..b87ab18a50a 100644
--- a/packages/client-runtime/src/state/threads-sync.test.ts
+++ b/packages/client-runtime/src/state/threads-sync.test.ts
@@ -1180,25 +1180,6 @@ describe("EnvironmentThreads", () => {
}),
);
- it.effect("ignores replayed thread events at or below the snapshot sequence", () =>
- Effect.gen(function* () {
- const harness = yield* makeHarness({ cached: BASE_PROJECTION });
- yield* Queue.offer(harness.inputs, snapshot(BASE_PROJECTION));
- yield* Queue.offer(harness.inputs, titleUpdated("Replayed title", 1));
- yield* Queue.offer(harness.inputs, titleUpdated("Live title", 2));
-
- const state = yield* awaitThreadState(
- harness.observed,
- (value) =>
- value.status === "live" &&
- Option.isSome(value.data) &&
- value.data.value.thread.title === "Live title",
- );
-
- expect(Option.getOrThrow(state.data).thread.title).toBe("Live title");
- }),
- );
-
it.effect("does not recreate a deleted cache from a queued save or finalizer", () =>
Effect.gen(function* () {
const scope = yield* Scope.make();
diff --git a/packages/client-runtime/src/state/usageProgress.test.ts b/packages/client-runtime/src/state/usageProgress.test.ts
index 512615876d4..ce720b0bc02 100644
--- a/packages/client-runtime/src/state/usageProgress.test.ts
+++ b/packages/client-runtime/src/state/usageProgress.test.ts
@@ -109,20 +109,6 @@ describe("usageProgress", () => {
});
describe("usageLoadingState", () => {
- it("marks only refreshing providers while the rest have answered", () => {
- const state = usageLoadingState([
- environment("a", { isPending: true, summary: summary(["cursor"]) }),
- environment("b"),
- ]);
- expect(state).toEqual({ partial: true, everyProvider: false, providers: new Set(["cursor"]) });
- });
-
- it("marks every provider while an environment has not answered", () => {
- const state = usageLoadingState([environment("a"), environment("b", { summary: null })]);
- expect(state.everyProvider).toBe(true);
- expect(state.partial).toBe(true);
- });
-
it("ignores environments that cannot answer and settles once all have", () => {
const state = usageLoadingState([
environment("a"),
diff --git a/packages/client-runtime/src/state/vcsAction.test.ts b/packages/client-runtime/src/state/vcsAction.test.ts
index 98390c51f50..52fc5575d04 100644
--- a/packages/client-runtime/src/state/vcsAction.test.ts
+++ b/packages/client-runtime/src/state/vcsAction.test.ts
@@ -200,33 +200,6 @@ describe("vcsActionState", () => {
});
});
- it("keeps running presentation state and retains a terminal action error until settle", () => {
- const initial = beginVcsActionState({
- operation: "run_change_request",
- label: "Running source control action",
- actionId,
- });
- const failed = applyVcsActionProgressEvent(
- initial,
- progress({
- actionId,
- action,
- cwd,
- kind: "action_failed",
- phase: null,
- message: "Push failed.",
- }),
- );
-
- expect(failed).toMatchObject({
- isRunning: true,
- operation: "run_change_request",
- actionId,
- action,
- error: "Push failed.",
- });
- });
-
it("ignores progress after a newer action owns the target", () => {
const current = beginVcsActionState({
operation: "pull",
diff --git a/packages/client-runtime/src/work-log/commandLabel.test.ts b/packages/client-runtime/src/work-log/commandLabel.test.ts
index c9dc17fcebe..405019d6943 100644
--- a/packages/client-runtime/src/work-log/commandLabel.test.ts
+++ b/packages/client-runtime/src/work-log/commandLabel.test.ts
@@ -4,52 +4,30 @@ import { commandDisplayText, commandProgramName } from "./commandLabel.ts";
describe("commandProgramName", () => {
it.each([
- ["/bin/zsh -lc 'vp test run apps/web/src/session-logic.test.ts'", "vp"],
- ["/bin/zsh -lc 'git diff --check'", "git"],
- ['/bin/zsh -lc "npx -y react-doctor@latest apps/web"', "npx"],
- ["/bin/zsh -lc 'rg -n \"registerHooks|worker\" apps/web/src'", "rg"],
- ["/bin/bash --noprofile --norc -l -c 'sed -n 1,270p file.ts'", "sed"],
- ["/bin/bash -o pipefail -lc 'vp test run'", "vp"],
["/bin/bash --rcfile /tmp/config -c 'git status'", "git"],
- ["sh -ec 'node scripts/check.js'", "node"],
- ["fish --command 'rg --files'", "rg"],
["zsh -lc 'CI=1 env -u DEBUG sudo -u root vp test run'", "vp"],
- ["env CI=1 /bin/zsh -lc '\"/Applications/My Tools/bin/check\" --verbose'", "check"],
- ["bash -lc \"zsh -c 'git status'\"", "git"],
['"C:\\Program Files\\Git\\bin\\bash.exe" -lc "git status"', "git"],
+ // regression: #9371 a multiline script whose later line re-quotes must still label its first program
["/bin/zsh -lc 'git status\nsed -n '\"'1,20p' apps/web/src/components/DiffPanel.tsx\"", "git"],
])("unwraps shell scripts without executing them: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
});
it.each([
- ["vp test run", "vp"],
["sudo -u root pnpm test", "pnpm"],
- ["env --split-string='CI=1 node scripts/check.js'", "node"],
- ['"C:\\Program Files\\nodejs\\node.exe" script.js', "node.exe"],
- ["/bin/zsh", "zsh"],
- ["/bin/bash -l", "bash"],
["zsh script.sh -c 'git status'", "zsh"],
- ["bash -- -c 'git status'", "bash"],
- ["bash --rcfile config.sh", "bash"],
["my-shell -c 'git status'", "my-shell"],
["$HOME/.bun/bin/bun test", "bun"],
- ['"$ANDROID_HOME/emulator/emulator" -list-avds', "emulator"],
- ["${ROOT}/bin/tool --version", "tool"],
])("preserves ordinary programs and actual shell launches: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
});
- it.each([
- "",
- "zsh -lc",
- "zsh -lc ''",
- "zsh -lc 'git status",
- "zsh -lc 'env'",
- 'zsh -lc "git \\\"',
- ])("falls back for missing or malformed scripts: %s", (command) => {
- expect(commandProgramName(command)).toBeNull();
- });
+ it.each(["zsh -lc", "zsh -lc 'git status", "zsh -lc 'env'"])(
+ "falls back for missing or malformed scripts: %s",
+ (command) => {
+ expect(commandProgramName(command)).toBeNull();
+ },
+ );
it.each([
"if test -f package.json; then vp test; fi",
@@ -90,16 +68,7 @@ describe("commandProgramName", () => {
it.each([
['rg -n "if|for|while" src', "rg"],
- ["printf '%s\\n' 'a;b|c'", "printf"],
- ["node -e \"if (true) console.log('ok')\"", "node"],
- ["echo '$(git status)'", "echo"],
["vp test && git status", "vp"],
- ["vp test || git status", "vp"],
- ["rg needle src | head", "rg"],
- ["vp test; git status", "vp"],
- ["vp test &", "vp"],
- ["vp test\ngit status", "vp"],
- ['echo "$(git status)"', "echo"],
["echo `git status`", "echo"],
["cat <(rg needle src)", "cat"],
])("uses the first executable-looking program: %s", (command, program) => {
@@ -108,53 +77,25 @@ describe("commandProgramName", () => {
it.each([
["cd packages/client-runtime && vp test run", "vp"],
- ['cd "a path with spaces"; git status', "git"],
- ["cd apps/web\npnpm test", "pnpm"],
- ["cd first && cd second && bun test", "bun"],
- ["CI=1 cd apps/web && npm test", "npm"],
["PATH+=:/tools npm test", "npm"],
- ["PATH+=:/tools && npm test", "npm"],
- ['TMP=$(mktemp -d); cd "$TMP"; npm pack ./package', "npm"],
["cd $(find . -type d | head -1) && git status", "git"],
- ["cd `find . -type d | head -1` && node script.js", "node"],
- ["cd /tmp 2>&1 && npm test", "npm"],
- ["cd /tmp 2<&0 && pnpm test", "pnpm"],
- ["cd /tmp &>/dev/null && bun test", "bun"],
- ["cd work |& npm test", "npm"],
["cd /tmp && # use the selected workspace\nnpm test", "npm"],
- ["export CI=1; # first note\n# second note\npnpm test", "pnpm"],
- ["cd&&npm test", "npm"],
- ["export CI=1;pnpm test", "pnpm"],
["cd ${ROOT:-path;with;semicolons} && bun test", "bun"],
- ["cd ${ROOT:-path&&fallback} && node app.js", "node"],
- ["cd @(first|second) && npm test", "npm"],
- ["cd /tmp \\\n&& npm test", "npm"],
- ["/bin/zsh -lc 'cd apps/web && vp test run'", "vp"],
])("skips leading cd commands and uses the next useful program: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
});
it.each([
["source ~/.nvm/nvm.sh && nvm use", "nvm"],
- [". ./.env && pnpm test", "pnpm"],
- ["export CI=1 && vp test run", "vp"],
["unset DEBUG; node app.js", "node"],
- ["export CI=1 && cd apps/web && pnpm test", "pnpm"],
["/bin/zsh -lc 'source ~/.nvm/nvm.sh && nvm use'", "nvm"],
])("skips shell setup commands and uses the next useful program: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
});
it.each([
- ["timeout 10 pnpm test", "pnpm"],
["timeout 10s python3 script.py", "python3"],
- ["gtimeout 1.5 node app.js", "node"],
- ["nohup npx expo start >/tmp/metro.log 2>&1 &", "npx"],
- ["nohup -- env CI=1 bun test", "bun"],
- ["arch -x86_64 ./build/app-under-test", "app-under-test"],
["arch -arch arm64 /opt/tools/check", "check"],
- ["bundle exec pod install", "pod"],
- ["timeout 30 nohup env CI=1 node app.js", "node"],
["timeout 60 script -q /dev/null env CI=1 node app.js", "node"],
])("unwraps process-launch wrappers: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
@@ -162,56 +103,17 @@ describe("commandProgramName", () => {
it.each([
"command -v git",
- "command -V git",
- "command -a git",
- "command -pv git",
- "builtin -p",
- "exec",
"exec > output.log",
- "exec --",
- "exec cd /tmp && npm test",
- "exec env CI=1 cd /tmp && npm test",
- "exec CI=1 npm test",
"env CI=1 cd /tmp && npm test",
- "env CI=1; npm test",
- "sudo cd /tmp && npm test",
- "command CI=1 npm test",
- "command false && npm test",
- "cmd /c false && npm test",
- "cd /tmp <<EOF\nunterminated heredoc",
- "cd /tmp && >/tmp/log",
- "(xcrun simctl io booted recordVideo /tmp/video.mp4 &) ; wait",
- "export CI=1 && (bundle exec pod install || pod install)",
"$PY scripts/check.py",
- "${TOOL} --version",
- "%TOOL% --version",
- "!TOOL! --version",
- "& $tool --version",
"& { Get-Process }",
- "$value = 'configured'",
- "$headers = @{ 'Accept' = 'application/json'; 'Content-Type' = 'application/json' }; Invoke-WebRequest https://example.com",
- '"sha256(value)=$hash"',
- "broken{",
- "@echo off",
- ":: comment",
- "time -- npm test",
- "time -v npm test",
"coproc npm test",
- "coproc worker { npm test; }",
- "cd [first|second] && pnpm test",
- "npm) --version",
- "try { Invoke-WebRequest https://example.com } catch { Write-Error $_ }",
- "for($i=0; $i -lt 2; $i++){ Start-Sleep 1 }",
- "# comment only",
])("does not treat shell lookup and commandless wrapper forms as executions: %s", (command) => {
expect(commandProgramName(command)).toBeNull();
});
it.each([
- ["parallel -j4", "parallel"],
["hash --help", "hash"],
- ["process --help", "process"],
- ["rem comment", "rem"],
["Exec node app.js", "Exec"],
["CD /tmp && npm test", "CD"],
])("does not hide legitimate or case-distinct program names: %s", (command, program) => {
@@ -224,26 +126,15 @@ describe("commandProgramName", () => {
it.each([
[">/tmp/log && npm test", "npm"],
- ["2>/tmp/error.log; pnpm test", "pnpm"],
- ["cd /tmp && >/tmp/log npm test", "npm"],
- ["cd /tmp && > /tmp/log pnpm test", "pnpm"],
- ["cd /tmp && 2>&1 bun test", "bun"],
["cd /tmp && 2>& 1 node app.js", "node"],
- ["cd /tmp && &>/tmp/log git status", "git"],
- ["cd /tmp && *>>/tmp/log vp test", "vp"],
["cd /tmp && {output}>/tmp/log deno test", "deno"],
- ["cd /tmp && <<<input ruby script.rb", "ruby"],
])("skips redirections before the next command: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
});
it.each([
- ["cd /tmp <<EOF\nnot-a-command\nEOF\nnpm test", "npm"],
- ["cd /tmp <<'EOF'\nnot-a-command\nEOF\npnpm test", "pnpm"],
- ["cd /tmp <<'EOF'\nnot-a-command\\\nEOF\npnpm test", "pnpm"],
["cd /tmp <<-EOF\n\tnot-a-command\n\tEOF\nbun test", "bun"],
["cd /tmp <<A <<B\none\nA\ntwo\nB\ngit status", "git"],
- ["cd /tmp <<EOF; # setup\nnot-a-command\nEOF\nnpm test", "npm"],
["cd /tmp <<EOF && pnpm test\nnot-a-command\nEOF\nbun test", "pnpm"],
])("skips heredoc bodies before finding the next command: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
@@ -291,9 +182,7 @@ describe("commandDisplayText control characters", () => {
it.each([
["printf '\u001b[31mred\u001b[0m'", "printf '␛[31mred␛[0m'"],
["zsh -lc 'printf \"\u001b[1m\"'", 'printf "␛[1m"'],
- ["echo bell\u0007 delete\u007f", "echo bell␇ delete␡"],
["printf 'a\\tb'\r\necho done", "printf 'a\\tb'\r\necho done"],
- ["cat <<'EOF'\n\tindented\nEOF", "cat <<'EOF'\n\tindented\nEOF"],
])("shows %j as %j", (input, expected) => {
expect(commandDisplayText(input)).toBe(expected);
});
diff --git a/packages/client-runtime/src/work-log/presentation.test.ts b/packages/client-runtime/src/work-log/presentation.test.ts
index 49b11c61743..2d29cca6361 100644
--- a/packages/client-runtime/src/work-log/presentation.test.ts
+++ b/packages/client-runtime/src/work-log/presentation.test.ts
@@ -47,12 +47,9 @@ describe("workEntryIndicatesToolFailure", () => {
};
it.each([
- [{ outputIndicatesFailure: true }, true],
[{ exitCode: 2 }, true],
[{ output: "sh: missing-command: command not found" }, true],
- [{ output: "Found 3 matches" }, false],
[{ output: `${"x".repeat(32_768)} command not found` }, false],
- [{}, false],
] as const)(
"preserves command failure state after removing displayed output: %j",
(fields, failed) => {
diff --git a/packages/contracts/src/settings.test.ts b/packages/contracts/src/settings.test.ts
index 25fce10a26f..9cce0c7e970 100644
--- a/packages/contracts/src/settings.test.ts
+++ b/packages/contracts/src/settings.test.ts
@@ -155,13 +155,6 @@ describe("ClientSettings quit confirmation", () => {
});
});
-describe("ServerSettings.providerInstances (slice-2 invariant)", () => {
- it("decodes a fully empty config (legacy on-disk shape) without complaint", () => {
- const decoded = decodeServerSettings({});
- expect(decoded.providerInstances).toEqual({});
- });
-});
-
describe("provider enabled defaults", () => {
it("resolves instance enabled state with explicit false winning", () => {
const grok = ProviderDriverKind.make("grok");
@@ -291,19 +284,6 @@ describe("resolveProjectProviderInstanceEnabled", () => {
};
expect(resolveProjectProviderInstanceEnabled(settings, projectId, instanceId)).toBe(false);
});
-
- it("always resolves to the machine value when no project is in scope", () => {
- const settings: ServerSettings = {
- ...DEFAULT_SERVER_SETTINGS,
- providerInstances: {
- [instanceId]: { driver: ProviderDriverKind.make("codex"), enabled: true },
- },
- projectSettingsOverrides: {
- [projectId]: { providerInstances: { [instanceId]: { enabled: false } } },
- },
- };
- expect(resolveProjectProviderInstanceEnabled(settings, null, instanceId)).toBe(true);
- });
});
describe("requiredScopesForProjectMutation", () => {
diff --git a/packages/effect-acp/src/_internal/stdio.test.ts b/packages/effect-acp/src/_internal/stdio.test.ts
index e696ecbe20d..e47e5f5fb9e 100644
--- a/packages/effect-acp/src/_internal/stdio.test.ts
+++ b/packages/effect-acp/src/_internal/stdio.test.ts
@@ -7,20 +7,6 @@ import * as AcpError from "../errors.ts";
import { makeTerminationError } from "./stdio.ts";
describe("ACP child process termination", () => {
- it.effect("retains the process identifier with the exit code", () =>
- Effect.gen(function* () {
- const error = yield* makeTerminationError({
- pid: ChildProcessSpawner.ProcessId(41),
- exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(7)),
- });
-
- assert.instanceOf(error, AcpError.AcpProcessExitedError);
- assert.equal(error.pid, 41);
- assert.equal(error.code, 7);
- assert.equal(error.message, "ACP process exited with code 7");
- }),
- );
-
it.effect("retains the process identifier and exact exit-status cause", () =>
Effect.gen(function* () {
const rootCause = new Error("private process diagnostics");
diff --git a/packages/effect-acp/src/errors.test.ts b/packages/effect-acp/src/errors.test.ts
index 3db0d7634a8..345c63070f7 100644
--- a/packages/effect-acp/src/errors.test.ts
+++ b/packages/effect-acp/src/errors.test.ts
@@ -3,7 +3,6 @@ import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";
import * as RpcClientError from "effect/rpc/RpcClientError";
-import * as AcpSchema from "./_generated/schema.gen.ts";
import { callRpc } from "./_internal/shared.ts";
import * as AcpError from "./errors.ts";
@@ -54,27 +53,6 @@ describe("effect-acp errors", () => {
});
});
- it.effect("preserves protocol request errors as request errors", () => {
- const failure = AcpSchema.Error.make({
- code: -32602,
- message: "Invalid params",
- data: { field: "sessionId" },
- });
-
- return Effect.gen(function* () {
- const error = yield* callRpc("session/load", Effect.fail(failure)).pipe(Effect.flip);
-
- expect(error).toMatchObject({
- _tag: "AcpRequestError",
- code: -32602,
- errorMessage: "Invalid params",
- data: { field: "sessionId" },
- method: "session/load",
- operation: "receive-response",
- });
- });
- });
-
it("preserves structured extension handler failures behind stable request errors", () => {
const cause = new AcpError.AcpTransportError({
operation: "read-input-stream",
diff --git a/packages/effect-acp/src/protocol.test.ts b/packages/effect-acp/src/protocol.test.ts
index d1fcbb7fef7..78a2250b5e6 100644
--- a/packages/effect-acp/src/protocol.test.ts
+++ b/packages/effect-acp/src/protocol.test.ts
@@ -52,7 +52,6 @@ const decodeSessionCancelNotification = Schema.decodeEffect(
Schema.fromJsonString(SessionCancelNotification),
);
const decodeExtRequest = Schema.decodeEffect(Schema.fromJsonString(ExtRequest));
-const decodeExtResponse = Schema.decodeEffect(Schema.fromJsonString(ExtResponse));
const decodeRequestPermissionResponse = Schema.decodeEffect(
Schema.fromJsonString(RequestPermissionResponse),
);
@@ -271,6 +270,7 @@ it.layer(NodeServices.layer)("effect-acp protocol", (it) => {
}),
);
+ // regression: #9154 notifications went out with `id` and `headers`, which Grok CLI drops
it.effect("logs outgoing notifications when logOutgoing is enabled", () =>
Effect.gen(function* () {
const { stdio } = yield* makeInMemoryStdio();
@@ -383,44 +383,6 @@ it.layer(NodeServices.layer)("effect-acp protocol", (it) => {
}),
);
- it.effect("supports generic extension requests over the patched transport", () =>
- Effect.gen(function* () {
- const { stdio, input, output } = yield* makeInMemoryStdio();
- const transport = yield* AcpProtocol.makeAcpPatchedProtocol({
- stdio,
- serverRequestMethods: new Set(),
- });
-
- const response = yield* transport
- .request("x/test", { hello: "world" })
- .pipe(Effect.forkScoped);
- const outbound = yield* Queue.take(output);
- assert.deepEqual(yield* decodeExtRequest(outbound), {
- jsonrpc: "2.0",
- id: 1,
- method: "x/test",
- params: {
- hello: "world",
- },
- headers: [],
- });
-
- yield* Queue.offer(
- input,
- yield* encodeJsonl(ExtResponse, {
- jsonrpc: "2.0",
- id: 1,
- result: {
- ok: true,
- },
- }),
- );
-
- const resolved = yield* Fiber.join(response);
- assert.deepEqual(resolved, { ok: true });
- }),
- );
-
it.effect("does not correlate a string response id with a numeric extension request id", () =>
Effect.gen(function* () {
const { stdio, input, output } = yield* makeInMemoryStdio();
@@ -543,39 +505,6 @@ it.layer(NodeServices.layer)("effect-acp protocol", (it) => {
}),
);
- it.effect("preserves numeric ids for inbound extension requests", () =>
- Effect.gen(function* () {
- const { stdio, input, output } = yield* makeInMemoryStdio();
- yield* AcpProtocol.makeAcpPatchedProtocol({
- stdio,
- serverRequestMethods: new Set(),
- onExtRequest: () => Effect.succeed({ ok: true }),
- });
-
- yield* Queue.offer(
- input,
- yield* encodeJsonl(ExtRequest, {
- jsonrpc: "2.0",
- id: 7,
- method: "x/test",
- params: {
- hello: "world",
- },
- headers: [],
- }),
- );
-
- const outbound = yield* Queue.take(output);
- assert.deepEqual(yield* decodeExtResponse(outbound), {
- jsonrpc: "2.0",
- id: 7,
- result: {
- ok: true,
- },
- });
- }),
- );
-
it.effect("preserves zero-valued ids for inbound core client requests", () =>
Effect.gen(function* () {
const { stdio, input, output } = yield* makeInMemoryStdio();
diff --git a/packages/effect-codex-app-server/src/_internal/shared.test.ts b/packages/effect-codex-app-server/src/_internal/shared.test.ts
index fdc8ece7918..61e16b41853 100644
--- a/packages/effect-codex-app-server/src/_internal/shared.test.ts
+++ b/packages/effect-codex-app-server/src/_internal/shared.test.ts
@@ -103,16 +103,3 @@ it.effect("retains the request-handler error as the internal error cause", () =>
assert.notInclude(error.message, source.message);
}),
);
-
-it.effect("passes request errors through without adding a wrapper", () =>
- Effect.gen(function* () {
- const source = CodexError.CodexAppServerRequestError.invalidParams("Invalid thread id");
- const error = yield* Shared.runHandler(
- (_payload: void) => Effect.fail(source),
- undefined,
- "thread/start",
- ).pipe(Effect.flip);
-
- assert.strictEqual(error, source);
- }),
-);
diff --git a/packages/effect-codex-app-server/src/protocol.test.ts b/packages/effect-codex-app-server/src/protocol.test.ts
index 98d8a80fd7a..10e979c6501 100644
--- a/packages/effect-codex-app-server/src/protocol.test.ts
+++ b/packages/effect-codex-app-server/src/protocol.test.ts
@@ -546,44 +546,6 @@ it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
}),
);
- it.effect("surfaces JSON encoding failures as protocol parse errors", () =>
- Effect.gen(function* () {
- const { stdio } = yield* makeInMemoryStdio();
- const transport = yield* CodexProtocol.makeCodexAppServerPatchedProtocol({ stdio });
-
- const bigintError = yield* transport.notify("x/test", 1n).pipe(Effect.flip);
- assert.instanceOf(bigintError, CodexError.CodexAppServerProtocolParseError);
- assert.equal(bigintError.operation, "encode-wire-message");
- assert.equal(bigintError.method, "x/test");
- assert.exists(bigintError.cause);
- assert.equal(
- bigintError.message,
- "Codex App Server protocol operation 'encode-wire-message' failed for method 'x/test'.",
- );
-
- const circular: Record<string, unknown> = {};
- circular.self = circular;
- const circularError = yield* transport.notify("x/test", circular).pipe(Effect.flip);
- assert.instanceOf(circularError, CodexError.CodexAppServerProtocolParseError);
- assert.equal(circularError.operation, "encode-wire-message");
- assert.equal(circularError.method, "x/test");
- assert.exists(circularError.cause);
-
- const requestError = yield* transport.request("x/request", 1n).pipe(
- Effect.match({
- onFailure: (error) => error,
- onSuccess: () => assert.fail("Expected request encoding to fail"),
- }),
- );
- assert.instanceOf(requestError, CodexError.CodexAppServerProtocolParseError);
- assert.deepInclude(requestError, {
- operation: "encode-wire-message",
- method: "x/request",
- requestId: "1",
- });
- }),
- );
-
it.effect("correlates response errors with the originating request", () =>
Effect.gen(function* () {
const { stdio, input, output } = yield* makeInMemoryStdio();
diff --git a/packages/provider-acp/src/server/nativeLogging.test.ts b/packages/provider-acp/src/server/nativeLogging.test.ts
index dddab4a995e..2f81bcf0aca 100644
--- a/packages/provider-acp/src/server/nativeLogging.test.ts
+++ b/packages/provider-acp/src/server/nativeLogging.test.ts
@@ -4,7 +4,6 @@ import { assert, it } from "@effect/vitest";
import * as Cause from "effect/Cause";
import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
-import * as Logger from "effect/Logger";
import * as Schema from "effect/Schema";
import * as AcpErrors from "effect-acp/errors";
@@ -68,33 +67,6 @@ nodeServicesIt("ACP native logging", (it) => {
}),
);
- it.effect("keeps request diagnostics without enabling full protocol logging", () =>
- Effect.gen(function* () {
- const records: Array<unknown> = [];
- const makeLogger = yield* makeAcpNativeLoggerFactory();
- const logger = makeLogger({
- nativeEventLogger: {
- filePath: "/tmp/provider-native.ndjson",
- write: (event) => Effect.sync(() => void records.push(event)),
- close: () => Effect.void,
- },
- provider: ProviderDriverKind.make("grok"),
- threadId: ThreadId.make("thread-1"),
- });
-
- assert.isUndefined(logger.protocolLogging);
- const requestLogger = logger.requestLogger;
- assert.exists(requestLogger);
- if (!requestLogger) return;
- yield* requestLogger({
- method: "session/prompt",
- payload: {},
- status: "started",
- });
- assert.lengthOf(records, 1);
- }),
- );
-
it.effect("drops transient ACP chunks before formatting verbose protocol logs", () =>
Effect.gen(function* () {
const records: Array<unknown> = [];
@@ -152,89 +124,6 @@ nodeServicesIt("ACP native logging", (it) => {
}),
);
- it.effect("keeps mixed and incomplete raw diagnostics", () =>
- Effect.gen(function* () {
- const records: Array<unknown> = [];
- const makeLogger = yield* makeAcpNativeLoggerFactory();
- const logger = makeLogger({
- nativeEventLogger: {
- filePath: "/tmp/provider-native.ndjson",
- write: (event) => Effect.sync(() => void records.push(event)),
- close: () => Effect.void,
- },
- provider: ProviderDriverKind.make("cursor"),
- threadId: ThreadId.make("thread-1"),
- verboseProtocolLogging: true,
- });
- const protocolLogger = logger.protocolLogging?.logger;
- assert.exists(protocolLogger);
- if (!protocolLogger) return;
-
- const transient = encodeUnknownJson({
- method: "session/update",
- params: { update: { sessionUpdate: "agent_message_chunk" } },
- });
- const lifecycle = encodeUnknownJson({ method: "session/new", params: {} });
-
- yield* protocolLogger({
- direction: "incoming",
- stage: "raw",
- payload: `${transient}\n${lifecycle}\n`,
- });
- yield* protocolLogger({
- direction: "incoming",
- stage: "raw",
- payload: transient,
- });
- yield* protocolLogger({
- direction: "incoming",
- stage: "raw",
- payload: `${transient}\n{malformed}\n`,
- });
-
- assert.lengthOf(records, 3);
- }),
- );
-
- it.effect("logs a structural tag when the native writer defects", () => {
- const messages: Array<unknown> = [];
- const logCapture = Logger.make<unknown, void>(({ message }) => {
- if (Array.isArray(message)) {
- messages.push(...message);
- } else {
- messages.push(message);
- }
- });
- const secret = "secret-writer-failure";
-
- return Effect.gen(function* () {
- const makeLogger = yield* makeAcpNativeLoggerFactory();
- const logger = makeLogger({
- nativeEventLogger: {
- filePath: "/tmp/provider-native.ndjson",
- write: () => Effect.die(new Error(secret)),
- close: () => Effect.void,
- },
- provider: ProviderDriverKind.make("cursor"),
- threadId: ThreadId.make("thread-1"),
- });
- const requestLogger = logger.requestLogger;
- assert.exists(requestLogger);
- if (!requestLogger) return;
-
- yield* requestLogger({
- method: "session/prompt",
- payload: {},
- status: "started",
- });
-
- const serialized = encodeUnknownJson(messages);
- assert.notInclude(serialized, secret);
- assert.include(serialized, '"errorTag":"Die"');
- assert.include(serialized, '"reasonCount":1');
- }).pipe(Effect.provide(Logger.layer([logCapture], { mergeWithExisting: false })));
- });
-
it.effect("preserves native writer interruption", () =>
Effect.gen(function* () {
const makeLogger = yield* makeAcpNativeLoggerFactory();
diff --git a/packages/provider-acp/src/server/runtimeModel.test.ts b/packages/provider-acp/src/server/runtimeModel.test.ts
index d6717f09d7a..6c05d3f4613 100644
--- a/packages/provider-acp/src/server/runtimeModel.test.ts
+++ b/packages/provider-acp/src/server/runtimeModel.test.ts
@@ -636,17 +636,6 @@ describe("AcpRuntimeModel", () => {
data: {},
}) satisfies AcpToolCallState;
- it("emits the first in-progress tool_call even when it has no detail", () => {
- expect(
- decideToolCallUpdateEmission({
- previous: undefined,
- next: { toolCallId: "tool-1", title: "Grok Tool", status: "pending", data: {} },
- lastEmittedDetailLength: undefined,
- skippedSinceEmit: 0,
- }),
- ).toEqual({ emit: true, skippedSinceEmit: 0 });
- });
-
it("always emits terminal (completed/failed) status updates regardless of growth", () => {
expect(
decideToolCallUpdateEmission({
@@ -705,16 +694,6 @@ describe("AcpRuntimeModel", () => {
expect(emittedIndices).toEqual([1, 11]);
});
- it("emits immediately when the title changes, even with no growth", () => {
- const decision = decideToolCallUpdateEmission({
- previous: { toolCallId: "tool-1", title: "Reading file", detail: "x", data: {} },
- next: { toolCallId: "tool-1", title: "Ran command", detail: "x", data: {} },
- lastEmittedDetailLength: 1,
- skippedSinceEmit: 0,
- });
- expect(decision).toEqual({ emit: true, skippedSinceEmit: 0 });
- });
-
it("coalesces small deltas but forces an emission after the coalesce limit", () => {
let lastEmittedDetailLength: number | undefined = 0;
let skippedSinceEmit = 0;
diff --git a/packages/provider-core/src/server/notification.test.ts b/packages/provider-core/src/server/notification.test.ts
index a67cab6b7e2..cab8ed06a64 100644
--- a/packages/provider-core/src/server/notification.test.ts
+++ b/packages/provider-core/src/server/notification.test.ts
@@ -15,10 +15,6 @@ import { backgroundWorkNotification, notificationTurnItem } from "./notification
const childThreadId = ThreadId.make("thread:child");
describe("backgroundWorkNotification", () => {
- it("keeps the generic notification when nothing is known", () => {
- assert.isNull(backgroundWorkNotification([]));
- });
-
it("names one piece of work and the thread of a subagent", () => {
assert.deepEqual(
backgroundWorkNotification([
@@ -124,17 +120,6 @@ describe("notificationTurnItem", () => {
task("c", "Update docs", "running"),
];
- it("says how many of a run's delegated tasks a delivery reports", () => {
- const item = notificationTurnItem(userMessage, delivery(["a", "b"]), tasks);
- assert.equal(item.type, "notification");
- if (item.type !== "notification") return;
- assert.equal(item.summary, "2 of 3 delegated tasks finished: Review src/math.ts, Write tests");
- assert.deepEqual(item.source, {
- kind: "delegated_task",
- taskIds: [NodeId.make("a"), NodeId.make("b")],
- });
- });
-
it("opens the child thread of a single delegated task", () => {
const item = notificationTurnItem(userMessage, delivery(["a"]), tasks);
assert.deepInclude(item, {
diff --git a/packages/provider-core/src/server/textGenerationUtils.test.ts b/packages/provider-core/src/server/textGenerationUtils.test.ts
index 342fdfe19bd..f7ce3eb5a29 100644
--- a/packages/provider-core/src/server/textGenerationUtils.test.ts
+++ b/packages/provider-core/src/server/textGenerationUtils.test.ts
@@ -3,11 +3,10 @@ import { describe, expect, it } from "vite-plus/test";
import { sanitizeCommitSubject } from "./textGenerationUtils.ts";
describe("sanitizeCommitSubject", () => {
+ // regression: #19181 truncation split grapheme clusters at the subject limit
it.each([
{ name: "an emoji", prefixLength: 71, character: "🚀" },
{ name: "an accented character", prefixLength: 71, character: "e\u0301" },
- { name: "an emoji with a skin tone", prefixLength: 70, character: "👍🏽" },
- { name: "a flag", prefixLength: 69, character: "🇮🇹" },
{ name: "a joined emoji", prefixLength: 65, character: "👨‍👩‍👧‍👦" },
])("keeps $name intact at the subject limit", ({ prefixLength, character }) => {
const prefix = "a".repeat(prefixLength);
diff --git a/packages/provider-cursor/src/server/transportFailure.test.ts b/packages/provider-cursor/src/server/transportFailure.test.ts
index 91d4fb9f17e..c42c3d2d70c 100644
--- a/packages/provider-cursor/src/server/transportFailure.test.ts
+++ b/packages/provider-cursor/src/server/transportFailure.test.ts
@@ -14,8 +14,6 @@ describe("CursorTransportFailure", () => {
it.each([
diagnostic,
"Error: ConnectError: [unavailable] transport closed",
- "Error: ConnectError: [aborted] aborted",
- "Error: ConnectError: [deadline_exceeded] timed out",
"Something went wrong communicating with the server. Please try again.",
])("recognizes a terminal diagnostic: %s", (message) => {
expect(failureFor([message])).toBe(message);
@@ -28,18 +26,9 @@ describe("CursorTransportFailure", () => {
it.each([
"The error was " + diagnostic,
- "This is an example of a transport error:\n" + diagnostic,
- "I inspected the files.\n" + diagnostic,
- "> " + diagnostic,
- " " + diagnostic,
"```text\n" + diagnostic + "\n```",
- "~~~\n" + diagnostic + "\n~~~",
- diagnostic + "\nThis is an example of a transport error.",
"Error: ConnectError: [unauthenticated] sign in",
- "Error: ConnectError: [permission_denied] subscription required",
- "Error: HTTP 500 from the application being debugged",
"Error: RetriableError: [internal] Failed to run step, exceeded max retries",
- "Error: RetriableError: [internal] Failed to run step, exceeded max retries\n at step (cli.js:1:2)",
])("preserves prose, code and non-transport errors: %s", (message) => {
expect(failureFor([...message])).toBeUndefined();
});
diff --git a/packages/provider-grok/src/server/acpSupport.test.ts b/packages/provider-grok/src/server/acpSupport.test.ts
index 4dffc1d3c4d..ef874a73e43 100644
--- a/packages/provider-grok/src/server/acpSupport.test.ts
+++ b/packages/provider-grok/src/server/acpSupport.test.ts
@@ -18,20 +18,6 @@ describe("grokAcpSpawnArgs", () => {
"stdio",
]);
});
-
- it("maps Full access to Grok always-approve", () => {
- expect(grokAcpSpawnArgs("full-access")).toEqual(["agent", "--always-approve", "stdio"]);
- });
-
- it("launches Auto on Grok's classifier and a mode Grok does not offer asking", () => {
- expect(grokAcpSpawnArgs("auto")).toEqual(["--permission-mode", "auto", "agent", "stdio"]);
- expect(grokAcpSpawnArgs("auto-accept-edits")).toEqual([
- "--permission-mode",
- "default",
- "agent",
- "stdio",
- ]);
- });
});
describe("applyGrokAcpModelSelection", () => {
@@ -139,20 +125,4 @@ describe("applyGrokAcpModelSelection", () => {
expect(result).toBe("grok-4.6");
}),
);
-
- it.effect("propagates session/set_model failures via mapError", () =>
- Effect.gen(function* () {
- const failure = EffectAcpErrors.AcpRequestError.invalidParams("session id not known");
- const { runtime } = makeRecordingRuntime(failure);
- const error = yield* Effect.flip(
- applyGrokAcpModelSelection({
- runtime,
- currentModelId: "grok-build",
- requestedModelId: "grok-mock-alt",
- mapError: (cause) => cause.message,
- }),
- );
- expect(error).toBe(failure.message);
- }),
- );
});
diff --git a/packages/provider-grok/src/server/xaiAcpExtension.test.ts b/packages/provider-grok/src/server/xaiAcpExtension.test.ts
index d27c11898c1..5de0a88c198 100644
--- a/packages/provider-grok/src/server/xaiAcpExtension.test.ts
+++ b/packages/provider-grok/src/server/xaiAcpExtension.test.ts
@@ -37,23 +37,6 @@ import {
const decodeXAiAskUserQuestionRequest = Schema.decodeUnknownSync(XAiAskUserQuestionRequest);
describe("xAiPromptCompleteFromSessionUpdate", () => {
- it("maps live turn_completed snake_case payloads", () => {
- expect(
- xAiPromptCompleteFromSessionUpdate({
- sessionId: "019f4428-4bf1-7e52-b7c6-c29b506543b1",
- update: {
- sessionUpdate: "turn_completed",
- prompt_id: "t3-xai-prompt-1",
- stop_reason: "end_turn",
- },
- }),
- ).toEqual({
- sessionId: "019f4428-4bf1-7e52-b7c6-c29b506543b1",
- promptId: "t3-xai-prompt-1",
- stopReason: "end_turn",
- });
- });
-
it("ignores non-turn updates and task-completed prompt ids", () => {
expect(
xAiPromptCompleteFromSessionUpdate({
diff --git a/packages/provider-grok/src/server/xaiBackgroundTasks.test.ts b/packages/provider-grok/src/server/xaiBackgroundTasks.test.ts
index 34c80e761d4..544e9460290 100644
--- a/packages/provider-grok/src/server/xaiBackgroundTasks.test.ts
+++ b/packages/provider-grok/src/server/xaiBackgroundTasks.test.ts
@@ -54,16 +54,8 @@ describe("Grok background tasks", () => {
it.each([
["running", null, "task.progress", undefined],
- ["pending", null, "task.progress", undefined],
- ["completed", 0, "task.completed", "completed"],
- ["success", 0, "task.completed", "completed"],
- ["succeeded", 0, "task.completed", "completed"],
["failed", 1, "task.completed", "failed"],
- ["error", 1, "task.completed", "failed"],
["stopped", 137, "task.completed", "stopped"],
- ["killed", 137, "task.completed", "stopped"],
- ["cancelled", 137, "task.completed", "stopped"],
- [undefined, 0, "task.completed", "completed"],
[undefined, 1, "task.completed", "failed"],
])("maps poll status %s / exit %s", (status, exit_code, type, expectedStatus) => {
const { tasks, update } = mapper();
@@ -182,11 +174,7 @@ describe("Grok background tasks", () => {
});
it.each([
- null,
- [],
- {},
{ type: "Text", text: "subagent_id: fake\ntype: executor\ndescription: fake" },
- { type: "Monitor", taskId: " " },
{ type: "BackgroundTaskStarted", task_id: "shell-1" },
{
type: "TaskOutput",
diff --git a/packages/provider-opencode/src/server/OpenCodeRuntime.cliParsers.test.ts b/packages/provider-opencode/src/server/OpenCodeRuntime.cliParsers.test.ts
index 2e632507e87..4e8450a25a8 100644
--- a/packages/provider-opencode/src/server/OpenCodeRuntime.cliParsers.test.ts
+++ b/packages/provider-opencode/src/server/OpenCodeRuntime.cliParsers.test.ts
@@ -23,12 +23,6 @@ describe("parseModelsCliOutput", () => {
NodeAssert.equal(Object.keys(result.providers.get("openai")!.models).length, 1);
});
- it("handles empty input", () => {
- const result = OpenCodeRuntime.parseModelsCliOutput("");
- NodeAssert.equal(result.providers.size, 0);
- NodeAssert.equal(result.connected.length, 0);
- });
-
it("skips unparseable JSON blocks", () => {
const stdout = [
"anthropic/claude-sonnet-4-5",
@@ -79,26 +73,6 @@ describe("parseModelsCliOutput", () => {
});
describe("parseAgentListCliOutput", () => {
- it("parses multiple agents", () => {
- const stdout = [
- "build (primary)",
- " " + JSON.stringify([{ permission: "*", action: "allow", pattern: "*" }]),
- "explore (subagent)",
- " " + JSON.stringify([{ permission: "read", action: "allow", pattern: "*" }]),
- "plan (primary)",
- " " + JSON.stringify([{ permission: "edit", action: "ask", pattern: "*.md" }]),
- ].join("\n");
-
- const result = OpenCodeRuntime.parseAgentListCliOutput(stdout);
- NodeAssert.equal(result.length, 3);
- NodeAssert.equal(result[0]!.name, "build");
- NodeAssert.equal(result[0]!.mode, "primary");
- NodeAssert.equal(result[1]!.name, "explore");
- NodeAssert.equal(result[1]!.mode, "subagent");
- NodeAssert.equal(result[2]!.name, "plan");
- NodeAssert.equal(result[2]!.mode, "primary");
- });
-
it("skips agents with unparseable permission JSON", () => {
const stdout = [
"build (primary)",
diff --git a/packages/provider-opencode/src/server/OpenCodeRuntime.permissions.test.ts b/packages/provider-opencode/src/server/OpenCodeRuntime.permissions.test.ts
index b7678464942..9b644b2ebc5 100644
--- a/packages/provider-opencode/src/server/OpenCodeRuntime.permissions.test.ts
+++ b/packages/provider-opencode/src/server/OpenCodeRuntime.permissions.test.ts
@@ -63,9 +63,7 @@ describe("toOpenCodePermissionReply", () => {
it.each([
["accept", "once"],
["acceptForSession", "always"],
- ["acceptAlways", "always"],
["decline", "reject"],
- ["cancel", "reject"],
] as const)("maps %s to %s", (decision, reply) => {
NodeAssert.equal(OpenCodeRuntime.toOpenCodePermissionReply(decision), reply);
});
diff --git a/packages/provider-opencode/src/server/adapter.test.ts b/packages/provider-opencode/src/server/adapter.test.ts
index 122adf4216b..92d72ef0b35 100644
--- a/packages/provider-opencode/src/server/adapter.test.ts
+++ b/packages/provider-opencode/src/server/adapter.test.ts
@@ -237,7 +237,7 @@ const makeOpenCodeRuntimeHarness = Effect.fn("makeOpenCodeRuntimeHarness")(funct
});
describe("OpenCodeAdapterV2", () => {
- it.effect.each(["completed", "failed", "unresolved", "unavailable", "reconnect"] as const)(
+ it.effect.each(["completed", "failed", "unavailable"] as const)(
"normalizes OpenCode step usage for %s turns",
(ending) =>
Effect.gen(function* () {
@@ -324,16 +324,6 @@ describe("OpenCodeAdapterV2", () => {
);
yield* Effect.promise(() => nativeEvents.push(step("old", "old-assistant")));
}
- if (ending === "unresolved")
- yield* Effect.promise(() => nativeEvents.push(step("unknown", "unknown-assistant")));
- if (ending === "reconnect") {
- yield* Effect.promise(() =>
- nativeEvents.push({ type: "server.connected", properties: {} }),
- );
- yield* Effect.promise(() =>
- nativeEvents.push({ type: "server.connected", properties: {} }),
- );
- }
if (ending === "failed") {
yield* Effect.promise(() =>
nativeEvents.push({
diff --git a/packages/provider-opencode/src/server/openCode2Catalog.test.ts b/packages/provider-opencode/src/server/openCode2Catalog.test.ts
index 233bd0a3614..85ab86a171b 100644
--- a/packages/provider-opencode/src/server/openCode2Catalog.test.ts
+++ b/packages/provider-opencode/src/server/openCode2Catalog.test.ts
@@ -84,6 +84,7 @@ describe("loadOpenCode2Catalog", () => {
}),
);
+ // regression: #17424 only the provider list is optional; a model-list failure fails the read
it.effect("fails the read when the model list fails", () =>
Effect.gen(function* () {
const error = yield* readCatalog({
diff --git a/packages/provider-opencode/src/server/status.test.ts b/packages/provider-opencode/src/server/status.test.ts
index 1e0e46087dc..69ef0b90b27 100644
--- a/packages/provider-opencode/src/server/status.test.ts
+++ b/packages/provider-opencode/src/server/status.test.ts
@@ -462,31 +462,6 @@ const checkProvider = Effect.fn("checkProvider")(function* (
});
it.layer(layerTest)("checkOpenCodeProviderStatus", (it) => {
- it.effect("shows a codex-style missing binary message", () =>
- Effect.gen(function* () {
- runtimeMock.state.runVersionError = new Error("spawn opencode ENOENT");
- const snapshot = yield* checkProvider(makeOpenCodeSettings());
-
- NodeAssert.equal(snapshot.status, "error");
- NodeAssert.equal(snapshot.installed, false);
- NodeAssert.equal(
- snapshot.message,
- "OpenCode CLI (`opencode`) is not installed or not on PATH.",
- );
- }),
- );
-
- it.effect("hides generic Effect.tryPromise text for local CLI probe failures", () =>
- Effect.gen(function* () {
- runtimeMock.state.runVersionError = new Error("An error occurred in Effect.tryPromise");
- const snapshot = yield* checkProvider(makeOpenCodeSettings());
-
- NodeAssert.equal(snapshot.status, "error");
- NodeAssert.equal(snapshot.installed, true);
- NodeAssert.equal(snapshot.message, "Failed to execute OpenCode CLI health check.");
- }),
- );
-
it.effect("emits OpenCode variant defaults so trait picker can resolve a visible selection", () =>
Effect.gen(function* () {
runtimeMock.state.inventory = {
@@ -715,18 +690,6 @@ it.layer(layerTest)("checkOpenCodeProviderStatus", (it) => {
}),
);
- it.effect("uses the settings password when local environment auth differs", () =>
- Effect.gen(function* () {
- yield* checkProvider(
- makeOpenCodeSettings({ serverPassword: "settings-password" }),
- process.cwd(),
- { OPENCODE_SERVER_PASSWORD: "environment-password" },
- );
-
- NodeAssert.equal(runtimeMock.state.sdkClientInputs[0]?.serverPassword, "settings-password");
- }),
- );
-
it.effect("reports local model inventory failures without treating them as empty", () =>
Effect.gen(function* () {
runtimeMock.state.versionStdout = "opencode 1.14.20\n";
@@ -805,25 +768,6 @@ it.layer(layerTest)("checkOpenCodeProviderStatus with configured server URL", (i
NodeAssert.equal(runtimeMock.state.sdkClientInputs.length, 0);
}),
);
-
- it.effect("surfaces a friendly auth error for configured servers", () =>
- Effect.gen(function* () {
- runtimeMock.state.connectionError = new Error("401 Unauthorized");
- const snapshot = yield* checkProvider(
- makeOpenCodeSettings({
- serverUrl: "http://127.0.0.1:9999",
- serverPassword: "secret-password",
- }),
- );
-
- NodeAssert.equal(snapshot.status, "error");
- NodeAssert.equal(snapshot.installed, true);
- NodeAssert.equal(
- snapshot.message,
- "OpenCode server rejected authentication. Check the server URL and password.",
- );
- }),
- );
});
const builtinCommands = [
diff --git a/packages/provider-opencode/src/server/textGeneration.test.ts b/packages/provider-opencode/src/server/textGeneration.test.ts
index c3f0926fc94..7a8847e7406 100644
--- a/packages/provider-opencode/src/server/textGeneration.test.ts
+++ b/packages/provider-opencode/src/server/textGeneration.test.ts
@@ -213,10 +213,6 @@ const layerOpenCodeTextGenerationExistingServerTest = Layer.succeed(
const DEFAULT_OPENCODE_SETTINGS = Schema.decodeSync(OpenCodeSettings)({
binaryPath: "fake-opencode",
});
-const LOCAL_AUTH_OPENCODE_SETTINGS = Schema.decodeSync(OpenCodeSettings)({
- binaryPath: "fake-opencode",
- serverPassword: "secret-password",
-});
const EXISTING_SERVER_OPENCODE_SETTINGS = Schema.decodeSync(OpenCodeSettings)({
binaryPath: "fake-opencode",
serverUrl: "http://127.0.0.1:9999",
@@ -370,19 +366,6 @@ it.layer(layerOpenCodeTextGenerationTest)("OpenCodeTextGeneration", (it) => {
),
);
- it.effect("passes configured authentication to a locally spawned server", () =>
- withOpenCodeTextGeneration(LOCAL_AUTH_OPENCODE_SETTINGS, (textGeneration) =>
- Effect.gen(function* () {
- yield* textGeneration.generateCommitMessage(DEFAULT_COMMIT_MESSAGE_INPUT);
-
- expect(runtimeMock.state.startCalls).toEqual(["fake-opencode"]);
- expect(runtimeMock.state.authHeaders).toEqual([
- `Basic ${btoa("opencode:secret-password")}`,
- ]);
- }),
- ),
- );
-
it.effect("uses an environment-only password for a locally spawned server", () =>
withOpenCodeTextGeneration(
DEFAULT_OPENCODE_SETTINGS,
@@ -398,21 +381,6 @@ it.layer(layerOpenCodeTextGenerationTest)("OpenCodeTextGeneration", (it) => {
),
);
- it.effect("uses settings auth when the local environment password differs", () =>
- withOpenCodeTextGeneration(
- LOCAL_AUTH_OPENCODE_SETTINGS,
- (textGeneration) =>
- Effect.gen(function* () {
- yield* textGeneration.generateCommitMessage(DEFAULT_COMMIT_MESSAGE_INPUT);
-
- expect(runtimeMock.state.authHeaders).toEqual([
- `Basic ${btoa("opencode:secret-password")}`,
- ]);
- }),
- { OPENCODE_SERVER_PASSWORD: "environment-password" },
- ),
- );
-
it.effect("returns a typed empty-output error for malformed and blank response parts", () =>
withOpenCodeTextGeneration(DEFAULT_OPENCODE_SETTINGS, (textGeneration) =>
Effect.gen(function* () {
@@ -471,43 +439,6 @@ it.layer(layerOpenCodeTextGenerationTest)("OpenCodeTextGeneration", (it) => {
}),
),
);
-
- it.effect("surfaces the upstream OpenCode structured-output error message", () =>
- withOpenCodeTextGeneration(DEFAULT_OPENCODE_SETTINGS, (textGeneration) =>
- Effect.gen(function* () {
- runtimeMock.state.promptResult = {
- data: {
- info: {
- error: {
- name: "StructuredOutputError",
- data: {
- message: "Model did not produce structured output",
- retries: 2,
- },
- },
- },
- },
- };
-
- const error = yield* textGeneration
- .generateCommitMessage(DEFAULT_COMMIT_MESSAGE_INPUT)
- .pipe(Effect.flip);
-
- expect(error.message).toContain("Model did not produce structured output");
- expect(error.cause).toMatchObject({
- _tag: "OpenCodeTextGenerationPromptResponseError",
- operation: "generateCommitMessage",
- cwd: process.cwd(),
- sessionId: "http://127.0.0.1:4301/session",
- providerId: "openai",
- modelId: "gpt-5",
- providerErrorName: "StructuredOutputError",
- providerMessage: "Model did not produce structured output",
- });
- expect(error.cause).not.toHaveProperty("cause");
- }),
- ),
- );
});
it.layer(layerOpenCodeTextGenerationExistingServerTest)(
diff --git a/packages/provider-pi/src/server/adapter.test.ts b/packages/provider-pi/src/server/adapter.test.ts
index 652444f175d..dcc9023c2b9 100644
--- a/packages/provider-pi/src/server/adapter.test.ts
+++ b/packages/provider-pi/src/server/adapter.test.ts
@@ -517,45 +517,6 @@ const startTurn = Effect.fnUntraced(function* (
});
});
-const expectModelFailure = (errorMessage: string) =>
- Effect.gen(function* () {
- const fake = yield* makeFakePi;
- const { runtime, takeEvent } = yield* openRuntime(fake);
- const providerThread = yield* runtime.ensureThread({
- threadId: THREAD_ID,
- modelSelection: modelSelection("default"),
- runtimePolicy,
- });
- yield* startTurn(runtime, providerThread);
- yield* fake.takeRequest("prompt");
- yield* fake.emit({ type: "agent_start" });
- yield* fake.emit({
- type: "message_end",
- message: {
- role: "assistant",
- content: [],
- stopReason: "error",
- errorMessage,
- },
- });
- yield* fake.emit({ type: "agent_settled" });
-
- const sessionError = yield* takeEvent(
- (event) =>
- event.type === "provider_session.updated" && event.providerSession.status === "error",
- );
- assert.isTrue(
- sessionError.type === "provider_session.updated" &&
- sessionError.providerSession.lastError === errorMessage,
- );
- const terminal = yield* takeEvent((event) => event.type === "turn.terminal");
- assert.isTrue(
- terminal.type === "turn.terminal" &&
- terminal.status === "failed" &&
- terminal.failure.message === errorMessage,
- );
- }).pipe(Effect.scoped, Effect.provide(layerTest));
-
describe("PiAdapterV2", () => {
it.effect.each([false, true])(
"completes a resumed user turn before native wake events arrive, Pi streaming=%s",
@@ -2902,10 +2863,6 @@ describe("PiAdapterV2", () => {
}).pipe(Effect.scoped, Effect.provide(layerTest)),
);
- it.effect("persists current xAI capacity text for the thread error banner", () =>
- expectModelFailure("The model is currently at capacity due to high demand."),
- );
-
it.effect.each([
{ toolName: "bash", exitCode: 0, legacy: false },
{ toolName: "powershell", exitCode: 2, legacy: false },
diff --git a/packages/provider-pi/src/server/commands.test.ts b/packages/provider-pi/src/server/commands.test.ts
index ce3751335a6..b1089bdd52f 100644
--- a/packages/provider-pi/src/server/commands.test.ts
+++ b/packages/provider-pi/src/server/commands.test.ts
@@ -47,35 +47,3 @@ it("maps current Pi skill metadata to T3's user and project skill scopes", () =>
slashCommands: [{ name: "hello", description: "Say hello." }],
});
});
-
-it("maps Pi global location and interface labels onto T3 skill fields", () => {
- expect(
- parsePiDiscoveredCommands({
- commands: [
- {
- name: "skill:global-review",
- description: "Review changes.",
- source: "skill",
- location: "global",
- interface: {
- displayName: "Global Review",
- shortDescription: "Review diffs.",
- },
- },
- ],
- }),
- ).toEqual({
- skills: [
- {
- name: "global-review",
- description: "Review changes.",
- path: "pi:skill:global-review",
- scope: "user",
- enabled: true,
- displayName: "Global Review",
- shortDescription: "Review diffs.",
- },
- ],
- slashCommands: [],
- });
-});
diff --git a/packages/provider-pi/src/server/status.test.ts b/packages/provider-pi/src/server/status.test.ts
index d712a63ec96..cee6442fc96 100644
--- a/packages/provider-pi/src/server/status.test.ts
+++ b/packages/provider-pi/src/server/status.test.ts
@@ -146,13 +146,10 @@ describe("PiProvider", () => {
}).pipe(Effect.provide(NodeServices.layer)),
);
+ // regression: #18498 a malformed model inventory must not restore stale Pi models
it.effect.each([
["missing models", {}],
- ["non-array models", { models: {} }],
- ["missing model provider", { models: [{ id: "claude-sonnet-4" }] }],
["missing model id", { models: [{ provider: "anthropic" }] }],
- ["empty model provider", { models: [{ provider: "", id: "claude-sonnet-4" }] }],
- ["empty model id", { models: [{ provider: "anthropic", id: "" }] }],
[
"mixed valid and invalid models",
{ models: [{ provider: "anthropic", id: "claude-sonnet-4" }, { provider: "openrouter" }] },
diff --git a/packages/shared/src/agentAwareness.test.ts b/packages/shared/src/agentAwareness.test.ts
index 7619c11c467..7216f1defb3 100644
--- a/packages/shared/src/agentAwareness.test.ts
+++ b/packages/shared/src/agentAwareness.test.ts
@@ -158,22 +158,6 @@ describe("projectThreadAwarenessV2", () => {
).toMatchObject({ phase });
});
- it("prioritizes V2 user-input requests", () => {
- expect(
- projectThreadAwarenessV2({
- environmentId: "env-1" as EnvironmentId,
- project,
- thread: v2Thread({
- pendingRuntimeRequest: {
- id: RuntimeRequestId.make("request-1"),
- kind: "user_input",
- createdAt: updatedAt,
- },
- }),
- }),
- ).toMatchObject({ phase: "waiting_for_input", headline: "Waiting for input" });
- });
-
it("reports an async question as input only after the working run completes", () => {
const input = {
environmentId: "env-1" as EnvironmentId,
diff --git a/packages/shared/src/assistantCitations.test.ts b/packages/shared/src/assistantCitations.test.ts
index fee7a15d5b6..923ca2555a0 100644
--- a/packages/shared/src/assistantCitations.test.ts
+++ b/packages/shared/src/assistantCitations.test.ts
@@ -89,22 +89,11 @@ describe("assistant citation references", () => {
});
it.each([
- "https://example.com/quote",
"t3-citation://v2/a/b/c?text=quote&start=0&end=5&prefix=&suffix=",
- "t3-citation://v1/%ZZ/b/c?text=quote&start=0&end=5&prefix=&suffix=",
- "t3-citation://v1/a/b/c?text=quote&start=NaN&end=5&prefix=&suffix=",
"t3-citation://v1/a/b/c?text=quote&start=5&end=0&prefix=&suffix=",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=9007199254740992&prefix=&suffix=",
"t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&text=other",
"t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&unknown=value",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&comment=note&unknown=value",
"t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&comment=one&comment=two",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&comment=&comment=",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&comment=one&%63omment=two",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&comment=note",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=&text=other&comment=note",
- "t3-citation://v1/a/b/c?text=&start=0&end=5&prefix=&suffix=",
- "t3-citation://v1/a/b/c?text=quote&start=0&end=5&prefix=&suffix=#unexpected",
])("leaves invalid or unsupported references unchanged: %s", (href) => {
expect(parseAssistantCitationHref(href)).toBeNull();
const prompt = `[Assistant quote](${href})`;
diff --git a/packages/shared/src/changeRequestUrl.test.ts b/packages/shared/src/changeRequestUrl.test.ts
index 052a3f84b66..e1ac1e77ac6 100644
--- a/packages/shared/src/changeRequestUrl.test.ts
+++ b/packages/shared/src/changeRequestUrl.test.ts
@@ -126,43 +126,12 @@ describe("parseChangeRequestUrl", () => {
});
describe("siblingPullRequestUrl", () => {
- it("recognizes Forgejo on custom HTTP hosts", () => {
- expect(parseChangeRequestUrl("http://git.example.test:3000/team/repo/pulls/42/files")).toEqual({
- host: "git.example.test",
- authority: "git.example.test:3000",
- repository: "team/repo",
- number: 42,
- });
- });
it.each([
[
"http://git.example.test:3000/team/repo/pulls/42/files",
"http://git.example.test:3000/team/repo/pulls/43",
],
- [
- "https://git.example.test/forgejo/team/repo/pulls/42/files",
- "https://git.example.test/forgejo/team/repo/pulls/43",
- ],
["https://github.com/pull/1/pull/42/files", "https://github.com/pull/1/pull/43"],
- [
- "https://git.acme.test/team/merge_requests/1/repo/-/merge_requests/42/diffs",
- "https://git.acme.test/team/merge_requests/1/repo/-/merge_requests/43",
- ],
-
- ["https://github.com/acme/web/pull/42#discussion_r123", "https://github.com/acme/web/pull/43"],
- ["https://github.com/acme/web/pull/42/files?w=1", "https://github.com/acme/web/pull/43"],
- [
- "https://github.acme.test:8443/acme/web/pull/42/",
- "https://github.acme.test:8443/acme/web/pull/43",
- ],
- [
- "https://git.acme.test/acme/web/-/merge_requests/42/diffs",
- "https://git.acme.test/acme/web/-/merge_requests/43",
- ],
- [
- "https://bitbucket.org/acme/web/pull-requests/42",
- "https://bitbucket.org/acme/web/pull-requests/43",
- ],
[
"https://dev.azure.com/acme/project/_git/web/pullrequest/42?view=files",
"https://dev.azure.com/acme/project/_git/web/pullrequest/43",
@@ -187,7 +156,6 @@ describe("changeRequestUrlFor", () => {
it.each([
["http://forge.example:3000/git/owner/repo.git", "http://forge.example:3000"],
- ["https://forge.example:8443/git/owner/repo.git", "https://forge.example:8443"],
["[email protected]:git/owner/repo.git", "https://forge.example"],
["http://other.example:3000/git/owner/repo.git", "https://forge.example"],
])("preserves the matching Forgejo web origin from %s", (remoteUrl, origin) => {
@@ -198,7 +166,6 @@ describe("changeRequestUrlFor", () => {
it.each([
["ssh.dev.azure.com", "v3/org/project/web"],
- ["vs-ssh.visualstudio.com", "v3/org/project/web"],
["org.visualstudio.com", "defaultcollection/project/_git/web"],
["dev.azure.com", "org/project/_git/web"],
])("builds a browser URL from the Azure remote %s/%s", (host, repository) => {
diff --git a/packages/shared/src/changedFileKind.test.ts b/packages/shared/src/changedFileKind.test.ts
index 9ff3cea8395..a3c7ee1f3f0 100644
--- a/packages/shared/src/changedFileKind.test.ts
+++ b/packages/shared/src/changedFileKind.test.ts
@@ -4,43 +4,10 @@ import { classifyChangedFile } from "./changedFileKind.ts";
describe("classifyChangedFile", () => {
it.each([
- ["apps/server/src/ws.ts", "code"],
- ["src/latest.ts", "code"],
- ["src/Latest.java", "code"],
["src/contest.py", "code"],
- ["src/mockingbird.ts", "code"],
- ["src/testimonials/List.tsx", "code"],
- ["apps/web/src/foo.test.ts", "tests"],
- ["apps/web/src/Foo.browser.test.tsx", "tests"],
- ["src/foo.spec.js", "tests"],
- ["pkg/server_test.go", "tests"],
- ["tests/test_api.py", "tests"],
- ["conftest.py", "tests"],
- ["src/main/java/RequestTest.java", "tests"],
- ["Sources/AppTests.swift", "tests"],
- ["src/HTTPTest.java", "tests"],
- ["Sources/URLTests.swift", "tests"],
- ["spec/models/user_spec.rb", "tests"],
- ["src/__tests__/helpers.ts", "tests"],
- ["src/testUtils.ts", "code"],
- ["src\\__tests__\\app.ts", "tests"],
- ["src/__mocks__/fs.ts", "mocks"],
["test/fixtures/pr.json", "mocks"],
- ["src/__snapshots__/view.test.ts.snap", "mocks"],
- ["src/api.mock.ts", "mocks"],
- ["src/mockServer.ts", "mocks"],
- ["pkg/testdata/input.txt", "mocks"],
["pnpm-lock.yaml", "generated"],
- ["apps/web/package-lock.json", "generated"],
- ["go.sum", "generated"],
- ["src/routeTree.gen.ts", "generated"],
- ["src/__generated__/types.ts", "generated"],
- ["dist/app.min.js", "generated"],
["README.md", "docs"],
- ["docs/internals/overview.mdx", "docs"],
- ["NOTES.txt", "docs"],
- ["requirements-dev.txt", "code"],
- ["CMakeLists.txt", "code"],
["tests/README.md", "tests"],
] as const)("%s is %s", (path, kind) => {
expect(classifyChangedFile(path)).toBe(kind);
diff --git a/packages/shared/src/cliArgs.test.ts b/packages/shared/src/cliArgs.test.ts
index f3e694bd0be..e4fdfe3c2db 100644
--- a/packages/shared/src/cliArgs.test.ts
+++ b/packages/shared/src/cliArgs.test.ts
@@ -40,20 +40,6 @@ describe("tokenizeCliArgs", () => {
});
describe("parseCliArgs", () => {
- it("parses --chrome --effort high --debug", () => {
- expect(parseCliArgs("--chrome --effort high --debug")).toEqual({
- flags: { chrome: null, effort: "high", debug: null },
- positionals: [],
- });
- });
-
- it("parses quoted --append-system-prompt with value and --chrome", () => {
- expect(parseCliArgs(`--append-system-prompt "always think step by step" --chrome`)).toEqual({
- flags: { "append-system-prompt": "always think step by step", chrome: null },
- positionals: [],
- });
- });
-
it("parses --key=value mixed with boolean flags", () => {
expect(parseCliArgs("--chrome --model=claude-sonnet-4-6 --debug")).toEqual({
flags: { chrome: null, model: "claude-sonnet-4-6", debug: null },
@@ -80,13 +66,4 @@ describe("parseCliArgs", () => {
},
);
});
-
- it("non-boolean flag still consumes next token", () => {
- expect(parseCliArgs(["--root", "/path", "1.2.3"], { booleanFlags: ["github-output"] })).toEqual(
- {
- flags: { root: "/path" },
- positionals: ["1.2.3"],
- },
- );
- });
});
diff --git a/packages/shared/src/codexMarkdownDirectives.test.ts b/packages/shared/src/codexMarkdownDirectives.test.ts
index 313fc7cb4db..4db9e7c4b86 100644
--- a/packages/shared/src/codexMarkdownDirectives.test.ts
+++ b/packages/shared/src/codexMarkdownDirectives.test.ts
@@ -74,12 +74,8 @@ describe("remarkCodexDirectives", () => {
it.each([
"Meeting at 10:30",
- "Open src/main.ts:42",
- "Use :hover and :tada:",
- "::note",
":::note\ncontent\n:::",
':codex-file-citation-extra{path="outputs/report.xlsx"}',
- "::artifact-template-extra",
':codex-followup-extra[Label]{prompt="Prompt"}',
])("does not change unrelated colon syntax: %s", (markdown) => {
expect(parse(markdown)).toEqual(parseOrdinaryMarkdown(markdown));
@@ -87,10 +83,8 @@ describe("remarkCodexDirectives", () => {
it.each([
':codex-file-citation{purpose="output"}',
- '::artifact-template{skill_name="artifact-template-hello-world"}',
":codex-followup[Prepare print version]",
':codex-followup[ ]{prompt="Prepare the document for printing."}',
- ':codex-followup[Prepare print version]{prompt=" "}',
])("keeps malformed supported directives literal: %s", (markdown) => {
expect(parse(markdown)).toEqual(parseOrdinaryMarkdown(markdown));
});
@@ -100,10 +94,10 @@ describe.each([
{ name: "renderCodexDirectivesForCopy", render: renderCodexDirectivesForCopy },
{ name: "renderCodexInlineDirectivesAsMarkdown", render: renderCodexInlineDirectivesAsMarkdown },
])("$name file citation round trips", ({ render }) => {
+ // regression: #12243 copied Codex citations keep their backslashes
it.each([
"C:\\Users\\test\\[draft]\\report.md",
"\\\\server\\share\\report.md",
- "outputs/report.md",
"/tmp/report%5C.md",
])("preserves the literal path and line: %s", (path) => {
const markdown = render(`:codex-file-citation{path="${path}" line_range_start="7"}`);
@@ -126,7 +120,6 @@ describe("native Markdown adapters", () => {
it.each([
`\\${FILE_CITATION}`,
`\`${FILE_CITATION}\``,
- `\`\`\`text\n${FILE_CITATION}\n\`\`\``,
`[See ${FILE_CITATION}](https://example.com)`,
])("does not render excluded citation syntax: %s", (markdown) => {
expect(renderCodexInlineDirectivesAsMarkdown(markdown)).toBe(markdown);
diff --git a/packages/shared/src/composerContextLegacy.test.ts b/packages/shared/src/composerContextLegacy.test.ts
index 6feac24546c..f64fe124947 100644
--- a/packages/shared/src/composerContextLegacy.test.ts
+++ b/packages/shared/src/composerContextLegacy.test.ts
@@ -80,25 +80,17 @@ describe("upgradeLegacyContextMessage", () => {
expect(upgradeLegacyContextMessage(text)).toEqual({ text, records: [] });
});
- it.each([
- "email@build:7",
- "café@build:7",
- "𐐀@build:7",
- "@build:7foo",
- "@build:7st",
- "@build:7é",
- "@build:7.foo",
- "@build:7@mention",
- "@build:7..foo",
- "@build:7.é",
- ])("does not replace terminal labels embedded in %s", (prompt) => {
- const upgraded = upgradeLegacyContextMessage(
- `${prompt}\n<terminal_context>\n- Build line 7:\n output\n</terminal_context>`,
- );
- expect(upgraded.text).toBe(
- `${prompt}\n\n[Build line 7](t3-context://v1/terminal/legacy_terminal_1)`,
- );
- });
+ it.each(["email@build:7", "@build:7foo", "@build:7.foo"])(
+ "does not replace terminal labels embedded in %s",
+ (prompt) => {
+ const upgraded = upgradeLegacyContextMessage(
+ `${prompt}\n<terminal_context>\n- Build line 7:\n output\n</terminal_context>`,
+ );
+ expect(upgraded.text).toBe(
+ `${prompt}\n\n[Build line 7](t3-context://v1/terminal/legacy_terminal_1)`,
+ );
+ },
+ );
it.each(["terminal_context", "element_context"])(
"preserves malformed trailing %s blocks as text",
diff --git a/packages/shared/src/connectAuth.test.ts b/packages/shared/src/connectAuth.test.ts
index b6f1d4055d4..7bbab61992d 100644
--- a/packages/shared/src/connectAuth.test.ts
+++ b/packages/shared/src/connectAuth.test.ts
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vite-plus/test";
import {
buildConnectAuthorizeRequestUrl,
- buildConnectClerkAuthorizeUrl,
connectLoopbackRedirectUri,
readConnectAuthorizeRequest,
} from "./connectAuth.ts";
@@ -49,27 +48,4 @@ describe("connectAuth", () => {
expect(readConnectAuthorizeRequest(url), port).toBeNull();
}
});
-
- it("builds a PKCE authorize URL against the Clerk endpoint", () => {
- const url = new URL(
- buildConnectClerkAuthorizeUrl({
- authorizationEndpoint: "https://clerk.t3.codes/oauth/authorize",
- clientId: "oauthapp_123",
- redirectUri: connectLoopbackRedirectUri(34338),
- scopes: ["openid", "profile", "email", "offline_access"],
- state: "state-1",
- challenge: "challenge-1",
- }),
- );
-
- expect(url.origin).toBe("https://clerk.t3.codes");
- expect(url.pathname).toBe("/oauth/authorize");
- expect(url.searchParams.get("client_id")).toBe("oauthapp_123");
- expect(url.searchParams.get("redirect_uri")).toBe("http://127.0.0.1:34338/callback");
- expect(url.searchParams.get("response_type")).toBe("code");
- expect(url.searchParams.get("scope")).toBe("openid profile email offline_access");
- expect(url.searchParams.get("state")).toBe("state-1");
- expect(url.searchParams.get("code_challenge")).toBe("challenge-1");
- expect(url.searchParams.get("code_challenge_method")).toBe("S256");
- });
});
diff --git a/packages/shared/src/dateTime.test.ts b/packages/shared/src/dateTime.test.ts
index c4862d743dc..a036cce1c6c 100644
--- a/packages/shared/src/dateTime.test.ts
+++ b/packages/shared/src/dateTime.test.ts
@@ -14,47 +14,23 @@ describe("compareDateTimeStrings", () => {
it.each([
["2024-02-29T12:00:00Z", "2024-02-29T17:30:00+05:30"],
- ["2000-02-29T00:00:00.100Z", "2000-02-28T20:30:00.1-03:30"],
["0000-01-01T00:00:00.000Z", "+000000-01-01T00:00:00.000+00:00"],
- ["+010000-01-01T00:00:00.000Z", "9999-12-31T23:00:00.000-01:00"],
["2026-09-01T24:00:00Z", "2026-09-02T00:00:00Z"],
- ["2026-09-01T24:00:00.0000Z", "2026-09-02T00:00:00.000Z"],
- ["2024-02-29T24:00:00+05:30", "2024-03-01T00:00:00+05:30"],
- ["2026-12-31T24:00:00-07:00", "2027-01-01T07:00:00Z"],
- ["2026-09-01T12:00Z", "2026-09-01T12:00:00.000Z"],
- ["2026-09-01T05:00-07:00", "2026-09-01T12:00:00Z"],
- ["2026-09-01T24:00Z", "2026-09-02T00:00:00Z"],
- ["2026-09-01T24:00+05:30", "2026-09-02T00:00:00+05:30"],
])("preserves equal ISO instants %s and %s", (left, right) => {
expect(compareDateTimeStrings(left, right)).toBe(0);
});
- it.each([
- "2014-02-30",
- "2014-03-02",
- "2014-03-02T00:00:00",
- "2014-03-02T00:00:00.000",
- "03/02/2014",
- "March 2, 2014",
- "Sun, 02 Mar 2014 00:00:00 GMT",
- "2014-03-02T00:00:00.000Z\n",
- "2014-02-30T00:00:00.000Z",
- "1900-02-29T00:00:00.000-07:00",
- "2024-04-31T00:00:00.000+05:30",
- "2024-03-02T12:00:00.000+24:00",
- "2026-09-01T24:01:00Z",
- "2026-09-01T24:00:01Z",
- "2026-09-01T24:00:00.0001Z",
- "2026-09-01T24:01Z",
- "2026-09-01T25:00Z",
- ])("treats %s as malformed without native date guessing", (malformed) => {
- const valid = "1970-01-01T00:00:00.000Z";
- expect(compareDateTimeStrings(malformed, valid)).toBeLessThan(0);
- expect(compareDateTimeStrings(valid, malformed)).toBeGreaterThan(0);
- expect(compareDateTimeStrings(malformed, "invalid")).toBeLessThan(0);
- expect(compareDateTimeStrings("invalid", malformed)).toBeGreaterThan(0);
- expect(compareDateTimeStrings(malformed, malformed)).toBe(0);
- });
+ it.each(["2014-03-02", "2014-02-30T00:00:00.000Z", "2026-09-01T24:01:00Z"])(
+ "treats %s as malformed without native date guessing",
+ (malformed) => {
+ const valid = "1970-01-01T00:00:00.000Z";
+ expect(compareDateTimeStrings(malformed, valid)).toBeLessThan(0);
+ expect(compareDateTimeStrings(valid, malformed)).toBeGreaterThan(0);
+ expect(compareDateTimeStrings(malformed, "invalid")).toBeLessThan(0);
+ expect(compareDateTimeStrings("invalid", malformed)).toBeGreaterThan(0);
+ expect(compareDateTimeStrings(malformed, malformed)).toBe(0);
+ },
+ );
it("gives every permutation of mixed values the same order", () => {
const early = "2026-09-01T12:00:00.000+14:00";
diff --git a/packages/shared/src/favicon.test.ts b/packages/shared/src/favicon.test.ts
index fb8bf79a254..ab6e5767563 100644
--- a/packages/shared/src/favicon.test.ts
+++ b/packages/shared/src/favicon.test.ts
@@ -9,7 +9,8 @@ describe("faviconUrlForOrigin", () => {
);
});
- it.each([null, undefined, "", "invalid URL", "file:///tmp/private", "data:text/plain,private"])(
+ // regression: #5838 no favicon request for missing or non-http origins
+ it.each([null, "invalid URL", "file:///tmp/private"])(
"rejects an invalid or unsupported origin %s",
(origin) => {
expect(faviconUrlForOrigin(origin)).toBeNull();
diff --git a/packages/shared/src/fileLinks.test.ts b/packages/shared/src/fileLinks.test.ts
index 9783aec75da..3d18cbb6cd1 100644
--- a/packages/shared/src/fileLinks.test.ts
+++ b/packages/shared/src/fileLinks.test.ts
@@ -3,7 +3,6 @@ import { parseFileUrlHref, splitFilePathPosition, resolvePathLinkTarget } from "
describe("parseFileUrlHref", () => {
it.each([
- ["file:///Users/julius/project/src/main.ts#L42", "/Users/julius/project/src/main.ts", "#L42"],
[
"file:///D:/Programme/t3code/OpenInPicker.tsx#L69",
"D:/Programme/t3code/OpenInPicker.tsx",
@@ -29,40 +28,28 @@ describe("parseFileUrlHref", () => {
describe("splitFilePathPosition", () => {
it.each([
- ["src/main.ts", "", { path: "src/main.ts" }],
- ["src/main.ts:12", "", { path: "src/main.ts", line: 12 }],
["src/main.ts:12:5", "", { path: "src/main.ts", line: 12, column: 5 }],
["src/main.ts", "#L18C2", { path: "src/main.ts", line: 18, column: 2 }],
["src/main.ts:3", "#L18C2", { path: "src/main.ts", line: 3 }],
["src/main.ts:0", "", { path: "src/main.ts" }],
- ["src/main.ts", "#section", { path: "src/main.ts" }],
])("splits %s%s", (path, hash, expected) => {
expect(splitFilePathPosition(path, hash)).toEqual(expected);
});
});
describe("resolvePathLinkTarget", () => {
+ // regression: #21199 Windows terminal file links resolve against a Windows cwd
it.each([
[
String.raw`src\index.ts:12:7`,
String.raw`C:\Users\Jane Doe\project`,
String.raw`C:\Users\Jane Doe\project\src\index.ts:12:7`,
],
- [
- "src/index.ts:12:7",
- "C:/Users/Jane Doe/project",
- String.raw`C:/Users/Jane Doe/project\src\index.ts:12:7`,
- ],
[
String.raw`.\src\index.ts:12`,
String.raw`\\server\share\project`,
String.raw`\\server\share\project\.\src\index.ts:12`,
],
- [
- String.raw`~\index.ts:12`,
- String.raw`C:\Users\Jane Doe\project`,
- String.raw`C:\Users\Jane Doe\index.ts:12`,
- ],
["src/index.ts:12", "/home/jane/project", "/home/jane/project/src/index.ts:12"],
])("resolves %s using the connected environment cwd %s", (path, cwd, expected) => {
expect(resolvePathLinkTarget(path, cwd)).toBe(expected);
@@ -74,9 +61,8 @@ describe("resolvePathLinkTarget", () => {
).toBe("C:/Users/julius/project/src/main.ts:12");
});
+ // regression: #19627 Windows home paths match case-insensitively
it.each([
- ["C:\\Users\\julius\\project", "C:\\Users\\julius\\notes.md:3"],
- ["C:/Users/julius/project", "C:/Users/julius\\notes.md:3"],
["C:\\users\\alice\\project", "C:\\users\\alice\\notes.md:3"],
["C:/uSeRs/alice/project", "C:/uSeRs/alice\\notes.md:3"],
])("resolves home paths against the Windows cwd %s", (cwd, expected) => {
diff --git a/packages/shared/src/filePreview.test.ts b/packages/shared/src/filePreview.test.ts
index b58930c3735..236865f9fe3 100644
--- a/packages/shared/src/filePreview.test.ts
+++ b/packages/shared/src/filePreview.test.ts
@@ -9,31 +9,22 @@ import {
} from "./filePreview.ts";
describe("workspace file previews", () => {
- it.each([
- "README.md",
- "src/index.ts",
- "image.png.ts",
- "png",
- "image.png#notes.txt",
- "image.svg?notes.txt",
- "document.pdf?download=1",
- "report.html#notes.txt",
- "image%2Epng",
- ])("rejects non-preview path %s", (path) => {
- expect(isWorkspacePreviewEntryPath(path)).toBe(false);
- });
+ // regression: #10311 previews classify by the literal filename, not URL-like suffixes
+ it.each(["image.png.ts", "image.png#notes.txt", "image%2Epng"])(
+ "rejects non-preview path %s",
+ (path) => {
+ expect(isWorkspacePreviewEntryPath(path)).toBe(false);
+ },
+ );
});
describe("media path parsing", () => {
+ // regression: #9023 media kind comes from the decoded pathname, ignoring query and hash
it.each([
["https://cdn.example/clip.webm?download=1#t=2", "video"],
["https://example.com/download?name=recording.mp4", null],
- ["https://example.png", null],
["images%2Fresult%2Epng", "image"],
- ["images/result%23v2.png", "image"],
["images/result.png%23secret.txt", null],
- ["images/result.png%3Fsecret.txt", null],
- ["/tmp/100%.png", "image"],
])("classifies the decoded pathname of %s", (source, kind) => {
expect(mediaKindFromPath(source)).toBe(kind);
});
@@ -42,13 +33,7 @@ describe("media path parsing", () => {
describe("attachment preview classification", () => {
it.each([
["example.json", "application/octet-stream", "text"],
- ["README.md", "text/plain", "markdown"],
- ["component.tsx", "", "text"],
- ["report.pdf", "application/pdf", "pdf"],
- ["page.HTML", "", "html"],
- ["recording.mp3", "", "audio"],
["payload", "application/problem+json", "text"],
- ["archive.zip", "application/zip", "unsupported"],
["misleading.json", "application/pdf", "pdf"],
["misleading.pdf", "application/zip", "unsupported"],
])("classifies %s (%s) as %s", (name, mimeType, expected) => {
diff --git a/packages/shared/src/git.test.ts b/packages/shared/src/git.test.ts
index de93fc84615..91d01cd3a18 100644
--- a/packages/shared/src/git.test.ts
+++ b/packages/shared/src/git.test.ts
@@ -266,9 +266,9 @@ describe("sanitizeFeatureBranchName", () => {
);
});
+ // regression: #15615 generated branch namespaces are preserved
it.each([
["refine toolbar", "feature/refine-toolbar"],
- ["", "feature/update"],
[" /?. / ", "feature/update"],
["fix///", "feature/fix"],
])("keeps the fallback for unprefixed input %s", (input, expected) => {
@@ -286,13 +286,11 @@ describe("resolveAutoFeatureBranchName", () => {
).toBe("fix/refine-toolbar-3");
});
+ // regression: #15615 generated branch namespaces are preserved
it.each([
["fix/name", ["fix"], "fix-2/name"],
- ["team/jules/fix/name", ["team/jules"], "team/jules-2/fix/name"],
["fix/name", ["fix/name/child"], "fix/name-2"],
- ["FIX/name", ["FIX", "FIX-2"], "fix-3/name"],
["fix/name", ["fixes", "fix/name-extra/child"], "fix/name"],
- [undefined, ["feature", "feature-2"], "feature-3/update"],
])("resolves %s against namespace blockers %j", (preferredBranch, existingNames, expected) => {
expect(resolveAutoFeatureBranchName(existingNames, preferredBranch)).toBe(expected);
});
@@ -300,7 +298,6 @@ describe("resolveAutoFeatureBranchName", () => {
describe("formatGeneratedBranchName", () => {
it.each([
- ["release..candidate", "release-candidate/add-search"],
[" Team / Jules.lock/", "Team/Jules-lock/add-search"],
["-team//feature@{new}", "team/feature-new/add-search"],
[" /?. / ", "add-search"],
diff --git a/packages/shared/src/htmlRender.test.ts b/packages/shared/src/htmlRender.test.ts
index f9d84fac8ea..793fde8b824 100644
--- a/packages/shared/src/htmlRender.test.ts
+++ b/packages/shared/src/htmlRender.test.ts
@@ -31,17 +31,14 @@ describe("injectHtmlRenderBootstrap", () => {
expect(injected.endsWith("<p>hi</p>")).toBe(true);
});
- it.each(["textarea", "title", "xmp", "iframe", "noembed", "noframes", "noscript", "plaintext"])(
- "keeps the bootstrap outside %s content",
- (tag) => {
- const fragment = `<${tag}><head><meta name="viewport"></head></${tag}>`;
- const injected = injectHtmlRenderBootstrap(fragment);
- expect(injected.startsWith("<!doctype html><head>")).toBe(true);
- expect(injected.indexOf('<style id="t3-theme">')).toBeLessThan(injected.indexOf(`<${tag}>`));
- expect(injected).toContain('<meta name="viewport" content="width=device-width');
- expect(injected.endsWith(fragment)).toBe(true);
- },
- );
+ it.each(["textarea", "iframe", "plaintext"])("keeps the bootstrap outside %s content", (tag) => {
+ const fragment = `<${tag}><head><meta name="viewport"></head></${tag}>`;
+ const injected = injectHtmlRenderBootstrap(fragment);
+ expect(injected.startsWith("<!doctype html><head>")).toBe(true);
+ expect(injected.indexOf('<style id="t3-theme">')).toBeLessThan(injected.indexOf(`<${tag}>`));
+ expect(injected).toContain('<meta name="viewport" content="width=device-width');
+ expect(injected.endsWith(fragment)).toBe(true);
+ });
it.each([
'<template><head><meta name="viewport"></head></template>',
diff --git a/packages/shared/src/markdownLinks.test.ts b/packages/shared/src/markdownLinks.test.ts
index 434cb9c2c46..dafbfce2f94 100644
--- a/packages/shared/src/markdownLinks.test.ts
+++ b/packages/shared/src/markdownLinks.test.ts
@@ -9,50 +9,23 @@ import {
} from "./markdownLinks.ts";
describe("isMarkdownFileLinkLabel", () => {
+ // regression: #15509 descriptive labels are not mistaken for the linked file name
it.each([
["validates the input", "/repo/src/example.ts:12", false],
- ["read src/example.ts", "/repo/src/example.ts:12", false],
- ["example.ts?why this matters", "/repo/src/example.ts", false],
- ["example.ts", "/repo/src/example.ts:12", true],
["example.ts:12", "/repo/src/example.ts:12", true],
["example.ts:99", "/repo/src/example.ts:12", false],
- ["example.ts:12:2", "/repo/src/example.ts:12:2", true],
- ["example.ts:12:3", "/repo/src/example.ts:12:2", false],
- ["example.ts:12", "/repo/src/example.ts", false],
- ["src/example.ts:12", "/repo/src/example.ts:12", true],
- ["./src/example.ts", "/repo/src/example.ts", true],
- ["/repo/src/example.ts", "/repo/src/example.ts", true],
- ["src/", "/home/me/project/src/", true],
- ["EXAMPLE.TS", "C:/repo/src/example.ts:12", true],
- ["file name.ts", "file:///repo/file%20name.ts", true],
- ["", "/repo/src/example.ts", true],
])("classifies %s for %s", (label, href, expected) => {
expect(isMarkdownFileLinkLabel(label, href)).toBe(expected);
});
});
describe("inlineCodeFilePathCandidate", () => {
+ // regression: #13909 model ids in inline code do not become file chips
it.each([
["src\\main.ts", "src/main.ts"],
- ["C:\\Users\\demo\\image.png", "C:\\Users\\demo\\image.png"],
- ["\\\\server\\share\\image.png", "\\\\server\\share\\image.png"],
- ["conf.d/nginx.conf", "conf.d/nginx.conf"],
- ["script.pl:10", "script.pl:10"],
- ["node.meta", null],
- ["Recorded evidence here: /tmp/image.png", null],
["origin/main", null],
- ["127.0.0.1:3000", null],
- ["example.com/index.html", null],
- ["example.pl/index.html", null],
["z-ai/glm-5.3", null],
- ["z-ai/glm-5.3:12", null],
- ["python/3.12", null],
- ["Qwen/Qwen2.5-Coder", null],
- ["meta-llama/Llama-3.1-8B", null],
["share/man/ls.1", "share/man/ls.1"],
- ["usr/lib/libfoo.so.1", "usr/lib/libfoo.so.1"],
- ["vendor/jquery-3.6.0.min.js", "vendor/jquery-3.6.0.min.js"],
- ["./models/glm-5.3", "./models/glm-5.3"],
])("distinguishes file paths from code and hostnames in %s", (source, candidate) => {
expect(inlineCodeFilePathCandidate(source)).toBe(candidate);
});
@@ -60,46 +33,19 @@ describe("inlineCodeFilePathCandidate", () => {
describe("parseMarkdownFileLink", () => {
it.each([
- ["/Users/julius/project/AGENTS.md", "/Users/julius/project/AGENTS.md"],
- ["/home/me/notes.md", "/home/me/notes.md"],
- ["/usr/local/bin/tool", "/usr/local/bin/tool"],
- ["/workspace/Makefile", "/workspace/Makefile"],
- ["/tmp/favicons/", "/tmp/favicons/"],
- ["C:\\Users\\mike\\project\\src\\main.ts", "C:\\Users\\mike\\project\\src\\main.ts"],
["C:%5Crepo%5Cimage.png", "C:\\repo\\image.png"],
- ["\\\\server\\share\\image.png", "\\\\server\\share\\image.png"],
- ["/D:/Programme/t3code/OpenInPicker.tsx", "D:/Programme/t3code/OpenInPicker.tsx"],
["</D:/Programme/t3code/ChatMarkdown.tsx:1>", "D:/Programme/t3code/ChatMarkdown.tsx"],
- ["file:///Users/julius/project/file%2520name.md", "/Users/julius/project/file%20name.md"],
- ["file://server/share/workspace-image.svg", "\\\\server\\share\\workspace-image.svg"],
["file://localhost/home/me/notes.md", "/home/me/notes.md"],
- ["apps/mobile/src/index.ts:10", "apps/mobile/src/index.ts"],
- ["docs/My%20Folder/checklist.xml", "docs/My Folder/checklist.xml"],
- ["Updated%20cutover%20checklist.md", "Updated cutover checklist.md"],
- ["./scripts/deploy", "./scripts/deploy"],
- ["~/notes/today.md", "~/notes/today.md"],
- ["AGENTS.md", "AGENTS.md"],
- ["script.ts:10", "script.ts"],
- ["/tmp/clip%23one.mp4#t=2", "/tmp/clip#one.mp4"],
])("recognizes %s as a file", (href, path) => {
expect(parseMarkdownFileLink(href)?.path).toBe(path);
});
- it.each([
- "",
- "#anchor",
- "//cdn.example.com/clip.mp4",
- "https://example.com/docs",
- "mailto:[email protected]",
- "javascript:alert(1)",
- "/chat/settings",
- "/chat/settings#L3",
- "/app#L1",
- "readme",
- "TODO:12",
- ])("does not treat %s as a file", (href) => {
- expect(parseMarkdownFileLink(href)).toBeNull();
- });
+ it.each(["https://example.com/docs", "/chat/settings#L3", "TODO:12"])(
+ "does not treat %s as a file",
+ (href) => {
+ expect(parseMarkdownFileLink(href)).toBeNull();
+ },
+ );
it("accepts conventional extensionless names with or without a position", () => {
expect(parseMarkdownFileLink("Makefile")).toEqual({ path: "Makefile" });
@@ -122,29 +68,10 @@ describe("parseMarkdownFileLink", () => {
});
describe("workspaceRelativeFilePath", () => {
+ // regression: #12449 workspace root links resolve to "."
it.each([
["/repo/project", "/repo/project", "."],
- ["/repo/project/", "/repo/project/", "."],
- ["/", "/", "."],
- ["C:/USERS/mike/project", "c:/users/MIKE/project", "."],
["C:/", "c:/", "."],
- ["/repo/project/src/main.ts", "/repo/project", "src/main.ts"],
- ["/repo/project/src/main.ts", "/repo/project/", "src/main.ts"],
- ["C:\\Users\\mike\\t3code\\apps\\web\\a.ts", "C:/Users/mike/t3code", "apps/web/a.ts"],
- ["/C:/Users/mike/t3code/apps/web/a.ts", "C:/Users/mike/t3code", "apps/web/a.ts"],
- ["/Repo/Project/src/main.ts", "/repo/project", null],
- ["/tmp/case/project/probe.txt", "/tmp/case/Project", null],
- ["//tmp/case/project/probe.txt", "//tmp/case/Project", null],
- ["/tmp/case/Project/probe.txt", "/tmp/case/Project", "probe.txt"],
- ["C:/USERS/mike/t3code/main.ts", "c:/users/MIKE/t3code", "main.ts"],
- ["/C:/USERS/mike/t3code/main.ts", "/c:/users/MIKE/t3code", "main.ts"],
- ["\\\\server\\share\\PROJECT\\main.ts", "\\\\Server\\Share\\Project", "main.ts"],
- ["/tmp/repo/file.ts", "/", "tmp/repo/file.ts"],
- ["C:/Users/MIKE/main.ts", "c:/", "Users/MIKE/main.ts"],
- ["\\\\server\\SHARE\\file.ts", "\\\\Server\\Share\\", "file.ts"],
- ["/tmp/repo/file.ts ", "/tmp/repo", "file.ts "],
- ["/tmp/report.ts", "/repo/project", null],
- ["/repo/project-two/a.ts", "/repo/project", null],
["/repo/project/a.ts", undefined, null],
])("relates %s to %s", (path, workspaceRoot, relativePath) => {
expect(workspaceRelativeFilePath(path, workspaceRoot)).toBe(relativePath);
@@ -154,31 +81,14 @@ describe("workspaceRelativeFilePath", () => {
describe("extractMarkdownLinkHrefs", () => {
it.each([
["[".repeat(32_000), []],
- ["[](a".repeat(16_000), []],
- ["[](<a".repeat(16_000), []],
- ["[x](https://e.com/".repeat(8_000), []],
["[a](<foo)bar> invalid [b](ok)", ["<foo", "ok"]],
- ["[a](foo \"mixed title') [b](< >)", ["foo"]],
- ["[a](<one [b](two)> invalid [c](ok)", ["two", "ok"]],
- ["```text\n" + "[unfinished item\n".repeat(8_000) + "```", []],
["[[[nested](src/main.ts) [unfinished", ["src/main.ts"]],
- ["[outer [inner] invalid [valid](src/main.ts)", ["src/main.ts"]],
- ["[bad](missing title [valid](src/main.ts)", ["src/main.ts"]],
- ["```text\n[link](src/main.ts)\n```", ["src/main.ts"]],
- ["[empty]() [valid](src/main.ts 'title')", ["src/main.ts"]],
- ['[angle](<src/My File.ts> "title")', ["src/My File.ts"]],
])("extracts links from incomplete and nested text", (markdown, hrefs) => {
expect(extractMarkdownLinkHrefs(markdown)).toEqual(hrefs);
});
});
describe("resolveMarkdownFileLinkTarget", () => {
- it("resolves relative file paths against cwd", () => {
- expect(resolveMarkdownFileLinkTarget("src/processRunner.ts:71", "/Users/julius/project")).toBe(
- "/Users/julius/project/src/processRunner.ts:71",
- );
- });
-
it("does not treat filename line references as external schemes", () => {
expect(resolveMarkdownFileLinkTarget("script.ts:10", "/Users/julius/project")).toBe(
"/Users/julius/project/script.ts:10",
diff --git a/packages/shared/src/markdownMath.test.ts b/packages/shared/src/markdownMath.test.ts
index 70ddd1ee5f7..cb920c07379 100644
--- a/packages/shared/src/markdownMath.test.ts
+++ b/packages/shared/src/markdownMath.test.ts
@@ -54,16 +54,13 @@ describe("chat math parsing", () => {
},
);
- it.each(["\\(x\\)", "\\[x\\]", "$x$", "$$x$$"])(
- "preserves indented code containing %s",
- (formula) => {
- const source = ` ${formula}`;
- expect(collect(parse(source)).find((node) => node.type === "code")).toMatchObject({
- value: formula,
- });
- expect(markdownMathRanges(source)).toEqual([]);
- },
- );
+ it.each(["\\(x\\)", "$x$", "$$x$$"])("preserves indented code containing %s", (formula) => {
+ const source = ` ${formula}`;
+ expect(collect(parse(source)).find((node) => node.type === "code")).toMatchObject({
+ value: formula,
+ });
+ expect(markdownMathRanges(source)).toEqual([]);
+ });
it("parses formulas without reserving private-use characters", () => {
const characters = Array.from({ length: 6400 }, (_, index) =>
@@ -187,7 +184,7 @@ describe("chat math parsing", () => {
});
});
- it.each([1, 2, 3, 4])("respects %i backslashes before a display fence", (count) => {
+ it.each([1, 2])("respects %i backslashes before a display fence", (count) => {
const prefix = "a+" + "\\".repeat(count);
for (const opening of ["$$", "$$\n"]) {
const source = `${opening}${prefix}$$\nb\n$$`;
@@ -270,28 +267,25 @@ describe("math in GFM tables", () => {
}
});
- it.each([
- "[a](https://example.com/$x)",
- '[a](https://example.com "title $x")',
- "<https://example.com/$x>",
- "`$x`",
- '<span title="$x">a</span>',
- ])("preserves table separators after literal dollars in %s", (literal) => {
- const row = `| ${literal} | y$ |`;
- for (const source of [`${row}\n| --- | --- |`, `| First | Second |\n| --- | --- |\n${row}`]) {
- const tree = parse(source);
- const table = tree.children[0];
- expect(table?.type).toBe("table");
- if (table?.type !== "table") throw new Error("Missing table");
- expect(table.children.every((entry) => entry.children.length === 2)).toBe(true);
- expect(markdownMathRanges(source, tree)).toEqual([]);
- if (literal.startsWith("[a](https://example.com/$x)")) {
- expect(collect(tree).find((node) => node.type === "link")).toMatchObject({
- url: "https://example.com/$x",
- });
+ it.each(["[a](https://example.com/$x)", "`$x`", '<span title="$x">a</span>'])(
+ "preserves table separators after literal dollars in %s",
+ (literal) => {
+ const row = `| ${literal} | y$ |`;
+ for (const source of [`${row}\n| --- | --- |`, `| First | Second |\n| --- | --- |\n${row}`]) {
+ const tree = parse(source);
+ const table = tree.children[0];
+ expect(table?.type).toBe("table");
+ if (table?.type !== "table") throw new Error("Missing table");
+ expect(table.children.every((entry) => entry.children.length === 2)).toBe(true);
+ expect(markdownMathRanges(source, tree)).toEqual([]);
+ if (literal.startsWith("[a](https://example.com/$x)")) {
+ expect(collect(tree).find((node) => node.type === "link")).toMatchObject({
+ url: "https://example.com/$x",
+ });
+ }
}
- }
- });
+ },
+ );
it("retains multiline math after a prose pipe outside tables", () => {
const source = "a | b: \\(x\n+y\\)";
@@ -326,7 +320,7 @@ describe("math in GFM tables", () => {
]);
expect(JSON.stringify(tree)).not.toMatch(/[\uE000-\uF8FF]/);
});
- it.each(["\\(\\frac{1}{|x|}\\)", "$$|x|$$", "$|x|$", "\\[|x|\\]"])(
+ it.each(["\\(\\frac{1}{|x|}\\)", "$$|x|$$", "$|x|$"])(
"keeps pipes inside %s in one cell and preserves source offsets",
(formula) => {
const source = `| Name | Value |\n| --- | --- |\n| x | ${formula} |\n\n- [ ] next`;
diff --git a/packages/shared/src/nodeSqliteClient.test.ts b/packages/shared/src/nodeSqliteClient.test.ts
index 9bda7bbe2b6..c29652ae847 100644
--- a/packages/shared/src/nodeSqliteClient.test.ts
+++ b/packages/shared/src/nodeSqliteClient.test.ts
@@ -202,6 +202,7 @@ it.effect("lets the writer commit while a read-only transaction is open", () =>
),
);
+// regression: #19226 read-only transactions run on the separate reader connection
it.effect("rejects a write in a read-only transaction", () =>
withReaderClient((sql) =>
Effect.gen(function* () {
diff --git a/packages/shared/src/orchestrationTiming.test.ts b/packages/shared/src/orchestrationTiming.test.ts
index 1d801637be9..94e5fb670e1 100644
--- a/packages/shared/src/orchestrationTiming.test.ts
+++ b/packages/shared/src/orchestrationTiming.test.ts
@@ -100,7 +100,7 @@ describe("deriveSubagentElapsedMs", () => {
const startedAt = "2026-09-21T12:00:00.000Z";
const completedAt = "2026-09-21T12:00:10.000Z";
const now = Date.parse("2026-09-21T13:00:00.000Z");
- it.each(["idle", "completed", "failed", "cancelled", "interrupted"] as const)(
+ it.each(["idle", "completed", "failed"] as const)(
"does not count the age of %s work with unknown completion timing",
(status) => {
expect(deriveSubagentElapsedMs({ status, startedAt, completedAt: null }, now)).toBeNull();
diff --git a/packages/shared/src/orchestrationV2PendingBackgroundWork.test.ts b/packages/shared/src/orchestrationV2PendingBackgroundWork.test.ts
index ce221c5c450..934d7f81757 100644
--- a/packages/shared/src/orchestrationV2PendingBackgroundWork.test.ts
+++ b/packages/shared/src/orchestrationV2PendingBackgroundWork.test.ts
@@ -139,23 +139,6 @@ describe("derivePendingBackgroundWork", () => {
]);
});
- it("returns the provider-thread roster after settlement", () => {
- const tasks = derivePendingBackgroundWork({
- latestRun: { id: "run-1" as never, ordinal: 1, status: "completed" },
- providerThreads: [
- {
- id: "pt-1" as never,
- pendingBackgroundTasks: [
- { taskId: "bg-1", description: "Run Codex review", kind: "command" },
- ],
- },
- ],
- turnItems: [],
- activeProviderThreadId: "pt-1",
- });
- expect(tasks).toEqual([{ taskId: "bg-1", description: "Run Codex review", kind: "command" }]);
- });
-
it("includes nonterminal turn items and excludes completed ones", () => {
const tasks = derivePendingBackgroundWork({
latestRun: { id: "run-1" as never, ordinal: 1, status: "completed" },
diff --git a/packages/shared/src/orchestrationV2Timeline.test.ts b/packages/shared/src/orchestrationV2Timeline.test.ts
index 71f7e8f0618..8d38d1db59b 100644
--- a/packages/shared/src/orchestrationV2Timeline.test.ts
+++ b/packages/shared/src/orchestrationV2Timeline.test.ts
@@ -64,17 +64,6 @@ describe.each([
).toBe(false);
});
- it("keeps queued user messages while their run is queued", () => {
- expect(
- isVisible({
- item: { type: "user_message", inputIntent: "queued_turn", runId, nodeId },
- runs: [{ id: runId, status: "queued" }],
- attempts: [],
- items: [{ type: "user_message", inputIntent: "queued_turn", runId, nodeId }],
- }),
- ).toBe(true);
- });
-
it("keeps non-queued user messages on cancelled runs", () => {
expect(
isVisible({
diff --git a/packages/shared/src/otelEnvironment.test.ts b/packages/shared/src/otelEnvironment.test.ts
index 48ff08987fb..c5a1632f7a0 100644
--- a/packages/shared/src/otelEnvironment.test.ts
+++ b/packages/shared/src/otelEnvironment.test.ts
@@ -179,13 +179,6 @@ describe("OtelEnvironment", () => {
Unset: () => "Unset",
});
it.effect.each([
- {
- name: "headers are comma-separated pairs with percent-encoded values",
- env: { ...ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS: "api-key=a%20b,tenant=t3" },
- traces: { protocol: "http/protobuf", headers: { "api-key": "a b", tenant: "t3" } },
- logs: { protocol: "http/protobuf", headers: { "api-key": "a b", tenant: "t3" } },
- warnings: [],
- },
{
name: "a per-signal protocol and headers beat the generic ones",
env: {
@@ -244,12 +237,6 @@ describe("OtelEnvironment", () => {
headers: { "x-key": "otel" },
});
it.each([
- {
- name: "T3CODE_OTLP_*_URL wins over an OTEL endpoint",
- otel: withLogs(otelExport),
- t3Url: "http://t3:4318/v1/logs",
- expected: { url: "http://t3:4318/v1/logs", export: t3Export },
- },
{
name: "T3CODE_OTLP_*_URL wins over a signal the OTEL variables turned off",
otel: withLogs(OtelEnvironment.OtelSignal.Off()),
diff --git a/packages/shared/src/path.test.ts b/packages/shared/src/path.test.ts
index 641574e9cc2..32cdb8ab2c8 100644
--- a/packages/shared/src/path.test.ts
+++ b/packages/shared/src/path.test.ts
@@ -8,13 +8,10 @@ import {
} from "./path.ts";
describe("path helpers", () => {
+ // regression: #17923 literal colons in names are kept, not parsed as positions
it.each([
["report:123", "/workspace", "/workspace/report:123"],
- ["/workspace/report:12:3", "/other", "/workspace/report:12:3"],
["src/file", "C:\\Workspace\\", "C:\\Workspace\\src\\file"],
- ["C:/Workspace/file", "/other", "C:/Workspace/file"],
- ["file", "\\\\host\\share\\", "\\\\host\\share\\file"],
- ["file", "/", "/file"],
["~/report:123", "/workspace", "~/report:123"],
])("resolves literal path %s within %s", (path, root, expected) => {
expect(resolveWorkspaceFilePath(path, root)).toBe(expected);
@@ -41,25 +38,11 @@ describe("path helpers", () => {
});
describe("workspaceRelativeFilePath", () => {
+ // regression: #9309 POSIX paths compare case-sensitively, Windows paths do not
it.each([
- ["/repo/project/src/main.ts", "/repo/project", "src/main.ts"],
- ["/repo/project/src/main.ts", "/repo/project/", "src/main.ts"],
- ["C:\\Users\\mike\\t3code\\apps\\web\\a.ts", "C:/Users/mike/t3code", "apps/web/a.ts"],
- ["/C:/Users/mike/t3code/apps/web/a.ts", "C:/Users/mike/t3code", "apps/web/a.ts"],
["/Repo/Project/src/main.ts", "/repo/project", null],
- ["/tmp/case/project/probe.txt", "/tmp/case/Project", null],
- ["//tmp/case/project/probe.txt", "//tmp/case/Project", null],
- ["/tmp/case/Project/probe.txt", "/tmp/case/Project", "probe.txt"],
["C:/USERS/mike/t3code/main.ts", "c:/users/MIKE/t3code", "main.ts"],
- ["/C:/USERS/mike/t3code/main.ts", "/c:/users/MIKE/t3code", "main.ts"],
- ["\\\\server\\share\\PROJECT\\main.ts", "\\\\Server\\Share\\Project", "main.ts"],
- ["/tmp/repo/file.ts", "/", "tmp/repo/file.ts"],
- ["C:/Users/MIKE/main.ts", "c:/", "Users/MIKE/main.ts"],
- ["\\\\server\\SHARE\\file.ts", "\\\\Server\\Share\\", "file.ts"],
- ["/tmp/repo/file.ts ", "/tmp/repo", "file.ts "],
- ["/tmp/report.ts", "/repo/project", null],
["/repo/project-two/a.ts", "/repo/project", null],
- ["/repo/project/a.ts", undefined, null],
])("relates %s to %s", (path, workspaceRoot, relativePath) => {
expect(workspaceRelativeFilePath(path, workspaceRoot)).toBe(relativePath);
});
diff --git a/packages/shared/src/preview.test.ts b/packages/shared/src/preview.test.ts
index 0bf8a4a5c93..23f4b4390c7 100644
--- a/packages/shared/src/preview.test.ts
+++ b/packages/shared/src/preview.test.ts
@@ -26,7 +26,6 @@ describe("previewPdfAssetUrl", () => {
"http://localhost:6497/api/assets/token/index.html",
"https://example.com/paper.pdf",
"file:///api/assets/token/paper.pdf",
- "javascript:alert(1)",
"invalid",
])("leaves non-asset documents on their browser session: %s", (url) => {
expect(previewPdfAssetUrl(url, "https://environment.test")).toBeNull();
@@ -45,7 +44,7 @@ describe("previewPdfAssetUrl", () => {
expect(previewPdfAssetUrl(source, "https://environment.test")).toBe(source);
});
- it.each(["127.0.0.2", "127.255.255.254", "localhost.", "[::1]", "0.0.0.0"])(
+ it.each(["127.0.0.2", "localhost.", "[::1]"])(
"remaps local assets on %s through the client connection",
(host) => {
expect(
diff --git a/packages/shared/src/projectSettings.test.ts b/packages/shared/src/projectSettings.test.ts
index 2ef00e0d40c..67aaf2186e7 100644
--- a/packages/shared/src/projectSettings.test.ts
+++ b/packages/shared/src/projectSettings.test.ts
@@ -20,6 +20,7 @@ const projectId = ProjectId.make("project-a");
const otherProjectId = ProjectId.make("project-b");
describe("resolveSendEnvMode", () => {
+ // regression: #21404 non-git projects send from the current checkout, git repos keep their mode
it.each(["local", "worktree"] as const)(
"uses local for non-git projects requesting %s",
(mode) => {
diff --git a/packages/shared/src/providerAuthReturnUrl.test.ts b/packages/shared/src/providerAuthReturnUrl.test.ts
index f90736738e7..7e057496e91 100644
--- a/packages/shared/src/providerAuthReturnUrl.test.ts
+++ b/packages/shared/src/providerAuthReturnUrl.test.ts
@@ -15,12 +15,7 @@ describe("provider auth return destinations", () => {
);
it.each([
"t3code://attacker/welcome",
- "t3code://app:123/welcome",
- "t3code://app/auth/callback",
- "t3code://user@ app/welcome",
"t3code://app/welcome/../evil",
"https://attacker.example/welcome",
- "file:///welcome",
- "javascript:alert(1)",
])("rejects %s", (url) => expect(providerAuthReturnUrl(url)).toBeUndefined());
});
diff --git a/packages/shared/src/relayAuth.test.ts b/packages/shared/src/relayAuth.test.ts
index 313af452ed1..8fdfae32c90 100644
--- a/packages/shared/src/relayAuth.test.ts
+++ b/packages/shared/src/relayAuth.test.ts
@@ -49,19 +49,4 @@ describe("Clerk relay auth", () => {
});
expect((pathError as Error & { cause?: unknown }).cause).toBeUndefined();
});
-
- it("preserves URL parser failures for decoded frontend APIs", () => {
- const frontendApi = "[invalid-host";
- const error = captureError(() =>
- clerkFrontendApiHostnameFromPublishableKey(clerkPublishableKey(frontendApi)),
- );
-
- expect(error).toBeInstanceOf(ClerkPublishableKeyFrontendApiError);
- expect(error).toMatchObject({
- keyPrefix: "pk_test",
- frontendApi,
- reason: "invalid-url",
- });
- expect((error as ClerkPublishableKeyFrontendApiError).cause).toBeInstanceOf(Error);
- });
});
diff --git a/packages/shared/src/relayJwt.test.ts b/packages/shared/src/relayJwt.test.ts
index b289ffd22ad..f0557bfe505 100644
--- a/packages/shared/src/relayJwt.test.ts
+++ b/packages/shared/src/relayJwt.test.ts
@@ -1,36 +1,8 @@
-// @effect-diagnostics-next-line nodeBuiltinImport:off -- Effect's Crypto has no generateKeyPairSync.
-import * as NodeCrypto from "node:crypto";
-
import { describe, expect, it } from "@effect/vitest";
-import * as Effect from "effect/Effect";
-import { RelayJwtError, verifyRelayJwt } from "./relayJwt.ts";
+import { RelayJwtError } from "./relayJwt.ts";
describe("relayJwt", () => {
- it.effect("preserves verification request context and the JOSE cause", () =>
- Effect.gen(function* () {
- const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
- publicKeyEncoding: { format: "pem", type: "spki" },
- privateKeyEncoding: { format: "pem", type: "pkcs8" },
- });
- const error = yield* verifyRelayJwt({
- publicKey: keyPair.publicKey,
- token: "not-a-jwt",
- typ: "test-verify+jwt",
- issuer: "https://issuer.example.test",
- audience: "test-audience",
- nowEpochSeconds: 100,
- }).pipe(Effect.flip);
-
- expect(error.operation).toBe("verify");
- expect(error.typ).toBe("test-verify+jwt");
- expect(error.issuer).toBe("https://issuer.example.test");
- expect(error.audience).toBe("test-audience");
- expect(error.cause).toBeInstanceOf(Error);
- expect(error.message).toBe('Failed to verify relay JWT of type "test-verify+jwt".');
- }),
- );
-
it("extracts stable diagnostic codes without copying cause text into the error message", () => {
const error = new RelayJwtError({
operation: "verify",
diff --git a/packages/shared/src/relayUrl.test.ts b/packages/shared/src/relayUrl.test.ts
index 5127db85d1d..d0480d22f76 100644
--- a/packages/shared/src/relayUrl.test.ts
+++ b/packages/shared/src/relayUrl.test.ts
@@ -16,9 +16,6 @@ describe("normalizeSecureRelayUrl", () => {
"http://relay.example.test",
"https://user:[email protected]",
"https://relay.example.test/path",
- "https://relay.example.test?query=value",
- "https://relay.example.test#fragment",
- "not a url",
])("rejects unsafe relay URL %s", (value) => {
expect(normalizeSecureRelayUrl(value)).toBeNull();
expect(isSecureRelayUrl(value)).toBe(false);
diff --git a/packages/shared/src/remote.test.ts b/packages/shared/src/remote.test.ts
index ea42f9cf548..c355f0f699d 100644
--- a/packages/shared/src/remote.test.ts
+++ b/packages/shared/src/remote.test.ts
@@ -1,7 +1,6 @@
import { describe, expect, it } from "vite-plus/test";
import {
- RemoteBackendUrlInvalidError,
RemoteBackendUrlMissingError,
RemotePairingTokenMissingError,
RemotePairingUrlInvalidError,
@@ -72,18 +71,6 @@ describe("remote", () => {
});
});
- it("normalizes a protocol-relative host from a hosted pairing link", () => {
- expect(
- resolveRemotePairingTarget({
- pairingUrl: "https://app.t3.codes/pair?host=%2F%2Fremote.example.com#token=pairing-token",
- }),
- ).toEqual({
- credential: "pairing-token",
- httpBaseUrl: "https://remote.example.com/",
- wsBaseUrl: "wss://remote.example.com/",
- });
- });
-
it("collapses extra leading slashes instead of producing an empty host", () => {
expect(
resolveRemotePairingTarget({
@@ -138,38 +125,6 @@ describe("remote", () => {
expect((pairingUrlError as RemotePairingUrlInvalidError).cause).toBeUndefined();
});
- it("rejects unsupported hosted pairing backend protocols", () => {
- let hostError: unknown;
- try {
- resolveRemotePairingTarget({
- pairingUrl:
- "https://app.t3.codes/pair?host=ftp%3A%2F%2Fremote.example.com#token=pairing-token",
- });
- } catch (cause) {
- hostError = cause;
- }
-
- expect(hostError).toBeInstanceOf(RemoteBackendUrlInvalidError);
- expect(hostError).toMatchObject({ source: "hosted-pairing-host", protocol: "ftp:" });
- expect((hostError as RemoteBackendUrlInvalidError).cause).toBeUndefined();
- });
-
- it("rejects unsupported direct host protocols", () => {
- let hostError: unknown;
- try {
- resolveRemotePairingTarget({
- host: "ftp://remote.example.com",
- pairingCode: "pairing-token",
- });
- } catch (cause) {
- hostError = cause;
- }
-
- expect(hostError).toBeInstanceOf(RemoteBackendUrlInvalidError);
- expect(hostError).toMatchObject({ source: "direct-host", protocol: "ftp:" });
- expect((hostError as RemoteBackendUrlInvalidError).cause).toBeUndefined();
- });
-
it("uses distinct structural errors for missing pairing inputs", () => {
expect(() => resolveRemotePairingTarget({})).toThrowError(RemoteBackendUrlMissingError);
expect(() =>
diff --git a/packages/shared/src/schemaJson.test.ts b/packages/shared/src/schemaJson.test.ts
index 5d53efd10a8..22001ffb2f0 100644
--- a/packages/shared/src/schemaJson.test.ts
+++ b/packages/shared/src/schemaJson.test.ts
@@ -66,25 +66,6 @@ Done.`),
}
});
- it("preserves nested paths reported by schema filters", () => {
- const decode = decodeJsonResult(
- Schema.String.check(
- Schema.makeFilter(() => ({
- path: ["session", "token"],
- issue: "credential is invalid",
- })),
- ),
- );
- const decoded = decode('"credential=secret-value"');
-
- expect(Result.isFailure(decoded)).toBe(true);
- if (Result.isFailure(decoded)) {
- const diagnostic = formatSchemaError(decoded.failure);
- expect(diagnostic).toBe('Invalid value\n at ["session"]["token"]');
- expect(diagnostic).not.toContain("credential=secret-value");
- }
- });
-
it("does not expose malformed lenient JSON input in diagnostics", () => {
const decode = Schema.decodeUnknownExit(fromLenientJson(Schema.Unknown));
const exit = decode('{"token":"credential=secret-value",,}');
@@ -120,25 +101,4 @@ Done.`),
expect(diagnostic.match(/Invalid type/g)).toHaveLength(8);
expect(diagnostic).toContain("... and 2 more issue(s)");
});
-
- it("retains the omitted issue count when bounding long diagnostics", () => {
- const longPath = Array.from({ length: 16 }, (_, index) => `${index}-${"segment".repeat(16)}`);
- const decode = decodeJsonResult(
- Schema.String.check(
- Schema.makeFilter(() => ({ path: longPath, issue: "credential is invalid" })),
- ),
- );
- const failures: Array<Cause.Cause<Schema.SchemaError>> = [];
- for (let index = 0; index < 10; index += 1) {
- const decoded = decode(`"credential=secret-value-${index}"`);
- if (Result.isFailure(decoded)) {
- failures.push(decoded.failure);
- }
- }
-
- const cause = Cause.fromReasons(failures.flatMap((cause) => cause.reasons));
- const diagnostic = formatSchemaError(cause);
- expect(diagnostic.length).toBeLessThanOrEqual(2_048);
- expect(diagnostic.endsWith("\n... and 2 more issue(s)")).toBe(true);
- });
});
diff --git a/packages/shared/src/serverSettings.test.ts b/packages/shared/src/serverSettings.test.ts
index eb1f37f653a..d35cd148605 100644
--- a/packages/shared/src/serverSettings.test.ts
+++ b/packages/shared/src/serverSettings.test.ts
@@ -85,15 +85,6 @@ describe("serverSettings helpers", () => {
tokens: {},
});
});
- it("replaces SSH host lists when saving, editing, and removing hosts", () => {
- const host = { kind: "ssh" as const, id: "mini", label: "Mac mini", target: "mini" };
- const saved = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, { deviceHosts: [host] });
- expect(saved.deviceHosts).toEqual([host]);
- const replacement = { ...host, target: "other-mini" };
- const edited = applyServerSettingsPatch(saved, { deviceHosts: [replacement] });
- expect(edited.deviceHosts).toEqual([replacement]);
- expect(applyServerSettingsPatch(edited, { deviceHosts: [] }).deviceHosts).toEqual([]);
- });
it("inherits actions, preserves existing actions, and supports empty overrides and reset", () => {
const project = { id: ProjectId.make("project-actions"), scripts: [] };
@@ -752,21 +743,6 @@ describe("serverSettings helpers", () => {
},
});
});
-
- it("ignores overrides attached to a concrete background profile", () => {
- const resolved = resolveServerBackgroundActivitySettings({
- ...DEFAULT_SERVER_SETTINGS,
- backgroundActivity: {
- schemaVersion: 1,
- profile: "balanced",
- overrides: {
- pauseWhenOnBattery: true,
- },
- },
- });
-
- expect(resolved.pauseWhenOnBattery).toBe(false);
- });
});
describe("worktreesDirectory", () => {
diff --git a/packages/shared/src/telemetryId.test.ts b/packages/shared/src/telemetryId.test.ts
index 1a8e65eb745..e17598eb0cc 100644
--- a/packages/shared/src/telemetryId.test.ts
+++ b/packages/shared/src/telemetryId.test.ts
@@ -3,14 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
import { hashTelemetryId, isTelemetryIdHash } from "./telemetryId.ts";
describe("telemetry ids", () => {
- // The server hashes the linked Connect account and clients hash the signed-in
- // one. Both must give plain SHA-256 hex, or the two never match.
- it("is the SHA-256 hex digest of the id", () => {
- expect(hashTelemetryId("user_connect")).toBe(
- "7938265611170ce1ba814a67f5a51bcff2b9b46c5597da465e6f098f2217717a",
- );
- });
-
it("accepts only hashes, never a raw id", () => {
expect(isTelemetryIdHash(hashTelemetryId("user_connect"))).toBe(true);
expect(isTelemetryIdHash("user_connect")).toBe(false);
diff --git a/packages/shared/src/usageLimits.test.ts b/packages/shared/src/usageLimits.test.ts
index 938055e0e77..503521c087d 100644
--- a/packages/shared/src/usageLimits.test.ts
+++ b/packages/shared/src/usageLimits.test.ts
@@ -720,6 +720,7 @@ describe("pooled account columns", () => {
row.columns.map((member) => (member.window ? member.account.key : null)),
);
+ // regression: #20349 sessions stay visible while the weekly quota is exhausted
it.each([
["claudeAgent", "13:00", 40, "14:00", 100],
["codex", "14:00", 100, "14:00", 100],
diff --git a/packages/shared/src/usageMerge.test.ts b/packages/shared/src/usageMerge.test.ts
index d0a79159af1..b58c2e6a8d8 100644
--- a/packages/shared/src/usageMerge.test.ts
+++ b/packages/shared/src/usageMerge.test.ts
@@ -113,26 +113,6 @@ describe("mergeUsage", () => {
expect(merged.duplicateSources).toHaveLength(1);
});
- it("sums environments that read different transcript directories", () => {
- const merged = mergeUsage(
- [
- environment(
- "env-a",
- summary([bucket()], [{ provider: "claude", hostId: "mac", homePath: "/a/.claude" }]),
- ),
- environment(
- "env-b",
- summary([bucket()], [{ provider: "claude", hostId: "linux", homePath: "/b/.claude" }]),
- ),
- ],
- USAGE_CONTRACT_VERSION,
- );
-
- expect(merged.costUsd).toBe(20);
- expect(merged.records).toBe(10);
- expect(merged.duplicateSources).toHaveLength(0);
- });
-
it("counts a shared transcript directory once", () => {
const shared = { provider: "claude" as const, hostId: "mac", homePath: "/home/theo/.claude" };
const merged = mergeUsage(
diff --git a/packages/source-control-azure-devops/src/server/AzureDevOpsCli.test.ts b/packages/source-control-azure-devops/src/server/AzureDevOpsCli.test.ts
index 0fa30a4a5e4..9a39f74d290 100644
--- a/packages/source-control-azure-devops/src/server/AzureDevOpsCli.test.ts
+++ b/packages/source-control-azure-devops/src/server/AzureDevOpsCli.test.ts
@@ -1,5 +1,5 @@
import * as NodeServices from "@effect/platform-node/NodeServices";
-import { assert, it, afterEach, describe, expect, vi } from "@effect/vitest";
+import { assert, it, afterEach, describe, vi } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
@@ -152,66 +152,6 @@ describe("AzureDevOpsCli.layer", () => {
}).pipe(Effect.provide(layer)),
);
- it.effect("lists pull requests with Azure status and source branch arguments", () =>
- Effect.gen(function* () {
- mockRun.mockReturnValueOnce(
- Effect.succeed(
- processOutput(
- JSON.stringify([
- {
- pullRequestId: 7,
- title: "Merged work",
- sourceRefName: "refs/heads/feature/merged",
- targetRefName: "refs/heads/main",
- status: "completed",
- closedDate: "2026-01-03T00:00:00.000Z",
- _links: {
- web: {
- href: "https://dev.azure.com/acme/project/_git/repo/pullrequest/7",
- },
- },
- },
- ]),
- ),
- ),
- );
-
- const az = yield* AzureDevOpsCli.AzureDevOpsCli;
- const result = yield* az.listPullRequests({
- cwd: "/repo",
- headSelector: "origin:feature/merged",
- state: "merged",
- limit: 10,
- });
-
- assert.strictEqual(result[0]?.state, "merged");
- assert.strictEqual(result[0]?.mergedAt, "2026-01-03T00:00:00.000Z");
- assert.strictEqual(result[0]?.closedAt, null);
- expect(mockRun).toHaveBeenCalledWith({
- operation: "AzureDevOpsCli.execute",
- command: "az",
- args: [
- "repos",
- "pr",
- "list",
- "--detect",
- "true",
- "--source-branch",
- "feature/merged",
- "--status",
- "completed",
- "--top",
- "10",
- "--only-show-errors",
- "--output",
- "json",
- ],
- cwd: "/repo",
- timeoutMs: 30_000,
- });
- }).pipe(Effect.provide(layer)),
- );
-
it.effect("reads repository clone URLs", () =>
Effect.gen(function* () {
mockRun.mockReturnValueOnce(
@@ -297,27 +237,6 @@ describe("AzureDevOpsCli.layer", () => {
}).pipe(Effect.provide(layer)),
);
- it.effect("keeps invalid pull request output diagnostics structured", () =>
- Effect.gen(function* () {
- mockRun.mockReturnValueOnce(Effect.succeed(processOutput("not-json")));
-
- const az = yield* AzureDevOpsCli.AzureDevOpsCli;
- const error = yield* az.getPullRequest({ cwd: "/repo", reference: "42" }).pipe(Effect.flip);
-
- assert.instanceOf(error, AzureDevOpsCli.AzureDevOpsPullRequestDecodeError);
- assert.strictEqual(error.operation, "getPullRequest");
- assert.strictEqual(error.command, "az");
- assert.strictEqual(error.cwd, "/repo");
- assert.strictEqual(error.outputLength, 8);
- assert.strictEqual(error.detail, "Azure DevOps CLI returned invalid pull request JSON.");
- assert.exists(error.cause);
- assert.strictEqual(
- error.message,
- "Azure DevOps CLI failed in getPullRequest: Azure DevOps CLI returned invalid pull request JSON.",
- );
- }).pipe(Effect.provide(layer)),
- );
-
it.effect("preserves rate-limit failures as a distinct error", () =>
Effect.gen(function* () {
const cause = new VcsProcessExitError({
diff --git a/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.test.ts b/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.test.ts
index 84a8bcadbbf..5e75e6269c9 100644
--- a/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.test.ts
+++ b/packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestCli.test.ts
@@ -201,26 +201,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
}),
);
- it.effect("reports truncation from the extra row", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequests(11, 1))));
- const cli = yield* AzureDevOpsPullRequestCli.AzureDevOpsPullRequestCli;
-
- const batch = yield* cli.listPullRequests({
- cwd: "/w",
- repository: "web",
- state: "open",
- involvement: "all",
- viewer: "[email protected]",
- limit: 10,
- });
-
- assert.strictEqual(batch.items.length, 10);
- assert.isTrue(batch.truncated);
- assert.strictEqual(batch.cursorAdvance, 10);
- }),
- );
-
it.effect("advances by malformed raw rows and keeps reading until the page is full", () =>
Effect.gen(function* () {
mockedExecute
@@ -849,22 +829,6 @@ layer("AzureDevOpsPullRequestCli.layer", (it) => {
}),
);
- it.effect("asks for a file by Azure's own spelling of its path", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(json({ content: "const a = 1;" }))));
- const cli = yield* AzureDevOpsPullRequestCli.AzureDevOpsPullRequestCli;
-
- yield* cli.readItemContent({
- cwd: "/w",
- location: { project: "platform", repository: "web" },
- path: "src/app.ts",
- commit: "a".repeat(40),
- });
-
- expect(argsOfCall(0)).toContain("path=/src/app.ts");
- }),
- );
-
it.effect("reports a pull request it cannot place as its own outcome", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
diff --git a/packages/source-control-azure-devops/src/server/azureDevOpsDiff.test.ts b/packages/source-control-azure-devops/src/server/azureDevOpsDiff.test.ts
index 3b54348fbaa..25e68f8caed 100644
--- a/packages/source-control-azure-devops/src/server/azureDevOpsDiff.test.ts
+++ b/packages/source-control-azure-devops/src/server/azureDevOpsDiff.test.ts
@@ -196,25 +196,6 @@ describe("azureDevOpsFilePatch", () => {
});
describe("a file Azure names something a patch header cannot carry plainly", () => {
- it("writes each side as git's quoted form, the side letter inside the quotes", () => {
- const patch = azureDevOpsFilePatch({
- change: change({ path: "notes\treadme.md", oldPath: "notes\treadme.md" }),
- texts: texts("one\n", "two\n"),
- });
-
- expect(patch.section).toBe(
- [
- 'diff --git "a/notes\\treadme.md" "b/notes\\treadme.md"',
- '--- "a/notes\\treadme.md"',
- '+++ "b/notes\\treadme.md"',
- "@@ -1 +1 @@",
- "-one",
- "+two",
- "",
- ].join("\n"),
- );
- });
-
it("quotes the names a rename states, which carry no side letter", () => {
const patch = azureDevOpsFilePatch({
change: change({
diff --git a/packages/source-control-azure-devops/src/server/azureDevOpsPullRequestJson.test.ts b/packages/source-control-azure-devops/src/server/azureDevOpsPullRequestJson.test.ts
index 330e8501d9d..0166570a9a6 100644
--- a/packages/source-control-azure-devops/src/server/azureDevOpsPullRequestJson.test.ts
+++ b/packages/source-control-azure-devops/src/server/azureDevOpsPullRequestJson.test.ts
@@ -63,9 +63,7 @@ describe("decodePullRequestListJson", () => {
});
it.each([
- ["active", "open"],
["completed", "merged"],
- ["abandoned", "closed"],
["something new", "open"],
])("reads the %s status as %s", (status, expected) => {
const batch = expectSuccess(decodePullRequestListJson(asJson([pullRequest({ status })])));
@@ -76,9 +74,7 @@ describe("decodePullRequestListJson", () => {
it.each([
["succeeded", "mergeable"],
["conflicts", "conflicting"],
- ["rejectedByPolicy", "conflicting"],
["queued", "unknown"],
- ["notSet", "unknown"],
])("reads the %s merge status as %s", (mergeStatus, expected) => {
const batch = expectSuccess(decodePullRequestListJson(asJson([pullRequest({ mergeStatus })])));
@@ -407,19 +403,6 @@ describe("decodeIterationChangesJson", () => {
expect(page.changes.map((change) => change.path)).toEqual(["docs/page.md"]);
});
- it("carries where the next page of a long change starts", () => {
- const page = expectSuccess(
- decodeIterationChangesJson(
- asJson({
- changeEntries: [{ changeType: "add", item: { path: "/DEMO.md", objectId: "ec00" } }],
- nextSkip: 2000,
- }),
- ),
- );
-
- expect(page.nextSkip).toBe(2000);
- });
-
it("reads where a rename came from out of either of the two places Azure names it", () => {
const page = expectSuccess(
decodeIterationChangesJson(
@@ -446,16 +429,6 @@ describe("decodeItemContentJson", () => {
isBinary: false,
});
});
-
- it("keeps Azure's own word that a file is binary", () => {
- expect(
- expectSuccess(
- decodeItemContentJson(
- asJson({ path: "/logo.png", content: "b2xk", contentMetadata: { isBinary: true } }),
- ),
- ),
- ).toEqual({ contents: "b2xk", isBinary: true });
- });
});
/**
diff --git a/packages/source-control-bitbucket/src/server/BitbucketPullRequestApi.test.ts b/packages/source-control-bitbucket/src/server/BitbucketPullRequestApi.test.ts
index 65f723ffdb5..1dafdb02b24 100644
--- a/packages/source-control-bitbucket/src/server/BitbucketPullRequestApi.test.ts
+++ b/packages/source-control-bitbucket/src/server/BitbucketPullRequestApi.test.ts
@@ -305,21 +305,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
}),
);
- it.effect("rewrites a title alone, without touching anything else", () =>
- Effect.gen(function* () {
- mockedRequest.mockReturnValue(Effect.succeed(response("{}")));
- const api = yield* BitbucketPullRequestApi.BitbucketPullRequestApi;
-
- yield* api.updateChangeRequest({ repository: "acme/web", number: 7, title: "A new title" });
-
- const call = callAt(0);
- expect(call.method).toBe("PUT");
- expect(call.url).toBe("/repositories/acme/web/pullrequests/7");
- // Bitbucket's PUT is a partial update, so a field left out of the body is left as it was.
- expect(JSON.parse(call.body ?? "")).toEqual({ title: "A new title" });
- }),
- );
-
it.effect("asks for the time a pull request closed, which Bitbucket leaves out by default", () =>
Effect.gen(function* () {
mockedRequest.mockReturnValueOnce(
@@ -421,35 +406,6 @@ layer("BitbucketPullRequestApi.layer", (it) => {
}),
);
- it.effect("writes a review's line comments, its summary, then its verdict", () =>
- Effect.gen(function* () {
- mockedRequest.mockReturnValue(Effect.succeed(response("{}")));
- const api = yield* BitbucketPullRequestApi.BitbucketPullRequestApi;
-
- yield* api.submitReview({
- repository: "acme/web",
- number: 7,
- verdict: "request-changes",
- body: "Two things.",
- comments: [
- {
- path: "src/a.ts",
- position: { kind: "deleted", oldLine: 12 },
- body: "why remove?",
- },
- ],
- });
-
- expect(callAt(0).url).toContain("/pullrequests/7/comments");
- expect(JSON.parse(callAt(0).body ?? "")).toEqual({
- content: { raw: "why remove?" },
- inline: { path: "src/a.ts", from: 12 },
- });
- expect(callAt(1).url).toContain("/pullrequests/7/comments");
- expect(callAt(2).url).toContain("/pullrequests/7/request-changes");
- }),
- );
-
it.effect("asks for the credentials' permission on this repository, and nobody else's", () =>
Effect.gen(function* () {
mockedRequest.mockReturnValue(
diff --git a/packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.ts b/packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.ts
deleted file mode 100644
index fc73ab69a75..00000000000
--- a/packages/source-control-bitbucket/src/server/BitbucketSourceControlProvider.test.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { SourceControlProviderKind } from "@t3tools/contracts";
-import { assert, it } from "@effect/vitest";
-import * as Effect from "effect/Effect";
-import * as Layer from "effect/Layer";
-import * as Option from "effect/Option";
-import * as Schema from "effect/Schema";
-
-import * as BitbucketApi from "./BitbucketApi.ts";
-import * as BitbucketSourceControlProvider from "./BitbucketSourceControlProvider.ts";
-import {
- BitbucketPullRequestSchema,
- normalizeBitbucketPullRequestRecord,
-} from "./bitbucketPullRequests.ts";
-
-const decodePullRequest = Schema.decodeEffect(BitbucketPullRequestSchema);
-
-function makeProvider(bitbucket: Partial<BitbucketApi.BitbucketApi["Service"]>) {
- return BitbucketSourceControlProvider.make.pipe(
- Effect.provide(Layer.mock(BitbucketApi.BitbucketApi)(bitbucket)),
- );
-}
-
-it.effect("maps Bitbucket PR summaries into provider-neutral change requests", () =>
- Effect.gen(function* () {
- const provider = yield* makeProvider({
- getPullRequest: () =>
- decodePullRequest({
- id: 42,
- title: "Add Bitbucket provider",
- links: { html: { href: "https://bitbucket.org/pingdotgg/t3code/pull-requests/42" } },
- source: {
- branch: { name: "feature/source-control" },
- commit: { hash: "a".repeat(40) },
- repository: { full_name: "fork/t3code" },
- },
- destination: {
- branch: { name: "main" },
- repository: { full_name: "pingdotgg/t3code" },
- },
- state: "OPEN",
- }).pipe(Effect.orDie, Effect.map(normalizeBitbucketPullRequestRecord)),
- });
-
- const changeRequest = yield* provider.getChangeRequest({
- cwd: "/repo",
- reference: "42",
- });
-
- assert.deepStrictEqual(changeRequest, {
- provider: SourceControlProviderKind.make("bitbucket"),
- number: 42,
- title: "Add Bitbucket provider",
- url: "https://bitbucket.org/pingdotgg/t3code/pull-requests/42",
- baseRefName: "main",
- headRefName: "feature/source-control",
- headSha: "a".repeat(40),
- state: "open",
- updatedAt: Option.none(),
- isCrossRepository: true,
- headRepositoryNameWithOwner: "fork/t3code",
- headRepositoryOwnerLogin: "fork",
- });
- }),
-);
diff --git a/packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.ts b/packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.ts
index 3cad526c222..8b3becac22b 100644
--- a/packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.ts
+++ b/packages/source-control-bitbucket/src/server/bitbucketPullRequestJson.test.ts
@@ -75,8 +75,6 @@ describe("decodePullRequestPageJson", () => {
it.each([
["MERGED", "merged"],
["DECLINED", "closed"],
- ["SUPERSEDED", "closed"],
- ["OPEN", "open"],
["something new", "open"],
])("reads the %s state as %s", (state, expected) => {
const decoded = expectSuccess(decodePullRequestPageJson(page([pullRequest({ state })])));
@@ -94,6 +92,7 @@ describe("decodePullRequestPageJson", () => {
});
describe("decodePullRequestJson", () => {
+ // regression: #18402 a pull request with no head commit hash still decodes, headSha null
it.each([
{ metadata: "absent commit", commit: undefined },
{ metadata: "null commit", commit: null },
@@ -271,8 +270,6 @@ describe("decodeStatusesJson", () => {
it.each([
["SUCCESSFUL", "success"],
["FAILED", "failure"],
- ["INPROGRESS", "pending"],
- ["STOPPED", "cancelled"],
["something new", "neutral"],
])("reads the %s build state as %s", (state, expected) => {
const decoded = expectSuccess(decodeStatusesJson(page([{ name: "Pipeline", state }])));
diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts
index dfea4e12847..92d74450f24 100644
--- a/packages/source-control-core/src/server/pullRequestChecks.test.ts
+++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts
@@ -20,17 +20,11 @@ function entry(
}
describe("dedupeChecks", () => {
+ // regression: #20094 runs were compared as timestamp text, picking the older run
it.each([
- ["2026-10-16T12:00:00Z", "2026-10-16T12:00:00.500Z"],
["2026-10-16T12:00:00+02:00", "2026-10-16T10:30:00Z"],
- ["2026-10-16T12:00:00.0001Z", "2026-10-16T12:00:00.0002Z"],
- ["2026-10-16T12:00:00.0001z", "2026-10-16T12:00:00.0002z"],
["2026-10-16T12:00:00.00009Z", "2026-10-16T12:00:00.0001Z"],
- ["2024-02-28T23:59:59Z", "2024-02-29T00:00:00.0001Z"],
- ["2000-02-28T23:59:59Z", "2000-02-29T00:00:00Z"],
["2024-03-01T01:00:00Z", "2024-02-29T23:30:00-02:00"],
- ["2026-10-16t12:00:00z", "2026-10-16t12:00:00.0001z"],
- ["+010000-01-01T00:00:00Z", "+010000-01-01T00:00:00.0001Z"],
])("keeps the newer instant between %s and %s in either listing order", (older, newer) => {
const oldRun = entry("build", "success", { at: older });
const newRun = entry("build", "failure", { at: newer });
@@ -44,7 +38,6 @@ describe("dedupeChecks", () => {
});
it.each([
- ["2026-10-16T12:00:00Z", "2026-10-16T12:00:00.000Z"],
["2026-10-16T12:00:00Z", "2026-10-16T14:00:00+02:00"],
["2026-10-16T24:00:00.000Z", "2026-10-17T00:00:00Z"],
["2026-10-16T12:00Z", "2026-10-16T12:00:00Z"],
@@ -61,23 +54,6 @@ describe("dedupeChecks", () => {
expect([forward[0]?.status, reversed[0]?.status]).toEqual(["failure", "failure"]);
});
- it("keeps the newest run of a check the host listed twice", () => {
- const checks = dedupeChecks([
- entry("Prepare PR size config", "success", {
- workflowName: "PR Size",
- at: "2026-08-11T16:06:25Z",
- }),
- entry("Prepare PR size config", "pending", {
- workflowName: "PR Size",
- at: "2026-08-11T17:01:04Z",
- }),
- ]);
-
- expect(checks.map((check) => [check.name, check.status])).toEqual([
- ["Prepare PR size config", "pending"],
- ]);
- });
-
it.each([
["2026-10-16", "2026-10-15T23:00:00-02:00", "success"],
["2026-10-16T00:00:00", "2026-10-15T23:00:00-02:00", "success"],
@@ -96,7 +72,6 @@ describe("dedupeChecks", () => {
it.each([
["2026-02-30T00:00:00Z", "2026-03-01T00:00:00Z"],
- ["2026-02-29T00:00:00Z", "2026-03-01T00:00:00Z"],
["1900-02-29T00:00:00Z", "1900-03-01T00:00:00Z"],
["2026-04-31T00:00:00.0001-02:00", "2026-05-01T00:00:00Z"],
])("uses text fallback for impossible date %s", (malformed, valid) => {
diff --git a/packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts b/packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
index b427b9e2030..73327470ab8 100644
--- a/packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
+++ b/packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
@@ -139,10 +139,10 @@ it.effect.each([
),
);
+// regression: #18775 a failed branch-protection read surfaces; only 403/404 are treated as no policy
it.effect.each([
["rate limit", { reason: "rate-limit", httpStatus: 429 }, "rate-limited"],
["authentication failure", { reason: "authentication", httpStatus: 401 }, "unauthenticated"],
- ["server failure", { httpStatus: 503 }, "failed"],
["network failure", {}, "failed"],
] as const)("propagates branch metadata %s", ([detail, fields, reason]) => {
const cause = new ForgejoCli.ForgejoCliError({ command: "fj", cwd: "/repo", detail, ...fields });
@@ -225,10 +225,7 @@ it.effect("opens Forgejo Actions check links on the pull request's server", () =
it.effect.each([
["Ready", false, true, false, "mergeable"],
["Draft", true, false, true, "unknown"],
- ["Blocked", false, false, false, "unknown"],
- ["Unchecked", false, undefined, false, "unknown"],
["WIP: Legacy draft", undefined, false, true, "unknown"],
- ["[WIP] Legacy draft", undefined, false, true, "unknown"],
["WIP: Explicitly ready", false, false, false, "unknown"],
] as const)(
"reads Forgejo mergeability for %s (draft=%s, mergeable=%s) across list, summary and detail",
diff --git a/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.test.ts b/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.test.ts
index f5115c99af0..d31f73038f2 100644
--- a/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.test.ts
+++ b/packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.test.ts
@@ -246,49 +246,6 @@ describe("GitCafePullRequestProvider", () => {
}).pipe(Effect.provide(server.layer));
});
- it.effect("reads the diff from the pull request's changed files", () => {
- const file = {
- path: "file.ts",
- oldPath: null,
- status: "modified",
- additions: 1,
- deletions: 1,
- binary: false,
- };
- const snapshot = { version: 4, headOid, comparisonBaseOid: baseOid };
- const server = fakeGitCafe({
- "GET /repos/owner/repo/pulls/7": pull,
- "GET /repos/owner/repo/pulls/7/changes": { ...snapshot, items: [file], next: null },
- "POST /repos/owner/repo/pulls/7/diff-files": {
- ...snapshot,
- items: [
- {
- ...file,
- hunks: [
- {
- oldStart: 1,
- oldLines: 1,
- newStart: 1,
- newLines: 1,
- lines: [
- { origin: "-", content: "old\n" },
- { origin: "+", content: "new\n" },
- ],
- },
- ],
- },
- ],
- },
- });
- return Effect.gen(function* () {
- const provider = yield* GitCafePullRequestProvider.make;
- const diff = yield* provider.getDiff(target);
- assert.include(diff.patch, "-old\n+new\n");
- assert.isNull(diff.nextCursor);
- assert.deepStrictEqual(server.writes(), ["POST /repos/owner/repo/pulls/7/diff-files"]);
- }).pipe(Effect.provide(server.layer));
- });
-
it.effect("resolves a thread through its root at the root's version", () => {
const server = fakeGitCafe({
"GET /repos/owner/repo/pulls/7/comments": { items: [root], next: null },
diff --git a/packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts b/packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts
index 010f03d4b5a..08fee86bc26 100644
--- a/packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts
+++ b/packages/source-control-gitcafe/src/server/GitCafeSourceControlProvider.test.ts
@@ -198,8 +198,6 @@ describe("GitCafeSourceControlProvider", () => {
it.effect.each([
["no context", undefined, "https://git.cafe/fork/project.git"],
- ["an HTTPS remote", "https://git.cafe/team/project.git", "https://git.cafe/fork/project.git"],
- ["an SSH remote", "[email protected]:team/project.git", "[email protected]:fork/project.git"],
["an ssh:// remote", "ssh://[email protected]/team/project.git", "[email protected]:fork/project.git"],
[
"an HTTPS remote with a user",
diff --git a/packages/source-control-gitcafe/src/server/gitCafeHosts.test.ts b/packages/source-control-gitcafe/src/server/gitCafeHosts.test.ts
index eba3e00eafb..77fa0ed7860 100644
--- a/packages/source-control-gitcafe/src/server/gitCafeHosts.test.ts
+++ b/packages/source-control-gitcafe/src/server/gitCafeHosts.test.ts
@@ -13,11 +13,8 @@ describe("gitCafeHosts", () => {
});
it.each([
- ["https://git.cafe/team/project.git", "git.cafe"],
- ["https://git.cafe/team/project", "git.cafe"],
["https://staging.git.cafe/team/project.git/", "staging.git.cafe"],
["[email protected]:team/project.git", "git.cafe"],
- ["[email protected]:team/project.git", "staging.git.cafe"],
["ssh://[email protected]/team/project.git", "git.cafe"],
])("reads the host and repository of %s", (url, host) => {
assert.deepStrictEqual(GitCafeHosts.parseGitCafeRemote(url), {
@@ -27,10 +24,8 @@ describe("gitCafeHosts", () => {
});
it.each([
- "https://github.com/team/project.git",
"https://evil.git.cafe/team/project.git",
"https://git.cafe/team/nested/project.git",
- "https://git.cafe/team",
"team/project",
])("is not a GitCafe repository: %s", (url) => {
assert.isNull(GitCafeHosts.parseGitCafeRemote(url));
diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
index 75a7d36b305..23cadae8577 100644
--- a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
+++ b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
@@ -1200,31 +1200,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("excludes merged pull requests from the Closed tab", () =>
- Effect.gen(function* () {
- mockedExecute.mockImplementation((call) =>
- Effect.succeed(
- call.kind === "graphql" && call.operationName === "PullRequestList"
- ? emptyList()
- : emptySearch(),
- ),
- );
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.listPullRequests({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- state: "closed",
- involvement: "all",
- viewer: "bilal",
- limit: 10,
- });
-
- expect(searchOfCall(0)).toBe("is:pr is:closed is:unmerged sort:updated-desc repo:acme/web");
- }),
- );
-
it.effect("carries every repository and every qualifier into one search", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValue(Effect.succeed(searchPage([])));
@@ -1523,34 +1498,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("joins a search onto the tab's own qualifiers instead of replacing them", () =>
- Effect.gen(function* () {
- mockedExecute.mockImplementation((call) =>
- Effect.succeed(
- call.kind === "graphql" && call.operationName === "PullRequestList"
- ? emptyList()
- : emptySearch(),
- ),
- );
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.listPullRequests({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- state: "closed",
- involvement: "reviewing",
- viewer: "bilal",
- limit: 10,
- query: "page",
- });
-
- expect(searchOfCall(0)).toBe(
- 'is:pr is:closed is:unmerged review-requested:bilal "page" sort:updated-desc repo:acme/web',
- );
- }),
- );
-
it.effect("carries the further narrowings into the search as qualifiers", () =>
Effect.gen(function* () {
mockedExecute.mockImplementation((call) =>
@@ -1861,55 +1808,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
},
});
- it.effect("updates a stale branch with a merge commit unless asked to rebase", () =>
- Effect.gen(function* () {
- route(["query PullRequestActionState", actionState()]);
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.runPullRequestAction({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- action: "update-branch",
- });
- yield* cli.runPullRequestAction({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- action: "update-branch",
- updateMethod: "rebase",
- });
-
- expect(variablesOf("updatePullRequestBranch(")).toEqual([
- { pullRequestId: "PR_7", expectedHeadOid: "abc123", updateMethod: "MERGE" },
- { pullRequestId: "PR_7", expectedHeadOid: "abc123", updateMethod: "REBASE" },
- ]);
- }),
- );
-
- it.effect("merges with the strategy it was asked for", () =>
- Effect.gen(function* () {
- route(["query PullRequestActionState", actionState()]);
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.runPullRequestAction({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- action: "merge",
- mergeMethod: "squash",
- });
-
- expect(variablesOf("mergePullRequest(")).toEqual([
- { input: { pullRequestId: "PR_7", mergeMethod: "SQUASH" } },
- ]);
- expect(variablesOf("enablePullRequestAutoMerge(")).toEqual([]);
- }),
- );
-
it.effect.each([
{
description: "base-only write",
@@ -2056,20 +1954,17 @@ layer("GitHubPullRequestApi.layer", (it) => {
it.effect.each([
{ description: "an open PR", head: { state: "OPEN" }, source: {} },
- { description: "a missing source repository", head: { headRepository: null }, source: {} },
{ description: "the base branch", head: { headRefName: "main" }, source: {} },
{
description: "the default branch",
head: {},
source: { defaultBranchRef: { name: "feat/delete" } },
},
- { description: "a missing default branch", head: {}, source: { defaultBranchRef: null } },
{
description: "a changed branch",
head: {},
source: { ref: { target: { __typename: "Commit", oid: "new-commit" } } },
},
- { description: "an unavailable source repository", head: {}, source: null },
])("refuses to delete $description", ({ head, source }) =>
Effect.gen(function* () {
route(
@@ -2271,35 +2166,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("arms auto-merge with the same strategy a merge would have used", () =>
- Effect.gen(function* () {
- route(["query PullRequestActionState", actionState()]);
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.runPullRequestAction({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- action: "enable-auto-merge",
- mergeMethod: "squash",
- });
- yield* cli.runPullRequestAction({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- action: "enable-auto-merge",
- });
-
- expect(variablesOf("enablePullRequestAutoMerge(")).toEqual([
- { input: { pullRequestId: "PR_7", mergeMethod: "SQUASH" } },
- { input: { pullRequestId: "PR_7", mergeMethod: "MERGE" } },
- ]);
- expect(variablesOf("mergePullRequest(")).toEqual([]);
- }),
- );
-
it.effect("merges at once when auto-merge is asked of a pull request that is ready now", () =>
Effect.gen(function* () {
route(["query PullRequestActionState", actionState({ mergeStateStatus: "CLEAN" })]);
@@ -2715,25 +2581,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("carries on from a cursor without asking for the whole diff again", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(Effect.fail(diffRefused));
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequestFiles(100, 0))));
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
- const target = { cwd: "/w", repository: "acme/web", host: "github.com", number: 7 };
-
- const first = yield* cli.getPullRequestDiff(target);
- assert.isNotNull(first.nextCursor);
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequestFiles(4, 100))));
- const second = yield* cli.getPullRequestDiff({ ...target, cursor: first.nextCursor });
-
- assert.isNull(second.nextCursor);
- expect(second.patch).toContain("diff --git a/src/file100.ts b/src/file100.ts");
- assert.strictEqual(mockedExecute.mock.calls.length, 3);
- assert.strictEqual(pathAt(2), "repos/acme/web/pulls/7/files?per_page=100&page=2");
- }),
- );
-
it.effect("refuses a cursor it never handed out rather than reading it into a request", () =>
Effect.gen(function* () {
const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
@@ -2849,33 +2696,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("reports an oversized diff file with its path and reason", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequestRefs)));
- mockedExecute.mockReturnValueOnce(Effect.succeed(output("partial", true)));
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- const error = yield* Effect.flip(
- cli.getPullRequestDiffFileContents({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- changeType: "deleted",
- oldPath: "src/large.ts",
- newPath: "src/large.ts",
- }),
- );
-
- assert.strictEqual(error._tag, "GitHubDiffFileContentsUnavailableError");
- if (error._tag === "GitHubDiffFileContentsUnavailableError") {
- assert.strictEqual(error.path, "src/large.ts");
- assert.strictEqual(error.reason, "oversized");
- }
- assert.strictEqual(pathAt(1), "repos/acme/web/contents/src/large.ts?ref=a1b2c3d");
- }),
- );
-
it.effect("reports undecodable diff file contents as binary", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequestRefs)));
@@ -3060,21 +2880,12 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
+ // regression: #18780 credentials that cannot read /user still load pull requests
it.effect.each([
new GitHubRequestPolicy.GitHubApiAuthenticationError({
host: "github.identity-auth-error.test",
operation: "getRoutingIdentity",
}),
- new GitHubRequestPolicy.GitHubApiRateLimitError({
- host: "github.identity-rate-error.test",
- operation: "getRoutingIdentity",
- retryAt: 123_456,
- }),
- new GitHubRequestPolicy.GitHubApiRequestError({
- host: "github.identity-network-error.test",
- operation: "getRoutingIdentity",
- cause: new Error("connection refused"),
- }),
new GitHubRequestPolicy.GitHubApiResponseError({
host: "github.identity-server-error.test",
operation: "getRoutingIdentity",
@@ -3136,36 +2947,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("sends a whole review as one request", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValue(Effect.succeed(output("{}")));
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.submitReview({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- verdict: "approve",
- body: "Looks right.",
- comments: [{ path: "src/a.ts", position: { kind: "added", newLine: 4 }, body: "nit" }],
- });
-
- assert.strictEqual(mockedExecute.mock.calls.length, 1);
- expect(restCallsTo("/reviews")).toMatchObject([
- {
- method: "POST",
- path: "repos/acme/web/pulls/7/reviews",
- body: {
- event: "APPROVE",
- body: "Looks right.",
- comments: [{ path: "src/a.ts", line: 4, side: "RIGHT", body: "nit" }],
- },
- },
- ]);
- }),
- );
-
it.effect("confirms a given subject belongs to the named pull request, then reacts to it", () =>
Effect.gen(function* () {
route([SUBJECT_SCOPE_QUERY, subjectScope("IC_1", "PR_kwDOA")]);
@@ -3228,50 +3009,7 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("rewrites only the words a request named", () =>
- Effect.gen(function* () {
- route([NODE_ID_QUERY, nodeIdAnswer("PR_kwDOA")]);
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
- const rewrite = (fields: { readonly title?: string; readonly body?: string }) =>
- cli.updatePullRequest({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 22,
- ...fields,
- });
-
- yield* rewrite({ title: "A better title" });
- yield* rewrite({ body: "A better description." });
- yield* rewrite({ title: "Both", body: "at once." });
-
- assert.strictEqual(variablesOf(NODE_ID_QUERY).length, 1);
- expect(variablesOf("updatePullRequest(")).toEqual([
- { pullRequestId: "PR_kwDOA", title: "A better title" },
- { pullRequestId: "PR_kwDOA", body: "A better description." },
- { pullRequestId: "PR_kwDOA", title: "Both", body: "at once." },
- ]);
- }),
- );
-
- it.effect("fails the read when gh returns something unreadable", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(Effect.succeed(output('{"message":"not found"}')));
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- const error = yield* Effect.flip(
- cli.getPullRequestDetail({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- }),
- );
-
- assert.strictEqual(error._tag, "GitHubPullRequestReadError");
- }),
- );
-
+ // regression: #19564 only a refused reviewer path is retried; other failures surface as-is
it.effect.each([
{
name: "check path",
@@ -3282,31 +3020,7 @@ layer("GitHubPullRequestApi.layer", (it) => {
},
],
},
- {
- name: "mixed errors",
- errors: [refusedReviewer, { ...refusedReviewer, path: [...refusedReviewer.path, "login"] }],
- },
- {
- name: "untyped error",
- errors: [{ message: refusedReviewer.message, path: refusedReviewer.path }],
- },
- {
- name: "negative index",
- errors: [
- {
- ...refusedReviewer,
- path: ["repository", "pullRequest", "reviewRequests", "nodes", -1, "requestedReviewer"],
- },
- ],
- },
{ name: "HTTP 403", errors: [refusedReviewer], status: 403 },
- {
- name: "authentication",
- errors: [refusedReviewer],
- status: 401,
- tag: "GitHubApiAuthenticationError",
- },
- { name: "rate limit", errors: [refusedReviewer], status: 429, tag: "GitHubApiRateLimitError" },
{
name: "GraphQL rate limit",
errors: [refusedReviewer, { message: "API rate limit exceeded", type: "RATE_LIMITED" }],
@@ -3842,32 +3556,6 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect("asks GitHub to review, naming the collection a request is added to", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValue(Effect.succeed(output("{}")));
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
-
- yield* cli.setReviewerRequest({
- cwd: "/w",
- repository: "acme/web",
- host: "github.com",
- number: 7,
- reviewers: [
- { id: "octocat", kind: "user" },
- { id: "reviewers", kind: "team" },
- ],
- requested: true,
- });
-
- expect(callAt(0)).toMatchObject({
- kind: "rest",
- method: "POST",
- path: "repos/acme/web/pulls/7/requested_reviewers",
- body: { reviewers: ["octocat"], team_reviewers: ["reviewers"] },
- });
- }),
- );
-
it.effect("reads who may review and who already has in one request", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValue(
diff --git a/packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts b/packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts
index a7da530b294..28b83ed3d32 100644
--- a/packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts
+++ b/packages/source-control-github/src/server/GitHubPullRequestProvider.test.ts
@@ -761,15 +761,6 @@ describe("getChangeRequestActivity dismissed reviews", () => {
Effect.provide(layerFor("<!-- Macroscope (Approvability) review body marker -->")),
),
);
-
- it.effect("keeps the words of a dismissed review that has its own", () =>
- readActivity.pipe(
- Effect.map((activity) => {
- expect(activity.comments[0]?.body).toBe("These findings still stand.");
- }),
- Effect.provide(layerFor("These findings still stand.")),
- ),
- );
});
describe("loginAvatarUrl", () => {
diff --git a/packages/source-control-github/src/server/GitHubSourceControlProvider.test.ts b/packages/source-control-github/src/server/GitHubSourceControlProvider.test.ts
index 05a5b9961b6..a8dfbabf7d2 100644
--- a/packages/source-control-github/src/server/GitHubSourceControlProvider.test.ts
+++ b/packages/source-control-github/src/server/GitHubSourceControlProvider.test.ts
@@ -292,31 +292,6 @@ describe("GitHubSourceControlProvider repository resolution", () => {
assert.deepStrictEqual(paths, ["github.com repos/acme/web"]);
}).pipe(Effect.provide(layer));
});
-
- it.effect("reads an SSH alias remote through github.com", () => {
- const hosts: string[] = [];
- const { layer } = harness({
- remotes: remotesOutput(["origin", "git@github:acme/web.git"]),
- api: {
- rest: (input) =>
- Effect.sync(() => {
- hosts.push(`${input.host} ${input.path}`);
- return restResponse({
- full_name: "acme/web",
- html_url: "https://github.com/acme/web",
- ssh_url: "[email protected]:acme/web.git",
- default_branch: "main",
- });
- }),
- },
- });
- return Effect.gen(function* () {
- const gh = yield* GitHubSourceControlProvider.make;
- yield* gh.getDefaultBranch({ cwd: "/repo" });
- yield* gh.getDefaultBranch({ cwd: "/repo", context: githubContext("github") });
- assert.deepStrictEqual(hosts, ["github.com repos/acme/web", "github.com repos/acme/web"]);
- }).pipe(Effect.provide(layer));
- });
});
describe("GitHubSourceControlProvider change request lookups by head", () => {
@@ -865,14 +840,6 @@ it("reports every gh login and leads with the account Settings pin", () => {
]);
});
-it("falls back to gh's active login when the pinned account is gone", () => {
- const auth = GitHubSourceControlProvider.parseGitHubAuth(multiAccountStatus(), {
- hosts: { "github.com": { account: "former-job", enabled: true } },
- tokens: {},
- });
- assert.deepStrictEqual(auth.account, Option.some("personal"));
-});
-
it("reports unauthenticated when Settings turn off every signed-in host", () => {
const auth = GitHubSourceControlProvider.parseGitHubAuth(multiAccountStatus(), {
hosts: { "github.com": { enabled: false } },
@@ -1007,13 +974,6 @@ it.live.each([
it.effect.each([
{ host: "github.com", resolved: "", envRepository: "", expected: "acme/web" },
- { host: "code.example.test", resolved: "", envRepository: "", expected: "acme/web" },
- {
- host: "github.com",
- resolved: "remote.origin.gh-resolved base",
- envRepository: "",
- expected: "me/web",
- },
{
host: "code.example.test",
resolved: "remote.origin.gh-resolved base",
@@ -1026,13 +986,6 @@ it.effect.each([
envRepository: "",
expected: "acme/other",
},
- {
- host: "code.example.test",
- resolved: "remote.upstream.gh-resolved acme/other",
- envRepository: "",
- expected: "acme/other",
- },
- { host: "github.com", resolved: "", envRepository: "chosen/repo", expected: "chosen/repo" },
{
host: "code.example.test",
resolved: "",
diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts
index 7485f658dbb..5a408c98044 100644
--- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts
+++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts
@@ -1453,30 +1453,6 @@ describe("decodePullRequestFilesJson", () => {
);
});
- it("assembles a unified patch the files API does not return", () => {
- const result = expectSuccess(
- decodePullRequestFilesJson(
- JSON.stringify([
- { filename: "src/app.ts", status: "modified", patch: "@@ -1 +1 @@\n-old\n+new" },
- ]),
- ),
- );
-
- expect(result.patch).toBe(
- [
- "diff --git a/src/app.ts b/src/app.ts",
- "--- a/src/app.ts",
- "+++ b/src/app.ts",
- "@@ -1 +1 @@",
- "-old",
- "+new",
- "",
- ].join("\n"),
- );
- expect(result.truncated).toBe(false);
- expect(result.rawCount).toBe(1);
- });
-
it("points an added file at /dev/null on the left and a removed one on the right", () => {
const result = expectSuccess(
decodePullRequestFilesJson(
diff --git a/packages/source-control-gitlab/src/server/GitLabPullRequestCli.legacy.test.ts b/packages/source-control-gitlab/src/server/GitLabPullRequestCli.legacy.test.ts
index 00ffeb6e4e8..6b059d8fa58 100644
--- a/packages/source-control-gitlab/src/server/GitLabPullRequestCli.legacy.test.ts
+++ b/packages/source-control-gitlab/src/server/GitLabPullRequestCli.legacy.test.ts
@@ -123,6 +123,7 @@ layer("legacy GitLab diff requests through GitLabCli", (it) => {
expect(run).toHaveBeenCalledTimes(2);
}),
);
+ // regression: #15886 the older-GitLab fallback still surfaces its own failure
it.effect("propagates failure of the legacy endpoint", () =>
Effect.gen(function* () {
run.mockReturnValueOnce(failure("not-found"));
diff --git a/packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts b/packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
index d0c3c93b091..f9a88a84618 100644
--- a/packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
+++ b/packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
@@ -282,29 +282,10 @@ layer("GitLabPullRequestCli.layer", (it) => {
}),
);
- it.effect("addresses a nested group project by its encoded full path", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(Effect.succeed(output("[]")));
- const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
-
- yield* cli.listMergeRequests({
- cwd: "/w",
- repository: "acme/platform/web",
- state: "open",
- involvement: "all",
- viewer: "bilal",
- limit: 10,
- });
-
- expect(argsOfCall(0)[1]).toContain("projects/acme%2Fplatform%2Fweb/merge_requests");
- }),
- );
-
it.effect.each([
{ action: "merge", autoMerge: "false", mergeMethod: "squash" },
{ action: "enable-auto-merge", autoMerge: "true", mergeMethod: "squash" },
{ action: "merge", autoMerge: "false", mergeMethod: "rebase" },
- { action: "enable-auto-merge", autoMerge: "true", mergeMethod: "rebase" },
] as const)(
"$action with $mergeMethod succeeds on a project requiring the current source SHA",
({ action, autoMerge, mergeMethod }) =>
@@ -453,24 +434,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
}),
);
- it.effect("carries on from a cursor at the page it names", () =>
- Effect.gen(function* () {
- mockedExecute
- .mockReturnValueOnce(Effect.succeed(output(diffPage(0))))
- .mockReturnValueOnce(Effect.succeed(output(diffPage(100, 3))));
- const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
- const target = { cwd: "/w", repository: "acme/web", number: 7 };
-
- const first = yield* cli.getMergeRequestDiff(target);
- assert.isNotNull(first.nextCursor);
- const second = yield* cli.getMergeRequestDiff({ ...target, cursor: first.nextCursor });
-
- expect(argsOfCall(1)[1]).toContain("page=2");
- assert.isNull(second.nextCursor);
- expect(second.patch).toContain("diff --git a/src/100.ts b/src/100.ts");
- }),
- );
-
it.effect("refuses a cursor it never handed out rather than reading it into a query", () =>
Effect.gen(function* () {
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -581,43 +544,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
}),
);
- it.effect("reports an oversized diff file with its path and reason", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValueOnce(
- Effect.succeed(
- output(
- JSON.stringify({
- diff_refs: {
- base_sha: "a1b2c3d",
- head_sha: "b1c2d3e",
- start_sha: "a1b2c3d",
- },
- }),
- ),
- ),
- );
- mockedExecute.mockReturnValueOnce(Effect.succeed(output("partial", true)));
- const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
-
- const error = yield* Effect.flip(
- cli.getMergeRequestDiffFileContents({
- cwd: "/w",
- repository: "acme/web",
- number: 7,
- changeType: "deleted",
- oldPath: "src/large.ts",
- newPath: "src/large.ts",
- }),
- );
-
- assert.strictEqual(error._tag, "GitLabDiffFileContentsUnavailableError");
- if (error._tag === "GitLabDiffFileContentsUnavailableError") {
- assert.strictEqual(error.path, "src/large.ts");
- assert.strictEqual(error.reason, "oversized");
- }
- }),
- );
-
it.effect("reports undecodable diff file contents as binary", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
@@ -1071,27 +997,6 @@ layer("GitLabPullRequestCli.layer", (it) => {
expect(JSON.parse(callAt(1).stdin ?? "")).toEqual({ reviewer_ids: [5] });
}),
);
-
- it.effect("rewrites title and description together in one request", () =>
- Effect.gen(function* () {
- mockedExecute.mockReturnValue(Effect.succeed(output("{}")));
- const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
-
- yield* cli.updateMergeRequest({
- cwd: "/w",
- repository: "acme/web",
- number: 7,
- title: "A better title",
- description: "What this changes.",
- });
-
- assert.strictEqual(mockedExecute.mock.calls.length, 1);
- expect(JSON.parse(callAt(0).stdin ?? "")).toEqual({
- title: "A better title",
- description: "What this changes.",
- });
- }),
- );
it.effect("reads blob ids for the marked paths at the merge request's head", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
diff --git a/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts b/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
index 33d5dad89b6..23728f63127 100644
--- a/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
+++ b/packages/source-control-gitlab/src/server/GitLabSourceControlProvider.test.ts
@@ -25,49 +25,6 @@ function makeProvider(gitlab: Partial<GitLabCli.GitLabCli["Service"]>) {
);
}
-it.effect("maps GitLab MR summaries into provider-neutral change requests", () =>
- Effect.gen(function* () {
- const provider = yield* makeProvider({
- getMergeRequest: () =>
- Effect.succeed({
- number: 42,
- title: "Add GitLab provider",
- url: "https://gitlab.com/pingdotgg/t3code/-/merge_requests/42",
- baseRefName: "main",
- headRefName: "feature/source-control",
- headSha: "a".repeat(40),
- state: "closed",
- closedAt: "2026-08-23T10:00:00Z",
- isCrossRepository: true,
- headRepositoryNameWithOwner: "fork/t3code",
- headRepositoryOwnerLogin: "fork",
- }),
- });
-
- const changeRequest = yield* provider.getChangeRequest({
- cwd: "/repo",
- reference: "42",
- });
-
- assert.deepStrictEqual(changeRequest, {
- provider: SourceControlProviderKind.make("gitlab"),
- number: 42,
- title: "Add GitLab provider",
- url: "https://gitlab.com/pingdotgg/t3code/-/merge_requests/42",
- baseRefName: "main",
- headRefName: "feature/source-control",
- headSha: "a".repeat(40),
- state: "closed",
- closedAt: "2026-08-23T10:00:00Z",
- mergedAt: null,
- updatedAt: Option.none(),
- isCrossRepository: true,
- headRepositoryNameWithOwner: "fork/t3code",
- headRepositoryOwnerLogin: "fork",
- });
- }),
-);
-
it("accepts authenticated GitLab hosts when another configured host fails", () => {
const auth = GitLabSourceControlProvider.discovery.parseAuth({
exitCode: ChildProcessSpawner.ExitCode(1),
@@ -151,6 +108,7 @@ it("tells a host glab has no login for apart from output that cannot say", () =>
assert.strictEqual(refine("git.example.test\n x API call failed: 503"), undefined);
});
+// regression: #15395 self-hosted GitLab remotes resolve bare MR numbers once glab is signed in
it.effect.each([
[
"https://code.example.test:[email protected]:8443/Team/Repo.git",
@@ -159,8 +117,6 @@ it.effect.each([
"Code.Example.Test:8443",
],
["[email protected]:team/repo.git", true, "gitlab"],
- ["code.example.test:team/repo.git", true, "gitlab"],
- ["[email protected]:/team/repo.git", true, "gitlab"],
["https://code.example.test/team/repo.git", false, "unknown"],
["https://github.com/team/repo.git", true, "github"],
] as const)(
diff --git a/packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts b/packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
index 2c3019429ff..aba89ac5670 100644
--- a/packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
+++ b/packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
@@ -88,12 +88,6 @@ describe("decodeMergeRequestListJson", () => {
expect(batch.items[0]?.state).toBe("merged");
});
- it("keeps a locked merge request open", () => {
- const batch = expectSuccess(decodeMergeRequestListJson(listJson([{ state: "locked" }])));
-
- expect(batch.items[0]?.state).toBe("open");
- });
-
it("reads the legacy draft flag", () => {
const batch = expectSuccess(decodeMergeRequestListJson(listJson([{ work_in_progress: true }])));
@@ -108,14 +102,6 @@ describe("decodeMergeRequestListJson", () => {
expect(batch.items[0]?.mergeability).toBe("conflicting");
});
- it("leaves an unfinished merge check unknown", () => {
- const batch = expectSuccess(
- decodeMergeRequestListJson(listJson([{ merge_status: "checking" }])),
- );
-
- expect(batch.items[0]?.mergeability).toBe("unknown");
- });
-
it("skips a malformed row but still counts it, so paging does not stop early", () => {
const batch = expectSuccess(
decodeMergeRequestListJson(
@@ -460,17 +446,6 @@ describe("decodeMergeRequestDiffsJson", () => {
});
describe("merge request viewer fields", () => {
- it("carries GitLab's own answer for whether this viewer can merge", () => {
- expect(
- expectSuccess(decodeMergeRequestDetailJson(detailJson({ user: { can_merge: false } })))
- .viewerCanMerge,
- ).toBe(false);
- expect(
- expectSuccess(decodeMergeRequestDetailJson(detailJson({ user: { can_merge: true } })))
- .viewerCanMerge,
- ).toBe(true);
- });
-
it("leaves merging permitted where GitLab answered without the field", () => {
expect(expectSuccess(decodeMergeRequestDetailJson(detailJson({}))).viewerCanMerge).toBe(true);
expect(
@@ -525,26 +500,6 @@ describe("decodeAwardEmojiJson", () => {
expect(result.nextCursor).toBeNull();
});
- it("hands back a cursor when GitLab has more notes to page", () => {
- const result = expectSuccess(
- decodeAwardEmojiJson(
- JSON.stringify({
- data: {
- currentUser: null,
- project: {
- mergeRequest: {
- awardEmoji: { nodes: [] },
- notes: { pageInfo: { hasNextPage: true, endCursor: "Y3Vyc29yOjE" }, nodes: [] },
- },
- },
- },
- }),
- ),
- );
-
- expect(result.nextCursor).toBe("Y3Vyc29yOjE");
- });
-
it("matches the viewer's username case-insensitively, since GitLab is not consistent about case", () => {
const result = expectSuccess(
decodeAwardEmojiJson(
@@ -584,12 +539,6 @@ describe("decodeOwnAwardIdJson", () => {
expectSuccess(decodeOwnAwardIdJson(awards, { content: "thumbs-up", viewer: "bilal" })),
).toBe(102);
});
-
- it("returns nothing where the reader has no award of that name", () => {
- expect(
- expectSuccess(decodeOwnAwardIdJson(awards, { content: "heart", viewer: "bilal" })),
- ).toBeNull();
- });
});
describe("decodeRepositoryBlobsJson", () => {