Skip to main content

score

Function score 

Source
pub fn score(
    profile: &TransportProfile,
    observation: &TransportObservation,
) -> TransportRealismReport
Expand description

Score the supplied observation against the profile.

Returns a deterministic TransportRealismReport. When profile has at least one HTTP/2 expectation enabled and observation carries no HTTP/2 signal, the function returns a report whose compatibility.score is super::DEFAULT_SCORE_WHEN_HTTP2_UNAVAILABLE, compatibility.confidence is super::DEFAULT_CONFIDENCE_WHEN_HTTP2_UNAVAILABLE, and compatibility.coverage is super::DEFAULT_COVERAGE_WHEN_HTTP2_UNAVAILABLE. The mismatch list always carries a "http2_observations_unavailable" entry so downstream automation can detect the “no signal” path deterministically.

§Example

use stygian_browser::transport_realism::{
    score, TransportObservation, TransportProfile,
};

let profile = TransportProfile::default();
let observation = TransportObservation::chrome_136_reference();
let report = score(&profile, &observation);
assert!(report.compatibility.score > 0.95);