pub struct ConfidenceController { /* private fields */ }Expand description
Continuous confidence controller for genes and capsules.
Tracks per-asset success / failure outcomes within a rolling time window.
When the failure rate exceeds the configured threshold and the minimum
sample count is met, the asset’s confidence score is automatically
downgraded and a DowngradeEvent is appended to an internal
observability log. Successive successes can recover confidence.
§Selector integration
Call is_selectable before
choosing a gene/capsule for reuse. Assets below
ControllerConfig::min_selectable_confidence return false and
should be skipped until they have been re-validated.
Implementations§
Source§impl ConfidenceController
impl ConfidenceController
Sourcepub fn new(config: ControllerConfig) -> Self
pub fn new(config: ControllerConfig) -> Self
Create a new controller with the given configuration.
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create a controller using ControllerConfig::default.
Sourcepub fn confidence(&self, asset_id: &str) -> f32
pub fn confidence(&self, asset_id: &str) -> f32
Current confidence score for asset_id.
Returns ControllerConfig::initial_confidence for unknown assets.
Sourcepub fn is_selectable(&self, asset_id: &str) -> bool
pub fn is_selectable(&self, asset_id: &str) -> bool
Returns true when the asset’s confidence is at or above
ControllerConfig::min_selectable_confidence.
Sourcepub fn record_success(&mut self, asset_id: &str, now_ms: i64)
pub fn record_success(&mut self, asset_id: &str, now_ms: i64)
Record a successful outcome for asset_id at now_ms.
Applies a recovery boost (capped at initial_confidence).
Sourcepub fn record_failure(&mut self, asset_id: &str, now_ms: i64)
pub fn record_failure(&mut self, asset_id: &str, now_ms: i64)
Record a failure outcome for asset_id at now_ms.
Immediately evaluates the rolling-window failure rate and downgrades confidence if the threshold is exceeded.
Sourcepub fn run_downgrade_check(&mut self, now_ms: i64) -> Vec<DowngradeEvent>
pub fn run_downgrade_check(&mut self, now_ms: i64) -> Vec<DowngradeEvent>
Sweep all tracked assets and apply downgrade logic at now_ms.
Returns every DowngradeEvent generated in this sweep (also
appended to the internal log).
Sourcepub fn downgrade_log(&self) -> &[DowngradeEvent]
pub fn downgrade_log(&self) -> &[DowngradeEvent]
Full observability log of every downgrade event since construction.
Sourcepub fn assets_requiring_revalidation(&self) -> Vec<String>
pub fn assets_requiring_revalidation(&self) -> Vec<String>
Asset IDs whose confidence has fallen below
ControllerConfig::min_selectable_confidence and therefore require
re-validation before they can be reused.