paperclip/tests/e2e
Devin Foley a09d7dcc06
feat(ui): bounce cold arrivals off archived company URLs, add Unarchive (#11302)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Archiving a company hides it from the sidebar switcher, but
remembered last-visited paths, browser history, bookmarks, and restored
tabs keep depositing users onto its URLs long after archiving
> - Since the selection ping-pong fix (#11300) those arrivals render,
but the user is stranded inside a workspace the sidebar refuses to show
— and unarchiving had no UI anywhere, so the only way back was a
hand-typed settings URL
> - This pull request bounces cold arrivals at archived company URLs to
an active company (with a toast naming why), lets deliberate visits
stick, and adds an Unarchive action to the companies list
> - The benefit is that stale URLs stop stranding users in retired
workspaces, and archived companies become restorable from the one page
that still lists them

## Linked Issues or Issue Description

Follow-up to #11300. No existing issue for the remaining gap;
description follows the enhancement template:

**What happened?**

After #11300, opening an archived company's URL (stale tab, history,
bookmark, remembered path) renders that company's pages — but the
sidebar switcher does not list it, so the user is stranded in a
workspace they retired, and every stale URL pulls them back in.
Separately, unarchiving a company has no UI: the archive button lives in
company settings, which becomes unreachable through normal navigation
once the company is archived.

**Expected behavior**

Arriving cold at an archived company's URL lands the user in an active
workspace, with a toast explaining the redirect. Explicitly choosing the
archived company (from the companies list) still works, so its pages
remain reachable. Archived companies can be restored from the companies
list.

**Steps to reproduce**

1. Create two companies; archive one.
2. Open `/{archivedPrefix}/dashboard` directly — before: renders the
archived workspace with no sidebar presence; after: bounces to the
active company's dashboard with a toast.
3. On the companies list, open the archived company's row menu — before:
no restore action anywhere; after: Unarchive.

## What Changed

- `ui/src/lib/company-selection.ts`: `resolveArchivedCompanyBounce` —
pure policy: bounce when the URL names an archived company that is not
the current selection and an active company exists; prefer the currently
selected active company as the destination.
- `ui/src/components/Layout.tsx`: the route-sync effect applies the
bounce (toast + selection + `replace` navigation) before syncing
selection from the route.
- `ui/src/pages/Companies.tsx`: Unarchive action (`PATCH status:
"active"`) in the row menu for archived companies.
- Tests: unit cases for the bounce policy; the e2e now drives all three
behaviors (direct-load bounce with toast, re-arrival bounce, deliberate
visit sticks) on top of the existing crash regression.

## Verification

- `pnpm vitest run src/lib/company-selection.test.ts
src/context/CompanyContext.test.tsx src/pages/Companies.test.tsx` in
`ui/` — 20 tests pass.
- `npx playwright test --config tests/e2e/playwright.config.ts
archived-company-url` — passes, covering bounce, toast, and
deliberate-visit paths.
- `pnpm typecheck` in `ui/` — clean.

## Risks

Low risk. The bounce only fires for archived-company URLs when the
archived company is not already selected and an active company exists;
all-archived instances render as before. Deliberate selection from the
companies list is unaffected (selection equals the matched company, so
no bounce). Unarchive reuses the existing `PATCH /api/companies/:id`
status transition the server already supports.

## Model Used

- Claude (Anthropic), Claude Fable 5 (`claude-fable-5`), via Claude Code
CLI with extended thinking and tool use (code search, edit, test
execution, Playwright e2e).

## 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
2026-08-12 21:02:12 -07:00
..
helpers feat: make chat-style tasks the default experience (#11101) 2026-08-11 09:06:21 -07:00
app-not-connected.spec.ts feat(apps): support multiple provider connections (#11060) 2026-08-07 16:28:04 -05:00
application-delete-screenshot.spec.ts
applications-crud.spec.ts feat(apps): support multiple provider connections (#11060) 2026-08-07 16:28:04 -05:00
apps-dark-mode-shots.spec.ts feat: refine app connections and legacy worktree startup (#11040) 2026-08-07 14:26:40 -05:00
apps-prosumer-mcp-flow.spec.ts feat: refine app connections and legacy worktree startup (#11040) 2026-08-07 14:26:40 -05:00
archived-company-url.spec.ts feat(ui): bounce cold arrivals off archived company URLs, add Unarchive (#11302) 2026-08-12 21:02:12 -07:00
conference-room-typing-intro.spec.ts feat: make chat-style tasks the default experience (#11101) 2026-08-11 09:06:21 -07:00
fetch-allowed-port.ts
mcp-user-stories.catalog.ts
mcp-user-stories.spec.ts feat: refine app connections and legacy worktree startup (#11040) 2026-08-07 14:26:40 -05:00
multi-user-authenticated.spec.ts
multi-user.spec.ts
nux-phase4-screenshots.spec.ts feat: make chat-style tasks the default experience (#11101) 2026-08-11 09:06:21 -07:00
onboarding.spec.ts feat: make chat-style tasks the default experience (#11101) 2026-08-11 09:06:21 -07:00
pipelines-tutorial-flow.spec.ts
planning-mode-visual-verification.spec.ts feat: make chat-style tasks the default experience (#11101) 2026-08-11 09:06:21 -07:00
playwright-multiuser-authenticated.config.ts
playwright-multiuser.config.ts
playwright.config.ts
sidebar-takeover.spec.ts feat: make in-app features cloud-aware (#10850) 2026-08-04 23:00:14 -05:00
signoff-policy.spec.ts feat(issues): contain cross-issue agent side effects (#10837) 2026-08-04 13:17:49 -05:00
smoke-lab-browser-runner.mts
smoke-lab-routine-classifier.test.mts
smoke-lab-routine.mts
smoke-lab.catalog.ts
smoke-lab.spec.ts feat: refine app connections and legacy worktree startup (#11040) 2026-08-07 14:26:40 -05:00