From a55e4cfd10506b661d52cedb7bff55ac77a41364 Mon Sep 17 00:00:00 2001 From: claude Date: Tue, 14 Jul 2026 03:02:54 +0200 Subject: [PATCH] =?UTF-8?q?audit:=20trio=20tidy=20=E2=80=94=20hoist=20the?= =?UTF-8?q?=20ns-per-minute=20constant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- crates/aura-std/src/vol_tf_stop.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/aura-std/src/vol_tf_stop.rs b/crates/aura-std/src/vol_tf_stop.rs index 65fe825..31a5134 100644 --- a/crates/aura-std/src/vol_tf_stop.rs +++ b/crates/aura-std/src/vol_tf_stop.rs @@ -9,6 +9,9 @@ //! nothing, so the `Firing::Any` consumers (`Sizer`, `PositionManagement`) //! 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::{ Cell, Ctx, FieldSpec, Firing, Node, NodeSchema, ParamSpec, PortSpec, PrimitiveBuilder, ScalarKind, @@ -38,7 +41,7 @@ impl VolTfStop { assert!(length >= 1, "VolTfStop length must be >= 1"); assert!(k > 0.0, "VolTfStop k must be > 0"); Self { - period_ns: period_minutes * 60 * 1_000_000_000, + period_ns: period_minutes * NS_PER_MINUTE, k, alpha: 2.0 / (length as f64 + 1.0), length: length as usize, @@ -133,7 +136,7 @@ impl Node for VolTfStop { fn label(&self) -> String { format!( "VolTfStop({}m,{},{})", - self.period_ns / (60 * 1_000_000_000), + self.period_ns / NS_PER_MINUTE, self.length, self.k ) @@ -155,7 +158,7 @@ mod tests { .iter() .map(|&(ts_min, price)| { 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()) }) .collect()