refactor(registry): single-source the deflation-bootstrap constants (#199)

DEFLATION_N_RESAMPLES (1000) and DEFLATION_BLOCK_LEN (5) were duplicated
as independent copies in aura-cli and aura-campaign — a silent-drift risk
(an edit in one crate but not the other refuses nothing, it just produces
a wrong deflation result). Promote a single definition into aura-registry,
which owns optimize_deflated (the sole consumer of these counts); aura-cli
imports it and aura-campaign re-exports it to keep its public path stable.
DEFLATION_SEED stays cli-local (no campaign twin). Values unchanged;
behaviour-preserving, suite green unchanged (1043/0).

closes #199
This commit is contained in:
2026-07-04 15:12:40 +02:00
parent 71e5a6b9c3
commit 5256b3d0ca
3 changed files with 18 additions and 11 deletions
+6 -6
View File
@@ -116,12 +116,12 @@ pub const RANKABLE_METRICS: &[&str] = &[
"sqn", "sqn_normalized", "expectancy_r", "net_expectancy_r",
];
/// Deflation resample count — the shipped CLI `select_winner` constant.
/// Duplicated against `aura-cli`'s private copy, tracked in #199.
pub const DEFLATION_N_RESAMPLES: usize = 1000;
/// Deflation moving-block length — the shipped CLI `select_winner` constant.
/// Duplicated against `aura-cli`'s private copy, tracked in #199.
pub const DEFLATION_BLOCK_LEN: usize = 5;
/// Deflation resample count — re-exported from `aura-registry`'s shared
/// definition (single-sourced, #199).
pub use aura_registry::DEFLATION_N_RESAMPLES;
/// Deflation moving-block length — re-exported from `aura-registry`'s shared
/// definition (single-sourced, #199).
pub use aura_registry::DEFLATION_BLOCK_LEN;
/// Resolve one of the 14 [`PER_MEMBER_METRICS`] against a member's report.
/// An R-metric name against `metrics.r == None` reads `None` (conservative
+5 -5
View File
@@ -33,6 +33,7 @@ use aura_registry::{
check_r_metric, generalization, group_families, mc_member_reports, optimize_deflated,
optimize_plateau, rank_by, sweep_member_reports, walkforward_member_reports, FamilyKind,
FamilyMember, Generalization, NameKind, PlateauMode, Registry, RunTraces, WriteKind,
DEFLATION_BLOCK_LEN, DEFLATION_N_RESAMPLES,
};
use aura_std::{
Add, Bias, CarryCost, ConstantCost, Delay, Ema, GatedRecorder, Gt, Latch, LinComb, LongOnly, Mul,
@@ -65,11 +66,10 @@ const WF_REAL_IS_NS: i64 = 90 * WF_DAY_NS;
const WF_REAL_OOS_NS: i64 = 30 * WF_DAY_NS;
const WF_REAL_STEP_NS: i64 = 30 * WF_DAY_NS;
/// Trials-deflation resampling budget for walk-forward winner selection. Recorded
/// on each winner's manifest (so `overfit_probability` is reproducible by re-run);
/// CLI flags for these are a deferred refinement.
const DEFLATION_N_RESAMPLES: usize = 1000;
const DEFLATION_BLOCK_LEN: usize = 5;
/// Fixed RNG seed for the trials-deflation reality-check bootstrap in walk-forward
/// winner selection. Recorded on each winner's manifest (so `overfit_probability`
/// is reproducible by re-run); a CLI flag for it is a deferred refinement. The
/// resample count and block length are the shared `aura_registry::DEFLATION_*`.
const DEFLATION_SEED: u64 = 0xDEF1_A7ED;
/// The built-in synthetic price stream: rises through t=4 then reverses, so the
+7
View File
@@ -595,6 +595,13 @@ pub fn optimize_plateau(
))
}
/// Deflation-bootstrap default: the resample count of the null-distribution
/// bootstrap consumed by [`optimize_deflated`].
pub const DEFLATION_N_RESAMPLES: usize = 1000;
/// Deflation-bootstrap default: the moving-block length of the null-distribution
/// bootstrap consumed by [`optimize_deflated`].
pub const DEFLATION_BLOCK_LEN: usize = 5;
/// `optimize`'s argmax winner PLUS its trials-deflation provenance. The returned
/// `SweepPoint` is byte-identical to `optimize(family, metric)` (additive, C23).
/// R arm: a centred moving-block reality-check (`overfit_probability` =