pub mod baselines;
pub mod client;
pub mod compare;
pub mod fingerprint;
pub mod manifest;
pub mod pack;
pub mod posture;
pub mod relative;
pub mod render;
pub mod result;
pub mod run;
use std::path::PathBuf;
use thiserror::Error;
pub const BOUNDARY_STATEMENT: &str = "This is a benchmark record for comparative speed. It is not a conformance record, not a certificate, and not a performance-class rating; a bench result may motivate a class run, never substitute for one.";
pub const METHODOLOGY: &str = "Seed once, measure N times. Measured phases are open-loop: arrivals fire at their planned instants regardless of any other request's completion, and every latency is measured from the planned arrival instant, so coordinated omission cannot hide a stall. Seed phases are closed-loop by construction and are reported as bulk-load throughput only.";
#[derive(Debug, Error)]
pub enum BenchError {
#[error("unknown bench pack {requested:?} (embedded: {known})")]
UnknownPack {
requested: String,
known: String,
},
#[error("unknown {vocabulary} token {token:?} (accepted: {accepted})")]
UnknownToken {
vocabulary: &'static str,
token: String,
accepted: String,
},
#[error("unknown posture profile {requested:?} for pack {pack} (defined: {known})")]
UnknownProfile {
pack: pack::PackId,
requested: String,
known: String,
},
#[error("bench pack {pack} defines no posture profile, so a run has nothing to declare")]
NoProfiles {
pack: pack::PackId,
},
#[error(
"posture canary contradicts the declaration: `{}` is declared `{}` and the \
{} canary observed `{}` — {}",
.0.item, .0.declared, .0.bracket, .0.observed, .0.evidence
)]
PostureContradiction(Box<posture::PostureDisagreement>),
#[error(
"posture canary flipped across the measured window: `{item}` read `{before}` before and \
`{after}` after, so the measured window straddles two configurations"
)]
PostureFlip {
item: String,
before: String,
after: String,
},
#[error("posture canary {bracket} bracket produced no reading for `{item}`")]
PostureBracket {
item: String,
bracket: String,
},
#[error(
"bench pack {pack}: fixture {fixture} is pinned at sha256 {expected} but the embedded bytes hash to {actual}"
)]
FixturePin {
pack: pack::PackId,
fixture: pack::FixtureKey,
expected: String,
actual: String,
},
#[error(
"bench pack {}: fixture {} declares archetype_node_id {} and \
archetype_details.archetype_id {}, but its template {} roots at {}",
.0.pack, .0.fixture, .0.node_id, .0.archetype_id, .0.template, .0.root
)]
FixtureRoot(Box<pack::RootMismatch>),
#[error(
"bench pack {pack}: fixture {fixture} declares template {template}, which the pack does \
not seed (seeded: {seeded})"
)]
FixtureTemplate {
pack: pack::PackId,
fixture: pack::FixtureKey,
template: String,
seeded: String,
},
#[error("bench pack {pack}: fixture {fixture} cannot be read: {detail}")]
FixtureUnreadable {
pack: pack::PackId,
fixture: pack::FixtureKey,
detail: String,
},
#[error("--auth basic needs --user")]
MissingUser,
#[error("credential environment variable {name} is unset: {source}")]
Credential {
name: &'static str,
#[source]
source: std::env::VarError,
},
#[error("http client: {source}")]
Client {
#[source]
source: reqwest::Error,
},
#[error("{exchange}: transport: {source}")]
Transport {
exchange: String,
#[source]
source: reqwest::Error,
},
#[error("preflight refused the run at {exchange}: {detail}")]
Preflight {
exchange: String,
detail: String,
},
#[error("seed phase {phase}: {detail}")]
Seed {
phase: String,
detail: String,
},
#[error("measure phase {phase}: {detail}")]
Measure {
phase: String,
detail: String,
},
#[error("--repetitions must be at least 1 (got {0})")]
Repetitions(u32),
#[error("histogram: {0}")]
Histogram(String),
#[error("bench-compare needs at least two result files (got {0})")]
TooFewResults(usize),
#[error(
"--with-baselines needs the docker CLI, and {binary} does not answer: {detail}. \
A run without the flag measures the target alone and needs no container runtime."
)]
DockerUnavailable {
binary: String,
detail: String,
},
#[error("baseline {cdr}: {detail}")]
Baseline {
cdr: String,
detail: String,
},
#[error("cannot write {path}: {source}")]
Write {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("cannot read {path}: {source}")]
Read {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("{path}: not a bench result: {message}")]
Parse {
path: PathBuf,
message: String,
},
#[error("serialize {context}: {source}")]
Serialize {
context: &'static str,
#[source]
source: serde_json::Error,
},
}