perf-sentinel-core 0.9.25

Core library for perf-sentinel: polyglot performance anti-pattern detector
Documentation
//! Periodic disclosure report (v1.2).
//!
//! A separate JSON document type, distinct from the per-batch [`Report`]
//! tree, aggregated over a calendar period (default quarter). Designed
//! for public transparency: structured, sourced, hash-verifiable.
//!
//! See `docs/REPORTING.md` for the operator-facing guide and
//! `docs/schemas/perf-sentinel-report-v1.json` for the wire schema.
//!
//! [`Report`]: crate::report::Report

pub mod aggregator;
pub mod attestation;
pub mod errors;
pub mod hasher;
pub mod org_config;
pub mod schema;
pub mod validator;

#[cfg(test)]
mod test_fixtures;

/// `skip_serializing_if` for counters that only a declared source fills,
/// so a report without one keeps the wire shape it had before the field
/// existed.
#[allow(clippy::trivially_copy_pass_by_ref)] // serde requires the reference
pub(crate) fn is_zero_u64(v: &u64) -> bool {
    *v == 0
}

/// Same, for the energy sums.
#[allow(clippy::trivially_copy_pass_by_ref)] // serde requires the reference
pub(crate) fn is_zero_f64(v: &f64) -> bool {
    *v == 0.0
}

pub use aggregator::{
    AggregateInputs, AntiPatternAccumulator, ServiceAccumulator, UNATTRIBUTED_SERVICE,
    aggregate_from_paths,
};
pub use attestation::{
    IN_TOTO_STATEMENT_TYPE, InTotoStatement, InTotoSubject, MethodologySummary,
    OrganisationSummary, PERF_SENTINEL_PREDICATE_TYPE, PerfSentinelPredicate, PeriodSummary,
    build_in_toto_statement, build_in_toto_statement_named, hash_core_patterns,
};
pub use errors::{AggregationError, HashError, ValidationError};
pub use hasher::{binary_hash, compute_content_hash, compute_file_sha256_hex};
pub use schema::{
    Aggregate, AntiPatternDetail, Application, ApplicationG1, ApplicationG2,
    BinaryAttestationMetadata, CalibrationInputs, CarbonBreakdown, Confidentiality, Conformance,
    CoverageBasis, CrossPeriodLogRef, DisabledPattern, ExcludedApp, ExcludedEnv, Integrity,
    IntegrityLevel, Methodology, Notes, OrgIdentifiers, Organisation, Period, PeriodType,
    PeriodicReport, ReportIntent, ReportMetadata, SCHEMA_VERSION, ScopeManifest, SignatureMetadata,
    SourceChain, TemporalCoverage, core_patterns_required,
};
pub use validator::{
    LOW_TEMPORAL_COVERAGE_WARN_THRESHOLD, MIN_PERIOD_COVERAGE_FOR_OFFICIAL, validate_content_hash,
    validate_official,
};