audit: trio tidy — hoist the ns-per-minute constant

Cycle-close audit over the feature trio 75bfb93..d1b3a3d (#261 #260
#262). Architect verdict: clean — C1 (both stop variants and the
per-instrument cost round-trip through the manifest), C2 (rollover-only
emission), C18 (scalar cost wire form byte-identical; VolTf additive),
the four-scalar discipline (SessionFrankfurt bakes the timezone, no
string kind), and the match-arm lockstep across all four RiskRegime/
StopRule sites all hold; commit bodies match the diff. One low drift
item — the repeated 60·10^9 ns-per-minute literal in vol_tf_stop.rs —
fixed here as NS_PER_MINUTE rather than carried.

No regression scripts are configured (the architect is the sole gate);
full workspace suite green, clippy clean. Spec and plan working files
discarded per the audit lifecycle.

refs #262
This commit is contained in:
2026-07-14 03:02:54 +02:00
parent d1b3a3dd31
commit a55e4cfd10
+6 -3
View File
@@ -9,6 +9,9 @@
//! nothing, so the `Firing::Any` consumers (`Sizer`, `PositionManagement`) //! nothing, so the `Firing::Any` consumers (`Sizer`, `PositionManagement`)
//! hold the last completed bucket's value; the R-latch samples at entry. //! hold the last completed bucket's value; the R-latch samples at entry.
/// Nanoseconds per minute — the bucket-id divisor's one scale factor.
const NS_PER_MINUTE: i64 = 60 * 1_000_000_000;
use aura_core::{ use aura_core::{
Cell, Ctx, FieldSpec, Firing, Node, NodeSchema, ParamSpec, PortSpec, PrimitiveBuilder, Cell, Ctx, FieldSpec, Firing, Node, NodeSchema, ParamSpec, PortSpec, PrimitiveBuilder,
ScalarKind, ScalarKind,
@@ -38,7 +41,7 @@ impl VolTfStop {
assert!(length >= 1, "VolTfStop length must be >= 1"); assert!(length >= 1, "VolTfStop length must be >= 1");
assert!(k > 0.0, "VolTfStop k must be > 0"); assert!(k > 0.0, "VolTfStop k must be > 0");
Self { Self {
period_ns: period_minutes * 60 * 1_000_000_000, period_ns: period_minutes * NS_PER_MINUTE,
k, k,
alpha: 2.0 / (length as f64 + 1.0), alpha: 2.0 / (length as f64 + 1.0),
length: length as usize, length: length as usize,
@@ -133,7 +136,7 @@ impl Node for VolTfStop {
fn label(&self) -> String { fn label(&self) -> String {
format!( format!(
"VolTfStop({}m,{},{})", "VolTfStop({}m,{},{})",
self.period_ns / (60 * 1_000_000_000), self.period_ns / NS_PER_MINUTE,
self.length, self.length,
self.k self.k
) )
@@ -155,7 +158,7 @@ mod tests {
.iter() .iter()
.map(|&(ts_min, price)| { .map(|&(ts_min, price)| {
col[0].push(Scalar::f64(price)).unwrap(); col[0].push(Scalar::f64(price)).unwrap();
node.eval(Ctx::new(&col, Timestamp(ts_min * 60 * 1_000_000_000))) node.eval(Ctx::new(&col, Timestamp(ts_min * NS_PER_MINUTE)))
.map(|c| c[0].f64()) .map(|c| c[0].f64())
}) })
.collect() .collect()