Lutra/ui/tests
danny 20d1d28c32 M3.5: pending outcomes for commands that wait for the language server
Step 1 of M3.5: the shared mechanism. M3.4 and M3.5 build on it.

- Engine: `Outcome.pending: Option<Pending>`. `Pending::new(rx, timeout,
  finish)`; `Pending::wait()` is called without the engine lock and
  returns at the answer, a dropped sender or the deadline (timeout + 1 s).
  `Engine::resolve(answered)` then runs `finish(state, reply)` inside the
  guard, under the lock. `run_waiting(lock, cmd, params, publish)` does
  all three steps for hosts.
- Hosts: `Host::run`, `testkit::EngineBackend` and the control test
  backend use `run_waiting`.
- New IPC `engine_execute_waiting` (`#[tauri::command(async)]`, off the
  main thread) with `runWaiting()` in `ui/src/ipc.ts`. Only `lsp.*`
  requests use it.

Ordering guarantee:
- `engine_execute` stays synchronous on the main thread, so ordinary
  commands (`buffer.edit`) still run in call order.
- The order towards the server is fixed under the engine lock:
  `buffer.edit` queues its didChange on the session's FIFO queue before
  it returns, and `lsp::submit` queues the request on the same queue.
  A request therefore sees every edit whose `buffer.edit` returned
  first, and the UI awaits the sync's `idle()` before sending one.

Failures:
- A stall is caught by the request timeout, with the deadline as
  backstop.
- On restart, close, quit or crash the request is dropped or resolved
  as stopped, so the waiter gets an error, never a hang.

Tests: `crates/engine/tests/pending.rs` (answer, lock free while
waiting, dropped sender, deadline, resolve, lsp.restart while a
request is pending) and Vitest for `runWaiting`. Gate: 13 steps,
321 s, Vitest 443 + 1 skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 06:36:20 +02:00
..
commands M1.15: one modal at a time, restore dialog follows outside restores 2026-10-16 21:49:38 +02:00
editor M3.3: engine wiring for Phpactor and diagnostics 2026-10-21 18:58:32 +02:00
find M2.4: Find tool window in a new bottom panel 2026-10-17 12:42:53 +02:00
goto M2.6: go-to popup for files, classes and symbols 2026-10-17 17:35:50 +02:00
i18n M3.3: engine wiring for Phpactor and diagnostics 2026-10-21 18:58:32 +02:00
layout M1.5: main window layout and project tree against mocked engine events 2026-10-14 19:24:23 +02:00
menu M3.3: engine wiring for Phpactor and diagnostics 2026-10-21 18:58:32 +02:00
notifications M1.12: notifications as toasts 2026-10-16 16:20:45 +02:00
palette M3.3: engine wiring for Phpactor and diagnostics 2026-10-21 18:58:32 +02:00
problems M3.3: engine wiring for Phpactor and diagnostics 2026-10-21 18:58:32 +02:00
project M1.13: watch open buffers' folders, bufferFocused, truncated tree row 2026-10-16 16:20:11 +02:00
recovery M1.15: one modal at a time, restore dialog follows outside restores 2026-10-16 21:49:38 +02:00
settings M1.9b: settings dialog with search 2026-10-16 21:13:04 +02:00
structure M2.7: Structure tool window and syntax.outline 2026-10-17 17:04:12 +02:00
terminal M3.6: integrated terminal with PTY sessions and xterm.js sub-tabs 2026-10-20 21:10:37 +02:00
theme M3.6: integrated terminal with PTY sessions and xterm.js sub-tabs 2026-10-20 21:10:37 +02:00
App.test.ts M2.7: Structure tool window and syntax.outline 2026-10-17 17:04:12 +02:00
ipc.test.ts M3.5: pending outcomes for commands that wait for the language server 2026-10-22 06:36:20 +02:00
ipcEvents.test.ts M1.12: notifications as toasts 2026-10-16 16:20:45 +02:00