Skip to content

The open-source app everyone uses to manage agents at work

test: consolidate duplicate owner proofs (#16075)

Dotta3ea39f75c169
diff --git a/cli/src/__tests__/zip-codec.test.ts b/cli/src/__tests__/zip-codec.test.ts
index 03788e8807..aa1e35b285 100644
--- a/cli/src/__tests__/zip-codec.test.ts
+++ b/cli/src/__tests__/zip-codec.test.ts
@@ -12,24 +12,6 @@ describe("isBlobStorePath", () => {
});
describe("bytesToPortableFileEntry", () => {
- it("keeps blobs/ entries as base64 octet streams regardless of extension", () => {
- const bytes = new Uint8Array([0x00, 0x01, 0x80, 0xfe, 0xff]);
- expect(bytesToPortableFileEntry("blobs/4f2d1c9a", bytes)).toEqual({
- encoding: "base64",
- data: Buffer.from(bytes).toString("base64"),
- contentType: "application/octet-stream",
- });
- });
-
- it("falls back to base64 when bytes are not valid UTF-8", () => {
- const invalidUtf8 = new Uint8Array([0x68, 0x69, 0xff, 0xfe, 0xc0]);
- expect(bytesToPortableFileEntry("tasks/pap-1/raw-notes", invalidUtf8)).toEqual({
- encoding: "base64",
- data: Buffer.from(invalidUtf8).toString("base64"),
- contentType: "application/octet-stream",
- });
- });
-
it("decodes valid UTF-8 entries to text", () => {
const bytes = new TextEncoder().encode("# Notes\n\ncafé ✅\n");
expect(bytesToPortableFileEntry("tasks/pap-1/TASK.md", bytes)).toBe("# Notes\n\ncafé ✅\n");
@@ -38,7 +20,7 @@ describe("bytesToPortableFileEntry", () => {
describe("readZipArchive", () => {
it("round-trips blob and invalid UTF-8 entries byte-exactly", async () => {
- const blobBytes = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x00, 0xff]);
+ const blobBytes = new Uint8Array([0x68, 0x69]);
const invalidUtf8 = new Uint8Array([0x68, 0x69, 0xff, 0xfe, 0xc0]);
const archive = createStoredZipArchive(
{
diff --git a/doc/plans/2026-10-12-test-audit-r9.md b/doc/plans/2026-10-12-test-audit-r9.md
new file mode 100644
index 0000000000..9e89f27815
--- /dev/null
+++ b/doc/plans/2026-10-12-test-audit-r9.md
@@ -0,0 +1,18 @@
+# Test audit R9: owner-level duplicate consolidation
+
+Base: `77408fa6c3d7c916d7160760eae2144aaa0f8fe7` (#16072). This batch removes nine registered tests and 79 net test lines. It changes no production code. No CI timing claim was measured.
+
+| Retired proof | Keeper and preserved contract | Owner mutation caught by keeper |
+| --- | --- | --- |
+| CLI ZIP: separate binary blob and invalid UTF-8 fallback cases | Archive round-trip keeps blob bytes and invalid UTF-8 note bytes exact; valid UTF-8 blob input is covered there too. | Bypass blob storage or decode invalid UTF-8 lossily; exact round-trip fails. |
+| Daytona: first execute creates a session before the second reuses it | Persistent-shell case checks one created session, a `paperclip-` id, and the same session id for both commands. | Break the id prefix or session-store hit; the keeper fails. |
+| Shared account handle: plain `acct-42` acceptance | Whitespace-rejection case retains the exact accepted input and checks it is not trimmed. | Return null for the accepted identifier; the keeper fails. |
+| Loopback bind: bare `pnpm dev` rewrite | Loopback-preset case retains the same bare command and checks the rewritten command plus preset behavior. | Stop rewriting the bare command; the keeper fails. |
+| Native runner: generic remote-runner acceptance | Remote Dot capability case retains generic-remote acceptance alongside the Dot-specific rejection and acceptance controls. | Require Dot capability for generic remote runners; the keeper fails. |
+| Auth route: null Sentry DSN in an unset configuration | Full persisted-user session response already checks `sentryDsn: null` and `sentryEnvironment: null`. | Return an empty string for the DSN; full response equality fails. |
+| Discord registration: successful registration before runtime enablement | The 503 refresh case first proves successful registration, capabilities, callback, persisted receipt, token exclusion, and idempotent reconciliation. | Persist the bot token in the receipt; the migrated token-exclusion assertion fails. |
+| Slack OAuth: organization grant over-grant provenance | The no-scope refresh case first checks the original database grant before refresh, then retains the post-refresh warning. | Omit OAuth provenance when creating the initial organization grant; the pre-refresh database assertion fails. |
+
+Each mutation was tested against the intended retained assertion. Production owners were restored byte-for-byte after controls. Complete owner candidates passed before restoration. The modified files were then replayed on this exact base in two runs: six owners passed 1,001 tests; after building the local plugin SDK dependency, the two server owners passed 1,691 tests. The final combined total is 2,692 passing tests across all eight changed owners. `git diff --check` passes.
+
+The reductions consolidate proof at an existing owner and keep the distinct boundary controls. They do not claim a specific CI-time reduction; the focused suites still exercise their retained inputs and assertions.
diff --git a/packages/plugins/sandbox-providers/daytona/src/plugin.test.ts b/packages/plugins/sandbox-providers/daytona/src/plugin.test.ts
index 8526e7c12d..5035fcdb44 100644
--- a/packages/plugins/sandbox-providers/daytona/src/plugin.test.ts
+++ b/packages/plugins/sandbox-providers/daytona/src/plugin.test.ts
@@ -2142,19 +2142,6 @@ describe("Daytona sandbox provider plugin", () => {
...overrides,
});
- it("creates one session on the first execute and reuses it on the next", async () => {
- process.env.DAYTONA_API_KEY = "host-key";
- const sandbox = createMockSandbox();
- mockGet.mockResolvedValue(sandbox);
-
- await plugin.definition.onEnvironmentExecute?.(sessionExecParams());
- await plugin.definition.onEnvironmentExecute?.(sessionExecParams());
-
- expect(sandbox.process.createSession).toHaveBeenCalledTimes(1);
- const sessionId = sandbox.process.createSession.mock.calls[0]![0] as string;
- expect(sessionId).toMatch(/^paperclip-/);
- });
-
it("opens one session when two first commands overlap", async () => {
process.env.DAYTONA_API_KEY = "host-key";
const sandbox = createMockSandbox();
@@ -2541,6 +2528,8 @@ describe("Daytona sandbox provider plugin", () => {
await plugin.definition.onEnvironmentExecute?.(sessionExecParams());
expect(sandbox.process.createSession).toHaveBeenCalledTimes(1);
+ const sessionId = sandbox.process.createSession.mock.calls[0]![0] as string;
+ expect(sessionId).toMatch(/^paperclip-/);
const firstSid = sandbox.process.executeSessionCommand.mock.calls[0]![0] as string;
const secondSid = sandbox.process.executeSessionCommand.mock.calls[1]![0] as string;
expect(firstSid).toBe(secondSid);
diff --git a/packages/shared/src/account-handle.test.ts b/packages/shared/src/account-handle.test.ts
index 9e6ca78971..fb77e08a68 100644
--- a/packages/shared/src/account-handle.test.ts
+++ b/packages/shared/src/account-handle.test.ts
@@ -3,10 +3,6 @@ import { ACCOUNT_HANDLE_MAX_LENGTH, toAccountHandle } from "./account-handle.js"
import { createUserSecretDefinitionSchema } from "./validators/secret.js";
describe("toAccountHandle", () => {
- it("returns the value for a plain identifier", () => {
- expect(toAccountHandle("acct-42")).toBe("acct-42");
- });
-
it("returns null for a value that holds a space, such as \"a b\"", () => {
expect(toAccountHandle("a b")).toBeNull();
});
diff --git a/packages/shared/src/runtime-exposure/loopback-bind.test.ts b/packages/shared/src/runtime-exposure/loopback-bind.test.ts
index 293e1ef352..91e49c143f 100644
--- a/packages/shared/src/runtime-exposure/loopback-bind.test.ts
+++ b/packages/shared/src/runtime-exposure/loopback-bind.test.ts
@@ -37,14 +37,6 @@ describe("forceLoopbackBindInCommand", () => {
);
});
- it("adds an explicit loopback bind when the command selects none", () => {
- // A bare `pnpm dev` lets an old guest runner infer its bind from HOST, so the
- // flags must be added rather than assumed.
- expect(forceLoopbackBindInCommand("pnpm dev")).toBe(
- "pnpm dev --bind loopback",
- );
- });
-
it("keeps the legacy lan aliases so dev-service detection still matches", () => {
// `isPaperclipDevRuntimeService` matches `--tailscale-auth` as a substring;
// an explicit `--bind` already beats the alias in every dev-runner version.
diff --git a/server/src/__tests__/auth-routes.test.ts b/server/src/__tests__/auth-routes.test.ts
index 08d2a047f0..62ef9653a4 100644
--- a/server/src/__tests__/auth-routes.test.ts
+++ b/server/src/__tests__/auth-routes.test.ts
@@ -115,23 +115,6 @@ describe("auth routes", () => {
expect(res.body.sentryDsn).toBe("https://[email protected]/1");
});
- it("sends a null sentryDsn when SENTRY_DSN is unset", async () => {
- delete process.env.SENTRY_DSN;
- const app = await createApp(
- {
- type: "board",
- userId: "user-1",
- source: "session",
- },
- baseUser,
- );
-
- const res = await request(app).get("/api/auth/get-session");
-
- expect(res.status).toBe(200);
- expect(res.body.sentryDsn).toBe(null);
- });
-
it("sends sentryDsn for a board actor when only SENTRY_DSN_FRONTEND is set", async () => {
delete process.env.SENTRY_DSN;
delete process.env.SENTRY_DSN_BACKEND;
diff --git a/server/src/__tests__/chat-channels.integration.test.ts b/server/src/__tests__/chat-channels.integration.test.ts
index 24fa9b9ac7..b6d5f28c29 100644
--- a/server/src/__tests__/chat-channels.integration.test.ts
+++ b/server/src/__tests__/chat-channels.integration.test.ts
@@ -6037,46 +6037,6 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => {
};
}
- it("persists registration before enabling the runtime and preserves unrelated commands", async () => {
- const f = await registrationFixture();
- try {
- await f.configure();
- const connected = await f.service.get(f.endpoint.id);
- expect(connected?.capabilities).toMatchObject({
- slashCommands: true,
- ephemeralMessages: true,
- });
- expect(
- f.runtime.configurations.get(f.endpoint.id)?.callbacks.onSlashCommand,
- ).toBeTypeOf("function");
- expect(f.calls).toEqual(["GET", "POST"]);
- expect(f.commandRows().map((row) => row.name)).toEqual([
- "other",
- "paperclip",
- ]);
- const [registration] = await db
- .select()
- .from(chatActions)
- .where(
- and(
- eq(chatActions.endpointId, f.endpoint.id),
- eq(chatActions.kind, "discord_command_registration"),
- ),
- );
- expect(registration?.status).toBe("processed");
- expect(registration?.payload.registration).toMatchObject({
- phase: "registered",
- });
- expect(JSON.stringify(registration)).not.toContain(
- f.credentials.botToken,
- );
- await f.service.reconcileProviderRuntimes();
- expect(f.calls).toEqual(["GET", "POST"]);
- } finally {
- await retireRegistrationFixture(f.service, f.endpoint.id);
- }
- });
-
it("keeps mention setup usable on registration failure and upgrades automatically when due", async () => {
const f = await registrationFixture("unavailable");
try {
@@ -6150,6 +6110,37 @@ describeEmbeddedPostgres("chat channel control-plane integration", () => {
)!.callbacks;
expect(originalCallbacks.onMessage).toBeTypeOf("function");
expect(originalCallbacks.onSlashCommand).toBeTypeOf("function");
+ const connected = await f.service.get(f.endpoint.id);
+ expect(connected?.capabilities).toMatchObject({
+ slashCommands: true,
+ ephemeralMessages: true,
+ });
+ expect(
+ f.runtime.configurations.get(f.endpoint.id)?.callbacks.onSlashCommand,
+ ).toBeTypeOf("function");
+ expect(f.calls).toEqual(["GET", "POST"]);
+ expect(f.commandRows().map((row) => row.name)).toEqual([
+ "other",
+ "paperclip",
+ ]);
+ const [registration] = await db
+ .select()
+ .from(chatActions)
+ .where(
+ and(
+ eq(chatActions.endpointId, f.endpoint.id),
+ eq(chatActions.kind, "discord_command_registration"),
+ ),
+ );
+ expect(registration?.status).toBe("processed");
+ expect(registration?.payload.registration).toMatchObject({
+ phase: "registered",
+ });
+ expect(JSON.stringify(registration)).not.toContain(
+ f.credentials.botToken,
+ );
+ await f.service.reconcileProviderRuntimes();
+ expect(f.calls).toEqual(["GET", "POST"]);
const shutdown = vi.spyOn(original!, "shutdown");
const targetRestart = vi.fn(async () => {
throw new Error(
diff --git a/server/src/__tests__/tool-access-service.test.ts b/server/src/__tests__/tool-access-service.test.ts
index 16dae1966e..5ea8b6ebba 100644
--- a/server/src/__tests__/tool-access-service.test.ts
+++ b/server/src/__tests__/tool-access-service.test.ts
@@ -10826,20 +10826,14 @@ describeEmbeddedPostgres("tool access service", () => {
};
}
- it("records the over-grant on the shared organization grant", async () => {
+ it("keeps the over-grant warning when a refresh asserts no scope", async () => {
const lane = await connectSharedSlack("channels:read chat:write");
- // The organization grant is created before OAuth has any credentials, so it used to be
- // the one record with no provenance at all.
expect((await lane.readGrant()).providerTenant?.oauth).toMatchObject({
scopes: ["channels:read", "chat:write"],
scopeSource: "provider",
unrequestedScopes: ["chat:write"],
});
- });
-
- it("keeps the over-grant warning when a refresh asserts no scope", async () => {
- const lane = await connectSharedSlack("channels:read chat:write");
await lane.refreshWithScope(null);
diff --git a/server/src/services/native-runtime/native-session-executor.test.ts b/server/src/services/native-runtime/native-session-executor.test.ts
index b0555926fe..f90b4ffeb9 100644
--- a/server/src/services/native-runtime/native-session-executor.test.ts
+++ b/server/src/services/native-runtime/native-session-executor.test.ts
@@ -2643,12 +2643,6 @@ describe("remote runner build metadata", () => {
prpTransportModes: ["dial_ws_loopback", "dial_wss", "listen_ws"],
};
- it("accepts the current contract with the required transport", () => {
- expect(() =>
- assertRemoteRunnerBuildMetadata(current, "listen_ws"),
- ).not.toThrow();
- });
-
it("requires an explicit Dot bridge capability only for remote Dot execution", () => {
expect(() => assertRemoteRunnerBuildMetadata(current, "listen_ws", "openai_dot_mcp"))
.toThrow("runner_remote_dot_capability_missing");