Commit graph

23 commits

Author SHA1 Message Date
Kit Langton
5acc917591 refactor(test/cli): simplify pass on tier-A + prebuild
Applies findings from the third simplify pass:

1. \`cliArgv\` is a module-level const, not a function — prebuiltCli is
   read once at module init and never mutated, so the per-spawn function
   allocation was pure overhead.

2. Help-snapshot failures surface via \`Effect.fail\` instead of \`throw\`,
   symmetric with the \`Effect.fail\` already inside the partition above.
   Keeps the failure typed in the Effect channel rather than as a defect.

3. \`prebuild-test-cli.ts\` skips the build when the binary is already
   newer than every file in src/ — saves the 2.8s rebuild cost on every
   subsequent invocation. Pass --force to bypass.

4. \`prebuild-test-cli.ts\` verifies the built binary is executable before
   symlinking — catches a silently-failed build leaving stale output
   instead of letting tests fail with confusing exec errors later.

Verified: 331/331 CLI tests pass; typecheck clean; skip-if-fresh + --force
behave as documented.
2026-05-19 11:36:15 -04:00
Kit Langton
5bc6a7f6d0 test(cli): opt-in pre-built binary for ~3x faster subprocess spawns
\`bun run --conditions=browser src/index.ts\` pays ~15s of JIT + plugin
init + DB migration per subprocess spawn in isolation mode. A pre-built
binary cuts that to ~5s — most of which is now the SQLite \`:memory:\`
migration that runs regardless of execution mode.

Adds \`script/prebuild-test-cli.ts\` which wraps the existing build.ts
with \`--single --skip-embed-web-ui --skip-install\`, then symlinks the
platform-specific output to \`dist/test-cli/bin/opencode\` so the
harness has a stable path.

The harness (test/lib/cli-process.ts) reads OPENCODE_TEST_CLI_PATH and
spawns the binary directly when set; falls back to dev mode otherwise.
Strictly opt-in — default behavior, CI, and local iteration are
unchanged. Anyone who wants the speedup runs:

  bun script/prebuild-test-cli.ts
  export OPENCODE_TEST_CLI_PATH="\$PWD/dist/test-cli/bin/opencode"
  bun test test/cli/

Measured locally:
  Dev mode (default):  29.9s  (331 tests)
  Binary mode:         22.1s  (-26%, after one-time 2.8s build)

The win compounds as more subprocess tests are added — every new test
that hits DB migration saves ~10s vs dev mode.
2026-05-19 11:36:15 -04:00
Kit Langton
55baa16fbc
test(lib): extract snapshot normalizer utility for cross-OS stability (#28356) 2026-05-19 11:09:49 -04:00
Kit Langton
18b9cec50d
test(cli): help-text snapshots for every CLI command (#28267) 2026-05-19 10:58:12 -04:00
Kit Langton
cb15b3ad84
test(cli): subprocess integration tests for opencode acp (#28265) 2026-05-19 08:18:22 -04:00
opencode-agent[bot]
6f160bb48f chore: generate 2026-05-19 00:57:09 +00:00
Kit Langton
ebb672ac39
test(cli): subprocess integration tests for opencode serve (#28263) 2026-05-19 00:55:58 +00:00
Kit Langton
7b8a1037a0
refactor(test/lib): generalize run-process harness into cli-process (#28253) 2026-05-18 19:16:10 -04:00
opencode-agent[bot]
2e1593dea5 chore: generate 2026-05-18 22:33:32 +00:00
Kit Langton
0f3d168fdd
test(cli): subprocess integration test harness + regression suite for opencode run (#28230) 2026-05-18 18:32:20 -04:00
Kit Langton
4e143e3a3e
test(lib): promote pollWithTimeout/awaitWithTimeout helpers (#27626) 2026-05-14 23:45:32 +00:00
opencode-agent[bot]
a6464062b7 chore: generate 2026-05-03 00:32:24 +00:00
Kit Langton
fd01dc9c89
test(httpapi): add route exerciser 2026-05-02 20:31:21 -04:00
James Long
293877cb7e
fix(core): reconnect editor context for session directory (#24984) 2026-04-29 15:11:44 -04:00
Kit Langton
34213d4446
fix: delete 9 dead functions with zero callers (#22697) 2026-04-16 02:01:02 +00:00
Kit Langton
9581bf0670
refactor(effect): upgrade opencode to beta.46 context APIs (#21977) 2026-04-10 23:06:28 -04:00
Kit Langton
c3ef69c866
test(app): add a golden path for mocked e2e prompts (#20593) 2026-04-02 18:17:28 +00:00
Kit Langton
d9d4f895bc
fix(test): auto-acknowledge tool-result follow-ups in mock LLM server (#20528) 2026-04-01 23:47:26 +00:00
Kit Langton
38d2276592
test(e2e): isolate prompt tests with per-worker backend (#20464) 2026-04-01 15:58:11 +00:00
Kit Langton
9a1c9ae15a
test(app): route prompt e2e through mock llm (#20383) 2026-04-01 08:28:38 -04:00
Kit Langton
7532d99e5b
test: finish HTTP mock processor coverage (#20372) 2026-04-01 00:45:42 +00:00
Kit Langton
0c03a3ee10
test: migrate prompt tests to HTTP mock LLM server (#20304) 2026-03-31 19:14:32 -04:00
Kit Langton
5dfe86dcb1
refactor(truncation): effectify TruncateService, delete Scheduler (#17957) 2026-03-17 21:59:54 -04:00