mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-12 14:19:00 +01:00
> Follows #20388 (merged as50df9a19b9). This PR adds only test and fixture files. It changes no product code. ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The Mine inbox (`/:companyPrefix/issues?view=mine`) is the first page an operator opens > - On an instance with 8,758 execution workspaces, Mine took about 13 s to show rows. It loaded every workspace in the company (`execution-workspaces?summary=true`, 2.5 MB) and kept all rows hidden until that read finished > - #20388 fixes this. Mine now reads only the workspaces its rows reference (`ids` filter), and waits for them only when the rows show workspace data > - The collections perf suite did not catch the regression. Its fixture has almost no execution workspaces, and it has no check on the workspace read > - This pull request adds a workspace-scale fixture and a spec that fails if Mine requests the company-wide list again, or if Mine rows wait for the workspace read when no workspace data is shown > - The benefit is a regression guard that fails on `master` before #20388 and passes with it ## Linked Issues or Issue Description Refs #20388 **What happened?** The collections perf suite could not detect that Mine waited on a company-wide execution-workspace list. The fixture had no workspace scale, and no assertion covered the workspace request or the reveal gate. **What did you expect?** A browser check that fails when Mine requests the unfiltered workspace list, or when Mine rows wait on a workspace read that does not change what the rows show. **Steps to reproduce** Run `tests/perf/collections` against `master` UI assets on a company with thousands of execution workspaces. All existing checks pass, although Mine requests the full list and holds rows for it. ## What Changed - `tests/perf/collections/workspace-fixture.ts` (new): a retained company with 6,000 execution workspaces. 4,000 of them belong to finished tasks. 12 Mine tasks each run in their own isolated workspace. Mine tasks come from the API. The API cannot create execution workspaces, so the bulk rows go to the disposable instance database directly (same pattern as `tests/e2e/legacy-failure-continuation.spec.ts`). The database URL comes from `PAPERCLIP_CONFIG` or `PAPERCLIP_COLLECTION_PERF_DATABASE_URL`, loopback only. The fixture uses the existing retain/404 rule. - `tests/perf/collections/mine-workspaces.spec.ts` (new), cold load of `/:prefix/issues?view=mine`: 1. Mine requests only `ids`-filtered `execution-workspaces?summary=true` reads, and only for the workspaces its rows reference. No unfiltered read. 2. With the Workspace column off and no workspace grouping, all Mine rows appear while every workspace read is held. 3. With the Workspace column on, each row shows its isolated workspace name. 4. Records cold time from navigation start to the first Mine row (two frames after mount, as in `measure-mine-context.ts`) over at least 5 runs. It attaches the samples and the median. It is not a budget. - `tests/perf/collections/README.md`: documents the fixture, its database prerequisite, and the checks. ## Verification Local disposable instance (`onboard --yes --run`, `local_trusted`, embedded PostgreSQL, `PAPERCLIP_UI_DEV_MIDDLEWARE=false`, production UI builds). Both arms used the same server (this branch) and the same database. Only the UI assets changed, so this is a UI comparison. The `master` UI does not send `ids`. ```sh PAPERCLIP_CONFIG=<instance>/config.json PAPERCLIP_COLLECTION_PERF_BASE_URL=http://127.0.0.1:3219 \ pnpm exec playwright test --config tests/perf/collections/playwright.config.ts mine-workspaces.spec.ts ``` **Fails on `origin/master` UI at5858cef8f9(before #20388 merged):** ``` ✘ 1 Mine reads only the execution workspaces its rows reference Error: Mine requested the company-wide list of 6000 workspaces + "/api/companies/<id>/execution-workspaces?summary=true", ✘ 2 Mine rows appear while workspace reads are pending when no workspace data is shown Error: Mine rows waited for the workspace read expect(locator).toBeVisible() failed … timeout 15000ms ✓ 3 the Workspace column resolves each Mine row's isolated workspace name ✓ 4 records cold time to Mine rows 2 failed, 2 passed ``` **Passes on this branch (#20388 UI):** ``` ✓ 1 Mine reads only the execution workspaces its rows reference ✓ 2 Mine rows appear while workspace reads are pending when no workspace data is shown ✓ 3 the Workspace column resolves each Mine row's isolated workspace name ✓ 4 records cold time to Mine rows 4 passed ``` **Cold time to first Mine row, 5 runs each, fresh browser contexts, 1440×900:** | Scenario | `master` UI median (samples) | This branch median (samples) | | --- | --- | --- | | Native loopback, no interception | 472 ms (461, 466, 472, 483, 523) | 425 ms (406, 417, 425, 429, 998) | | Workspace reads delayed 3,000 ms (diagnostic, intercepted) | 3,523 ms (3488–3539) | 546 ms (471–1754) | On this fixture the unfiltered list is 1.55 MB but returns in about 40 ms on loopback. The filtered read is 3.2 KB in about 4 ms. So native loopback timing does not separate the arms. The delayed scenario shows the dependency: on `master`, rows wait for the full workspace delay. No hard time budget is added. The suite has no CI timing convention, and the structural assertions are the guard. **CI status of this suite:** `tests/perf/collections` runs in no GitHub workflow. It is a manual suite against a disposable local instance (see its README). The new spec runs the same way as the existing specs: same directory, same `playwright.config.ts`, no new config. The Vitest checks in #20388 (`ui/src/pages/Inbox.test.tsx`) remain the CI guard for the reveal rule. **Full collections suite on this branch:** 19 passed, 5 failed. The 5 failures are existing cases (`startup-regressions`: two partial-source cases and two 429 cases; `startup`: "Coordinator Inbox retains aggregate Mine reads when Streamlined UI is disabled"). They fail the same way on the `origin/master` UI with the new spec excluded. This PR does not cause them. `pnpm verify`: exit 2 (README is a global CI input), so required CI supplies broad coverage. `tsc -p tests/tsconfig.playwright.json` passes (the CI typecheck project that covers `tests/perf`). ## Risks - Low risk. Test and fixture files only. - The fixture writes rows straight to the database. It needs `PAPERCLIP_CONFIG` or `PAPERCLIP_COLLECTION_PERF_DATABASE_URL`, and refuses non-loopback databases. Without either variable the spec fails with a clear message. - The timing case changes the real `enableIsolatedWorkspaces` instance setting and restores it in `finally`. - Seeding 6,000 workspaces takes about 10 s on the first run. Later runs reuse the retained fixture. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, via Claude Code with tool use (shell, file edits, Playwright runs). Extended reasoning on. ## 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>