mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 17:54:40 +01:00
fix(ui): defer the Connectors announcement until a return visit (#22790)
## Thinking Path > - People use Paperclip to manage AI agents at work. > - New users now meet their agent in chat after setup. > - The Connectors card previously checked for an open onboarding task. > - Chat-first onboarding creates no such task, so the card could appear three seconds into a first visit. > - This change holds that promotion until the person returns after 30 minutes of inactivity. ## Linked Issues or Issue Description Refs: #19514, #22077 **What happened?** On master at `11cfe0910d`, a new user could see the Connectors card in their first agent chat. **Expected behavior** The card stays hidden through the first visit and can appear when the user returns after a 30-minute gap in activity. **Steps to reproduce** With the Connectors announcement active, finish chat-first onboarding in a fresh browser profile and wait for the announcement delay. ## What Changed - Track the first visible board visit per account in browser storage. Local input and visits in other tabs extend the first session. After the first qualifying return, the browser remembers eligibility and stops tracking input. - Apply this rule to the published Connectors announcement ID. The existing checks for dismissal, open dialogs, and legacy onboarding tasks still apply. - Exercise the onboarding chat, reload, idle return, account isolation, and activity in another tab. ## Verification - Before the fix, the Vitest regression displayed `2026-09-14-connectors` on the first visit. - The announcement and workspace identity Vitest suites passed locally (28 tests). The UI typecheck passed. - Chromium passed all four tests in `announcement-first-session.spec.ts` and `announcement-placement.spec.ts` against a local test server. - A second red-green regression covers dismissal in another browser while the first tab sits idle. The return triggers a fresh check and keeps the card hidden until it succeeds. - At `8fab1932fa`, GitHub reported 73 successful checks and three skipped checks. [CI run](https://github.com/paperclipai/paperclip/actions/runs/45449353624) ## Risks A new browser profile or cleared site data starts the visit history again. Storage failures keep the Connectors card hidden. Existing users start accumulating visit history when they first use this version. ## Model Used OpenAI Codex, GPT-6.2 Astra (`gpt-6.2-astra`), with shell, Vitest, and Playwright. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Scott Tong <scott@scotts-mbp-m5-max.local> Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
9 files changed
+211
-18
No files matched your search
@@ -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) }),
|
||||
);
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user