forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Context
PR #214 fixed the pending tool state bug in processor.ts. The code review requested tests that call processor.process() directly, but this is not currently feasible because processor.process() calls LLM.stream() internally which requires active provider installations, API credentials, Config DB, and Instance context.
The existing "integration" tests in test/core/stream.test.ts also do not call process() — they only verify typeof processor.process === "function".
Goal
Build a test harness that allows processor.process() to be called in unit tests by providing a mockable LLM.stream that emits synthetic stream events.
Acceptance Criteria
- A mock factory
createMockStream(events: StreamEvent[])that returns an object compatible withLLM.StreamInput - At minimum, the mock must support emitting:
tool-input-start,tool-call,tool-result,tool-error,text-delta,finish - At least one test in
test/session/processor.test.tsthat callsprocessor.process(mockStream)end-to-end - The harness does not require network access, API keys, or a running database
Why
This would enable proper integration tests for processor stream handler logic, including the pending tool fix in #214.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request