GeezerVison is showing github.com — Run CLI subprocess tests concurrently (#28399) · BlueBlock/opencode@a8f7c5e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/opencode/test/cli/run/run-process.test.ts +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,7 @@ import { cliIt } from "../../lib/cli-process" | 10 | 10 | describe("opencode run (non-interactive subprocess)", () => { | 11 | 11 | // Happy path: prompt completes, output reaches stdout, process exits 0. | 12 | 12 | // If this fails, all the others likely will too — debug here first. | 13 | | - cliIt.live( | | 13 | + cliIt.concurrent( | 14 | 14 | "exits 0 and writes the response to stdout on a successful prompt", | 15 | 15 | ({ llm, opencode }) => | 16 | 16 | Effect.gen(function* () { | @@ -27,7 +27,7 @@ describe("opencode run (non-interactive subprocess)", () => { | 27 | 27 | // makes the SDK call surface an error promptly so the process exits nonzero. | 28 | 28 | // We assert nonzero exit AND wall-clock under the harness timeout — a hang | 29 | 29 | // would expire the timeout and produce a different (signal-killed) failure. | 30 | | - cliIt.live( | | 30 | + cliIt.concurrent( | 31 | 31 | "exits nonzero promptly when the model is unknown (regression for #27371)", | 32 | 32 | ({ opencode }) => | 33 | 33 | Effect.gen(function* () { | @@ -47,7 +47,7 @@ describe("opencode run (non-interactive subprocess)", () => { | 47 | 47 | // | 48 | 48 | // This is debatable — a future cleanup might flip it to exit 1. If you're | 49 | 49 | // changing this expectation, do it deliberately and say so in the PR. | 50 | | - cliIt.live( | | 50 | + cliIt.concurrent( | 51 | 51 | "mid-stream LLM error still exits 0 today (contract lock-in)", | 52 | 52 | ({ llm, opencode }) => | 53 | 53 | Effect.gen(function* () { | @@ -61,7 +61,7 @@ describe("opencode run (non-interactive subprocess)", () => { | 61 | 61 | // --format json puts one JSON object per line on stdout for each emitted | 62 | 62 | // event. Consumers (CI scripts, tooling) parse this stream. Asserts the | 63 | 63 | // shape so a future event-emit change has to update this expectation. | 64 | | - cliIt.live( | | 64 | + cliIt.concurrent( | 65 | 65 | "--format json emits parseable line-delimited JSON to stdout", | 66 | 66 | ({ llm, opencode }) => | 67 | 67 | Effect.gen(function* () { | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/test/lib/cli-process.ts +9-4Lines changed: 9 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | // builders (`opencode.serve(opts)`, `opencode.acp(opts)`, `opencode.auth(...)`) | 18 | 18 | // without changing the fixture. Long-lived commands like `serve` will need a | 19 | 19 | // different return shape — see the TODO at the bottom of OpencodeCli. | 20 | | -import type { TestOptions } from "bun:test" | | 20 | +import { test, type TestOptions } from "bun:test" | 21 | 21 | import { AppFileSystem } from "@opencode-ai/core/filesystem" | 22 | 22 | import { AppProcess } from "@opencode-ai/core/process" | 23 | 23 | import { Deferred, Duration, Effect, Layer, Queue, Scope, Stream } from "effect" | @@ -439,9 +439,9 @@ function expectExit(result: RunResult, expected: number, label = "opencode") { | 439 | 439 | // `it.live(name, () => withCliFixture(fixture))` — one fewer nesting level at | 440 | 440 | // every call site. Use this for any test that needs the opencode CLI fixture. | 441 | 441 | // | 442 | | -// Only `.live` is exposed because subprocess tests must run against the real | 443 | | -// clock — a TestClock-paused environment can't drive a child process. If you | 444 | | -// need `.only` or `.skip`, fall back to `it.live` + `withCliFixture` directly. | | 442 | +// Subprocess tests must run against the real clock — a TestClock-paused | | 443 | +// environment can't drive a child process. If you need `.only` or `.skip`, fall | | 444 | +// back to `it.live` + `withCliFixture` directly. | 445 | 445 | // Body's R is `Scope.Scope | never` so tests can yield* scope-requiring | 446 | 446 | // resources (e.g. `opencode.serve`) without an extra `Effect.scoped` wrapper — | 447 | 447 | // `withCliFixture`'s outer scope is the natural lifetime. | @@ -451,4 +451,9 @@ export const cliIt = { | 451 | 451 | body: (input: CliFixture) => Effect.Effect<A, E, Scope.Scope | HttpClient.HttpClient>, | 452 | 452 | opts?: number | TestOptions, | 453 | 453 | ) => it.live(name, () => withCliFixture(body), opts), | | 454 | + concurrent: <A, E>( | | 455 | + name: string, | | 456 | + body: (input: CliFixture) => Effect.Effect<A, E, Scope.Scope | HttpClient.HttpClient>, | | 457 | + opts?: number | TestOptions, | | 458 | + ) => test.concurrent(name, () => Effect.runPromise(Effect.scoped(withCliFixture(body))), opts), | 454 | 459 | } |
Collapse file Copy file name to clipboardExpand all lines: perf/test-suite.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,6 +84,7 @@ Repeated setup work, long sleeps/timeouts, serial integration tests, filesystem/ | 84 | 84 | | Remaining legacy tools config cases can use Effect-aware instance fixtures | Migrated allow/deny legacy `tools` permission cases to `it.instance` | 2.65s | 1.90s | keep | Single baseline before edit; after median from three sequential reruns (2.58, 1.90, 1.90). | | 85 | 85 | | Oversized snapshot batch tests only need to cross the 100-file boundary | Reduced large diff/revert fixture sizes while keeping each case above the batch boundary | 4.32s | 3.66s | keep | Three affected snapshot tests; after median from three reruns (4.32, 3.66, 3.66) while still crossing the 100-file boundary. | | 86 | 86 | | Prompt tests without LLM calls do not need the test LLM server | Added a no-server runner and moved obvious non-LLM prompt/shell cases to it | 25.41s | 21.03s | keep | Full prompt file after simplify pass median from three reruns (20.66, 21.03, 21.64); LLM-backed tests stay on original runner. | | | 87 | +| CLI run subprocess cases can run independently | Marked `run-process.test.ts` subprocess cases concurrent | 11.87s | 4.13s | keep | Newest-dev single baseline; after median from three reruns (4.13, 4.17, 4.11). Each case has an isolated temp home and LLM port. | | 87 | 88 |
| 88 | 89 | ## Profiling Results | 89 | 90 |
| |
|