9db841fc62
Adds `integration_mock_llm.rs` covering the LlmClient trait surface: - streaming turn loop (text deltas + finish reason) - reasoning-content replay across tool-call rounds (V4 §5.1.1, the HTTP 400 path that broke v0.4.9-v0.5.1) - tool-call round-trip with chunked input JSON - multiple tool calls in one turn preserve event ordering - compaction-style non-streaming `create_message` - sub-agent style independent parent/child mocks - capacity-gate observation of a captured request Four full-engine tests are `#[ignore]`-marked as BLOCKED on the engine refactor from concrete `Option<DeepSeekClient>` to `Arc<dyn LlmClient>`. Once that wiring lands the ignored tests light up with no mock changes. Adds: - `tests/support/llm_client.rs` mirrors the trait so the mock can be brought into the integration test via `#[path]` without dragging in the rest of the binary's module tree - `tests/fixtures/.gitkeep` so the `eval --record` output directory rides the repo - `tests/README.md` documents both the trait-level mocking strategy and the `--record` fixture flow - `record_flag_writes_one_jsonl_line_per_step` in `eval_harness.rs` exercises the new `--record` flag end-to-end Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.3 KiB
Rust
34 lines
1.3 KiB
Rust
//! Test-only mirror of the production `llm_client` module surface.
|
|
//!
|
|
//! The integration test under `tests/integration_mock_llm.rs` includes this
|
|
//! file as `mod llm_client` and `mock.rs` as the nested submodule. Doing it
|
|
//! this way means `mock.rs`'s `super::{LlmClient, StreamEventBox}` paths
|
|
//! resolve cleanly — they refer to the trait + alias declared right here.
|
|
//!
|
|
//! The trait shape MUST stay 1:1 with the real one in
|
|
//! `crates/tui/src/llm_client/mod.rs`. If the production trait grows a method,
|
|
//! mirror it here so `mock.rs` (the same source file shipped in the binary)
|
|
//! still satisfies it.
|
|
|
|
use anyhow::Result;
|
|
use std::pin::Pin;
|
|
|
|
use crate::models::{MessageRequest, MessageResponse, StreamEvent};
|
|
|
|
pub type StreamEventBox =
|
|
Pin<Box<dyn futures_util::Stream<Item = Result<StreamEvent>> + Send + 'static>>;
|
|
|
|
#[allow(async_fn_in_trait, dead_code)]
|
|
pub trait LlmClient: Send + Sync {
|
|
fn provider_name(&self) -> &'static str;
|
|
fn model(&self) -> &str;
|
|
async fn create_message(&self, request: MessageRequest) -> Result<MessageResponse>;
|
|
async fn create_message_stream(&self, request: MessageRequest) -> Result<StreamEventBox>;
|
|
async fn health_check(&self) -> Result<bool> {
|
|
Ok(true)
|
|
}
|
|
}
|
|
|
|
#[path = "../../src/llm_client/mock.rs"]
|
|
pub mod mock;
|