Files
dirigent/crates/dirigent_testing/CLAUDE.md
T
2026-05-08 01:59:04 +02:00

2.2 KiB

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

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

cargo test -p dirigent_testing
  • 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