Skip to content

test: add subprocess e2e suite driving plugins as Flow Launcher does#29

Open
Garulf wants to merge 1 commit into
mainfrom
test/e2e-subprocess
Open

test: add subprocess e2e suite driving plugins as Flow Launcher does#29
Garulf wants to merge 1 commit into
mainfrom
test/e2e-subprocess

Conversation

@Garulf

@Garulf Garulf commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Adds tests/e2e/: end-to-end tests that spawn fixture plugins as real subprocesses using the exact process mechanics Flow Launcher uses, asserting on the raw stdout stream.

  • V1: fresh process per request, JSON-RPC request serialized into argv[1], response deserialized from stdout — mirroring JsonRPCPlugin in the host.
  • V2: one persistent process, newline-delimited JSON-RPC over stdin/stdout, driven with the host's actual message shapes (params: [{search: ...}, Settings.Inner], lifecycle methods, $/ notifications).

Two self-contained fixture plugins (tests/e2e/fixtures/{v1,v2}_plugin/) with real plugin.json manifests, so launcher auto-detection (Language: python vs python_v2) is exercised end-to-end too.

What this catches that in-process tests can't

The existing integration tests patch sys.stdin/stdout in-process — great protocol coverage, but blind to:

  • stdout buffering / flush deadlocks over real pipes
  • encoding issues (UTF-8 vs legacy codepages on Windows)
  • stray output (logging, print, warnings) corrupting the JSON stream
  • process lifecycle: clean exit on close, surviving malformed input, one process serving many queries

Coverage

14 tests: query/context_menu roundtrips, settings delivery (both protocols), unicode, empty query, initialize/close, $/cancelRequest ignored silently, malformed line resilience, stdout purity, process persistence. Subprocesses run with cwd=tmp_path so plugin.log never lands in the repo, and a reader thread with timeouts ensures a hung plugin fails fast instead of hanging CI.

CI

  • Runs automatically in the existing matrix (pytest tests picks up tests/e2e/).
  • New e2e-windows job on windows-latest (tox -e py311 -- tests/e2e), since Flow Launcher plugins only ever run on Windows.

Verification

tox -e lint,type,py38,py312 all green — 148 tests (134 existing + 14 new).

Spawn fixture plugins across a real process boundary using the exact
mechanics of the host: V1 gets one JSON-RPC request in argv[1] in a
fresh process per query; V2 is a persistent process speaking
newline-delimited JSON-RPC over stdin/stdout.

Covers query/context_menu roundtrips, settings delivery, unicode,
lifecycle (initialize/close), $/cancelRequest notifications, malformed
input resilience, stdout stream purity, and process persistence -
buffering/encoding/stream-pollution bugs that in-process tests with
patched stdio cannot catch.

Also adds a windows-latest CI job running the e2e tests, since Flow
Launcher plugins only ever run on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant