Files
anomalyco_opencode/packages/opencode/test/lib
Kit Langton 13e68a5892 refactor(test/lib): simplify cli-process helpers per Effect idioms
Applied review findings from the simplify pass:

1. Extract fromBunStream(name, get) and forkStderrDrain(stream, into)
   helpers — 4 duplicated Stream.fromReadableStream call sites collapse
   to one factory, and the identical stderr drain across serve/acp is
   now a single helper. Error messages now include the underlying cause
   instead of swallowing it.

2. acp.send awaits proc.stdin.write's backpressure promise. The bare
   Effect.sync was discarding the Promise<number> form, which can
   reorder ndjson lines under pipe-buffer-full conditions and corrupt
   framing.

3. acp.close drops the try/catch around proc.stdin.end() — idempotent
   in Bun, the bare catch only masked future regressions.

4. Effect.ignore on stream drains is now Effect.ignore({ log: true })
   so a real protocol or decode error surfaces in test debug output
   instead of disappearing silently.

5. Help-snapshots replaces the manual failures[] accumulator + continue
   with Effect.partition. Same behavior, no mutable state, declarative.

324/324 CLI tests stay green; typecheck clean.
2026-05-18 21:11:29 -04:00
..