From a9dc0df9da0dc29ca0f13faca3af65de0e248986 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:29:48 -0600 Subject: [PATCH] fix(ui): clarify dashboard proposal hierarchy (#22180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - An agent can propose dashboard areas and responsibilities in one card. > - The card put the area name above a separate “New area” row. > - Responsibility rows had no type label and no visible parent structure. > - This pull request puts area changes in the heading and nests responsibility changes below it. > - People can see what each change creates and where it belongs before they apply it. ## Linked Issues or Issue Description **What existing behavior does this improve?** The dashboard proposal card in task conversations and the dashboard edit module. **Subsystem affected** The board UI and its Storybook examples. **Current behavior** “New area” appears in a row below the area title. New responsibilities appear at the same level. Their type is not stated. **Proposed behavior** “New area” appears beside the area title. Each new responsibility has a label and sits below its parent area. Existing areas have a separate label. Area headings follow the heading level in the dashboard module. **Reason and benefit** The person can see the parent area, the change type and the text to review in that order. Long proposals are easier to scan. **Breaking changes** None. Proposal inputs, indexes, dependencies and apply/decline endpoints stay the same. ## What Changed - Put area changes and their controls in the area heading. - Nest responsibility rows under each area. Label additions, rewords, moves and removals. - Keep the drop/keep dependency behavior and the existing apply payload. - Keep area classification and group partitions in one helper. Expose whether each group has an existing parent area. - Add Storybook examples for the new hierarchy, a narrow layout and a mix of new and existing areas. - Add focused component and browser checks for the hierarchy, responsive layout and apply payload. ## Verification - 24 focused unit tests passed across the proposal card, dashboard module and dashboard helpers. - 25 Chromium checks passed against current-source Storybook after the review refactor, with one worker and no retries. They cover six proposal states in light and dark themes at widths of 390 and 960 pixels, plus the existing apply payload. - The UI typecheck passed in low-memory mode after the review refactor. The initial implementation also passed the static Storybook build; current-head CI supplies broad build coverage. - 30 map/catalog tests passed. Catalog checks, token gates and whitespace checks passed. - A hierarchy regression failed before the fix and passed after it. A later hosted-story check found a skipped heading level. The fix passed the expanded browser checks. - Initial concurrent browser, build and typecheck runs hit the workspace memory limit. The final browser pass used one worker and the typecheck used low-memory mode. - The first CI build stopped because its runner received a shutdown signal after the UI build completed. A new CI run checks the review fixes. - The local verification selector returned exit 2 because the new browser spec is a global CI input. [Current-head CI](https://github.com/paperclipai/paperclip/actions/runs/44333497172) passed typecheck, build, all selected test suites, E2E shards and the final verify gate for `e71916cdde90ede313cc167ab8cfb8a5c3bb501a`. No visual baseline comparison was run because the baseline manifest has no published snapshots. - [Greptile reviewed the current head](https://github.com/paperclipai/paperclip/pull/22180#issuecomment-6982500386) at 5/5 with no findings. Both earlier maintainability threads are resolved; two Paperclip reviews remain pending. ## Risks Low risk. This changes UI structure and labels. Long text and drop/keep controls must continue to fit at narrow widths. The focused browser checks cover those states. Storybook uses synthetic API data and does not prove server persistence or permissions. ## Model Used OpenAI GPT-6 through Codex, with reasoning, tool use and code execution. ## 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 --- .../dashboard-proposals.spec.ts | 59 ++++++++++ .../DashboardChangesCard.test.tsx | 44 ++++++- .../responsibilities/DashboardChangesCard.tsx | 107 ++++++++++++------ ui/src/lib/responsibility-dashboard.test.ts | 19 ++++ ui/src/lib/responsibility-dashboard.ts | 34 ++++-- .../fixtures/responsibility-dashboard.ts | 8 ++ .../responsibility-dashboard.stories.tsx | 46 +++++++- 7 files changed, 268 insertions(+), 49 deletions(-) create mode 100644 tests/storybook-visual/dashboard-proposals.spec.ts diff --git a/tests/storybook-visual/dashboard-proposals.spec.ts b/tests/storybook-visual/dashboard-proposals.spec.ts new file mode 100644 index 00000000000..2c80b0863cb --- /dev/null +++ b/tests/storybook-visual/dashboard-proposals.spec.ts @@ -0,0 +1,59 @@ +import { expect, test } from "@playwright/test"; + +for (const theme of ["light", "dark"]) { + for (const width of [390, 960]) { + for (const story of ["proposal-hierarchy", "proposal-hierarchy-mobile", "proposal-create", "proposal-new-and-existing-areas", "proposal-edit", "proposal-in-conversation"]) { + test(`${story} ${theme} ${width}`, async ({ page }, testInfo) => { + await page.setViewportSize({ width, height: 1100 }); + const errors: string[] = []; + page.on("pageerror", (error) => errors.push(error.message)); + await page.goto(`/iframe.html?id=feature-responsibility-dashboard--${story}&viewMode=story&globals=theme:${theme}`); + const finished = () => page.evaluate(() => (window as unknown as { + __STORYBOOK_ADDONS_CHANNEL__?: { data: Record> }; + }).__STORYBOOK_ADDONS_CHANNEL__?.data.storyFinished?.[0]?.status); + await expect.poll(finished, { timeout: 30_000 }).not.toBeUndefined(); + expect(await finished()).toBe("success"); + expect(errors).toEqual([]); + expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true); + + if (story === "proposal-hierarchy") { + const area = page.getByRole("region", { name: "Fundraising" }); + const heading = area.getByRole("heading", { name: "Fundraising" }); + const responsibilities = area.getByRole("list", { name: "Responsibilities in Fundraising" }); + await expect(responsibilities.getByText("New responsibility", { exact: true })).toHaveCount(2); + expect((await responsibilities.getByRole("listitem").first().boundingBox())!.x).toBeGreaterThan((await heading.boundingBox())!.x); + await expect(responsibilities.getByRole("button", { name: "Drop this change" })).toHaveCount(2); + await area.getByRole("button", { name: "Drop this change" }).first().click(); + await expect(area.locator("[data-dropped]")).toHaveCount(3); + await expect(area.getByText("Goes with Fundraising")).toHaveCount(2); + expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true); + await responsibilities.getByRole("button", { name: "Keep", exact: true }).last().click(); + await expect(area.locator("[data-dropped]")).toHaveCount(1); + await area.getByRole("button", { name: "Keep", exact: true }).click(); + } + await page.evaluate(() => document.fonts.ready); + await page.getByTestId("dashboard-changes").screenshot({ path: testInfo.outputPath(`${story}-${theme}-${width}.png`) }); + }); + } + } +} + +test("nested selections retain the existing apply payload", async ({ page }) => { + await page.goto("/iframe.html?id=feature-responsibility-dashboard--proposal-hierarchy&viewMode=story"); + const area = page.getByRole("region", { name: "Portfolio", exact: true }); + await area.getByRole("button", { name: "Drop this change" }).first().click(); + await area.getByRole("button", { name: "Keep", exact: true }).last().click(); + await page.evaluate(() => { + const original = window.fetch; + (window as unknown as { appliedBody: unknown }).appliedBody = undefined; + window.fetch = (input, init) => { + if (String(input).endsWith("/accept")) { + (window as unknown as { appliedBody: unknown }).appliedBody = JSON.parse(String(init?.body)); + } + return original(input, init); + }; + }); + await page.getByRole("button", { name: "Apply changes" }).click(); + await expect.poll(() => page.evaluate(() => (window as unknown as { appliedBody: unknown }).appliedBody)) + .toEqual({ keep: [0, 1, 2, 3, 5, 6, 7, 8, 9] }); +}); diff --git a/ui/src/components/responsibilities/DashboardChangesCard.test.tsx b/ui/src/components/responsibilities/DashboardChangesCard.test.tsx index cb94f593235..220655118d6 100644 --- a/ui/src/components/responsibilities/DashboardChangesCard.test.tsx +++ b/ui/src/components/responsibilities/DashboardChangesCard.test.tsx @@ -59,14 +59,27 @@ describe("DashboardChangesCard", () => { return match; }; const group = (name: string) => container.querySelector(`section[aria-label="${name}"]`)!; - const rows = (name: string) => [...group(name).querySelectorAll("li")]; + const rows = (name: string) => [...group(name).querySelectorAll("[data-dashboard-change]")]; + + it("identifies new areas in their headings and nests explicitly named new responsibilities", async () => { + await render(); + const fundraising = group("Fundraising"); + const area = fundraising.querySelector('[data-dashboard-change="add_area"]')!; + expect(area.querySelector("h3")?.textContent).toBe("Fundraising"); + expect(area.textContent).toContain("New area"); + const responsibilities = fundraising.querySelector('ul[aria-label="Responsibilities in Fundraising"]')!; + expect(responsibilities).not.toBeNull(); + expect(responsibilities.contains(area)).toBe(false); + expect([...responsibilities.querySelectorAll("li")].map((row) => row.querySelector('[data-change-label]')?.textContent)) + .toEqual(["New responsibility", "New responsibility"]); + }); it("shows a first dashboard grouped by area, in plain words, with the agent's reasons", async () => { await render(); const text = container.textContent ?? ""; expect(text).toContain("Chief proposes"); expect(text).toContain("A first dashboard from your answers and your calendar."); - expect([...container.querySelectorAll("h4")].map((heading) => heading.textContent)).toEqual(["Fundraising", "Portfolio", "Team", "Board"]); + expect([...container.querySelectorAll("h3")].map((heading) => heading.textContent)).toEqual(["Fundraising", "Portfolio", "Team", "Board"]); expect(rows("Fundraising").map((row) => row.getAttribute("data-dashboard-change"))).toEqual(["add_area", "add_responsibility", "add_responsibility"]); expect(rows("Fundraising")[1]!.textContent).toContain("You run the weekly fundraising sync"); expect(text).not.toMatch(/\b(issue|interaction|op|areaRef)\b/i); @@ -83,8 +96,21 @@ describe("DashboardChangesCard", () => { expect(rows("Portfolio")[0]!.textContent).toContain("Moved from Fundraising"); const team = rows("Team"); // Area changes first: the rename, seen by others too, then the responsibility let go with its reason. - expect(team[0]!.textContent).toContain("TeamPeopleAlso renamed for 2 other people"); - expect(team[1]!.textContent).toContain("Hire a second designer.Let goThat is a task that finishes"); + expect(team[0]!.querySelector("h3")?.textContent).toBe("Team People"); + expect(team[0]!.textContent).toContain("Rename areaAlso renamed for 2 other people"); + expect(team[1]!.textContent).toContain("Let go of responsibilityHire a second designer.Let goThat is a task that finishes"); + }); + + it("names the existing parent area when only a responsibility is added, and identifies area removal", async () => { + const interaction = dashboardChangesFixture("create"); + await render(); + expect(group("Fundraising").textContent).toContain("FundraisingExisting areaNew responsibility"); + expect(group("Portfolio").querySelector("h3")?.textContent?.trim()).toBe("Portfolio"); + expect(group("Portfolio").textContent).toContain("Remove area"); + expect(group("Portfolio").querySelector("ul")).toBeNull(); }); it("drops a new area together with what is filed under it, and keeps the area when one of them is kept", async () => { @@ -101,6 +127,16 @@ describe("DashboardChangesCard", () => { expect(acceptMock).toHaveBeenCalledExactlyOnceWith("issue-dashboard-conversation", "dashboard-changes-create", [0, 1, 2, 3, 5, 6, 7, 8, 9]); }); + it("does not label an unfiled responsibility as an existing area", async () => { + const interaction = dashboardChangesFixture("edit"); + await render(); + expect(group("No area").textContent).not.toContain("Existing area"); + expect(group("No area").querySelector("h3")?.textContent).toBe("No area"); + expect(rows("No area")[0]!.textContent).toContain("Every prospective LP hears from us at least every two weeks."); + }); + it("applies everything when nothing is dropped, and cannot apply nothing", async () => { await render(); for (const name of ["Fundraising", "Portfolio", "Team"]) { diff --git a/ui/src/components/responsibilities/DashboardChangesCard.tsx b/ui/src/components/responsibilities/DashboardChangesCard.tsx index dfcc5712c04..5de134172a8 100644 --- a/ui/src/components/responsibilities/DashboardChangesCard.tsx +++ b/ui/src/components/responsibilities/DashboardChangesCard.tsx @@ -12,6 +12,7 @@ import { dashboardChangeGroups, dashboardChangeWords, droppedWithArea, + isDashboardAreaChange, keptDashboardChanges, lettingGoWith, toggleDashboardChange, @@ -58,6 +59,16 @@ export function useDashboardChangesActions(interaction: Pick = { + add_area: "New area", + rename_area: "Rename area", + remove_area: "Remove area", + add_responsibility: "New responsibility", + reword_responsibility: "Reword responsibility", + move_responsibility: "Move responsibility", + remove_responsibility: "Let go of responsibility", +}; + function ChangeRow({ change, changes, @@ -73,25 +84,40 @@ function ChangeRow({ }) { const isDropped = dropped.has(change.index); const words = dashboardChangeWords(change); + const areaChange = isDashboardAreaChange(change); + const Row = areaChange ? "div" : "li"; const withArea = isDropped ? droppedWithArea(changes, dropped, change) : null; const lettingGo = change.op === "remove_area" && !isDropped ? lettingGoWith(changes, dropped, change) : []; return ( -
  • -
    - {words.before ?

    {words.before}

    : null} - {words.after ?

    {words.after}

    : null} +
    + {areaChange ? ( +
    +

    + {words.before ? {words.before}{" "} : null} + {words.after} +

    + {CHANGE_LABELS[change.op]} +
    + ) : ( + <> + {CHANGE_LABELS[change.op]} + {words.before ?

    {words.before}

    : null} + {words.after ?

    {words.after}

    : null} + + )} {words.note ?

    {words.note}

    : null} {lettingGo.length > 0 ? (

    Also lets go of: {lettingGo.join("; ")}

    ) : null} - {change.reason ?

    {change.reason}

    : null} + {change.reason ?

    {change.reason}

    : null}
    {isDropped ? ( -
    +
    {withArea ? Goes with {withArea} : null}
    @@ -110,7 +136,7 @@ function ChangeRow({
  • + ); } @@ -179,24 +205,35 @@ export function DashboardChangesCard({

    {agentName} proposes

    {payload.message ?

    {payload.message}

    : null} -
    - {groups.map((group) => ( -
    -

    {group.name}

    -
      - {group.changes.map((change) => ( - setDropped((current) => toggleDashboardChange(changes, current, change.index))} - /> - ))} -
    -
    - ))} +
    + {groups.map((group) => { + const { areaChanges, responsibilityChanges } = group; + const row = (change: ResponsibilityDashboardChange) => ( + setDropped((current) => toggleDashboardChange(changes, current, change.index))} + /> + ); + return ( +
    + {areaChanges.length > 0 ? areaChanges.map(row) : ( +
    +

    {group.name}

    + {group.hasExistingArea ? Existing area : null} +
    + )} + {responsibilityChanges.length > 0 ? ( +
      + {responsibilityChanges.map(row)} +
    + ) : null} +
    + ); + })}
    {error ?

    {describeError(error).body}

    : null} {notRight ? ( @@ -209,15 +246,17 @@ export function DashboardChangesCard({ placeholder="e.g. Keep Hiring, and fewer responsibilities under Fundraising" /> ) : ( -
    - {showConversationLink ? ( - + ) : null} + - ) : null} - +