mirror of
https://github.com/bdbrown4/peltier.io.git
synced 2026-11-07 10:58:28 +00:00
Adds crates/verdict ('just verdict'): runs the core gates on the
candidate binary, then an interleaved A/B bench vs the baseline with
the CI-lower-bound rule, and writes the append-only ledger row with
per-side median CIs, workload statement, and env fingerprint. Gate
failure short-circuits to rejected-gate; --needs-human-review caps an
accepted verdict (never upgrades). CPU pinning moves into accept.toml
(pin_prefix, machine-specific, applied to both sides identically).
The smoke test caught a real trust gap: pointing --baseline-bin at the
workspace build (phase1-verdict-smoke-001) measured patched-vs-patched
and returned null, because gate runs rebuild the workspace binary from
the patched tree. Fix: --rebuild-baseline stashes the patch, builds
the baseline into isolated targets/<name>/baseline/, and restores the
patch — SPEC 3.1's pristine-checkout rule, now enforced by the
harness. Re-run (phase1-verdict-smoke-002) reproduces the Phase 0
result mechanically: +10.4% median, 95% CI [1.0932, 1.1137], accepted.
Both smoke rows are in the ledger, including the null one.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcKPWQ3MQD4NdEHwar96u2
55 lines
1.7 KiB
Rust
55 lines
1.7 KiB
Rust
//! Accept-threshold configuration, loaded from `config/accept.toml`.
|
|
|
|
use serde::Deserialize;
|
|
use std::path::Path;
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
#[serde(deny_unknown_fields)]
|
|
pub struct AcceptConfig {
|
|
/// CI lower bound must clear 1 + threshold (default 2%).
|
|
pub threshold: f64,
|
|
/// Measured runs per side (SPEC minimum: 30).
|
|
pub runs_per_side: usize,
|
|
/// Unmeasured warm-up runs per side, discarded.
|
|
pub warmup_runs: usize,
|
|
/// Bootstrap resample count.
|
|
pub bootstrap_iters: usize,
|
|
/// Confidence level for the ratio CI, e.g. 0.95.
|
|
pub confidence: f64,
|
|
/// PRNG seed for the bootstrap (reproducible calibration).
|
|
pub bootstrap_seed: u64,
|
|
/// Machine-specific command prefix for CPU pinning (e.g.
|
|
/// "taskset -c 2"); empty disables pinning. Applied by verdict to
|
|
/// both sides identically.
|
|
#[serde(default)]
|
|
pub pin_prefix: String,
|
|
}
|
|
|
|
impl Default for AcceptConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
threshold: 0.02,
|
|
runs_per_side: 30,
|
|
warmup_runs: 3,
|
|
bootstrap_iters: 10_000,
|
|
confidence: 0.95,
|
|
bootstrap_seed: 0x707E_17E5,
|
|
pin_prefix: String::new(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl AcceptConfig {
|
|
pub fn load(path: &Path) -> anyhow::Result<Self> {
|
|
let raw = std::fs::read_to_string(path)?;
|
|
let cfg: Self = toml::from_str(&raw)?;
|
|
anyhow::ensure!(cfg.runs_per_side >= 2, "runs_per_side must be >= 2");
|
|
anyhow::ensure!(cfg.threshold > 0.0, "threshold must be positive");
|
|
anyhow::ensure!(
|
|
(0.0..1.0).contains(&cfg.confidence),
|
|
"confidence must be in (0, 1)"
|
|
);
|
|
Ok(cfg)
|
|
}
|
|
}
|