mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-16 11:59:26 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The board UI builds company-prefixed links, such as `/PAP/cases`,
from short paths in the sidebar
> - The Cases and Status links use `/cases` and `/status`, but these
roots were not in the board route list
> - The router read `cases` as a company prefix and left the link
unprefixed, so the link only worked through the unprefixed redirect
> - When a person clicked Cases before the company list loaded, the
redirect picked an arbitrary company and showed its empty case list
> - The same race made `tests/e2e/cases-read-only.spec.ts` fail in "ci /
e2e shard (2/8)" on unrelated PRs (#21683, #21715, #21765)
> - This pull request adds both roots to the board route list and makes
the e2e test force the race
> - The benefit is that Cases and Status always open in the company the
person is in, and the flaky e2e test becomes deterministic
## Linked Issues or Issue Description
Refs #21683
Refs #21715
Refs #21765
**What happened?**
The read-only Cases e2e test failed about once per day with `Expected:
3, Received: 0` links in the case list (job 132875164249 on #21765, job
132680942843 on #21715). The failure screenshot shows the sidebar of a
different company ("Passive artifacts …", created by the previous spec)
and "No cases yet". The server log shows that the page asked for the
cases of the other company and never for the test company.
**Expected behavior**
A click on the Cases or Status link opens that page for the company in
the URL, also when the click happens before the company list has loaded.
**Steps to reproduce**
1. Have two or more companies.
2. Open `/<PREFIX>/issues` on a slow connection (the e2e test holds `GET
/api/companies`).
3. Before the company list loads, open More and click Cases.
4. The URL becomes `/cases`. When the list loads, the app redirects to
`/<OTHER>/cases` and shows another company's empty case list.
**Paperclip version or commit**
`master` at 46e5e4450f.
## What Changed
- `ui/src/lib/company-routes.ts`: add `cases` and `status` to
`BOARD_ROUTE_ROOTS`, so `applyCompanyPrefix("/cases", "PAP")` returns
`/PAP/cases`. Remove the part of the `caseHref` doc comment that
described the old behavior.
- `ui/src/lib/company-routes.test.ts`: unit test for both roots (red
before the fix, green after).
- `tests/e2e/cases-read-only.spec.ts`: hold `GET /api/companies` until
the Cases link is clicked, then require the URL `/<PREFIX>/cases`.
Without the fix the URL is `/cases`, so the test fails every time
instead of sometimes.
## Verification
- `cd ui && npx vitest run src/lib/company-routes.test.ts
src/App.cases-routing.test.tsx
src/lib/router.company-task-link.test.tsx`: 23 passed. The new test
failed on `master` (2 failed).
- E2E, before the fix (spec change only): `npx playwright test --config
tests/e2e/playwright.config.ts tests/e2e/cases-read-only.spec.ts
--repeat-each=5`: 5 of 5 failed with `Received string:
"http://127.0.0.1:3199/cases"`.
- E2E, after the fix: same command with `--repeat-each=50` on a loaded
machine (load average 6 to 12): 50 of 50 passed.
- The e2e config starts its own server on port 3199
(`reuseExistingServer: false`) with a fresh `mkdtemp` home and its own
embedded PostgreSQL data directory, so these runs did not touch any
other instance.
## Risks
- Low risk. A company whose issue prefix is exactly `CASES` or `STATUS`
now gets the same treatment as a company named after any other board
route (for example `TASKS`): a bare `/CASES` path is read as the Cases
page. The existing `/<PREFIX>/issues` exception still applies.
- No API, schema, or migration change.
## Model Used
- Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use
(shell, file edits, local Playwright runs).
## 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>