Repository navigation
Commit 25ca799
feat(desktop): New Window and deep links follow one dispatch table
## What Changed
Every window request resolves through one table in `apps/desktop/src/window/WindowDispatch.fork.ts`.
The startup drain and the second-instance buffer use the same table.
| Request | Behavior |
| --- | --- |
| New Window (menu, palette, key) | create at `/`, all projects |
| Open in New Window (row, thread) | create at that route, seed filter |
| Second launch, dock | focus most recent, else create |
| Deep link, `--project` | reuse a window showing it, else create |
| Focus window by id | focus if open; never resurrect |
| OAuth callback | unchanged |
- **Surfaces:** File > New Window, palette action, thread menu item
- **Bindings:** `window.new` on `mod+shift+w`
- **Rename:** `project.openWindow` becomes `window.openInNew`
- **Migration:** saved bindings with the old id load unchanged
- **IPC:** `openProjectWindow` replaced by `requestWindow`
- **Seed:** New Window seeds `"all-projects"`; Open in New Window and deep links seed their project
- **Recency:** a second launch focuses the first of `windowsByRecency`
- **Scope guard:** kept; a project window that leaves its project still closes, and closes itself rather than the first window sharing its project
- **List routes:** Issues and Pull requests keep a project window in its project from a shared page
- **Other project's item:** an issue or pull request link from another project widens the list to all projects, reading the window's project when the pathname names none
- **Guard close:** skipped when the window is already destroyed by the time the hub is revealed
- **Queued second launch:** drained after boot, it only creates main when none exists and never reveals a window
## Why
Closes #1343
Closes #1344
Window requests had separate paths with different reuse rules.
One table makes each row testable and keys windows by `WindowId` only.
### Issue work route
Issue work from `/project/<env>/<project>/issues` drafts at `/project/<env>/<project>/draft/<id>`, which the guard allows.
The route that bounced was the hub `/issues`.
Issues, from a shared page such as `/settings` in a project window, read the project from the pathname, found none, and navigated to `/issues`.
The guard then revealed the hub and closed the window.
`listRouteTarget` now falls back to the window's own project, so Issues and Pull requests stay on the project routes.
#179 left the route unconfirmed, and no desktop log still holds a `project window left its scope` line.
The trace came from the source; live proof then confirmed the fixed route (steps 70–74 below).
### Known limits
Refs #1345
- **Update relaunch:** extra hub or same-project windows are dropped; `DesktopWindowSession` dedups by identity and the startup drain restores through `getOrCreate`
- **New Window as hub:** when main closes, a New Window becomes main, but its bounds are never saved
## Close conditions
- [x] Table: each row has a focused test
- `WindowDispatch.fork.test.ts`: one test per row, plus argv classification
- [x] Binding: `mod+shift+w`, conflict-checked
- `keybindings.fork.test.ts`: no other default owns the chord
- [x] `mod+alt+o`: renamed; now always opens a new window, per the table
- live: a second press creates a second window where `openIdentity` reused one (step 41)
- migration of existing `keybindings.json`: unit-tested, not live
- [x] Issue work: thread opens in the source window
- live: steps 70–74; issues from settings stay in the project, the draft opens there, and the guard closes only itself
- `DesktopWindow.fork.test.ts`: issue work stays in its window; another project is still guarded
- `projectRoutes.test.ts`: lists from a shared page stay in the window's project
- [x] Seed (#1344): New Window opens on all projects; Open in New Window opens on its project
- live: New Window by key, menu, and palette (steps 20–22); Open in New Window by row and thread menu (steps 30–31)
- `DesktopWindow.fork.test.ts`: the seed preload argument per request
- [x] Deep link: reuses a window showing the project, else creates one
- live: steps 50–51
- [x] Second launch: focuses the most recent window
- live: steps 63 and 65; Linux has no dock activate
Live proof ran at `025eb14c81` on a client-only dev Electron over a seeded copy, 6/6 pass, no stray windows.
Evidence: `.dump/evidence/1369-live/` on the host, indexed by `transcript.json`; step N is its `N-*` files.
## Checks
```text
vp test run (desktop window/ipc/app/electron) → exit 0, 60 files, 409 tests
vp test run (web links, routes, sidebar) → exit 0, 17 files, 539 tests
vpr typecheck → exit 0
vp run knip:check → exit 0
vp run fork:ci → exit 0
```
Swap proofs, each reverted:
```diff
- open-in-new-window reuses a showing window → 1 test fails
- activate goes to openPrimary → 1 test fails
- migration returns input unchanged → 2 tests fail
- New Window default mod+shift+n → 2 tests fail
- dispatched window counted as primary → 1 test fails
- guard never closes → 2 tests fail
- guard allows only the exact project route → 1 test fails
- list route ignores the window's project → 1 test fails
- seed not passed to the preload → 1 test fails
- most recent read from the oldest window → 1 test fails
- guard closes a destroyed window → 1 test fails
- drained second launch takes the table row → 1 test fails
- link scope ignores the window's project → 1 test fails
```
## UI Changes
New menu, palette, and thread-menu items.
Screenshots stay in the host evidence directory above; they show private thread titles.
## Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [ ] I included before/after screenshots for any UI changes
- [ ] I included a video for animation/interaction changes
Model: Claude Opus 5.5, Claude Code in T3 Code.
## Fork trailers
Squashes:
- 9d6e5df feat(desktop): New Window and deep links follow one dispatch table
- fd56cc1 fix(desktop): mod+alt+o reuses the project's window again
- 7d18eaf feat(desktop): New Window and deep links follow one dispatch table
- faa53bd refactor(multi-window): createWindow seams become marked insertions (#1811) (#1811)
Fork-Domain: multi-window
Fork-Tier: core1 parent e95355d commit 25ca799
50 files changed
Lines changed: 1311 additions & 215 deletions
File tree
- apps
- desktop/src
- app
- backend
- electron
- ipc
- methods
- preview
- ssh
- updates
- window
- server/src
- web/src
- components
- settings
- sidebar
- hooks
- lib
- shortcuts
- docs/user
- packages
- contracts/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
99 | | - | |
| 100 | + | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | | - | |
46 | | - | |
| 43 | + | |
| 44 | + | |
47 | 45 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
65 | | - | |
| 65 | + | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
328 | 327 | | |
329 | 328 | | |
330 | 329 | | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | 330 | | |
342 | 331 | | |
343 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
0 commit comments