Files
DottaandClaude Opus 5.5 92308f839d test(e2e): use the Coordinator task panel, inbox and plan controls in QA journeys (#21701)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The QA Cloud product journeys check real user paths on a hosted test
stack
> - #19360 (2026-11-05) made the Coordinator workspace standard; its
task side panel starts with no tabs, and the header control opens a tab
chooser
> - The journeys were written for the classic panel, which opened
straight on Properties, and for older inbox and plan controls
> - On QA the smoke suite passed 8 of 24 journeys; 13 failures trace to
these out-of-date journey steps
> - This pull request updates the journeys to use the shipped
Coordinator controls the way a person does
> - The benefit is that the QA journeys test the product again instead
of failing on removed controls

## Linked Issues or Issue Description

**What happened?**
The QA staging smoke suite passed 8 of 24 journeys. 13 failures come
from journey steps that target the classic UI:
- Task side panel: the journeys click "Show properties" and expect
property rows. In Coordinator the click opens a tab chooser ("Open a
side panel tab"), and the user picks Properties or Artifacts. The
product's own e2e tests (`tests/e2e/artifact-tab-arrival.spec.ts`,
`artifact-uploads.spec.ts`, `disconnect-resilience.spec.ts`) and the
chat-catalog runtime cases already use the chooser.
- Inbox: desktop Coordinator inbox rows show unread state as a bold
title and have no per-row "Mark as read" button
(`doc/plans/2026-11-06-chat-contacts-pins.md`). The `r` shortcut marks
the hovered row read on the Mine view.
- Plan: the Coordinator Plan chip is named "Open Plan revision N in task
sidebar", not "Open Plan revision N".

**Steps to reproduce**
1. Run `pnpm test:e2e:runner -- --target-config <managed local config>`
with task-properties, task-edit-lifecycle, task-document-persistence and
project-task-context.
2. See 0/4 pass on master; each stops at the tab chooser.

**Expected behavior**
The journeys reach the same saved-state checks as before through the
shipped controls.

## What Changed

- New `product-journeys/task-panel.ts` helper: opens the side panel and
selects a tab (Properties or Artifacts) from the chooser, an open tab,
or the "Open a new tab" button. It waits for the page instead of a
single non-waiting visibility check, and does not close an already open
panel.
- task-properties, task-edit-lifecycle, task-dependency-resume,
project-task-context and task-document-persistence (and routine/agent
journeys that reuse `openDocumentAuthoring`) use the helper.
task-properties reopens the panel after reload before it checks "You".
- inbox-triage: when the row has no visible "Mark as read" button, open
the Mine view, blur search, hover the row and press `r` (as
`tests/e2e/coordinator-inbox-views.spec.ts` does).
- Plan journey: `planPreviewLabel()` accepts the optional " in task
sidebar" suffix and still requires the exact revision.
- No product code changes. An earlier revision of this PR changed "Show
properties" to select Properties; it is reverted because the product e2e
suite asserts the chooser is the intended design.

All saved-state assertions are unchanged: assignment, labels, status,
documents, read state and plan revision are still read back through the
API, so a broken feature still fails.

## Verification

- Real browser journeys on a managed local instance against unmodified
master UI: 4/4 pass (task-edit-lifecycle, task-properties,
task-document-persistence, project-task-context); 0/4 before.
- Inbox fallback checked by hand on a local instance: an unread task on
the Mine view became `isUnreadForMe=false` after blur + hover + `r`.
- `tests/runner-e2e` unit tests for product-journeys and plan-revision:
47 files, 1240 tests pass. The task-properties contract test now models
the chooser and asserts the opener and the Properties option are used
before assignment and after reload. New `planPreviewLabel` test covers
revision 12 vs 1 and a missing revision.
- QA Cloud rerun follows once the QA harness pin moves to a master
commit that contains this change.

## Risks

- Low risk: test code only. If the chooser changes again, the helper
fails visibly at the panel step.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with 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
- [ ] 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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 03:08:23 +00:00

160 lines
10 KiB
TypeScript

import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { expect } from "@playwright/test";
import { createTaskThroughUi, withBrowserEvent } from "../user-actions.js";
import { createObservedReader } from "./observation-read.js";
import { showPropertyRow } from "./task-panel.js";
import { taskLifecycleEvidence, taskLifecycleLabelName, type LifecycleExpectation, type LifecycleLabel, type LifecycleObservation, type LifecycleTask } from "./task-lifecycle-evidence.js";
import { JourneyError, type JourneyContext, type JourneyEvidence, type TargetSession } from "./types.js";
type Stage = "create" | "initial_read" | "rename" | "label" | "in_progress" | "reload" | "complete" | "reopen";
function taskSnapshot(task: LifecycleTask): LifecycleTask {
return { id: task.id, companyId: task.companyId, identifier: task.identifier, title: task.title,
description: task.description, status: task.status, priority: task.priority, projectId: task.projectId,
assigneeUserId: task.assigneeUserId, assigneeAgentId: task.assigneeAgentId, createdByUserId: task.createdByUserId,
createdByAgentId: task.createdByAgentId, labelIds: task.labelIds, completedAt: task.completedAt };
}
const emptyObservation = (): LifecycleObservation => ({ task: null, runCount: null,
titleVisible: false, descriptionVisible: false, statusVisible: false, labelVisible: false });
async function properties(context: JourneyContext) {
return await showPropertyRow(context.page, "Labels");
}
async function setStatus(context: JourneyContext, label: string) {
const { page } = context;
await page.getByTestId("issue-detail-header").filter({ visible: true })
.getByRole("button", { name: /^Change status \(current:/ }).click();
// The shipped picker includes both a labeled status glyph and visible text.
// Bind the choice to its exact accessible glyph inside the open popover.
await page.locator('[data-slot="popover-content"]').filter({ visible: true })
.getByRole("button").filter({ has: page.getByRole("img", { name: label, exact: true }) }).click();
}
/** All measured edits use the shipped browser. Independent GETs verify saved state. */
export async function taskEditLifecycle(context: JourneyContext, session: TargetSession, campaignId: string, evidence: JourneyEvidence,
options: { deadlineAt: number; directory: string }) {
const { page, api, company, user } = context;
const read = createObservedReader(api, options.deadlineAt);
const journeyId = "task-edit-lifecycle" as const;
const originalTitle = `Journey QA task lifecycle ${campaignId}`;
const revisedTitle = `Journey QA task lifecycle revised ${campaignId}`;
const description = `Keep this task assigned to me. Saved task context ${campaignId} must survive every edit.`;
const labelName = taskLifecycleLabelName(campaignId);
const observed = { created: emptyObservation(), edited: emptyObservation(), reloaded: emptyObservation(),
completed: emptyObservation(), reopened: emptyObservation() };
let expected: LifecycleExpectation | undefined;
let label: LifecycleLabel | null = null;
let stage: Stage = "create";
const check = (id: string, passed: boolean) => {
evidence.checks.push({ id, passed });
if (!passed) throw new JourneyError("failed", id.replaceAll("-", "_"));
};
const preserve = async () => {
await mkdir(options.directory, { recursive: true, mode: 0o700 });
await writeFile(path.join(options.directory, "task-lifecycle-observations.json"),
JSON.stringify({ schema: "paperclip.task-lifecycle-observations/v1", stage, expected, label, ...observed }, null, 2), { mode: 0o600 });
};
const grade = () => taskLifecycleEvidence({ expected: expected!, label, ...observed });
try {
for (const capability of ["company", "board-user", "task-write"]) {
if (!context.capabilities.includes(capability)) throw new JourneyError("unsupported", `missing_${capability}`);
}
if (!campaignId) throw new JourneyError("blocked", "task_lifecycle_campaign_required");
const created = await createTaskThroughUi({ page, origin: api.origin, issuePrefix: company.issuePrefix,
agentName: "Me", title: originalTitle, prompt: description, workMode: "standard", requireExplicitTitle: true,
beforeDispatch: () => session.own({ kind: "issue", name: originalTitle, journeyId }) });
await session.own({ kind: "issue", name: originalTitle, id: created.issueId, journeyId });
const route = `/api/issues/${created.issueId}`;
expected = { taskId: created.issueId, companyId: company.id, userId: user.id, originalTitle, revisedTitle, description, labelName };
const task = await read.get<LifecycleTask>(route);
await page.goto(`${api.origin}/${company.issuePrefix}/issues/${task.identifier}`);
const capture = async (title: string, statusLabel: string, withLabel: boolean): Promise<LifecycleObservation> => {
await expect(page.getByRole("heading", { name: title, exact: true })).toBeVisible();
await expect(page.getByText(description, { exact: true }).first()).toBeVisible();
const status = page.getByRole("button", { name: `Change status (current: ${statusLabel})`, exact: true }).filter({ visible: true }).first();
await expect(status).toBeVisible();
const labelRow = await properties(context);
if (withLabel) await expect(labelRow.getByText(labelName, { exact: true })).toBeVisible();
const saved = await read.get<LifecycleTask>(route);
const runs = await read.get<unknown[]>(`${route}/runs`);
return { task: structuredClone(taskSnapshot(saved)), runCount: Array.isArray(runs) ? runs.length : null,
titleVisible: await page.getByRole("heading", { name: title, exact: true }).isVisible(),
descriptionVisible: await page.getByText(description, { exact: true }).first().isVisible(),
statusVisible: await status.isVisible(), labelVisible: withLabel && await labelRow.getByText(labelName, { exact: true }).isVisible() };
};
stage = "initial_read";
const initialStatus = task.status === "backlog" ? "Backlog" : "Todo";
observed.created = await capture(originalTitle, initialStatus, false);
await preserve();
check("task-lifecycle-browser-created", grade().created);
stage = "rename";
// Keep the creation receipt stable. Cleanup may accept this one exact,
// predeclared title if the browser save commits but its response is lost.
await session.own({ kind: "issue", name: originalTitle, id: created.issueId, journeyId, taskEdit: { revisedTitle } });
await page.getByRole("heading", { name: originalTitle, exact: true }).click();
const titleEditor = page.getByTestId("issue-detail-header").locator("textarea").first();
await titleEditor.fill(revisedTitle);
await titleEditor.press("Enter");
await expect.poll(async () => (await read.get<LifecycleTask>(route)).title).toBe(revisedTitle);
stage = "label";
const labelsRoute = `/api/companies/${company.id}/labels`;
const beforeLabels = await read.get<LifecycleLabel[]>(labelsRoute);
if (beforeLabels.some(row => row.name === labelName)) throw new JourneyError("failed", "task_lifecycle_label_not_fresh");
const labels = await properties(context);
await labels.locator("[data-property-value]").getByRole("button").first().click();
await page.getByPlaceholder("New label", { exact: true }).fill(labelName);
await session.own({ kind: "label", name: labelName, journeyId });
const response = await withBrowserEvent(() => page.waitForResponse(response => response.request().method() === "POST"
&& new URL(response.url()).pathname === labelsRoute),
() => page.getByRole("button", { name: "Create label", exact: true }).click());
if (response.status() !== 201) throw new JourneyError("failed", "task_lifecycle_label_create_failed");
const createdLabel = await response.json() as LifecycleLabel;
if (typeof createdLabel.id !== "string" || !createdLabel.id || createdLabel.name !== labelName || createdLabel.companyId !== company.id) {
throw new JourneyError("failed", "task_lifecycle_label_receipt_mismatch");
}
await session.own({ kind: "label", name: labelName, id: createdLabel.id, journeyId });
label = { id: createdLabel.id, companyId: createdLabel.companyId, name: createdLabel.name, color: createdLabel.color };
await page.keyboard.press("Escape");
const savedLabels = await read.get<LifecycleLabel[]>(labelsRoute);
if (savedLabels.filter(row => row.name === labelName).length !== 1
|| !savedLabels.some(row => row.id === label!.id && row.name === labelName && row.companyId === company.id && row.color === label!.color)) {
throw new JourneyError("failed", "task_lifecycle_label_saved_mismatch");
}
stage = "in_progress";
await setStatus(context, "In Progress");
await expect.poll(async () => (await read.get<LifecycleTask>(route)).status).toBe("in_progress");
await expect.poll(async () => {
const task = await read.get<LifecycleTask>(route);
return Array.isArray(task.labelIds) && task.labelIds.length === 1 && task.labelIds[0] === label!.id;
}).toBe(true);
observed.edited = await capture(revisedTitle, "In Progress", true);
await preserve();
check("task-lifecycle-visible-edits-persisted", grade().edited);
stage = "reload";
await page.reload();
observed.reloaded = await capture(revisedTitle, "In Progress", true);
await preserve();
check("task-lifecycle-edits-reloaded", grade().reloaded);
stage = "complete";
await setStatus(context, "Done");
await expect.poll(async () => (await read.get<LifecycleTask>(route)).status).toBe("done");
await page.reload();
observed.completed = await capture(revisedTitle, "Done", true);
await preserve();
stage = "reopen";
await setStatus(context, "Todo");
await expect.poll(async () => (await read.get<LifecycleTask>(route)).status).toBe("todo");
await page.reload();
observed.reopened = await capture(revisedTitle, "Todo", true);
await preserve();
const final = grade();
check("task-lifecycle-completed-and-reopened", final.completedAndReopened);
check("task-lifecycle-unedited-context-preserved", final.uneditedFieldsPreserved);
check("no-agent-work", final.noAgentWork);
} catch (error) {
if (error instanceof JourneyError) throw error;
throw new JourneyError("failed", `task_lifecycle_${stage}_failed`);
} finally { await preserve(); await read.preserve(options.directory); }
}