openpencil/tests/engine
Danila Poyarkov 3c016e9573
fix(mcp): close orphaned servers after app disconnects (#494)
* fix(mcp): close orphaned servers that no app ever claims

- Add ServerOptions.appAttachTimeoutMs: if no app registers within this
  window after startup, the server closes itself and removes its
  discovery file, instead of squatting the port indefinitely.
- Wire it through the openpencil-mcp-http CLI as
  OPENPENCIL_MCP_APP_TIMEOUT_MS (opt-in, unset/0 disables it — a bare
  CLI invocation for manual testing should not self-terminate).
- The desktop app opts in with a 30s timeout when it spawns the server.

Without this, a server that outlives its spawning app (renderer crash,
forced reload) keeps holding its port with a stale discovery file. The
app's liveness check only asks whether something answers /health, not
whether an app has ever registered (see /health's no_app status) — so
every later launch finds the orphan already listening and defers to
it, and MCP tool calls fail with "app is not connected" until someone
manually kills the orphaned process. Closing self-caused orphans at
the source means the next launch finds no discovery file and takes
the normal fresh-spawn path.

Fixes #488

* fix(mcp): clean up servers after app disconnects

- Re-arm the orphan watchdog when the registered app disconnects

- Cancel pending shutdown when the app reconnects within the grace period

- Reject timeout values that overflow the runtime timer range

* test(mcp): make watchdog reconnect coverage deterministic

- Wait for the disconnected health state before reconnecting

- Report distinct safe-integer and timer-range validation errors

---------

Co-authored-by: swe-sanad <sanad.arousi@export119.com>
2026-08-12 18:44:31 +03:00
..
acp chore: enable stricter oxlint rules 2026-05-18 18:58:30 +03:00
app fix(storage): polish workspace and connection feedback (#492) 2026-08-12 16:06:10 +03:00
bytes refactor(core): centralize Base64 encoding 2026-07-28 08:27:22 +03:00
cli refactor: standardize acronym casing 2026-08-10 15:48:16 +03:00
clipboard fix(export): prevent GUID collisions and file corruption on .fig round-trip (#333) 2026-06-23 18:05:23 +03:00
collab fix(collab): replicate document content to joiners 2026-06-30 11:56:58 +03:00
color feat(vue): consolidate color model 2026-07-13 21:48:36 +03:00
dom-css fix(fig): restore strict parse validation 2026-07-18 03:58:18 +03:00
editor refactor: standardize acronym casing 2026-08-10 15:48:16 +03:00
figma/api fix(figma-api): expose node transforms 2026-08-03 20:17:32 +03:00
geometry fix(fig): restore strict parse validation 2026-07-18 03:58:18 +03:00
hit-test
icons fix(core): preserve inline SVG primitives (#485) 2026-08-12 16:02:45 +03:00
io fix(fig): preserve imported instance links 2026-08-11 18:54:29 +03:00
kiwi fix(fig): preserve regenerated override lineage 2026-07-21 01:51:27 +03:00
layout fix(layout): refresh effective text flow 2026-08-05 16:07:11 +03:00
lint test(engine): move root tests into domains 2026-05-16 12:30:27 +03:00
mcp fix(mcp): close orphaned servers after app disconnects (#494) 2026-08-12 18:44:31 +03:00
pen refactor(fig): own instance interpretation 2026-07-18 02:06:34 +03:00
profiler chore: format codebase 2026-05-24 12:15:29 +03:00
random test(engine): move root tests into domains 2026-05-16 12:30:27 +03:00
render fix(core): preserve inline SVG primitives (#485) 2026-08-12 16:02:45 +03:00
scene-graph refactor: standardize acronym casing 2026-08-10 15:48:16 +03:00
snap test(engine): move root tests into domains 2026-05-16 12:30:27 +03:00
tauri fix(mcp): close orphaned servers after app disconnects (#494) 2026-08-12 18:44:31 +03:00
text fix(fig): address instance rendering review 2026-08-10 05:09:03 -03:00
tools fix(tools): create vectors from SVG paths (#440) 2026-08-01 20:17:42 +03:00
vector refactor: standardize acronym casing 2026-08-10 15:48:16 +03:00
vue refactor(vue): split workspace preview lifecycle 2026-08-10 20:42:56 +03:00
perf.bench.ts feat: split SceneGraph and Pen packages 2026-06-30 10:54:32 +03:00