Files
PaperClipAI/tests/storybook-visual/toolbars-design.spec.ts
T
DottaandPaperclip 3f263e4faf feat(ui): align routine controls and remember list views (#22182)
## Thinking Path

> - Paperclip helps people manage AI agents and their work.
> - Routines define recurring work and create tasks.
> - People need the same controls to find and inspect routines as they
use for tasks.
> - The routine list had different search controls and no detailed
filters or column choices.
> - This pull request aligns the controls and remembers each person's
view.
> - People can share a filtered link and see the responsible person
beside the agent.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The Routines list controls and metadata in the current and classic
interfaces.

**Subsystem affected**

ui/ — the React board.

**Current behavior**

Routines use different search controls from Tasks. The list has limited
view settings and no filters for project, agent, enabled state,
responsible person, or source. Routine metadata is fixed.

**Proposed behavior**

Show New routine on the left. Show Search, Sort, Filter, Group, Columns,
and View all tasks on the right, in that order. Use the shared Tasks
search and filter controls. Show the responsible person next to the
agent. Let people choose metadata columns. Save filters, search, sort,
and grouping in the URL. Remember view settings per person and company
in local storage. Use a play icon for manual runs.

**Reason and benefit**

People can scan routine ownership, find a subset, share its link, and
return to their preferred columns and view.

**Breaking changes**

The list uses metadata columns with horizontal scrolling on narrow
screens. Existing company-level sort and group preferences are read as a
fallback. No API or database change is required.

Related work: Refs #22009, Refs #18606, Refs #18317. The open PR search
found no duplicate of this list-control change. ROADMAP.md lists
Routines as shipped and has no overlapping control work.

## What Changed

- Align both Routines toolbars with the requested order and shared
search and button styles.
- Extract the existing Tasks filter group and checkbox row for reuse by
Routines.
- Add project, agent, enabled, responsible person, and source filters.
- Keep linked filters ahead of saved filters. Preserve unrelated URL
parameters.
- Save preferences per person and company. Keep the controls usable when
storage is unavailable.
- Add selectable Project, Agent, Responsible user, Last run, and Enabled
columns.
- Use play-only manual run buttons with accessible names and pending
indicators.
- Correct the empty message when a status filter excludes every routine.
- Add production-page Storybook examples and browser tests for both
interfaces.

## Verification

- Linux checkout, Node 25.9.0, system Chromium 148.0.7778.96.
- The final change includes master through `07d9316218`. It uses the
shared routine creation form and the upstream Runner test and SDK
source-pin fixes.
- 68 tests pass across eight focused UI suites at `440a9eb6a7`. UI
typecheck, token gates, and whitespace checks pass.
- Two new directory-error cases fail before the fix and pass after it.
Both pages keep routine rows mounted, show an error with Retry, and
restore responsible names after retry.
- 59 checks pass across the SDK source-pin, public-type, and evidence
suites.
- The Runner test program typechecks after building its eval dependency.
A local run of the native-session test file passed 300 tests. One
additional test could not run because the local debug Runner binary was
absent. CI must cover that case.
- Storybook builds and all 13 browser checks pass on
`64a87af7c085426d09eb8aa48bf9491487565990` after the latest master
integration. They cover current and Classic controls, filters, columns,
links, selection alignment, Recent Runs, mobile overflow, and shared
toolbar behavior.
- Storybook examples: Default, LinkedFilters, Classic, ClassicSelection,
and ClassicRuns. They mount production pages with fictional API
responses. Screenshots cover light, dark, filters, custom columns, and
mobile. The baseline manifest has no snapshots; these are visual review
captures.
- Earlier preference, shared-link, title-link, compact-row, and
filter-render-cost regressions have red/green evidence. The
scheduled-routine journey has 17 passing unit checks from the prior
revision.
- The shared selector has three large-list cases with 1,200 routines and
120 folders. All filters are active. Each case checks row order and
folder counts. Work counters throw if filtering repeatedly scans
selected IDs or folder counts scan the routine list for each folder.
Both deliberate regressions fail; the unchanged selector passes. Both
Routines pages use this selector. The latest commit adds only these
tests; production source is unchanged.
- [CI at
`64a87af7c0`](https://github.com/paperclipai/paperclip/actions/runs/44416091562)
passed all jobs, including typecheck, Build, Runner, general tests,
serialized tests, and E2E. [Final-head CI at
`440a9eb6a7`](https://github.com/paperclipai/paperclip/actions/runs/44419144971)
now passes on attempt 2. All 52 executed jobs pass; one file-selection
job is skipped. Typecheck, Build, all test shards, E2E, Runner, and the
aggregate verify gate pass. The first attempt failed in the
timing-sensitive watchdog fixture; its retry passes.
- `pnpm verify` returned exit 2 because this branch needs broad CI
coverage. Final-head CI passes. Greptile and Ponytail both give 5/5 at
`440a9eb6a75184a35001e99a17e6856b7cdb0bd5`. All 20 inline threads are
resolved.
- Prior CI at `10a5b0813b` passed all general and serialized test
shards, all E2E shards, and Build. It failed on a circular test-mock
type and a stale SDK source pin. Master now contains both repairs; the
final branch uses those repairs.
- The two Routines page bodies were already duplicated. This PR reduces
them and shares list data, controls, rows, and view state. Codie owns
the remaining page-shell consolidation as later work.
- Live provider execution and scheduler behavior are outside this
presentation change. Protected Storybook publication still requires a
configured human reviewer; no deployment approval is inferred from merge
authorization.

## Risks

View settings now include filters. A person can return to a filtered
list. The URL and active filter button show that state. Shared filter
URLs override local filters. Column choices stay local. The shared
filter extraction can affect Tasks, so its component and toolbar checks
are included. No migration is needed.

## Model Used

OpenAI GPT-6 through Codex. The runtime does not expose a more specific
model revision. Used reasoning, source editing, shell tools, and browser
automation. No sub-agents were used.

## 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: Paperclip <noreply@paperclip.ing>
2026-11-18 17:43:29 -06:00

172 lines
12 KiB
TypeScript

import { expect, test, type Page } from "@playwright/test";
test.use({ viewport: { width: 1440, height: 1100 } });
async function openToolbars(page: Page, story = "playground") {
await page.goto(`/iframe.html?id=design-toolbars--${story}&viewMode=story&globals=theme:dark`);
await expect(page.getByTestId("toolbars-preview")).toBeVisible();
return page.getByTestId("toolbars-preview");
}
test("canonical toolbar stories mount the shared components under the proposal theme", async ({ page }) => {
const errors: string[] = [];
page.on("pageerror", error => errors.push(error.message));
for (const [story, count] of [["playground", 6], ["tasks", 1], ["decisions", 1], ["skills", 1], ["artifacts", 1], ["projects", 1], ["routines", 1], ["narrow", 6]] as const) {
const preview = await openToolbars(page, story);
await expect(page.locator(".design-proposal-theme")).toBeVisible();
await expect(preview.getByRole("toolbar")).toHaveCount(count);
}
expect(errors).toEqual([]);
});
test("task toolbar retains real view, search, layout, expansion and filter controls", async ({ page }) => {
const preview = await openToolbars(page, "tasks");
const toolbar = preview.getByRole("toolbar", { name: "Task list controls" });
await toolbar.getByRole("button", { name: "Task view: All tasks", exact: true }).click();
await page.getByRole("menuitemradio", { name: "Unread", exact: true }).click();
await expect(toolbar.getByRole("button", { name: "Task view: Unread", exact: true })).toBeVisible();
await toolbar.getByRole("textbox", { name: "Search tasks", exact: true }).fill("connector");
await toolbar.getByRole("button", { name: "Clear search", exact: true }).click();
await expect(toolbar.getByRole("textbox", { name: "Search tasks", exact: true })).toHaveValue("");
await toolbar.getByRole("button", { name: "Board view", exact: true }).click();
await expect(toolbar.getByRole("button", { name: "Board view", exact: true })).toHaveAttribute("aria-pressed", "true");
await expect(toolbar.getByRole("button", { name: /all tasks/ })).toBeDisabled();
await toolbar.getByRole("button", { name: "List view", exact: true }).click();
await toolbar.getByRole("button", { name: "Collapse all tasks", exact: true }).click();
await expect(toolbar.getByRole("button", { name: "Expand all tasks", exact: true })).toBeEnabled();
await toolbar.getByRole("button", { name: "Filter", exact: true }).click();
await expect(page.getByRole("dialog", { name: "Filters", exact: true })).toBeVisible();
await page.keyboard.press("Escape");
await toolbar.getByRole("button", { name: "New Task", exact: true }).click();
await expect(preview.getByRole("status")).toContainText("New Task requested · local preview only");
});
test("decision menus update local state", async ({ page }) => {
const writes: string[] = [];
page.on("request", request => { if (["POST", "PATCH", "PUT", "DELETE"].includes(request.method()) && request.url().includes("/api/")) writes.push(request.url()); });
const preview = await openToolbars(page);
const decisions = preview.getByRole("region", { name: "Decisions toolbar", exact: true });
await decisions.getByRole("button", { name: "Group", exact: true }).click();
await page.getByRole("button", { name: "Severity", exact: true }).click();
await page.keyboard.press("Escape");
await expect(decisions.getByRole("status")).toContainText("Group: severity");
await decisions.getByRole("button", { name: "Sort", exact: true }).click();
await page.getByRole("button", { name: "Oldest first", exact: true }).click();
await page.keyboard.press("Escape");
await expect(decisions.getByRole("status")).toContainText("Sort: oldest");
await decisions.getByRole("button", { name: "Filter", exact: true }).click();
await page.getByRole("button", { name: "Critical", exact: true }).click();
await page.keyboard.press("Escape");
await expect(decisions.getByRole("status")).toContainText("1 active filters");
expect(writes).toEqual([]);
});
test("width controls expose narrow wrapping and keyboard focus", async ({ page }) => {
const preview = await openToolbars(page);
await preview.getByRole("combobox", { name: "Toolbar container width", exact: true }).selectOption("narrow");
const specimens = preview.getByTestId("toolbar-specimens");
await expect(specimens).toHaveAttribute("data-container-width", "narrow");
expect(await specimens.evaluate(element => element.scrollWidth <= element.clientWidth)).toBe(true);
const search = preview.getByRole("textbox", { name: "Search tasks", exact: true });
await search.focus();
await page.keyboard.press("Tab");
const list = preview.getByRole("button", { name: "List view", exact: true });
await expect(list).toBeFocused();
await expect(list).not.toHaveCSS("box-shadow", "none");
});
test("Skills and Artifacts use their shared production controls with local preview state", async ({ page }) => {
let preview = await openToolbars(page, "skills");
await preview.getByRole("textbox", { name: "Search installed skills", exact: true }).fill("review");
await preview.getByRole("button", { name: "Sort Most agents", exact: true }).click();
await page.getByRole("menuitemradio", { name: "Alphabetical", exact: true }).click();
await expect(preview.getByRole("status")).toContainText("Search: review · Sort: alphabetical");
await preview.getByRole("button", { name: "Source All", exact: true }).click();
await page.getByRole("menuitemradio", { name: "GitHub", exact: true }).click();
await expect(preview.getByRole("status")).toContainText("Source: github");
const scan = preview.getByRole("button", { name: "Scan project workspaces for skills", exact: true });
await scan.click();
await expect(scan).toBeDisabled();
await preview.getByRole("button", { name: "Complete simulated scan", exact: true }).click();
await expect(scan).toBeEnabled();
await preview.getByRole("button", { name: "New", exact: true }).click();
await page.getByRole("menuitem", { name: "Create new skill", exact: true }).click();
await expect(preview.getByRole("status")).toContainText("Create skill requested");
await preview.getByRole("button", { name: "New folder", exact: true }).click();
await expect(preview.getByRole("status")).toContainText("New folder requested");
preview = await openToolbars(page, "artifacts");
await preview.getByRole("textbox", { name: "Search artifacts", exact: true }).fill("mockup");
await preview.getByRole("radio", { name: "Images", exact: true }).click();
await expect(preview.getByRole("radio", { name: "Images", exact: true })).toHaveCSS("font-size", "14px");
await expect(preview.getByRole("radio", { name: "Images", exact: true })).toHaveCSS("height", "32px");
await preview.getByTestId("artifact-group-control").click();
await page.getByTestId("artifact-group-option-parent_task").click();
await expect(preview.getByRole("status")).toHaveText("Search: mockup · Group: parent_task · Type: image");
await preview.getByRole("button", { name: "Clear artifact search", exact: true }).click();
await expect(preview.getByRole("textbox", { name: "Search artifacts", exact: true })).toHaveValue("");
});
test("canonical toolbars share control geometry and keep the requested keyboard order", async ({ page }) => {
const preview = await openToolbars(page);
const geometry = await preview.locator("[data-canonical-toolbar]").evaluateAll(toolbars => toolbars.map(toolbar => {
const search = toolbar.querySelector<HTMLElement>("[data-toolbar-search]")!;
const first = toolbar.querySelector("input, button")!;
const controls = [...toolbar.querySelectorAll<HTMLElement>("button:not([data-toolbar-clear], .canonical-tab), [data-toolbar-control]")].filter(button => !button.closest(".design-view-toggle"));
const style = getComputedStyle(search);
return { name: toolbar.getAttribute("data-canonical-toolbar"), searchHeight: search.getBoundingClientRect().height, gap: getComputedStyle(toolbar).columnGap,
border: style.borderColor, radius: style.borderRadius, first: first.getAttribute("aria-label") ?? first.textContent,
controls: controls.map(button => ({ height: button.getBoundingClientRect().height, border: getComputedStyle(button).borderColor, radius: getComputedStyle(button).borderRadius })) };
}));
expect(geometry).toHaveLength(6);
for (const toolbar of geometry) {
expect(toolbar.searchHeight).toBe(44);
expect(toolbar.gap).toBe("8px");
expect(toolbar.first).toBe(toolbar.name === "tasks" ? "Task view: All tasks" : toolbar.name === "skills" ? "Search installed skills" : toolbar.name === "routines" ? "New routine" : `Search ${toolbar.name}`);
for (const control of toolbar.controls) {
expect(control.height).toBe(toolbar.searchHeight);
expect(control.border).toBe(toolbar.border);
expect(control.radius).toBe(toolbar.radius);
}
}
const skills = preview.getByRole("toolbar", { name: "Skills controls", exact: true });
const skillViews = skills.getByRole("navigation", { name: "Skills views" });
await expect(skillViews.getByRole("link")).toHaveText(["Installed", "Discover", "My Skills"]);
await expect(skillViews.getByRole("link", { name: "Installed", exact: true })).toHaveAttribute("aria-current", "page");
await expect(skillViews.getByRole("link", { name: "My Skills", exact: true })).toHaveAttribute("href", /\/skills\/studio$/);
await expect(skillViews.getByRole("link", { name: "Sources", exact: true })).toHaveCount(0);
await expect(skills.getByRole("button").last()).toHaveAccessibleName("New");
const decisions = preview.getByRole("region", { name: "Decisions toolbar", exact: true });
await decisions.getByRole("textbox", { name: "Search decisions", exact: true }).fill("des-3");
await expect(decisions.locator("[data-toolbar-count]")).toHaveText("1 decision");
await decisions.getByRole("button", { name: "Clear search", exact: true }).click();
await expect(decisions.locator("[data-toolbar-count]")).toHaveText("2 decisions");
});
test("Projects toolbar searches, sorts and reports creation locally", async ({ page }) => {
const preview = await openToolbars(page, "projects");
await preview.getByRole("textbox", { name: "Search projects", exact: true }).fill("design");
await preview.getByRole("button", { name: "Sort: Name", exact: true }).click();
await page.getByRole("button", { name: "Updated", exact: true }).click();
await page.keyboard.press("Escape");
await expect(preview.getByRole("status")).toContainText("Search: design · Sort: updated · Direction: desc");
await preview.getByRole("button", { name: "Create project", exact: true }).click();
await expect(preview.getByRole("status")).toContainText("Create project requested · local preview only");
});
test("routines toolbar updates search, sort, group and creation intent", async ({ page }) => {
const preview = await openToolbars(page, "routines");
await preview.getByRole("textbox", { name: "Search routines", exact: true }).fill("review");
await expect(preview.locator("output")).toContainText("Search: review");
await preview.getByRole("button", { name: "Sort routines", exact: true }).click();
await page.getByRole("button", { name: "Title", exact: true }).click();
await expect(preview.locator("output")).toContainText("Sort: title · Direction: asc");
await preview.getByRole("button", { name: "Group routines", exact: true }).click();
await page.getByRole("button", { name: "Agent", exact: true }).click();
await expect(preview.locator("output")).toContainText("Group: assignee");
await expect(preview.getByRole("button", { name: "New folder" })).toHaveCount(0);
await preview.getByRole("button", { name: "New routine" }).click();
await expect(preview.locator("output")).toContainText("Create routine requested");
});