mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-23 04:54:00 +01:00
Integrate current master before rich ACP foundation review
Co-Authored-By: Paperclip <noreply@paperclip.ing> * commit '53aad90b9': fix: retry sandbox ACP input delivery after gateway failures (#14485) fix: retain project defaults in partial workspace overrides (#14502) test: control Telegram subscription retry timing (#14501) fix: retain diagnostic reasons for native runner failures (#14481) fix: prevent run identity locks from blocking audit checks (#14478) fix: preserve company context across browser hot reload (#14482) feat(ui): improve task composer controls and pending input (#14322) Improve task artifacts with rich cards and editable stories (#14469)
This commit is contained in:
commit
9774086a73
111 files changed
+7338
-1164
No files matched your search
@@ -246,11 +246,8 @@ for (const mode of ["Ask", "Plan"])
|
||||
const f = await setup(request);
|
||||
try {
|
||||
await page.goto(f.route);
|
||||
await page.getByTestId("task-chat-composer-mode").click();
|
||||
await page
|
||||
.getByTestId("task-chat-composer-mode-menu")
|
||||
.getByText(`${mode} mode`, { exact: true })
|
||||
.click();
|
||||
await page.getByTestId("task-chat-composer-add").click();
|
||||
await page.getByTestId(mode === "Plan" ? "composer-add-plan" : "composer-add-ask").click();
|
||||
await send(page, { action: "project", name: "Forbidden mutation" });
|
||||
await idle(request, f.chatPath);
|
||||
expect(
|
||||
@@ -387,11 +384,8 @@ test("plan approval hands the preserved revision to an assigned project task", a
|
||||
const f = await setup(request);
|
||||
try {
|
||||
await page.goto(f.route);
|
||||
await page.getByTestId("task-chat-composer-mode").click();
|
||||
await page
|
||||
.getByTestId("task-chat-composer-mode-menu")
|
||||
.getByText("Plan mode", { exact: true })
|
||||
.click();
|
||||
await page.getByTestId("task-chat-composer-add").click();
|
||||
await page.getByTestId("composer-add-plan").click();
|
||||
await send(page, {
|
||||
action: "plan",
|
||||
text: "# Approved welcome\nWrite two friendly sentences.",
|
||||
|
||||
@@ -50,7 +50,7 @@ for (const mobile of [false, true]) {
|
||||
await expect(artifacts).toBeVisible();
|
||||
await expect(artifacts).toHaveAttribute("aria-selected", "false");
|
||||
await artifacts.click();
|
||||
await expect(panel.getByText("Arriving report", { exact: true })).toBeVisible();
|
||||
await expect(panel.getByRole("heading", { name: "Arriving report", level: 2, exact: true })).toBeVisible();
|
||||
await page.screenshot({ path: testInfo.outputPath("artifact-opened-by-user.png"), fullPage: true });
|
||||
});
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
expect,
|
||||
test,
|
||||
type APIRequestContext,
|
||||
type Locator,
|
||||
type Page,
|
||||
} from "@playwright/test";
|
||||
|
||||
@@ -95,15 +96,19 @@ const files = [
|
||||
},
|
||||
];
|
||||
|
||||
async function openAttachmentChooser(page: Page, composer: Locator) {
|
||||
await composer.getByRole("button", { name: "Add to composer" }).click();
|
||||
const chooser = page.waitForEvent("filechooser");
|
||||
await page.getByRole("menuitem", { name: "Files and images", exact: true }).click();
|
||||
return chooser;
|
||||
}
|
||||
|
||||
async function upload(
|
||||
page: Page,
|
||||
fixture: Awaited<ReturnType<typeof setup>>,
|
||||
file: (typeof files)[number],
|
||||
) {
|
||||
const chooser = page.waitForEvent("filechooser");
|
||||
await fixture.composer
|
||||
.getByRole("button", { name: "Attach file", exact: true })
|
||||
.click();
|
||||
const chooser = await openAttachmentChooser(page, fixture.composer);
|
||||
const response = page.waitForResponse(
|
||||
(res) =>
|
||||
res.request().method() === "POST" &&
|
||||
@@ -111,7 +116,7 @@ async function upload(
|
||||
`/issues/${fixture.issue.id}/attachments`,
|
||||
),
|
||||
);
|
||||
await (await chooser).setFiles(file);
|
||||
await chooser.setFiles(file);
|
||||
const receipt = await body<Attachment>(await response);
|
||||
await expect
|
||||
.poll(async () =>
|
||||
@@ -376,11 +381,8 @@ for (const classic of [false, true])
|
||||
await route.fulfill({ response });
|
||||
},
|
||||
);
|
||||
const chooser = page.waitForEvent("filechooser");
|
||||
await fixture.composer
|
||||
.getByRole("button", { name: "Attach file", exact: true })
|
||||
.click();
|
||||
await (await chooser).setFiles(files[1]!);
|
||||
const chooser = await openAttachmentChooser(page, fixture.composer);
|
||||
await chooser.setFiles(files[1]!);
|
||||
await expect.poll(() => arrived).toBe(true);
|
||||
await expect(fixture.send).toBeDisabled();
|
||||
try {
|
||||
@@ -430,11 +432,8 @@ test("legacy failed upload can be removed before sending the retained text", asy
|
||||
body: JSON.stringify({ error: "Fixture upload rejected" }),
|
||||
}),
|
||||
);
|
||||
const chooser = page.waitForEvent("filechooser");
|
||||
await fixture.composer
|
||||
.getByRole("button", { name: "Attach file", exact: true })
|
||||
.click();
|
||||
await (await chooser).setFiles(files[0]!);
|
||||
const chooser = await openAttachmentChooser(page, fixture.composer);
|
||||
await chooser.setFiles(files[0]!);
|
||||
await expect(
|
||||
fixture.composer.getByText("Fixture upload rejected", { exact: true }),
|
||||
).toBeVisible();
|
||||
|
||||
@@ -275,13 +275,14 @@ test.describe("Board send delivery refresh", () => {
|
||||
"base64",
|
||||
),
|
||||
};
|
||||
if (!classic) {
|
||||
await page.getByRole("button", { name: "Add to composer" }).click();
|
||||
}
|
||||
const chooserPromise = page.waitForEvent("filechooser");
|
||||
await page
|
||||
.getByRole("button", {
|
||||
name: classic ? "Upload attachment" : "Attach file",
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
await (classic
|
||||
? page.getByRole("button", { name: "Upload attachment", exact: true })
|
||||
: page.getByRole("menuitem", { name: "Files and images", exact: true })
|
||||
).click();
|
||||
const responsePromise = page.waitForResponse(
|
||||
(response) =>
|
||||
response.request().method() === "POST" &&
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import path from "node:path";
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { createServer, type ViteDevServer } from "../../ui/node_modules/vite/dist/node/index.js";
|
||||
|
||||
let server: ViteDevServer;
|
||||
let origin: string;
|
||||
const uiRoot = path.resolve(import.meta.dirname, "../../ui");
|
||||
const probePath = path.join(uiRoot, "src/__company_context_probe.tsx");
|
||||
|
||||
// Use real Vite module instances and React contexts. Re-importing a refreshed
|
||||
// consumer must still see a provider retained from the previous module version.
|
||||
test.beforeAll(async () => {
|
||||
server = await createServer({
|
||||
root: uiRoot,
|
||||
configFile: false,
|
||||
resolve: { alias: { "@": path.join(uiRoot, "src") } },
|
||||
esbuild: { jsx: "automatic" },
|
||||
server: { host: "127.0.0.1", port: 0 },
|
||||
plugins: [{
|
||||
name: "company-context-regression",
|
||||
resolveId(id) { if (id === "/src/__company_context_probe.tsx") return probePath; },
|
||||
load(id) {
|
||||
if (id !== probePath) return;
|
||||
return `
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { CompanyProvider, useCompany } from "/src/context/CompanyContext.tsx";
|
||||
const root = createRoot(document.getElementById("root"));
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
function render(hook, generation) {
|
||||
function Consumer() { return <main>{generation + ":" + (hook().selectedCompanyId ?? "loading")}</main>; }
|
||||
root.render(<QueryClientProvider client={client}><CompanyProvider><Consumer /></CompanyProvider></QueryClientProvider>);
|
||||
}
|
||||
render(useCompany, "initial");
|
||||
window.refreshConsumer = async () => {
|
||||
const refreshed = await import(/* @vite-ignore */ "/src/context/CompanyContext.tsx?t=" + Date.now());
|
||||
render(refreshed.useCompany, "refreshed");
|
||||
};
|
||||
`;
|
||||
},
|
||||
configureServer(vite) {
|
||||
vite.middlewares.use((req, res, next) => {
|
||||
if (req.url !== "/") return next();
|
||||
res.setHeader("Content-Type", "text/html");
|
||||
res.end('<div id="root"></div><script type="module" src="/@vite/client"></script><script type="module" src="/src/__company_context_probe.tsx"></script>');
|
||||
});
|
||||
},
|
||||
}],
|
||||
});
|
||||
await server.listen();
|
||||
const address = server.httpServer!.address();
|
||||
if (!address || typeof address === "string") throw new Error("Missing test server address");
|
||||
origin = `http://127.0.0.1:${address.port}`;
|
||||
});
|
||||
|
||||
test.afterAll(async () => { await server?.close(); });
|
||||
|
||||
test("a refreshed company consumer reads the retained provider", async ({ page }) => {
|
||||
await page.route("**/api/**", async (route) => {
|
||||
const pathname = new URL(route.request().url()).pathname;
|
||||
if (!pathname.startsWith("/api/")) return route.continue();
|
||||
const body = pathname === "/api/auth/get-session"
|
||||
? { user: { id: "test-user" }, session: { userId: "test-user" } }
|
||||
: pathname === "/api/companies"
|
||||
? [{ id: "test-company", name: "Test company", status: "active" }]
|
||||
: [];
|
||||
await route.fulfill({ json: body });
|
||||
});
|
||||
const errors: string[] = [];
|
||||
page.on("pageerror", (error) => { errors.push(error.message); });
|
||||
await page.goto(origin);
|
||||
await expect(page.getByRole("main")).toHaveText("initial:test-company");
|
||||
await page.evaluate(() => (window as unknown as { refreshConsumer: () => Promise<void> }).refreshConsumer());
|
||||
await expect(page.getByRole("main")).toHaveText("refreshed:test-company");
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
@@ -12,12 +12,12 @@ const TASK_TITLE = "Paperclip onboarding";
|
||||
/**
|
||||
* The first task opens with the chief of staff's opening card sitting where
|
||||
* the composer is. Cancel hands the plain composer back (the card stays
|
||||
* pending), and the composer is where the mode toggle lives.
|
||||
* pending), and the composer is where the mode chip lives.
|
||||
*
|
||||
* The card arrives with the interactions fetch, after the composer's first
|
||||
* paint, so a bare `count()` right after navigation sees no card and skips
|
||||
* the click; the card then lands on top of the composer and hides the mode
|
||||
* toggle. Wait for the card (or, if it is already dismissed, the pending
|
||||
* chip. Wait for the card (or, if it is already dismissed, the pending
|
||||
* strip it leaves behind) before deciding, and only return once the plain
|
||||
* composer is back.
|
||||
*/
|
||||
@@ -176,8 +176,8 @@ test("captures planning mode UI for desktop and mobile", async ({ page }) => {
|
||||
await page.goto(issuePath);
|
||||
await dismissOpeningCard(page);
|
||||
await page.getByTestId("task-chat-composer-mode").click();
|
||||
await page.getByRole("menuitem", { name: /Auto mode/ }).click();
|
||||
await expect(page.getByTestId("task-chat-composer-mode")).toHaveAttribute("data-pending-work-mode", "standard");
|
||||
await expect(page.getByTestId("task-chat-composer-mode")).toHaveCount(0);
|
||||
await expect(page.getByTestId("task-chat-composer-add")).toBeVisible();
|
||||
await page.screenshot({
|
||||
path: `${screenshotDir}/desktop-standard-toggle-${timestamp}.png`,
|
||||
fullPage: true,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { defineConfig } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
testDir: ".",
|
||||
testMatch: "company-context-refresh.spec.ts",
|
||||
workers: 1,
|
||||
timeout: 30_000,
|
||||
use: {
|
||||
headless: true,
|
||||
...(process.env.PAPERCLIP_PLAYWRIGHT_CHANNEL
|
||||
? { channel: process.env.PAPERCLIP_PLAYWRIGHT_CHANNEL }
|
||||
: {}),
|
||||
},
|
||||
outputDir: "./test-results",
|
||||
reporter: "list",
|
||||
});
|
||||
@@ -693,11 +693,8 @@ export async function runChatFlow(input: ChatFlowInput) {
|
||||
await idle(3);
|
||||
} else await turn(clarification, 3);
|
||||
} else if (caseId === "plan-handoff") {
|
||||
await page.getByTestId("task-chat-composer-mode").click();
|
||||
await page
|
||||
.getByTestId("task-chat-composer-mode-menu")
|
||||
.getByText("Plan mode", { exact: true })
|
||||
.click();
|
||||
await page.getByTestId("task-chat-composer-add").click();
|
||||
await page.getByTestId("composer-add-plan").click();
|
||||
await turn(
|
||||
`Let's plan a two-sentence garden club welcome note. The finished welcome note itself must contain the exact phrase ${draftMarker}. Write a plan in the plan panel that includes this requirement, and present it for approval. When I approve the final revision, create a suitable repository-free project and an assigned task for yourself, copy the plan into that task, and have it save the note as a Paperclip document attached to that execution task and finish. Do not create the project or task before approval.`,
|
||||
1,
|
||||
|
||||
Reference in new issue
Block a user