63 lines
2.2 KiB
Markdown
63 lines
2.2 KiB
Markdown
# Package: dirigent_testing
|
|
|
|
Testing utilities for Dirigent with replay-based e2e test support.
|
|
|
|
## Quick Facts
|
|
- **Type**: Library (dev/test utility)
|
|
- **Main Entry**: src/lib.rs
|
|
- **Dependencies**: serde, serde_json, thiserror, uuid
|
|
- **Status**: Initial — replay framework only
|
|
|
|
## Purpose
|
|
|
|
Provides testing infrastructure for Dirigent, starting with replay-based end-to-end tests that use recorded ACP (Agent-Client Protocol) interactions. Fixtures are stored as JSON files and can be loaded, filtered, and round-tripped through serde.
|
|
|
|
## Module Organization
|
|
|
|
- **`lib.rs`**: Public API surface and re-exports
|
|
- **`replay.rs`**: Core replay types — `AcpReplay`, `ReplayMessage`, `Direction`, `ReplaySource`
|
|
- **`fixtures.rs`**: Fixture loading utilities — `load_fixture`, `fixture_path`, `list_fixtures`
|
|
|
|
## Fixtures
|
|
|
|
Fixture files live in `fixtures/` and are JSON files conforming to the `AcpReplay` schema. Each fixture contains:
|
|
- `name`: Human-readable identifier
|
|
- `source`: Origin system (`zed`, `claude`, or custom)
|
|
- `messages`: Ordered sequence of `ReplayMessage` with direction, payload, and optional delay
|
|
|
|
### Available Fixtures
|
|
- `minimal_init.json` — Minimal MCP/ACP initialize handshake (client request + server response)
|
|
- `zed_claude_session.json` — Real Zed-Claude ACP session adapted from recorded traffic (9 messages: initialize, session/load with updates, session/list)
|
|
|
|
## Usage
|
|
|
|
```rust
|
|
use dirigent_testing::{load_fixture, AcpReplay, Direction};
|
|
|
|
let replay = load_fixture("minimal_init.json").unwrap();
|
|
assert_eq!(replay.client_messages().len(), 1);
|
|
assert_eq!(replay.agent_messages().len(), 1);
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
cargo test -p dirigent_testing
|
|
```
|
|
|
|
## Related Packages
|
|
|
|
- **dirigent_acp_api**: ACP server that these replays exercise
|
|
- **dirigent_core**: Runtime under test in integration scenarios
|
|
- **dirigent_protocol**: Shared protocol types
|
|
|
|
## Integration Tests
|
|
|
|
- `tests/zed_claude_replay.rs` — Tests for the Zed-Claude session fixture: loading, message counts, direction filtering, protocol structure validation, serde roundtrip
|
|
|
|
## Future Enhancements
|
|
|
|
- Replay runner that drives an ACP server with recorded traffic
|
|
- Assertion helpers for validating ACP response sequences
|
|
- Timing simulation with `delay_ms` support
|