mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 10:44:52 +01:00
fix(ui): open Needs You on Assigned to you, keep saved filters (#23321)
## 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>
This commit is contained in:
1 parent
1949a8fa10
commit
3884cc6df4
5 files changed
+73
-45
No files matched your search
@@ -113,33 +113,40 @@ const location = () => container.querySelector("[data-location]")?.textContent;
|
||||
const listedViews = () => fixture.listCalls.map((call) => call.view);
|
||||
|
||||
describe("Needs You keeps its toolbar between visits", () => {
|
||||
it("opens All assignees for a board member, and keeps the chosen assignee, agent, project and grouping on the next visit", async () => {
|
||||
it("opens Assigned to you for a board member with no kept choice, and keeps the chosen assignee, agent, project and grouping on the next visit", async () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
const ours = card("ours", 1, { agentId: "agent-cos", project: website });
|
||||
fixture.byView = { all: [ours, card("dottas", 2, { userId: "dotta" })], mine: [ours] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||
expect(assignee().textContent).toBe("All assignees");
|
||||
expect(assignee().getAttribute("aria-label")).toBe("Filter decisions by assignee, All assignees");
|
||||
expect(location()).toBe("");
|
||||
expect(listedViews()).toEqual(["all"]);
|
||||
expect(cards()).toEqual(["ours", "dottas"]);
|
||||
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
await choose("Filter decisions by project", "Website");
|
||||
await choose("Group decisions", "By project");
|
||||
await choose("Filter decisions by assignee", "Assigned to you");
|
||||
expect(location()).toBe("?view=mine");
|
||||
expect(cards()).toEqual(["ours"]);
|
||||
|
||||
fixture.byView = { all: [ours, card("dottas", 2, { userId: "dotta", agentId: "agent-cos", project: website })], mine: [ours] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours"]));
|
||||
expect(assignee().value).toBe("me");
|
||||
expect(assignee().textContent).toBe("Assigned to you");
|
||||
expect(assignee().getAttribute("aria-label")).toBe("Filter decisions by assignee, Assigned to you");
|
||||
expect(location()).toBe("");
|
||||
expect(listedViews()).toEqual(["mine"]);
|
||||
|
||||
await choose("Filter decisions by assignee", "All assignees");
|
||||
expect(location()).toBe("?view=all");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "dottas"]));
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
await choose("Filter decisions by project", "Website");
|
||||
await choose("Group decisions", "By project");
|
||||
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "dottas"]));
|
||||
expect(assignee().value).toBe("all");
|
||||
expect(filterButton("Filter decisions by agent").value).toBe("agent-cos");
|
||||
expect(filterButton("Filter decisions by project").value).toBe("project-web");
|
||||
expect(filterButton("Group decisions").value).toBe("project");
|
||||
expect([...container.querySelectorAll("h2")].map((heading) => heading.textContent)).toContain("Website");
|
||||
expect(location()).toBe("");
|
||||
expect(listedViews()).toEqual(["all"]);
|
||||
|
||||
await choose("Filter decisions by assignee", "Assigned to you");
|
||||
expect(location()).toBe("?view=mine");
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours"]));
|
||||
expect(assignee().value).toBe("me");
|
||||
expect(listedViews()).toEqual(["mine"]);
|
||||
});
|
||||
|
||||
@@ -147,7 +154,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1), card("dottas", 2, { userId: "dotta" })], company: [card("alert", 3, { userId: "dotta" })] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("me"));
|
||||
await choose("Filter decisions by assignee", "Dotta");
|
||||
expect(location()).toBe("?view=all&for=dotta");
|
||||
expect(cards()).toEqual(["dottas"]);
|
||||
@@ -170,7 +177,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1), card("dottas", 2, { userId: "dotta" })], mine: [card("ours", 1)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("me"));
|
||||
await choose("Filter decisions by assignee", "Dotta");
|
||||
|
||||
fixture.boardAccess = member("viewer");
|
||||
@@ -190,12 +197,32 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
expect(listedViews()).toEqual(["mine"]);
|
||||
});
|
||||
|
||||
it("reads no feed until board access is known, so Assigned to you never shows first", async () => {
|
||||
it("loads Assigned to you without waiting for board access when nothing is kept", async () => {
|
||||
let release!: () => void;
|
||||
fixture.boardAccessGate = new Promise<void>((resolve) => { release = resolve; });
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1), card("dottas", 2, { userId: "dotta" })], mine: [card("ours", 1)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours"]));
|
||||
expect(assignee().value).toBe("me");
|
||||
expect(assignee().disabled).toBe(false);
|
||||
|
||||
await act(async () => release()); await flush(); await flush();
|
||||
expect(assignee().value).toBe("me");
|
||||
expect(cards()).toEqual(["ours"]);
|
||||
expect(listedViews()).toEqual(["mine"]);
|
||||
});
|
||||
|
||||
it("reads no feed until board access is known when All assignees is kept, so Assigned to you never shows first", async () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1), card("dottas", 2, { userId: "dotta" })], mine: [card("ours", 1)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("me"));
|
||||
await choose("Filter decisions by assignee", "All assignees");
|
||||
|
||||
let release!: () => void;
|
||||
fixture.boardAccessGate = new Promise<void>((resolve) => { release = resolve; });
|
||||
await visit("/decisions");
|
||||
expect(listedViews()).toEqual([]);
|
||||
expect(container.querySelector('[role="status"]')?.textContent).toContain("Loading decisions");
|
||||
expect(cards()).toEqual([]);
|
||||
@@ -212,13 +239,13 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
|
||||
it("still names a kept project with no open cards, so the filter never reads as All projects", async () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1, { project: website }), card("other", 2)] };
|
||||
fixture.byView = { mine: [card("ours", 1, { project: website }), card("other", 2)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "other"]));
|
||||
await choose("Filter decisions by project", "Website");
|
||||
expect(cards()).toEqual(["ours"]);
|
||||
|
||||
fixture.byView = { all: [card("other", 2)] };
|
||||
fixture.byView = { mine: [card("other", 2)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(container.textContent).toContain("No open decisions match these filters."));
|
||||
expect(filterButton("Filter decisions by project").value).toBe("project-web");
|
||||
@@ -230,7 +257,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
it("stops filtering by a kept agent the company no longer has", async () => {
|
||||
fixture.agents = [{ id: "agent-cos", name: "Chief of Staff" }, { id: "agent-old", name: "Old agent" }] as Agent[];
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1, { agentId: "agent-old" }), card("other", 2)] };
|
||||
fixture.byView = { mine: [card("ours", 1, { agentId: "agent-old" }), card("other", 2)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "other"]));
|
||||
await choose("Filter decisions by agent", "Old agent");
|
||||
@@ -244,7 +271,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
|
||||
it("shows every agent's cards while the agent list cannot be read, then filters by the kept agent again", async () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1, { agentId: "agent-cos" }), card("other", 2)] };
|
||||
fixture.byView = { mine: [card("ours", 1, { agentId: "agent-cos" }), card("other", 2)] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "other"]));
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
@@ -266,7 +293,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
Object.defineProperty(HTMLElement.prototype, "scrollIntoView", { configurable: true, writable: true, value: vi.fn() });
|
||||
fixture.boardAccess = member("admin");
|
||||
const linked = { ...card("linked", 3), sourceKind: "decision", subject: { id: "target", kind: "decision", title: "Linked decision" } } as unknown as AttentionItem;
|
||||
fixture.byView = { all: [card("ours", 1, { agentId: "agent-cos", project: website }), linked] };
|
||||
fixture.byView = { mine: [card("ours", 1, { agentId: "agent-cos", project: website }), linked] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "linked"]));
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
@@ -292,7 +319,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
Object.defineProperty(HTMLElement.prototype, "scrollIntoView", { configurable: true, writable: true, value: vi.fn() });
|
||||
fixture.boardAccess = member("admin");
|
||||
const linked = { ...card("linked", 3), sourceKind: "decision", subject: { id: "target", kind: "decision", title: "Linked decision" } } as unknown as AttentionItem;
|
||||
fixture.byView = { all: [card("ours", 1, { agentId: "agent-cos" }), linked] };
|
||||
fixture.byView = { mine: [card("ours", 1, { agentId: "agent-cos" }), linked] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["ours", "linked"]));
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
@@ -312,7 +339,7 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
fixture.boardAccess = member("admin");
|
||||
fixture.byView = { all: [card("ours", 1), card("dottas", 2, { userId: "dotta" })], unassigned: [card("pool", 4)], archived: [] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("me"));
|
||||
await choose("Filter decisions by assignee", "No owner yet");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["pool"]));
|
||||
|
||||
@@ -331,11 +358,11 @@ describe("Needs You keeps its toolbar between visits", () => {
|
||||
const waiting = card("waiting-1", 3);
|
||||
fixture.byView = { all: [dottas, other], waiting: [waiting] };
|
||||
await visit("/decisions");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("all"));
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
await choose("Filter decisions by project", "Website");
|
||||
await vi.waitFor(() => expect(assignee().value).toBe("me"));
|
||||
await choose("Filter decisions by assignee", "Dotta");
|
||||
await vi.waitFor(() => expect(cards()).toEqual(["dottas"]));
|
||||
await choose("Filter decisions by agent", "Chief of Staff");
|
||||
await choose("Filter decisions by project", "Website");
|
||||
|
||||
const waitingTab = [...container.querySelectorAll<HTMLButtonElement>('[aria-label="Inbox views"] button')].find((button) => button.textContent?.startsWith("Waiting"))!;
|
||||
await act(async () => waitingTab.click()); await flush();
|
||||
|
||||
Reference in new issue
Block a user