mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-03 11:47:42 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Coordinator Inbox (Needs You, `/decisions`) shows the decisions and problems that wait for a person > - #22964 made the page open on "All assignees" for a board member who has no saved assignee choice > - The page title and badge read as personal, so a board member sees other people's decisions and thinks they are theirs to act on > - This pull request opens the page on "Assigned to you" again when no choice is saved, and keeps the saved toolbar from #22964 > - The benefit is that each person opens on their own work, and a board member who wants the company-wide queue picks "All assignees" once and keeps it ## Linked Issues or Issue Description Refs #22964 **What existing behavior does this improve?** The opening assignee filter on the Coordinator Inbox / Needs You page (`/decisions`). **Current behavior** A board member with no saved assignee choice opens Needs You on "All assignees". The page shows decisions that are for other people (for example, a question an agent asked the person who created the task), with no signal that the list is not personal. **Proposed behavior** Every person with no saved assignee choice opens Needs You on "Assigned to you". The assignee, agent, project, and grouping choices stay saved per company and person, as in #22964. A board member who picks "All assignees" or one person still reopens on that choice. **Reason and benefit** A page named "Needs you" must open on the work that needs this person. The saved toolbar already removes the repeated clicks that #22964 set out to remove, so the company-wide default is not necessary. ## What Changed - `ui/src/lib/coordinator-attention.ts`: `openingCoordinatorAssignee` returns "Assigned to you" when no usable choice is saved, also for board members. A saved choice that the person may open still wins. - `ui/src/components/coordinator/CoordinatorNeedsYou.toolbar.test.tsx`: Tests now start from "Assigned to you", prove that "All assignees" sticks after a person picks it, and prove that the page loads the personal feed at once when nothing is saved. The board-access wait test now covers a saved "All assignees" choice. - `ui/src/lib/coordinator-attention.test.ts`: Update the unit expectations for the opening filter. - `tests/e2e/coordinator-inbox-views.spec.ts`: Assert "Assigned to you" on open, then pick "All assignees" and prove that it and the grouping persist across navigation and reload. - `doc/PRODUCT.md`: Document the opening filter and the saved choices. ## Verification - `cd ui && npx vitest run src/components/coordinator/ src/lib/coordinator-attention.test.ts src/hooks/useAttentionViews.test.tsx src/lib/attention-views.test.ts` → 7 files, 49 tests passed. - RED check: with the old `everyone ? "all" : "me"` fallback restored, 13 tests in the toolbar and coordinator-attention suites fail. - `pnpm --filter @paperclipai/ui typecheck` → pass. - `PAPERCLIP_E2E_PORT=3257 npx playwright test --config tests/e2e/playwright.config.ts tests/e2e/coordinator-inbox-views.spec.ts` against a freshly built UI → 2 passed (desktop and mobile). ## Risks - Behavioral shift: board members who relied on the #22964 default open on "Assigned to you" until they pick "All assignees" once. After that, the saved choice applies. - A board member who already picked a filter keeps it. No saved data changes. - The classic (non-Coordinator) Decisions page is unchanged. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) by Anthropic, in Claude Code with tool use, shell execution, 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 - [ ] All Paperclip CI gates are green - [ ] 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: Paperclip <noreply@paperclip.ing>
123 lines
8.0 KiB
TypeScript
123 lines
8.0 KiB
TypeScript
import path from "node:path";
|
|
import { expect, test, type APIResponse } from "@playwright/test";
|
|
|
|
async function json(response: APIResponse) {
|
|
expect(response.ok(), `${response.status()} ${await response.text()}`).toBe(true);
|
|
return response.json();
|
|
}
|
|
|
|
test.use({ hasTouch: true });
|
|
for (const mobile of [false, true]) test(`Mine retains Inbox behavior inside Tasks (${mobile ? "mobile" : "desktop"})`, async ({ page, request }) => {
|
|
test.setTimeout(90_000);
|
|
await page.setViewportSize(mobile ? { width: 390, height: 844 } : { width: 1280, height: 900 });
|
|
await page.addInitScript(() => {
|
|
if (!localStorage.getItem("paperclip:inbox:issue-columns")) localStorage.setItem("paperclip:inbox:issue-columns", JSON.stringify(["status", "id", "project", "updated"]));
|
|
});
|
|
const company = await json(await request.post("/api/companies", { data: { name: "Personal Tasks verification" } }));
|
|
const preferences = await json(await request.get("/api/workspace-preferences/me"));
|
|
await page.route("**/api/workspace-preferences/me", route => route.fulfill({ json: {
|
|
...preferences, coordinatorWorkspaceEnabled: true,
|
|
} }));
|
|
try {
|
|
const agent = await json(await request.post(`/api/companies/${company.id}/agents`, { data: {
|
|
name: "Inbox activity fixture", adapterType: "process", adapterConfig: {
|
|
command: process.execPath, args: [path.resolve("tests/e2e/fixtures/inbox-activity.mjs")],
|
|
}, runtimeConfig: { heartbeat: { enabled: false, wakeOnDemand: true } },
|
|
} }));
|
|
const unread = await json(await request.post(`/api/companies/${company.id}/issues`, { data: {
|
|
title: "Unread personal task", status: "todo", assigneeAgentId: agent.id,
|
|
} }));
|
|
const read = await json(await request.post(`/api/companies/${company.id}/issues`, { data: { title: "Read personal task", status: "todo" } }));
|
|
await expect.poll(async () => {
|
|
const comments = await json(await request.get(`/api/issues/${unread.id}/comments`));
|
|
return comments.some((comment: { authorAgentId: string | null }) => comment.authorAgentId === agent.id);
|
|
}, { timeout: 30_000 }).toBe(true);
|
|
await json(await request.delete(`/api/issues/${unread.id}/read`));
|
|
await json(await request.post(`/api/issues/${read.id}/read`, { data: {} }));
|
|
await page.goto(`/${company.issuePrefix}/inbox/mine`);
|
|
await expect(page).toHaveURL(/\/issues\?view=mine$/);
|
|
const mine = page.getByRole("region", { name: "Tasks", exact: true });
|
|
const unreadRow = mine.locator(`[data-issue-id="${unread.id}"]`);
|
|
const readRow = mine.locator(`[data-issue-id="${read.id}"]`);
|
|
await expect(unreadRow).toHaveAttribute("data-unread", "true");
|
|
await expect(unreadRow.locator('[data-slot="task-row-title"]')).toHaveClass(/font-semibold/);
|
|
await expect(readRow.locator('[data-slot="task-row-title"]')).not.toHaveClass(/font-semibold/);
|
|
await expect(page.getByRole("link", { name: /^Inbox(?:,|$)/ }).first()).toHaveAttribute("href", `/${company.issuePrefix}/decisions`);
|
|
|
|
await page.getByRole("button", { name: "Columns", exact: true }).click();
|
|
const creatorColumn = page.getByRole("menuitemcheckbox", { name: /^Kicked off by/ });
|
|
await creatorColumn.click();
|
|
await expect(creatorColumn).toBeChecked();
|
|
await page.keyboard.press("Escape");
|
|
await page.locator('button[title="Group"]').click();
|
|
await page.getByRole("button", { name: "Project", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
await page.reload();
|
|
await expect(unreadRow).toBeVisible();
|
|
await expect(mine.getByText("No project", { exact: true }).first()).toBeVisible();
|
|
await page.getByRole("button", { name: "Columns", exact: true }).click();
|
|
await expect(creatorColumn).toBeChecked();
|
|
await page.keyboard.press("Escape");
|
|
await page.locator('button[title="Group"]').click();
|
|
await page.getByRole("button", { name: "None", exact: true }).click();
|
|
await page.keyboard.press("Escape");
|
|
|
|
if (mobile) {
|
|
await unreadRow.scrollIntoViewIfNeeded();
|
|
const bounds = await unreadRow.boundingBox();
|
|
expect(bounds).not.toBeNull();
|
|
const session = await page.context().newCDPSession(page);
|
|
const x = bounds!.x + bounds!.width * 0.85;
|
|
const y = bounds!.y + bounds!.height / 2;
|
|
await session.send("Input.dispatchTouchEvent", { type: "touchStart", touchPoints: [{ x, y }] });
|
|
for (let step = 1; step <= 6; step++) await session.send("Input.dispatchTouchEvent", {
|
|
type: "touchMove", touchPoints: [{ x: x - bounds!.width * 0.1 * step, y }],
|
|
});
|
|
await session.send("Input.dispatchTouchEvent", { type: "touchEnd", touchPoints: [] });
|
|
await session.detach();
|
|
await expect(unreadRow).toHaveCount(0);
|
|
} else {
|
|
await unreadRow.hover();
|
|
await page.keyboard.press("r");
|
|
await expect(unreadRow).not.toHaveAttribute("data-unread", "true");
|
|
await page.keyboard.press("U");
|
|
await expect(unreadRow).toHaveAttribute("data-unread", "true");
|
|
const archiveSaved = page.waitForResponse(response => response.url().endsWith(`/api/issues/${unread.id}/inbox-archive`) && response.request().method() === "POST");
|
|
const archiveRefreshed = page.waitForResponse(response => response.url().includes(`/api/companies/${company.id}/inbox/mine`) && response.request().method() === "GET");
|
|
await page.keyboard.press("a");
|
|
expect((await archiveSaved).ok()).toBe(true);
|
|
await archiveRefreshed;
|
|
await page.evaluate(() => new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))));
|
|
await expect(unreadRow).toHaveCount(0);
|
|
await page.keyboard.press("u");
|
|
await expect(unreadRow).toBeVisible();
|
|
await page.getByRole("link", { name: "Inbox", exact: true }).click();
|
|
const inbox = page.getByRole("region", { name: "Inbox", exact: true });
|
|
await expect(inbox.getByRole("toolbar", { name: "Decisions controls" })).toBeVisible();
|
|
await expect(inbox.getByRole("button", { name: "Filter decisions by assignee, Assigned to you", exact: true })).toBeVisible();
|
|
await inbox.getByRole("button", { name: "Filter decisions by assignee, Assigned to you", exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "All assignees", exact: true }).click();
|
|
await expect(inbox.getByRole("button", { name: "Filter decisions by assignee, All assignees", exact: true })).toBeVisible();
|
|
await inbox.getByRole("button", { name: "Group decisions, By type", exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "By project", exact: true }).click();
|
|
await expect(inbox.getByRole("button", { name: "Group decisions, By project", exact: true })).toBeVisible();
|
|
await page.goto(`/${company.issuePrefix}/decisions`);
|
|
await expect(inbox.getByRole("button", { name: "Filter decisions by assignee, All assignees", exact: true })).toBeVisible();
|
|
await expect(inbox.getByRole("button", { name: "Group decisions, By project", exact: true })).toBeVisible();
|
|
await page.reload();
|
|
await expect(inbox.getByRole("button", { name: "Filter decisions by assignee, All assignees", exact: true })).toBeVisible();
|
|
await expect(inbox.getByRole("button", { name: "Group decisions, By project", exact: true })).toBeVisible();
|
|
await inbox.getByRole("button", { name: "Filter decisions by assignee, All assignees", exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "Assigned to you", exact: true }).click();
|
|
await expect(inbox.getByRole("button", { name: "Filter decisions by assignee, Assigned to you", exact: true })).toBeVisible();
|
|
await page.setViewportSize({ width: 1024, height: 720 });
|
|
const search = await inbox.locator("[data-toolbar-search]").boundingBox();
|
|
const firstFilter = await inbox.getByRole("button", { name: /^Filter decisions by agent,/ }).boundingBox();
|
|
expect(firstFilter!.y).toBeGreaterThanOrEqual(search!.y + search!.height);
|
|
expect(firstFilter!.x).toBeCloseTo(search!.x, 0);
|
|
}
|
|
} finally {
|
|
await request.patch(`/api/companies/${company.id}`, { data: { status: "archived" } });
|
|
}
|
|
});
|