mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 10:07:24 +01:00
Merge origin/master into feat/antigravity-swarm-command
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * origin/master: refactor(plugin-sdk): remove archivedState from the resume result (#22443) refactor(runner): let the provider decide whether a released Runner relaunches (#22442) fix(connections): drop MCP wording and the MCP guide link from Google Workspace setup (#22793) fix(ui): defer the Connectors announcement until a return visit (#22790) fix(connections): show only the privacy policy link in the Google Workspace picker (#22795) Add count, newest-first and lean run reads to customer-success inspection (#22781) fix(connections): keep a finished setup checklist on screen when the app refreshes queries (#22715) perf(ci): Phase 2 PR CI under 4 minutes (dynamic workers, fast E2E boot, typecheck overlap, test-budget gate) (#22729) fix(plan-mode): open the plan review card when a Plan-mode run settles without one (#22732)
This commit is contained in:
commit
3cbfa500f4
142 files changed
+5552
-11636
No files matched your search
@@ -31,7 +31,7 @@ test("answering questions in chat and inbox updates both open surfaces", async (
|
||||
});
|
||||
|
||||
test("a routine delivers a first digest, unread state, source link and replyable history", async ({ page, request }) => {
|
||||
const f = await setup(request);
|
||||
const f = await setup(request, { agentCount: 2 });
|
||||
try {
|
||||
await page.goto(`/${f.company.issuePrefix}/chats/${f.agents[1].id}`);
|
||||
await expect(page.getByTestId("task-chat-thread").locator(':scope > [aria-busy="false"]')).toBeVisible({ timeout: 20_000 });
|
||||
|
||||
@@ -219,24 +219,25 @@ test("split handoff commits relevant plans before execution and never creates ch
|
||||
}
|
||||
});
|
||||
|
||||
for (const bad of [
|
||||
{ ids: ["987654321"] },
|
||||
{ urls: ["https://user:password@github.com/org/repo"] },
|
||||
{
|
||||
urls: ["https://github.com/org/repo"],
|
||||
workspace: { name: "Conflicting", repoUrl: "https://github.com/org/repo" },
|
||||
},
|
||||
])
|
||||
test(`failed project creation has no success card or partial state: ${JSON.stringify(bad)}`, async ({
|
||||
page,
|
||||
request,
|
||||
}) => {
|
||||
const f = await setup(request);
|
||||
try {
|
||||
await page.goto(f.route);
|
||||
test("failed project creation has no success card or partial state", async ({
|
||||
page,
|
||||
request,
|
||||
}) => {
|
||||
const invalidPayloads = [
|
||||
{ ids: ["987654321"] },
|
||||
{ urls: ["https://user:password@github.com/org/repo"] },
|
||||
{
|
||||
urls: ["https://github.com/org/repo"],
|
||||
workspace: { name: "Conflicting", repoUrl: "https://github.com/org/repo" },
|
||||
},
|
||||
];
|
||||
const f = await setup(request);
|
||||
try {
|
||||
await page.goto(f.route);
|
||||
for (const [index, bad] of invalidPayloads.entries()) {
|
||||
await send(page, { action: "project", ...bad });
|
||||
await idle(request, f.chatPath);
|
||||
await expect(page.getByText(/Expected tool result:/)).toBeVisible();
|
||||
await idle(request, f.chatPath, index + 1);
|
||||
await expect(page.getByText(/Expected tool result:/)).toHaveCount(index + 1);
|
||||
await expect(
|
||||
page.getByRole("article", { name: /Project created:/ }),
|
||||
).toHaveCount(0);
|
||||
@@ -248,10 +249,11 @@ for (const bad of [
|
||||
expect(
|
||||
await json(await request.get(`/api/companies/${f.company.id}/issues`)),
|
||||
).toHaveLength(0);
|
||||
} finally {
|
||||
await f.restore();
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
await f.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("first upload creates the chat without invoking its agent; shared attachments persist", async ({
|
||||
page,
|
||||
|
||||
@@ -37,11 +37,9 @@ test("built chat initializes after service worker takeover and reload with a slo
|
||||
expect(scripts.length).toBeGreaterThan(0);
|
||||
expect(scripts.every((src) => src?.startsWith("/assets/"))).toBe(true);
|
||||
await page.evaluate(async () => { await navigator.serviceWorker.ready; });
|
||||
for (let reload = 0; reload < 3; reload += 1) {
|
||||
await page.reload();
|
||||
await expect(page.getByTestId("task-chat-composer-input")).toBeVisible({ timeout: 30_000 });
|
||||
expect(await page.evaluate(() => !!navigator.serviceWorker.controller)).toBe(true);
|
||||
}
|
||||
await page.reload();
|
||||
await expect(page.getByTestId("task-chat-composer-input")).toBeVisible({ timeout: 30_000 });
|
||||
expect(await page.evaluate(() => !!navigator.serviceWorker.controller)).toBe(true);
|
||||
expect(await json(await request.get(f.chatPath))).toBeNull();
|
||||
} finally {
|
||||
await cdp.detach();
|
||||
@@ -254,7 +252,7 @@ test("Stop then queued /new resets unpause the conversation without losing histo
|
||||
});
|
||||
|
||||
test("Coordinator agent switching preserves drafts and opens one conversation only on send", async ({ page, request }) => {
|
||||
const f = await setup(request);
|
||||
const f = await setup(request, { agentCount: 2 });
|
||||
try {
|
||||
await page.goto(f.route);
|
||||
await expect(page.getByRole("navigation", { name: "Workspace navigation" })).toBeVisible();
|
||||
@@ -295,7 +293,7 @@ test("secondary chat navigation preserves layout, unique conversations, history,
|
||||
request,
|
||||
}) => {
|
||||
const originalExperimental = await json(await request.get("/api/instance/settings/experimental"));
|
||||
const f = await setup(request);
|
||||
const f = await setup(request, { agentCount: 6 });
|
||||
const originalWorkspace = await json(await request.get("/api/workspace-preferences/me"));
|
||||
try {
|
||||
await page.route("**/api/workspace-preferences/me", (route) =>
|
||||
|
||||
@@ -16,7 +16,12 @@ export async function json(response: Awaited<ReturnType<APIRequestContext["get"]
|
||||
);
|
||||
return response.json();
|
||||
}
|
||||
export async function setup(request: APIRequestContext) {
|
||||
const DEFAULT_AGENT_NAMES = ["Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta"] as const;
|
||||
|
||||
export async function setup(
|
||||
request: APIRequestContext,
|
||||
options: { agentCount?: number } = {},
|
||||
) {
|
||||
const company = await json(
|
||||
await request.post("/api/companies", {
|
||||
data: { name: `Agent Chat ${Date.now()}` },
|
||||
@@ -35,26 +40,29 @@ export async function setup(request: APIRequestContext) {
|
||||
}),
|
||||
);
|
||||
}
|
||||
const agents = [];
|
||||
for (const name of ["Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta"])
|
||||
agents.push(
|
||||
await json(
|
||||
await request.post(`/api/companies/${company.id}/agents`, {
|
||||
data: {
|
||||
name,
|
||||
adapterType: "process",
|
||||
adapterConfig: {
|
||||
command: process.execPath,
|
||||
args: [path.resolve("tests/e2e/fixtures/agent-chat.mjs")],
|
||||
graceSec: 1,
|
||||
},
|
||||
runtimeConfig: {
|
||||
heartbeat: { enabled: false, wakeOnDemand: true },
|
||||
},
|
||||
const agentNames = DEFAULT_AGENT_NAMES.slice(0, options.agentCount ?? 1);
|
||||
const createAgent = (name: string) =>
|
||||
request
|
||||
.post(`/api/companies/${company.id}/agents`, {
|
||||
data: {
|
||||
name,
|
||||
adapterType: "process",
|
||||
adapterConfig: {
|
||||
command: process.execPath,
|
||||
args: [path.resolve("tests/e2e/fixtures/agent-chat.mjs")],
|
||||
graceSec: 1,
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
runtimeConfig: {
|
||||
heartbeat: { enabled: false, wakeOnDemand: true },
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(json);
|
||||
// Create the primary agent first so DB creation order and default primary-agent
|
||||
// selection stay deterministic (`agents[0]`), then parallelize any extra agents.
|
||||
const firstAgent = await createAgent(agentNames[0]!);
|
||||
const remainingAgents = await Promise.all(agentNames.slice(1).map(createAgent));
|
||||
const agents = [firstAgent, ...remainingAgents];
|
||||
const agent = agents[0];
|
||||
const chatPath = `/api/companies/${company.id}/chats/${agent.id}`;
|
||||
const route = `/${company.issuePrefix}/chats/${agent.id}`;
|
||||
@@ -66,57 +74,56 @@ export async function setup(request: APIRequestContext) {
|
||||
route,
|
||||
restore: async () => {
|
||||
try {
|
||||
const chat = await request.get(chatPath);
|
||||
const history = chat.ok() ? await chat.json() : null;
|
||||
const tasks = await json(
|
||||
await request.get(`/api/companies/${company.id}/issues`),
|
||||
);
|
||||
const projects = await json(
|
||||
await request.get(`/api/companies/${company.id}/projects`),
|
||||
);
|
||||
const ledger = await json(
|
||||
await request.get(`/api/companies/${company.id}/heartbeat-runs`),
|
||||
);
|
||||
const documents = await Promise.all(
|
||||
[...(history ? [history] : []), ...tasks].map(async (task: any) => ({
|
||||
taskId: task.id,
|
||||
documents: await json(
|
||||
await request.get(`/api/issues/${task.id}/documents`),
|
||||
const info = test.info();
|
||||
if (info.status !== info.expectedStatus) {
|
||||
const chat = await request.get(chatPath);
|
||||
const history = chat.ok() ? await chat.json() : null;
|
||||
const [tasks, projects, ledger] = await Promise.all([
|
||||
request.get(`/api/companies/${company.id}/issues`).then(json),
|
||||
request.get(`/api/companies/${company.id}/projects`).then(json),
|
||||
request.get(`/api/companies/${company.id}/heartbeat-runs`).then(json),
|
||||
]);
|
||||
const documents = await Promise.all(
|
||||
[...(history ? [history] : []), ...tasks].map(async (task: any) => ({
|
||||
taskId: task.id,
|
||||
documents: await json(
|
||||
await request.get(`/api/issues/${task.id}/documents`),
|
||||
),
|
||||
})),
|
||||
);
|
||||
await info.attach("chat-persisted-state", {
|
||||
contentType: "application/json",
|
||||
body: Buffer.from(
|
||||
JSON.stringify(
|
||||
{
|
||||
chat: history,
|
||||
tasks,
|
||||
projects,
|
||||
documents,
|
||||
comments: history
|
||||
? await json(
|
||||
await request.get(`/api/issues/${history.id}/comments`),
|
||||
)
|
||||
: [],
|
||||
runs: ledger.map((run: any) => ({
|
||||
id: run.id,
|
||||
status: run.status,
|
||||
startedAt: run.startedAt,
|
||||
finishedAt: run.finishedAt,
|
||||
sessionIdBefore: run.sessionIdBefore,
|
||||
sessionIdAfter: run.sessionIdAfter,
|
||||
issueId: run.contextSnapshot?.issueId,
|
||||
generation:
|
||||
run.contextSnapshot?.conversationSessionGeneration,
|
||||
reset: run.contextSnapshot?.conversationReset,
|
||||
})),
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
),
|
||||
})),
|
||||
);
|
||||
await test.info().attach("chat-persisted-state", {
|
||||
contentType: "application/json",
|
||||
body: Buffer.from(
|
||||
JSON.stringify(
|
||||
{
|
||||
chat: history,
|
||||
tasks,
|
||||
projects,
|
||||
documents,
|
||||
comments: history
|
||||
? await json(
|
||||
await request.get(`/api/issues/${history.id}/comments`),
|
||||
)
|
||||
: [],
|
||||
runs: ledger.map((run: any) => ({
|
||||
id: run.id,
|
||||
status: run.status,
|
||||
startedAt: run.startedAt,
|
||||
finishedAt: run.finishedAt,
|
||||
sessionIdBefore: run.sessionIdBefore,
|
||||
sessionIdAfter: run.sessionIdAfter,
|
||||
issueId: run.contextSnapshot?.issueId,
|
||||
generation:
|
||||
run.contextSnapshot?.conversationSessionGeneration,
|
||||
reset: run.contextSnapshot?.conversationReset,
|
||||
})),
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
),
|
||||
});
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
const runs = await json(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { test, expect, request as pwRequest, type APIRequestContext, type Page } from "@playwright/test";
|
||||
import { seedReturningAnnouncementVisit } from "./helpers/announcement-visit";
|
||||
|
||||
/**
|
||||
* E2E (N-13): the in-app announcement well ("Introducing Connectors" upsell)
|
||||
@@ -14,7 +15,7 @@ import { test, expect, request as pwRequest, type APIRequestContext, type Page }
|
||||
|
||||
const PORT = Number(process.env.PAPERCLIP_E2E_PORT ?? 3199);
|
||||
const BASE_URL = `http://127.0.0.1:${PORT}`;
|
||||
const ANNOUNCEMENT_ID = "e2e-n13-connectors";
|
||||
const ANNOUNCEMENT_ID = "2026-09-14-connectors";
|
||||
const SETTLE_WAIT_MS = 4_500; // ANNOUNCEMENT_SETTLE_MS (3 s) plus slack.
|
||||
const ONE_PIXEL_PNG = Buffer.from(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
|
||||
@@ -30,7 +31,8 @@ async function createCompany(board: APIRequestContext, name: string) {
|
||||
data: { name: "Chief of staff", role: "ceo", adapterType: "process", adapterConfig: { command: "true" } },
|
||||
});
|
||||
if (!agentRes.ok()) throw new Error(`POST agents → ${agentRes.status()}: ${await agentRes.text()}`);
|
||||
return { id: company.id as string, prefix: (company.issuePrefix ?? company.prefix) as string };
|
||||
const agent = await agentRes.json();
|
||||
return { agentId: agent.id as string, id: company.id as string, prefix: (company.issuePrefix ?? company.prefix) as string };
|
||||
}
|
||||
|
||||
async function createIssue(board: APIRequestContext, companyId: string, data: Record<string, unknown>) {
|
||||
@@ -54,11 +56,6 @@ async function mockAnnouncementFeed(page: Page) {
|
||||
await page.route("**/api/workspace-preferences/me", (route) => route.fulfill({ json: {
|
||||
userId: "local-board", coordinatorWorkspaceEnabled: false, updatedAt: null,
|
||||
} }));
|
||||
await page.addInitScript(() => {
|
||||
for (const key of Object.keys(window.localStorage)) {
|
||||
if (key.includes("announcement")) window.localStorage.removeItem(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test.describe("Announcement well (N-13)", () => {
|
||||
@@ -79,7 +76,27 @@ test.describe("Announcement well (N-13)", () => {
|
||||
await mockAnnouncementFeed(page);
|
||||
});
|
||||
|
||||
test("chat-first onboarding keeps Connectors hidden across a reload until an idle return", async ({ page }) => {
|
||||
const company = await createCompany(board, "E2E-Chat-Onboarding");
|
||||
companyIds.push(company.id);
|
||||
const start = await board.post(`${BASE_URL}/api/companies/${company.id}/chats/${company.agentId}/onboarding`, { data: {} });
|
||||
expect(start.ok(), await start.text()).toBe(true);
|
||||
const path = `/${company.prefix}/chats/${company.agentId}`;
|
||||
const well = page.getByRole("complementary", { name: "Paperclip announcements" });
|
||||
await page.clock.install();
|
||||
for (const navigate of [() => page.goto(path), () => page.reload()]) {
|
||||
await Promise.all([page.waitForResponse("**/api/announcements/current"), navigate()]);
|
||||
await page.clock.fastForward(SETTLE_WAIT_MS);
|
||||
await expect(well).toHaveCount(0);
|
||||
}
|
||||
const now = await page.evaluate(() => Date.now());
|
||||
await page.clock.setSystemTime(now + 30 * 60_000);
|
||||
await page.keyboard.press("Shift");
|
||||
await expect(well.getByRole("link", { name: "Explore connectors" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("a brand-new company with its onboarding task open does not show the upsell", async ({ page }) => {
|
||||
await seedReturningAnnouncementVisit(page);
|
||||
const company = await createCompany(board, "E2E-N13-Onboarding");
|
||||
companyIds.push(company.id);
|
||||
const firstTask = await createIssue(board, company.id, {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { test, expect, type APIRequestContext, type APIResponse, type Locator, type Page } from "@playwright/test";
|
||||
import { seedReturningAnnouncementVisit } from "./helpers/announcement-visit";
|
||||
|
||||
/**
|
||||
* N-17: a new user's first task view must stay usable while the in-app
|
||||
@@ -54,6 +55,7 @@ async function box(locator: Locator, name: string): Promise<Box> {
|
||||
}
|
||||
|
||||
async function serveConnectorsAnnouncement(page: Page, announcement: object = CONNECTORS_ANNOUNCEMENT) {
|
||||
await seedReturningAnnouncementVisit(page);
|
||||
await page.route("**/api/announcements/current", (route) =>
|
||||
route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify(announcement) }),
|
||||
);
|
||||
|
||||
@@ -352,7 +352,10 @@ for (const classic of [false, true]) {
|
||||
fullPage: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
const classic = false;
|
||||
test(`lost accepted response settles from its exact receipt without replay (classic=${classic})`, async ({
|
||||
page,
|
||||
request,
|
||||
|
||||
@@ -222,12 +222,12 @@ test.describe("chat destination partial updates", () => {
|
||||
});
|
||||
|
||||
test.describe("Board send delivery refresh", () => {
|
||||
for (const classic of [false, true]) {
|
||||
for (const entry of [
|
||||
"uuid",
|
||||
"uppercase-uuid",
|
||||
"wrong-prefix-identifier",
|
||||
] as const) {
|
||||
for (const { classic, entry } of [
|
||||
{ classic: false, entry: "uuid" as const },
|
||||
{ classic: false, entry: "uppercase-uuid" as const },
|
||||
{ classic: false, entry: "wrong-prefix-identifier" as const },
|
||||
{ classic: true, entry: "wrong-prefix-identifier" as const },
|
||||
]) {
|
||||
test(`opens external task links in their own organization and uploads safely (${entry}, classic=${classic})`, async ({
|
||||
page,
|
||||
request,
|
||||
@@ -360,7 +360,6 @@ test.describe("Board send delivery refresh", () => {
|
||||
)
|
||||
.toBe(target.companyId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test("keeps the connected-task banner readable in narrow task panes", async ({
|
||||
@@ -1372,8 +1371,21 @@ test.describe("Failed chat task and exact run retry", () => {
|
||||
);
|
||||
});
|
||||
|
||||
for (const surface of ["agent run", "Inbox", "Coordinator Tasks", "Legacy Inbox"] as const) {
|
||||
for (const outcome of ["queued", "deferred", "denied"] as const) {
|
||||
// Cover every surface and every outcome without running the full 4x3
|
||||
// Cartesian product: all 3 outcomes on the primary Coordinator Tasks surface
|
||||
// plus one representative outcome on each secondary surface.
|
||||
const retryCases: Array<{
|
||||
surface: "agent run" | "Inbox" | "Coordinator Tasks" | "Legacy Inbox";
|
||||
outcome: "queued" | "deferred" | "denied";
|
||||
}> = [
|
||||
{ surface: "Coordinator Tasks", outcome: "queued" },
|
||||
{ surface: "Coordinator Tasks", outcome: "deferred" },
|
||||
{ surface: "Coordinator Tasks", outcome: "denied" },
|
||||
{ surface: "agent run", outcome: "queued" },
|
||||
{ surface: "Inbox", outcome: "deferred" },
|
||||
{ surface: "Legacy Inbox", outcome: "denied" },
|
||||
];
|
||||
for (const { surface, outcome } of retryCases) {
|
||||
test(`${surface}: selected run ${outcome} preserves exact retry authority and truthful feedback`, async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
@@ -1633,6 +1645,5 @@ test.describe("Failed chat task and exact run retry", () => {
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
export async function seedReturningAnnouncementVisit(page: Page) {
|
||||
await page.addInitScript(() => {
|
||||
const key = "paperclip.board-visit.v1:local-board";
|
||||
if (!localStorage.getItem(key)) localStorage.setItem(key, String(Date.now() - 31 * 60_000));
|
||||
});
|
||||
}
|
||||
@@ -49,7 +49,10 @@ if (SKIP_UI_BUILD && !fs.existsSync(UI_DIST_INDEX)) {
|
||||
// `scripts/e2e-shard.mjs` — `scripts/__tests__/e2e-shard.test.mjs` fails if
|
||||
// the two ever drift.
|
||||
export const SERIAL_SPECS = [
|
||||
"agent-chat-projects.spec.ts",
|
||||
"agent-chat-sessions.spec.ts",
|
||||
"agent-configuration.spec.ts",
|
||||
"ai-personal-connection-recovery.spec.ts",
|
||||
"cases-read-only.spec.ts",
|
||||
"classic-workspace.spec.ts",
|
||||
"composer-stop.spec.ts",
|
||||
@@ -101,12 +104,12 @@ function resolveExecutionMode(): { workers: number; fullyParallel: boolean } {
|
||||
workers = explicitWorkers;
|
||||
fullyParallel = workers > 1 && !includesSerial;
|
||||
} else if (strictlyParallelSafe) {
|
||||
// 2 Chromium workers + Node server + embedded Postgres fits cleanly on
|
||||
// 4-vCPU CI runners without CPU over-subscription thrashing.
|
||||
workers = process.env.CI
|
||||
? 2
|
||||
: Math.min(2, Math.max(1, Math.floor(os.cpus().length / 2)));
|
||||
fullyParallel = true;
|
||||
// Scale parallel Chromium workers dynamically with runner CPU cores while
|
||||
// reserving headroom for the shared Node server + embedded Postgres:
|
||||
// 4-vCPU runner -> 2 workers; 8-vCPU runner (c8i.2xlarge) -> 4 workers.
|
||||
const cpus = os.availableParallelism();
|
||||
workers = Math.max(1, Math.min(4, Math.floor(cpus / 2)));
|
||||
fullyParallel = workers > 1;
|
||||
} else {
|
||||
workers = 1;
|
||||
fullyParallel = false;
|
||||
@@ -118,11 +121,13 @@ function resolveExecutionMode(): { workers: number; fullyParallel: boolean } {
|
||||
}
|
||||
|
||||
const EXECUTION_MODE = resolveExecutionMode();
|
||||
const UI_BUILD_COMMAND =
|
||||
"node ui/node_modules/vite/bin/vite.js build ui --outDir ../server/ui-dist --emptyOutDir --minify false";
|
||||
const SERVER_START_COMMAND =
|
||||
"node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts onboard --yes --run";
|
||||
"node cli/node_modules/tsx/dist/cli.mjs tests/e2e/start-e2e-server.ts";
|
||||
const WEB_SERVER_COMMAND = SKIP_UI_BUILD
|
||||
? SERVER_START_COMMAND
|
||||
: `pnpm --filter @paperclipai/ui build --outDir ../server/ui-dist --emptyOutDir && ${SERVER_START_COMMAND}`;
|
||||
: `${UI_BUILD_COMMAND} && ${SERVER_START_COMMAND}`;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: ".",
|
||||
@@ -131,6 +136,7 @@ export default defineConfig({
|
||||
// intentionally not part of the default local_trusted e2e run.
|
||||
testIgnore: ["in-feed-native/**", "multi-user.spec.ts", "multi-user-authenticated.spec.ts"],
|
||||
timeout: 60_000,
|
||||
expect: { timeout: 10_000 },
|
||||
retries: 0,
|
||||
// Parallel-safe shards run concurrently across multiple workers; shards or
|
||||
// runs that include any spec in SERIAL_SPECS (or unfiltered full runs) fall
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
import { randomBytes } from "node:crypto";
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { createDb } from "../../packages/db/src/client.js";
|
||||
import { startEmbeddedPostgresTestDatabase } from "../../packages/db/src/test-embedded-postgres.js";
|
||||
|
||||
// Fast throwaway server bootstrap for Playwright E2E shards.
|
||||
// Replaces `cli onboard --yes --run` (which runs CLI onboarding + 12 doctor
|
||||
// checks + fresh durable Postgres initdb/migrations) by:
|
||||
// 1. Writing the minimal throwaway local_trusted config + secrets key directly.
|
||||
// 2. Booting a disposable embedded Postgres via `@paperclipai/db`'s migrated
|
||||
// template cache and disabling durability flushes (`fsync=off`,
|
||||
// `synchronous_commit=off`, `full_page_writes=off`) so both startup and
|
||||
// every E2E test write execute at memory speed.
|
||||
// 3. Starting `server/src/index.ts` directly via `startServer()`.
|
||||
|
||||
const port = Number(process.env.PORT ?? process.env.PAPERCLIP_E2E_PORT ?? 3199);
|
||||
const instanceId = process.env.PAPERCLIP_INSTANCE_ID ?? "playwright-e2e";
|
||||
const homeDir =
|
||||
process.env.PAPERCLIP_HOME ??
|
||||
fs.mkdtempSync(path.join(os.tmpdir(), "paperclip-e2e-home-"));
|
||||
const instanceRoot = path.join(homeDir, "instances", instanceId);
|
||||
const configPath =
|
||||
process.env.PAPERCLIP_CONFIG ?? path.join(instanceRoot, "config.json");
|
||||
const logsDir = path.join(instanceRoot, "logs");
|
||||
const storageDir = path.join(instanceRoot, "data", "storage");
|
||||
const masterKeyPath = path.join(instanceRoot, "secrets", "master.key");
|
||||
|
||||
fs.mkdirSync(logsDir, { recursive: true });
|
||||
fs.mkdirSync(storageDir, { recursive: true });
|
||||
fs.mkdirSync(path.dirname(masterKeyPath), { recursive: true });
|
||||
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
||||
|
||||
if (!fs.existsSync(masterKeyPath)) {
|
||||
fs.writeFileSync(masterKeyPath, randomBytes(32).toString("base64"), {
|
||||
encoding: "utf8",
|
||||
mode: 0o600,
|
||||
});
|
||||
}
|
||||
|
||||
let db: Awaited<ReturnType<typeof startEmbeddedPostgresTestDatabase>> | undefined;
|
||||
let shutdownServer: ((signal?: "SIGINT" | "SIGTERM") => Promise<void>) | undefined;
|
||||
let shuttingDown = false;
|
||||
|
||||
async function shutdown(signal: "SIGINT" | "SIGTERM") {
|
||||
if (shuttingDown) return;
|
||||
shuttingDown = true;
|
||||
try {
|
||||
await shutdownServer?.(signal);
|
||||
} finally {
|
||||
await db?.cleanup();
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
process.once("SIGINT", () => {
|
||||
void shutdown("SIGINT");
|
||||
});
|
||||
process.once("SIGTERM", () => {
|
||||
void shutdown("SIGTERM");
|
||||
});
|
||||
|
||||
try {
|
||||
const usesExternalPostgres = Boolean(process.env.PAPERCLIP_TEST_POSTGRES_ADMIN_URL?.trim());
|
||||
db = await startEmbeddedPostgresTestDatabase("paperclip-e2e-pg-");
|
||||
|
||||
// Only tune cluster-wide durability settings on a disposable embedded
|
||||
// PostgreSQL instance owned by this script. Never mutate a shared external
|
||||
// PostgreSQL server passed via PAPERCLIP_TEST_POSTGRES_ADMIN_URL.
|
||||
if (!usesExternalPostgres) {
|
||||
const adminUrl = new URL(db.connectionString);
|
||||
adminUrl.pathname = "/postgres";
|
||||
const admin = createDb(adminUrl.toString(), { maxConnections: 1 });
|
||||
try {
|
||||
await admin.$client.unsafe("ALTER SYSTEM SET fsync = off");
|
||||
await admin.$client.unsafe("ALTER SYSTEM SET synchronous_commit = off");
|
||||
await admin.$client.unsafe("ALTER SYSTEM SET full_page_writes = off");
|
||||
await admin.$client.unsafe("SELECT pg_reload_conf()");
|
||||
} finally {
|
||||
await admin.$client.end({ timeout: 1 });
|
||||
}
|
||||
}
|
||||
|
||||
const config = {
|
||||
$meta: {
|
||||
version: 1,
|
||||
updatedAt: new Date().toISOString(),
|
||||
source: "onboard",
|
||||
},
|
||||
database: {
|
||||
mode: "postgres",
|
||||
connectionString: db.connectionString,
|
||||
backup: { enabled: false, intervalMinutes: 60, retentionDays: 7, dir: path.join(instanceRoot, "data", "backups") },
|
||||
},
|
||||
logging: { mode: "file", logDir: logsDir },
|
||||
server: {
|
||||
deploymentMode: "local_trusted",
|
||||
exposure: "private",
|
||||
bind: "loopback",
|
||||
host: "127.0.0.1",
|
||||
port,
|
||||
allowedHostnames: [],
|
||||
serveUi: true,
|
||||
},
|
||||
auth: { baseUrlMode: "auto", disableSignUp: false },
|
||||
storage: { provider: "local_disk", localDisk: { baseDir: storageDir } },
|
||||
secrets: {
|
||||
provider: "local_encrypted",
|
||||
strictMode: false,
|
||||
localEncrypted: { keyFilePath: masterKeyPath },
|
||||
},
|
||||
};
|
||||
fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, {
|
||||
encoding: "utf8",
|
||||
mode: 0o600,
|
||||
});
|
||||
|
||||
process.env.PAPERCLIP_HOME = homeDir;
|
||||
process.env.PAPERCLIP_INSTANCE_ID = instanceId;
|
||||
process.env.PAPERCLIP_CONFIG = configPath;
|
||||
process.env.DATABASE_URL = db.connectionString;
|
||||
process.env.PAPERCLIP_STORAGE_LOCAL_DIR = storageDir;
|
||||
process.env.PAPERCLIP_SECRETS_MASTER_KEY_FILE = masterKeyPath;
|
||||
process.env.PAPERCLIP_DB_BACKUP_ENABLED = "false";
|
||||
|
||||
const { startServer } = await import("../../server/src/index.js");
|
||||
const started = await startServer();
|
||||
shutdownServer = started.shutdown;
|
||||
} catch (error) {
|
||||
await db?.cleanup();
|
||||
throw error;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"inputs": {
|
||||
"package.json": "416070f08a97a51ad73bf8839ec52336ecb7ad4e",
|
||||
"package.json": "d9d6052ec03ec7bf20a875d9bcbe83ea96695097",
|
||||
"packages/plugins/sdk/package.json": "b7a4936e2803fd0d3b32dd7f17fc1ea86609ead0",
|
||||
"packages/plugins/sdk/src/bundlers.ts": "883bf3d9f2bd42877cfc0c3707cd882a6f6248d0",
|
||||
"packages/plugins/sdk/src/define-plugin.ts": "a99e07ce77ef72fcf1df1347346aacb8ba12e284",
|
||||
@@ -13,7 +13,7 @@
|
||||
"packages/plugins/sdk/src/environment-stop-error.ts": "b0e03f8aa2b2170ba095da5c7138050fced3f3cb",
|
||||
"packages/plugins/sdk/src/environment-sync-error.ts": "7d6a51a95da49a7da4525aebbab6382dc5c44ae8",
|
||||
"packages/plugins/sdk/src/environment-task-error.ts": "98aae8a06743b38884b68cb9a3ec44c57b34c0e4",
|
||||
"packages/plugins/sdk/src/environment-tasks.ts": "5557e21415c67aca5c2dff7e06e8ea590f6c582e",
|
||||
"packages/plugins/sdk/src/environment-tasks.ts": "ff2beb2c3c6af2e6b84bad8701367d8aee3c755d",
|
||||
"packages/plugins/sdk/src/host-client-factory.ts": "e0301c390ea13f2340b669383f07af2455e48c8a",
|
||||
"packages/plugins/sdk/src/idle-drain.test.ts": "cc59f7881e7d46c89395a1d93d74f6c6b9b0a64a",
|
||||
"packages/plugins/sdk/src/idle-drain.ts": "ae6e4c6be4657a3d541396922b3bc551b8db557f",
|
||||
@@ -130,7 +130,7 @@
|
||||
"packages/shared/src/app-definitions/google-sheets.json": "de87b58007fca0b719d242148a838e2b5c26ddca",
|
||||
"packages/shared/src/app-definitions/google-slides.json": "289366009d46be6b770eee6cd0bc650eb59a240c",
|
||||
"packages/shared/src/app-definitions/google-workspace-search.json": "f3ec9d00ed0116b7cb8b9b1b71353cb8d6dc8cf4",
|
||||
"packages/shared/src/app-definitions/google-workspace.json": "c3b55dc3ec502f6b86008e1e5b421748bdd50e91",
|
||||
"packages/shared/src/app-definitions/google-workspace.json": "7a4acb34fb2ab5106860e910de50573070cbed2b",
|
||||
"packages/shared/src/app-definitions/google.json": "f0bab0467612f915c88137eddbac0b320ac1aa2a",
|
||||
"packages/shared/src/app-definitions/gsc-wizard.json": "a4ba6f183d5f35a25d0a420ade18f00d3fb64534",
|
||||
"packages/shared/src/app-definitions/honcho.json": "17185eaf5189fc8c443388997c90ebf833bc9327",
|
||||
@@ -241,7 +241,7 @@
|
||||
"packages/shared/src/crash-point-registry.ts": "3cbf2d290bc111061376b43020848623e493737c",
|
||||
"packages/shared/src/crash-points.test.ts": "3564a1f62d22f54a3c2fb0a72b3a6cde17c957d2",
|
||||
"packages/shared/src/crash-points.ts": "c15259f39610e352eac5423a491548ec1bae94fe",
|
||||
"packages/shared/src/customer-success.ts": "a2d02aaa8223164c0eae4267b2a6da82242eaa6f",
|
||||
"packages/shared/src/customer-success.ts": "cf22017ffdd45123c1879f13c71c17516b8479a5",
|
||||
"packages/shared/src/decision-models.ts": "a07aefd87d2fae34283ce21a0334d57e2108aa7e",
|
||||
"packages/shared/src/decision.test.ts": "d0783d18613c73102f662e8a5da795ff6e7faed5",
|
||||
"packages/shared/src/document-anchors.test.ts": "6805d149ad66d91f2e3ba4841f82e9af05bf5d83",
|
||||
@@ -272,6 +272,7 @@
|
||||
"packages/shared/src/google-sign-in-deployment.ts": "2e4e4cc3c24347642e20c91186581e1dce81d740",
|
||||
"packages/shared/src/google-workspace-connectors.test.ts": "26316900a50e5ab384e0dcf9c45a2bb4abc0830d",
|
||||
"packages/shared/src/google-workspace-connectors.ts": "88d942d1e66d7facc68cf8645f665cdc80c8c005",
|
||||
"packages/shared/src/google-workspace-setup-links.test.ts": "d86428b26e74e54ab2902d1a14c0f06f562de775",
|
||||
"packages/shared/src/grok-bot.ts": "9de68f00e7926c397729ff62bf8e277f5a41c525",
|
||||
"packages/shared/src/heartbeat-inbox.ts": "227dc89705c20460ca02194091cb162e11503186",
|
||||
"packages/shared/src/home-paths.test.ts": "81235c17c376224e1be3abd3f034a8400f079c66",
|
||||
|
||||
Reference in new issue
Block a user