mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-30 13:20:54 +01:00
## Thinking Path > - Paperclip manages AI agents and their work. > - Pipelines was an unused experiment with its own UI, API, CLI, and automation. > - Keeping it leaves unsupported product surfaces and extra task-detail queries. > - Removing the experiment must preserve data that users already saved. > - This pull request removes the feature and keeps its database schema and migration history. > - Cases and Routines remain available as separate features. ## Linked Issues or Issue Description **What existing behavior does this improve?** Remove the unused Pipelines experiment across the application. **Current behavior** The experiment includes pipeline boards, stage settings, case automation, review queues, learnings, permissions, and CLI commands. Task detail also queries pipeline links. **Proposed behavior** Remove all these product surfaces and their implementation. Preserve existing tables, records, and documents. Ignore the retired boolean in older managed configurations so upgrades still start. **Breaking changes** Pipeline URLs, API endpoints, CLI commands, and `pipelines:write` are removed. Task detail no longer includes the old `linkedCases` field. The independent Cases API remains available. No database migration or cleanup is included. Related feature work: #7907, #9110, #10905, #11375, #13004, #14671, #16133. Related issues: #9663, #10310, #10312. This removal supersedes the feature; it does not implement those pending enhancements or delete their saved data. ## What Changed - Remove Pipeline UI pages, navigation, gates, clients, query keys, helpers, and unused design tokens. - Remove Pipeline REST routes, services, automation dispatch, task-detail queries, and OpenAPI discovery. - Remove the CLI commands, shared contracts, experimental flag, catalog entry, and permission defaults. - Remove feature-specific tests, tutorials, smoke scripts, maps, and Storybook examples. - Preserve database schema, migration history, and the reserved document key used by old records. - Keep Cases routes independent and cover obsolete stored and managed settings. ## Verification - Passed: `pnpm build` and `pnpm -r typecheck`. - Passed: targeted settings, managed configuration, sidebar, settings UI, routing, and feature-catalog tests. A first sidebar run caught a shared Workspaces icon import; the import was restored and the sidebar rerun passed. - Passed: 40 tests covering Cases routes, OpenAPI discovery, retained Pipeline table constraints, and schema snapshot drift. - Passed: token gates, map validation, generated API metadata check, Storybook catalog validation, and 28 map/catalog tests. - Passed: isolated local browser verification of navigation and Experimental settings with Pipelines absent; Cases and Routines still open normally. Live GET/POST requests to retired Pipeline endpoints return 404, and the retired setting is absent. CLI help has no Pipeline commands. - Passed: 22 access-service and agent-default-grant tests after restoring unrelated permission assertions flagged in review. - Local full run: `pnpm test:run` reported one failure in the unchanged workspace-runtime port-allocation test. That test passed in an isolated rerun. The long local run was stopped after full CI passed; it is not reported as a complete local pass. - Passed: all 56 checks on `def9181f3a4491d95fca1d38e9739f5b821aae3e` (2 conditional checks skipped), including build, typecheck, test shards, and browser suites. Eleven interrupted CI jobs reported “The operation was canceled”; their one-time retry passed. [CI run](https://github.com/paperclipai/paperclip/actions/runs/39255211006). - Greptile: 5/5 on the final commit, with the only review finding fixed and resolved. - Sandbox socket restrictions affected the first build/API test attempts. The same commands ran with local sockets available. ## Risks - Existing Pipeline clients must stop using the removed endpoints and commands. - Existing data remains in the database and backups, but the removed UI no longer displays it. - Historical boolean `enablePipelines` values are ignored. They cannot restore the feature. - Cases and Routines must retain their separate behavior. Targeted route tests cover this boundary. ## Model Used OpenAI Codex, GPT-6, with repository inspection, editing, shell execution, and browser verification. The exact deployed model ID and context-window size are not exposed 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: Paperclip <noreply@paperclip.ing>
146 lines
5.5 KiB
TypeScript
146 lines
5.5 KiB
TypeScript
// @vitest-environment jsdom
|
|
|
|
// Regression guard for PAP-13002: the experimental Cases UI emits *unprefixed*
|
|
// links (`/cases`, `/cases/:id`) — the same global-unprefixed pattern Routines
|
|
// uses. Those only resolve if `cases` and `cases/:caseIdentifier` are registered
|
|
// as reserved unprefixed redirect routes in <App>; otherwise the first path
|
|
// segment is parsed as a company prefix ("CASES") and the page 404s with
|
|
// "No company matches prefix". This drives the real <App> route table so a
|
|
// future removal of those redirect routes fails loudly.
|
|
|
|
import type { ReactNode } from "react";
|
|
import { flushSync } from "react-dom";
|
|
import { createRoot } from "react-dom/client";
|
|
import { MemoryRouter } from "react-router-dom";
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { App } from "./App";
|
|
|
|
// jsdom's CSS parser rejects the custom-property marker rule stitches inserts
|
|
// (`--sxs{--sxs:N}`), pulled into <App>'s eager import graph transitively via
|
|
// @codesandbox/sandpack-react. Substitute a benign, valid rule on parse failure
|
|
// so stitches' index bookkeeping stays intact and the module graph evaluates.
|
|
// (sandpack itself is never exercised by the routing under test.)
|
|
vi.hoisted(() => {
|
|
const sheetProto = window.CSSStyleSheet.prototype as unknown as {
|
|
insertRule: (rule: string, index?: number) => number;
|
|
__pap13002Patched?: boolean;
|
|
};
|
|
if (!sheetProto.__pap13002Patched) {
|
|
const original = sheetProto.insertRule;
|
|
sheetProto.insertRule = function patched(this: CSSStyleSheet, rule: string, index?: number) {
|
|
try {
|
|
return original.call(this, rule, index);
|
|
} catch {
|
|
try {
|
|
return original.call(this, ".pap13002-noop{}", index);
|
|
} catch {
|
|
return this.cssRules?.length ?? 0;
|
|
}
|
|
}
|
|
};
|
|
sheetProto.__pap13002Patched = true;
|
|
}
|
|
});
|
|
|
|
// Real Layout renders the full authenticated shell (sidebar, data queries) and
|
|
// owns the "No company matches prefix" NotFound. For routing we only need it to
|
|
// resolve the :companyPrefix segment and render its nested routes.
|
|
vi.mock("./components/Layout", async () => {
|
|
const { Outlet } = await import("react-router-dom");
|
|
return { Layout: () => <Outlet /> };
|
|
});
|
|
|
|
// The experimental gate would otherwise hide the page behind a feature flag.
|
|
vi.mock("./components/CasesExperimentalGate", () => ({
|
|
CasesExperimentalGate: ({ children }: { children: ReactNode }) => <>{children}</>,
|
|
}));
|
|
|
|
// Rendered by <App> outside <Routes> and needs DialogProvider; irrelevant here.
|
|
vi.mock("./components/OnboardingWizardVariant", () => ({
|
|
OnboardingWizardVariant: () => null,
|
|
}));
|
|
|
|
// Sentinel pages so we can assert *which* route resolved.
|
|
vi.mock("./pages/Cases", () => ({ Cases: () => <div>CASES_LIST_PAGE</div> }));
|
|
vi.mock("./pages/CaseDetail", () => ({ CaseDetail: () => <div>CASE_DETAIL_PAGE</div> }));
|
|
|
|
// Cloud access is unrelated to the route-table regression. Let it fall through
|
|
// synchronously so this test does not poll its three query transitions.
|
|
vi.mock("./components/CloudAccessGate", async () => {
|
|
const { Outlet } = await import("react-router-dom");
|
|
return { CloudAccessGate: () => <Outlet /> };
|
|
});
|
|
|
|
// The prefix resolver + redirect logic both read the active company.
|
|
const PAP_COMPANY = {
|
|
id: "company-1",
|
|
name: "Paperclip",
|
|
issuePrefix: "PAP",
|
|
status: "active",
|
|
};
|
|
vi.mock("./context/CompanyContext", () => ({
|
|
useCompany: () => ({
|
|
companies: [PAP_COMPANY],
|
|
selectedCompanyId: PAP_COMPANY.id,
|
|
selectedCompany: PAP_COMPANY,
|
|
loading: false,
|
|
}),
|
|
CompanyProvider: ({ children }: { children: ReactNode }) => <>{children}</>,
|
|
}));
|
|
|
|
async function renderAppAt(container: HTMLElement, path: string) {
|
|
const root = createRoot(container);
|
|
flushSync(() => {
|
|
root.render(
|
|
<MemoryRouter initialEntries={[path]}>
|
|
<App />
|
|
</MemoryRouter>,
|
|
);
|
|
});
|
|
return root;
|
|
}
|
|
|
|
/**
|
|
* Waits on the condition, not on a fixed number of turns. The previous version
|
|
* yielded at most three macrotasks before asserting, which is ample on an idle
|
|
* machine and not when the suite is running many workers in parallel — the
|
|
* container was still empty and the assertion failed on a route that resolves
|
|
* perfectly well. `vi.waitFor` retries against a time budget instead, so a
|
|
* loaded worker gets more turns rather than a failure.
|
|
*
|
|
* The same fix #11499 applied to the sibling `App.activity-routing.test.tsx`,
|
|
* which had the identical loop with five turns instead of three.
|
|
*/
|
|
async function waitForRoute(container: HTMLElement, text: string) {
|
|
await vi.waitFor(() => expect(container.textContent).toContain(text));
|
|
}
|
|
|
|
describe("App Cases routing (PAP-13002)", () => {
|
|
let container: HTMLDivElement;
|
|
|
|
beforeEach(() => {
|
|
container = document.createElement("div");
|
|
document.body.appendChild(container);
|
|
});
|
|
|
|
afterEach(() => {
|
|
container.remove();
|
|
document.body.innerHTML = "";
|
|
vi.clearAllMocks();
|
|
});
|
|
|
|
it("redirects unprefixed /cases to the company-prefixed list page", async () => {
|
|
const root = await renderAppAt(container, "/cases");
|
|
await waitForRoute(container, "CASES_LIST_PAGE");
|
|
expect(container.textContent).not.toContain("No organization matches prefix");
|
|
flushSync(() => root.unmount());
|
|
});
|
|
|
|
it("redirects unprefixed /cases/:id to the company-prefixed detail page", async () => {
|
|
const root = await renderAppAt(container, "/cases/PAP-C5");
|
|
await waitForRoute(container, "CASE_DETAIL_PAGE");
|
|
expect(container.textContent).not.toContain("No organization matches prefix");
|
|
flushSync(() => root.unmount());
|
|
});
|
|
});
|