Commit e12285d
committed
MCP: harden ack contract, fix viewer-close + close-about + open-cursor
Fixes a batch of issues found while reviewing the original ack-contract
PR end-to-end via real MCP traffic.
- `dialog close about` now waits for `SoftDialogDisappeared("about")`
instead of `WindowDisappeared("about")`. The about dialog is a soft
overlay, not a Tauri window, so the prior signal was always
immediately true and the close was effectively fire-and-forget. Now
it ack's on the tracker losing the id; absent → instant OK, present
→ wait for the FE to close it.
- `dialog close file-viewer` by path no longer hangs on the
ALL-viewers-gone signal. Added `AckSignal::WindowCountBelow {
prefix, threshold }` + `snapshot_window_count` helper, so the tool
snapshots the viewer count, dispatches, and ack's when the count
drops by one. Close-all uses `threshold: 1`. Fast-fail with
`invalid_params` when zero viewers are open instead of timing out.
- `open_under_cursor` no longer false-times-out on files. The OS-open
branch produces neither a state push nor a viewer window, so the
previous `Any([GenerationAdvanced, WindowAppeared("viewer")])`
signal would always time out at 5 s. Routed through
`mcp_round_trip` instead: FE awaits `handleNavigate(entry)` and
signals completion explicitly. Removed the now-unused `AckSignal::Any`
variant; round-trip is the only honest ack for multi-mode commands.
- `nav_to_parent` / `nav_back` / `nav_forward` get a `NAV_ACK_TIMEOUT`
of 5 s (up from 1500 ms) because a parent/back jump can land on an
SMB or MTP path whose directory listing takes a few seconds even
on success.
- `update_pane_tabs` now delegates to `PaneStateStore::set_tabs`, a
new helper that owns both the tab-list write and the generation bump.
Eliminates the inline `pane.write().unwrap().tabs = ...` +
`generation.fetch_add(1, Relaxed)` pair that a future contributor
would forget to keep in sync.
- Documented the `GenerationAdvanced` TOCTOU caveat (an unrelated
state push between snapshot and dispatch can satisfy the signal) and
the `SoftDialogDisappeared` test-context asymmetry (returns true
when the tracker isn't registered, so close paths don't need a
fixture).
- `mcp/CLAUDE.md`, `docs/tooling/mcp.md`, the ack-signal table, and
the round-trip list updated. `bindings.ts` regenerated for the
refreshed `update_pane_tabs` doc-comment.
End-to-end verified via the real MCP transport: dialog open/close for
settings/about/file-viewer (single and multi-viewer); mkdir/mkfile
cancel; copy/move/delete autoConfirm and manual; tab new/close;
toggle_hidden/set_view_mode/sort; nav_to_parent/back/forward;
open_under_cursor on both a .txt file (OS-opens) and a directory
(navigates). All Rust checks (1907 unit + 30 integration tests,
clippy, rustfmt, cargo-deny, cargo-audit) and Svelte (svelte-check,
1928 vitest tests, oxfmt) green.1 parent 3c1b0dc commit e12285d
14 files changed
Lines changed: 287 additions & 102 deletions
File tree
- apps/desktop
- src-tauri/src/mcp
- executor
- tests
- src
- lib
- file-explorer/pane
- ipc
- routes/(main)
- docs/tooling
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | | - | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
117 | | - | |
| 120 | + | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
| |||
201 | 204 | | |
202 | 205 | | |
203 | 206 | | |
204 | | - | |
| 207 | + | |
205 | 208 | | |
206 | 209 | | |
207 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
23 | 43 | | |
24 | 44 | | |
25 | 45 | | |
| |||
48 | 68 | | |
49 | 69 | | |
50 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
51 | 78 | | |
52 | 79 | | |
53 | 80 | | |
| |||
70 | 97 | | |
71 | 98 | | |
72 | 99 | | |
73 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
74 | 103 | | |
75 | | - | |
76 | | - | |
77 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
78 | 109 | | |
79 | 110 | | |
80 | 111 | | |
| |||
88 | 119 | | |
89 | 120 | | |
90 | 121 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 122 | + | |
| 123 | + | |
94 | 124 | | |
95 | 125 | | |
96 | 126 | | |
| |||
150 | 180 | | |
151 | 181 | | |
152 | 182 | | |
153 | | - | |
154 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
155 | 189 | | |
156 | 190 | | |
157 | 191 | | |
158 | | - | |
| 192 | + | |
159 | 193 | | |
160 | 194 | | |
161 | 195 | | |
162 | 196 | | |
163 | 197 | | |
164 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
165 | 206 | | |
166 | | - | |
167 | | - | |
168 | 207 | | |
169 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
170 | 211 | | |
171 | | - | |
| 212 | + | |
172 | 213 | | |
173 | 214 | | |
174 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
175 | 222 | | |
176 | 223 | | |
177 | 224 | | |
178 | 225 | | |
179 | 226 | | |
180 | 227 | | |
181 | 228 | | |
| 229 | + | |
182 | 230 | | |
183 | 231 | | |
184 | | - | |
185 | | - | |
| 232 | + | |
186 | 233 | | |
187 | 234 | | |
188 | 235 | | |
| |||
223 | 270 | | |
224 | 271 | | |
225 | 272 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
233 | 280 | | |
234 | 281 | | |
235 | 282 | | |
| |||
239 | 286 | | |
240 | 287 | | |
241 | 288 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
246 | 293 | | |
247 | 294 | | |
248 | 295 | | |
| |||
0 commit comments