1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Behavioral Cloning of Backends
//!
//! This module provides functionality to learn from recorded traffic and create
//! realistic mock behavior that captures the "personality" of the real backend.
//!
//! # Features
//!
//! - **Sequence Learning**: Discover and model multi-step flows from real traffic
//! - **Probabilistic Outcomes**: Model probabilities of errors, latency, and edge cases per endpoint
//! - **Rare Edge Amplification**: Option to increase rare error frequency for testing
//!
//! # Example Usage
//!
//! ```rust,ignore
//! use mockforge_core::behavioral_cloning::{
//! SequenceLearner, ProbabilisticModel, EdgeAmplifier,
//! };
//!
//! async fn example(database: &impl mockforge_core::behavioral_cloning::TraceQueryProvider) -> mockforge_core::Result<()> {
//! // Learn sequences from recorded traffic
//! let sequences = SequenceLearner::discover_sequences_from_traces(database).await?;
//!
//! // Build probability models for endpoints
//! let model = ProbabilisticModel::build_probability_model(
//! database,
//! "/api/users",
//! "GET"
//! ).await?;
//!
//! // Sample a status code based on learned distribution
//! let status_code = model.sample_status_code();
//!
//! // Amplify rare errors for testing
//! let amplifier = EdgeAmplifier::new();
//! amplifier.apply_amplification(&mut model.clone(), 0.5)?; // 50% frequency
//! Ok(())
//! }
//! ```
pub use EdgeAmplifier;
pub use ProbabilisticModel;
pub use ;
pub use ;