//! Chaos testing framework for StemeDB distributed clusters.
//!
//! This crate provides tools for testing the resilience of StemeDB clusters
//! under various failure conditions including:
//!
//! - Network partitions
//! - Node failures
//! - Clock skew
//! - Message reordering and duplication
//!
//! # Architecture
//!
//! The chaos testing framework uses an in-process simulation approach that
//! extends the existing `SimNode` pattern from partition_tolerance tests.
//! This provides:
//!
//! - **Deterministic testing**: No real network or elevated privileges required
//! - **CI-friendly**: Tests run in any environment without iptables/tc
//! - **Fast execution**: In-memory operations with simulated delays
//!
//! # Components
//!
//! - [`harness`]: Test cluster management with `ChaosNode` and `TestCluster`
//! - [`fault_injection`]: Controllers for network partitions and clock skew
//! - [`crdt_properties`]: CRDT invariant verification helpers
//!
//! # Example
//!
//! ```ignore
//! use stemedb_chaos::{TestCluster, NetworkController};
//! use std::time::Duration;
//!
//! #[tokio::test]
//! async fn test_partition_convergence() {
//!     let mut cluster = TestCluster::spawn(5).await;
//!
//!     // Write some data
//!     cluster.get_node_mut(0).write_assertion("key", "pred", 1000).await;
//!
//!     // Partition nodes [0,1,2] from [3,4]
//!     cluster.network().partition(&[0, 1, 2], &[3, 4]);
//!
//!     // Write on both sides of partition
//!     cluster.get_node_mut(0).write_assertion("key1", "pred", 2000).await;
//!     cluster.get_node_mut(3).write_assertion("key2", "pred", 3000).await;
//!
//!     // Heal partition
//!     cluster.network().heal();
//!
//!     // Sync and verify convergence
//!     cluster.sync_all().await;
//!     cluster.assert_converged();
//! }
//! ```

pub mod crdt_properties;
pub mod error;
pub mod fault_injection;
pub mod harness;

pub use error::{ChaosError, Result};
pub use fault_injection::{ClockController, NetworkController};
pub use harness::{
    ChaosNode, ClusterSummary, TestCluster, TestClusterAccessExt, TestClusterConvergenceExt,
    TestClusterCreationExt, TestClusterLifecycleExt, TestClusterSummaryExt, TestClusterSyncExt,
};
