mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 15:52:36 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People use Tasks to see shared work and manage the work that needs their attention. > - The old inbox already let each person archive a task and undo that action. > - The combined Tasks surface needs the same controls in Unread and in task table rows. > - The existing inbox archive rules determine when new activity brings a task back. > - This pull request adds an Archived view so people can find and restore their archived tasks. ## Linked Issues or Issue Description **What existing behavior does this improve?** Personal task archiving in Tasks. Related work includes the combined Inbox and Tasks surface (#15100), the Coordinator workspace (#17983), moving Mine into Tasks (#19363), and the existing inbox archive rules (#9931). **Subsystem affected** Cross-cutting. The UI and task list API reuse the existing inbox archive state. **Current behavior** Mine has an archive action. Unread and the task table have no equivalent action. The Tasks menu has no dedicated view for restoring archived tasks. **Proposed behavior** Add Archive and Undo to the task views. Let people restore tasks from Archived. Keep archived tasks available in All tasks. **Reason and benefit** People can clear their personal lists and still find the original task. **Breaking changes** The task list API adds an optional archive filter and viewer archive field. Existing callers use the same response and filters unless they opt in. ## What Changed - Reuse the current inbox archive and restore actions, activity rules, and authorization. - Add Archive and Restore to task table rows, Archive and Undo to Unread, and a personal Archived view. - Give each archived task its own Undo control, including when people archive tasks quickly. - Add tests for the archive list, account isolation, new activity, row actions, and Undo. - Document the archive flow and API filter. Refresh the generated SDK source input registry. ## Verification - Passed 287 focused tests in 12 Vitest files. These cover the task views, row actions, archive cache, and PostgreSQL routes. - Passed local server and UI typechecks. The source input registry check also passed. - Reproduced a missing Undo action when archiving two tasks in a row. After the fix, the 158 task and inbox tests and the 2 toast tests passed. - On macOS with Chrome, archived a task from Mine and restored it using Undo. Archived another task from All tasks, reloaded Archived, restored it, and verified its Todo status and return to Mine. - A human tester also verified Archive, Undo, and Restore in the local browser. - On commit `c5526fd9b1`, GitHub's [verification](https://github.com/paperclipai/paperclip/actions/runs/44630156078/job/135950130662) and [browser tests](https://github.com/paperclipai/paperclip/actions/runs/44630156078/job/135946228919) passed. A targeted retry passed after the first attempt hit a watchdog self-test failure and two cancelled jobs. - [Greptile scored 5/5](https://github.com/paperclipai/paperclip/pull/22358#issuecomment-7024083610) on the same commit. Both review threads are resolved. ## Risks - An incorrect visibility rule could hide a task from a personal list. The archived filter uses the same activity predicate as Mine. The PostgreSQL test covers isolation between people and resurfacing after a reply. - The archive state is already stored per person and company. No database migration is required. ## Model Used - OpenAI Codex, GPT-6, with shell, code editing, and browser verification tools. The serving model ID and context size were unavailable in this session. ## 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 <1504818+scotttong@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
98 lines
4.2 KiB
TypeScript
98 lines
4.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
DEFAULT_TASK_VIEW,
|
|
TASK_VIEW_GROUPS,
|
|
TASK_VIEW_KEYS,
|
|
isTaskViewKey,
|
|
normalizeTaskViewKey,
|
|
resolveInitialTaskView,
|
|
taskView,
|
|
taskViewForInboxTab,
|
|
taskViewPath,
|
|
} from "./task-views";
|
|
|
|
describe("task views registry (PAP-670)", () => {
|
|
it("covers every legacy Inbox tab and task status preset exactly once", () => {
|
|
const keys = TASK_VIEW_GROUPS.flatMap((group) => group.views.map((view) => view.key));
|
|
expect(keys).toEqual([...TASK_VIEW_KEYS]);
|
|
expect(new Set(keys).size).toBe(keys.length);
|
|
});
|
|
|
|
it("renders the archived collection and organization views in the task list", () => {
|
|
const [myWork, organization] = TASK_VIEW_GROUPS;
|
|
|
|
const inboxViews = myWork.views.filter(view => view.surface === "inbox");
|
|
expect(inboxViews.map(view => view.inboxTab)).toEqual(["mine", "unread", "blocked", "recent", "all"]);
|
|
for (const view of inboxViews) expect(view.statuses).toBeUndefined();
|
|
|
|
expect(myWork.views.find(view => view.key === "archived")).toMatchObject({ surface: "issues", statuses: [] });
|
|
expect(taskViewPath("archived")).toBe("/issues?view=archived");
|
|
for (const view of organization.views) {
|
|
expect(view.surface).toBe("issues");
|
|
expect(view.inboxTab).toBeUndefined();
|
|
expect(Array.isArray(view.statuses)).toBe(true);
|
|
}
|
|
expect(taskView("all").statuses).toEqual([]);
|
|
expect(taskView("active").statuses).toEqual(["todo", "in_progress", "monitoring", "in_review", "blocked"]);
|
|
expect(taskView("backlog").statuses).toEqual(["backlog"]);
|
|
expect(taskView("done").statuses).toEqual(["done", "cancelled"]);
|
|
});
|
|
|
|
it("every view carries a label and a hint for the Views menu", () => {
|
|
for (const key of TASK_VIEW_KEYS) {
|
|
expect(taskView(key).label.length).toBeGreaterThan(0);
|
|
expect(taskView(key).hint.length).toBeGreaterThan(0);
|
|
}
|
|
});
|
|
|
|
it("normalizes unknown view keys to null rather than guessing", () => {
|
|
expect(normalizeTaskViewKey("blocked")).toBe("blocked");
|
|
expect(normalizeTaskViewKey("everything")).toBe("everything");
|
|
expect(normalizeTaskViewKey("nonsense")).toBeNull();
|
|
expect(normalizeTaskViewKey(null)).toBeNull();
|
|
expect(normalizeTaskViewKey("")).toBeNull();
|
|
expect(isTaskViewKey("mine")).toBe(true);
|
|
expect(isTaskViewKey("Mine")).toBe(false);
|
|
});
|
|
|
|
it("maps the retired /inbox/* tabs onto views — /inbox/all becomes Everything, not All tasks", () => {
|
|
expect(taskViewForInboxTab("mine")).toBe("mine");
|
|
expect(taskViewForInboxTab("recent")).toBe("recent");
|
|
expect(taskViewForInboxTab("unread")).toBe("unread");
|
|
expect(taskViewForInboxTab("blocked")).toBe("blocked");
|
|
expect(taskViewForInboxTab("all")).toBe("everything");
|
|
expect(taskViewForInboxTab("requests")).toBe(DEFAULT_TASK_VIEW);
|
|
expect(taskViewForInboxTab(null)).toBe(DEFAULT_TASK_VIEW);
|
|
});
|
|
|
|
it("addresses views on the Tasks route", () => {
|
|
expect(taskViewPath("everything")).toBe("/issues?view=everything");
|
|
});
|
|
});
|
|
|
|
describe("resolveInitialTaskView", () => {
|
|
it("prefers an explicit ?view=", () => {
|
|
expect(resolveInitialTaskView("blocked", false, "done")).toBe("blocked");
|
|
expect(resolveInitialTaskView("backlog", true, "done")).toBe("backlog");
|
|
});
|
|
|
|
it("falls back to the last-used view on a bare /issues", () => {
|
|
expect(resolveInitialTaskView(null, false, "backlog")).toBe("backlog");
|
|
expect(resolveInitialTaskView("nonsense", false, "backlog")).toBe("backlog");
|
|
expect(resolveInitialTaskView(null, false, DEFAULT_TASK_VIEW)).toBe("all");
|
|
});
|
|
|
|
it("opens All tasks when an explicit inbox view carries an organization filter", () => {
|
|
// Inbox views can't apply ?participantAgentId= and friends.
|
|
expect(resolveInitialTaskView("mine", true, "mine")).toBe("all");
|
|
expect(resolveInitialTaskView("everything", true, "mine")).toBe("all");
|
|
});
|
|
|
|
it("opens All tasks for an organization-scoped deep link so its filter is not silently dropped", () => {
|
|
// /issues?assignee=… and friends mean the org task list; landing them on a
|
|
// My-work view would drop the filter they carry.
|
|
expect(resolveInitialTaskView(null, true, "mine")).toBe("all");
|
|
expect(resolveInitialTaskView(null, true, "blocked")).toBe("all");
|
|
});
|
|
});
|