Files
peltier.io/crates/report/src/pricing.rs
Claude 328aafae77 Bootstrap hotpath from engineering spec v0.1
Commit the spec and scaffold the system it describes:

- SPEC.md: the full v0.1 engineering spec
- crates/: trust-layer Rust workspace, unit-tested
  - bench-runner: interleaved ABAB scheduling with discarded warm-ups,
    deterministic bootstrap CIs over the ratio of medians,
    CI-lower-bound accept rule, env fingerprinting, and a CLI with
    compare + A/A self-test modes (A/A verified passing end-to-end)
  - diff-test: gate outcome model, sha256 corpus pin verifier that
    refuses on mismatch, per-target equivalence policy parser
    (byte-identical default, explicit fp-tolerance opt-in)
  - ledger: append-only SQLite attempt schema with UPDATE/DELETE
    refused by triggers, anti-double-attempt query
  - report: cores-saved and dollars/yr ROI math over speedup CIs,
    pricing.toml inputs
- playbook/: classes 1-7 with preconditions, procedure, verification
  notes, and known failure modes per class
- agent/: Python package skeleton — six-tool contract and prompting
  spine, harness IPC deferred to Phase 1
- config/: accept.toml (2% threshold, 30 runs/side), pricing.toml
- targets/, corpora/, results/calibration/: layout and policy docs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcKPWQ3MQD4NdEHwar96u2
2026-07-06 18:34:51 +00:00

31 lines
1.0 KiB
Rust

//! Pricing inputs (`config/pricing.toml`). Rates are engagement inputs,
//! not constants — public cloud list prices by default, customer's own
//! numbers when supplied.
use serde::Deserialize;
use std::path::Path;
#[derive(Debug, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Pricing {
/// Dollars per core-hour (e.g. public-cloud on-demand vCPU rate).
pub dollars_per_core_hour: f64,
/// Fleet hours per year the workload actually runs (8760 for 24/7).
pub hours_per_year: f64,
/// Where the rate came from — printed on the report.
pub rate_source: String,
}
impl Pricing {
pub fn load(path: &Path) -> anyhow::Result<Self> {
let raw = std::fs::read_to_string(path)?;
let p: Self = toml::from_str(&raw)?;
anyhow::ensure!(p.dollars_per_core_hour > 0.0, "rate must be positive");
anyhow::ensure!(
p.hours_per_year > 0.0 && p.hours_per_year <= 8784.0,
"hours_per_year must be in (0, 8784]"
);
Ok(p)
}
}