👎Deprecated:
Will be extracted to mockforge-intelligence crate
Expand description
Behavioral cloning of backends - learn from recorded traffic to create realistic mock behavior 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
ⓘ
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(())
}Re-exports§
pub use edge_amplifier::EdgeAmplifier;Deprecated pub use probabilistic_model::ProbabilisticModel;Deprecated pub use sequence_learner::SequenceLearner;Deprecated pub use sequence_learner::TraceQueryProvider;Deprecated pub use sequence_learner::TraceRequest;Deprecated pub use types::AmplificationScope;Deprecated pub use types::BehavioralSequence;Deprecated pub use types::EdgeAmplificationConfig;Deprecated pub use types::EndpointProbabilityModel;Deprecated pub use types::ErrorPattern;Deprecated pub use types::LatencyDistribution;Deprecated pub use types::PayloadVariation;Deprecated pub use types::SequenceStep;Deprecated
Modules§
- edge_
amplifier Deprecated - Rare edge case amplification
- probabilistic_
model Deprecated - Probabilistic outcome modeling
- sequence_
learner Deprecated - Sequence learning from recorded traffic
- types
Deprecated - Behavioral cloning type definitions