mod artifact_identity;
mod build_identity;
mod codec;
mod inspection;
mod persistence;
mod schema;
mod telemetry;
mod validation;
pub(super) use codec::autoroute_cache_file_presence;
#[allow(unused_imports)]
pub(crate) use inspection::{inspect_autoroute_cache, AutorouteReadiness};
pub(super) use persistence::{
load_autoroute_cache, save_autoroute_cache, AutorouteCacheSaveOutcome,
};
pub(crate) use telemetry::{
record_bucket_miss, record_calibration_reuse, record_hit, record_miss, render_missing_buckets,
render_summary, snapshot, AutorouteCacheMiss,
};
pub(crate) use persistence::{
bind_autoroute_cache_to_execution_packs, load_execution_pack_generation_binding,
StagedAutorouteCache,
};
pub(super) fn current_engine_identity() -> String {
schema::AutorouteBuildFeatures::current().describe()
}
pub(super) fn current_executable_identity(
) -> Result<&'static str, Box<dyn std::error::Error + Send + Sync>> {
artifact_identity::current_executable_sha256()
}
#[cfg(test)]
pub(super) use artifact_identity::installed_gpu_sidecar_digest;
#[cfg(test)]
pub(super) use codec::AUTOROUTE_CACHE_FILE_BYTES;
#[cfg(test)]
pub(super) use inspection::route_timing_inspections;
#[cfg(test)]
pub(super) use schema::{AutorouteBuildFeatures, AutorouteCache};
#[cfg(test)]
pub(super) use validation::{
validate_decision_route_evidence, validate_ordered_device_route_bindings,
validate_ordered_device_set_stability,
};
#[cfg(test)]
use keyhog_scanner::hw_probe::ScanBackend;
#[cfg(test)]
use std::collections::HashMap;
#[cfg(test)]
pub(super) use validation::decision_requires_gpu_artifact_identity;
#[cfg(test)]
use super::evidence::AutorouteDecision;
#[cfg(test)]
use super::workload::WorkloadKey;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg(test)]
pub(super) enum BucketResolution {
Exact(ScanBackend),
Unresolved,
}
#[cfg(test)]
pub(super) fn resolve_bucket(
decisions: &HashMap<WorkloadKey, AutorouteDecision>,
key: &WorkloadKey,
) -> BucketResolution {
if let Some(backend) = decisions.get(key).and_then(AutorouteDecision::backend) {
return BucketResolution::Exact(backend);
}
BucketResolution::Unresolved
}