Skip to content

test(e2e): isolate prompt tests with per-worker backend#20464

Merged
kitlangton merged 5 commits intodevfrom
kit/e2e-isolated-backend
Apr 1, 2026
Merged

test(e2e): isolate prompt tests with per-worker backend#20464
kitlangton merged 5 commits intodevfrom
kit/e2e-isolated-backend

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton commented Apr 1, 2026

Summary

  • Spawn a dedicated backend process per Playwright worker so prompt e2e tests no longer share the dev server
  • Add match-based queue routing to the mock LLM server (pushMatch/textMatch/toolMatch) so canned responses target specific requests
  • Extract shared mock OpenAI config into e2e/prompt/mock.ts and thread serverUrl through all e2e helpers
  • Deduplicate withProject/withBackendProject fixtures into shared runProject helper
  • Extract assistantText polling helper used by both prompt specs
  • Cap backend stdout/stderr log buffers

Shell refactor split to #20494.

Test plan

  • bun test:e2e -- prompt/prompt.spec.ts prompt/prompt-async.spec.ts — 3/3 pass
  • bun test:e2e:local -- e2e/prompt/ — passes (except prompt.spec which needs isolated backend)

…ed LLM routing

Spawn a dedicated backend process per Playwright worker so prompt e2e
tests no longer share the dev server. Add match-based queue routing to
the mock LLM server so canned responses target specific requests (e.g.
title generation vs actual prompt). Extract shared mock OpenAI config
into e2e/prompt/mock.ts and thread serverUrl through all helpers.
The shell invocation had `-c` before `-l`, causing zsh/bash to treat
`-l` as the command string instead of the login flag. Also move the
close-event listener to immediately after spawn to prevent missing
the event if the process exits before the listener is attached.

Also simplifies e2e fixtures (dedup withProject/withBackendProject),
extracts assistantText helper, caps backend log buffers, and reverts
prompt-shell test to use withProject (no isolated backend needed).
The prior change moved the close-event listener before stdout/stderr
data handlers, which caused the process close to resolve before output
was collected. Revert to the original inline close handling inside
Effect.promise which correctly sequences data→close→finish.

Keep the -l/-c arg reorder (harmless — both orders work for zsh/bash)
and the new shell unit tests. Revert prompt-shell e2e to withProject
since it doesn't need the isolated backend.
@kitlangton kitlangton force-pushed the kit/e2e-isolated-backend branch from 89b151b to 6944db8 Compare April 1, 2026 15:11
@kitlangton kitlangton changed the title test(e2e): isolate prompt tests with per-worker backend test(e2e): isolate prompt tests + refactor shell to Effect ChildProcess Apr 1, 2026
@kitlangton kitlangton added the beta label Apr 1, 2026
@kitlangton kitlangton force-pushed the kit/e2e-isolated-backend branch 3 times, most recently from 29adc0a to e1c29c9 Compare April 1, 2026 15:40
Replace raw node:child_process spawn + manual event wiring with
Effect's ChildProcessSpawner. Stream output is collected via
Stream.runForEach for incremental metadata updates. Process cleanup
uses handle.kill with forceKillAfter for reliable SIGTERM→SIGKILL
escalation.

Drop manual .zshrc/.bashrc sourcing — use login shell (-l) which
loads .zshenv/.zprofile. Interactive rc files caused CWD changes
and output capture issues.

Fix cross-spawn-spawner kill() so forceKillAfter wraps the entire
send+wait-for-exit sequence, not just the signal send.
@kitlangton kitlangton force-pushed the kit/e2e-isolated-backend branch from e1c29c9 to 4576a00 Compare April 1, 2026 15:43
Shell changes moved to kit/shell-effect-childprocess (#20494).
@kitlangton kitlangton changed the title test(e2e): isolate prompt tests + refactor shell to Effect ChildProcess test(e2e): isolate prompt tests with per-worker backend Apr 1, 2026
@kitlangton kitlangton marked this pull request as ready for review April 1, 2026 15:52
@kitlangton kitlangton requested a review from adamdotdevin as a code owner April 1, 2026 15:53
@kitlangton kitlangton enabled auto-merge (squash) April 1, 2026 15:53
@kitlangton kitlangton merged commit 38d2276 into dev Apr 1, 2026
10 checks passed
@kitlangton kitlangton deleted the kit/e2e-isolated-backend branch April 1, 2026 15:58
jeromelau pushed a commit to jeromelau/opencode that referenced this pull request Apr 2, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
@chenyy9527
Copy link
Copy Markdown

@kitlangton Side effects on non-prompt tests resulted in file-based tests being forced to use isolated backends with cold file indexes. Is this the intended behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants