pub fn build_runtime_policy_with_memory(
report: &InvestigationReport,
requirements: &RequirementsProfile,
memory: &ChallengeMemory,
domain: &str,
target_class: TargetClass,
) -> RuntimePolicyExpand description
Build a RuntimePolicy from an investigation report and
requirements profile, then apply a bounded challenge-memory
adjustment to the risk score.
The adjustment path is identical to
adjust_runtime_policy — this is a convenience wrapper for
the common “rebuild policy from scratch” workflow.
§Example
use stygian_charon::challenge_feedback::{
build_runtime_policy_with_memory, ChallengeMemory, ChallengeOutcome,
};
use stygian_charon::build_runtime_policy;
use stygian_charon::types::{
AdapterStrategy, AntiBotProvider, Detection, IntegrationRecommendation,
InvestigationReport, RequirementsProfile, TargetClass,
};
use std::collections::BTreeMap;
let memory = ChallengeMemory::with_defaults();
memory.record("example.com", TargetClass::ContentSite, ChallengeOutcome::Captcha);
let report = InvestigationReport {
page_title: Some("example.com".to_string()),
total_requests: 100,
blocked_requests: 0,
status_histogram: BTreeMap::new(),
resource_type_histogram: BTreeMap::new(),
provider_histogram: BTreeMap::new(),
marker_histogram: BTreeMap::new(),
top_markers: Vec::new(),
hosts: Vec::new(),
suspicious_requests: Vec::new(),
aggregate: Detection {
provider: AntiBotProvider::Unknown,
confidence: 0.0,
markers: Vec::new(),
},
target_class: Some(TargetClass::ContentSite),
};
let requirements = RequirementsProfile {
provider: AntiBotProvider::Unknown,
confidence: 0.0,
requirements: Vec::new(),
recommendation: IntegrationRecommendation {
strategy: AdapterStrategy::DirectHttp,
rationale: "test".to_string(),
required_stygian_features: Vec::new(),
config_hints: BTreeMap::new(),
},
};
let policy = build_runtime_policy(&report, &requirements);
let with_memory = build_runtime_policy_with_memory(
&report,
&requirements,
&memory,
"example.com",
TargetClass::ContentSite,
);
assert!(with_memory.risk_score >= policy.risk_score);