jgrusewski
cc4c47f471
audit(rust-consts): catch literal-vs-const drift + cleanup BOOK_LEVELS=10
Audit script (audit-rust-consts.sh) scans Rust src/examples for numeric
literals mirroring structural kernel-side consts (N_ACTIONS, Q_N_ATOMS,
HIDDEN_DIM, MAX_UNITS, BOOK_LEVELS). Closes the layer-3 gap noted in
feedback_use_consts_not_literals_for_structural_dims:
Layer 1: kernel `#define` allowlist → audit-isv
Layer 2: Rust `pub const` canonical → exists (e.g. N_ACTIONS in rl/common.rs)
Layer 3: Rust literals mirroring (2) → audit-rust-consts (this commit)
Honors `// audit-ignore: <SYMBOL>` per-line markers and skips `[u8; N]`
byte-buffer patterns (high false-positive class — almost always I/O
scratch, not structural dims).
Cleanup driven by first run (19 real flags, no grandfathering):
* New canonical: `BOOK_LEVELS` in `ml-alpha/src/cfc/snap_features.rs`
(10 book levels = same place as `Mbp10RawInput` struct)
* `ml-backtesting/src/lob/mod.rs`: redefine as `pub use` re-export from
ml-alpha (single source of truth; ml-backtesting depends on ml-alpha
via `Mbp10RawInput` already)
* 19 sites switched literal `10` → `BOOK_LEVELS`:
- snap_features.rs:44-47 (struct fields)
- data/loader.rs:872-876, 960 (Mbp10Snapshot → Mbp10RawInput convert)
- data/aggregation.rs:161 (level-wise aggregation loop)
- trainer/perception.rs:2750-2756, 6272-6278, 6686-6690, 7247-7253
(snapshot → batch staging loops)
- tests/lob_sim_fuzz.rs:21, lob_sim_integrated_fuzz.rs:22 (duplicate
const → use ml_backtesting::lob::BOOK_LEVELS)
* 5 sites marked `// audit-ignore: BOOK_LEVELS — <reason>`:
- harness.rs:572,574,594 (conviction-bucket histograms, 10 ≠ depth)
- multi_horizon_labels.rs:489,557,564 (10-element test price vecs)
Re-run after fixes: 0 suspect literals flagged. PASS.
2026-05-24 17:39:40 +02:00
..
2026-05-24 17:39:40 +02:00
2026-04-26 14:11:32 +02:00
2026-04-26 12:33:28 +02:00
2026-04-26 13:04:39 +02:00
2026-04-26 10:58:42 +02:00
2026-05-16 01:02:44 +02:00
2026-05-16 18:04:34 +02:00
2026-05-22 21:21:21 +02:00
2026-05-24 11:26:37 +02:00
2026-03-12 01:44:03 +01:00
2026-03-31 22:40:37 +02:00
2026-05-19 18:15:22 +02:00
2026-04-28 22:56:31 +02:00
2026-04-17 01:29:42 +02:00
2026-04-28 21:57:32 +02:00
2026-04-29 11:04:18 +02:00
2026-05-14 14:22:19 +02:00
2026-05-14 14:22:19 +02:00
2026-05-09 02:23:57 +02:00
2026-05-24 16:28:39 +02:00
2026-05-24 16:47:53 +02:00
2026-05-24 17:39:40 +02:00
2026-05-24 16:47:53 +02:00
2026-05-16 00:42:07 +02:00
2026-02-25 23:20:44 +01:00
2026-03-04 15:29:15 +01:00
2026-04-26 12:25:35 +02:00
2026-03-31 01:33:31 +02:00
2026-03-01 23:41:13 +01:00
2026-02-25 21:19:32 +01:00
2026-03-04 23:46:36 +01:00
2026-02-25 23:24:53 +01:00
2026-04-26 10:58:42 +02:00
2026-03-04 23:46:36 +01:00
2026-05-22 01:40:13 +02:00
2026-02-26 09:04:58 +01:00
2026-03-17 08:34:51 +01:00
2026-03-31 01:33:31 +02:00
2026-02-24 10:32:21 +01:00
2026-02-26 00:50:25 +01:00
2026-02-26 00:50:25 +01:00
2026-04-26 11:49:14 +02:00
2026-05-23 14:14:55 +02:00
2026-02-26 00:50:25 +01:00
2026-03-29 21:01:03 +02:00
2026-03-13 11:54:22 +01:00
2026-04-26 10:58:42 +02:00
2026-03-19 00:38:20 +01:00
2026-03-04 22:08:31 +01:00
2026-02-24 10:32:21 +01:00
2026-03-04 22:08:31 +01:00
2026-03-04 22:08:31 +01:00
2026-03-04 22:08:31 +01:00
2026-05-16 01:02:44 +02:00