chore(swarm): clippy-clean + publish guard for ruview-swarm

- ruview-swarm src is now 0 clippy warnings across default/train/full feature
  sets (derive Default, targeted allows for intentional from_str + bounded
  casts + borrow-required index loops; removed redundant unsigned .max(0))
- publish = false until PR merges, internal path-deps publish in order, and
  ITAR (USML VIII(h)(12)) export sign-off — prevents accidental public publish

Tests unchanged: 103 default / 108 train / 116 ruflo+itar / 120 full+train.
(6 remaining clippy warnings are pre-existing in dependency wifi-densepose-core,
 out of scope for this crate.)

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
ruv 2026-05-30 15:49:52 -04:00
parent 5617ec344b
commit bfcbf38c50
6 changed files with 24 additions and 19 deletions

View File

@ -4,6 +4,10 @@ version = "0.1.0"
edition = "2021"
description = "RuView drone swarm control system — hierarchical-mesh topology, Raft consensus, MARL, CSI sensing integration (ADR-148)"
license = "Apache-2.0"
# Publishing disabled until: (1) PR #862 merges, (2) internal path-deps are
# published in dependency order, (3) export-control sign-off on the ITAR-gated
# coordination features (USML Category VIII(h)(12)). Flip to true deliberately.
publish = false
[features]
default = []

View File

@ -44,14 +44,17 @@ impl FnnScorer {
/// Default weights initialised to a simple identity-like setup.
pub fn default_weights() -> Self {
// Simple: w1 diagonalish, others small constant
// Index needed: diagonal/strided init uses i for both row and column.
let mut w1 = [[0.0f32; 5]; 16];
#[allow(clippy::needless_range_loop)]
for i in 0..5 {
w1[i][i] = 1.0;
}
for i in 5..16 {
w1[i][0] = 0.1;
for row in w1.iter_mut().take(16).skip(5) {
row[0] = 0.1;
}
let mut w2 = [[0.0f32; 16]; 8];
#[allow(clippy::needless_range_loop)]
for i in 0..8 {
w2[i][i * 2] = 1.0;
}

View File

@ -284,6 +284,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let positions: Vec<(NodeId, Position3D)> =
states.iter().map(|s| (s.id, s.position)).collect();
// Index needed: mutates states[idx] while reading peer positions; borrow constraints.
#[allow(clippy::needless_range_loop)]
for idx in 0..states.len() {
let prev_pos = states[idx].position;
let node_id = states[idx].id;

View File

@ -314,6 +314,8 @@ pub async fn run_mission_with_report(
// properly separated swarm records zero collision events.
let min_sep = profile_config.formation.min_separation_m.max(1.5);
let snapshot: Vec<Position3D> = drones.iter().map(|d| d.state.position).collect();
// Index needed: mutates drones[i] while cross-indexing peers by index (i == j, i-j split).
#[allow(clippy::needless_range_loop)]
for i in 0..drones.len() {
let mut push = (0.0_f64, 0.0_f64);
for (j, other) in snapshot.iter().enumerate() {

View File

@ -13,9 +13,10 @@
//! the gradient backend lives in `candle_ppo.rs` behind the `train` feature.
/// Which self-learning strategy the swarm trains under. Selectable at runtime.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum LearningPattern {
/// Centralized critic, decentralized execution (CTDE).
#[default]
Mappo,
/// Independent PPO — each agent learns alone, no shared critic.
Ippo,
@ -25,15 +26,11 @@ pub enum LearningPattern {
MetaRl,
}
impl Default for LearningPattern {
fn default() -> Self {
LearningPattern::Mappo
}
}
impl LearningPattern {
/// Parse from a short identifier. Unknown strings fall back to the default
/// (Mappo). Accepts both canonical names and friendly aliases.
// Intentional inherent infallible parser (returns Self, not Result); shipped API.
#[allow(clippy::should_implement_trait)]
pub fn from_str(s: &str) -> Self {
match s.trim().to_ascii_lowercase().as_str() {
"mappo" => LearningPattern::Mappo,
@ -122,7 +119,7 @@ impl CuriosityModule {
pub fn visit_bonus(&mut self, x: f64, y: f64) -> f32 {
let idx = self.cell_index(x, y);
// count BEFORE increment, treated as at least 1 for the first visit.
let prior = self.counts[idx].max(0) + 1;
let prior = self.counts[idx] + 1;
let bonus = self.beta / (prior as f32).sqrt();
self.counts[idx] = self.counts[idx].saturating_add(1);
bonus
@ -169,8 +166,8 @@ impl MetaAdapter {
/// leading dimensions; extra entries are ignored.
pub fn adapt(&mut self, advantage: f32, feature_grad: &[f32]) {
let n = self.fast.len().min(feature_grad.len());
for i in 0..n {
self.fast[i] += self.inner_lr * advantage * feature_grad[i];
for (f, &g) in self.fast.iter_mut().zip(feature_grad.iter()).take(n) {
*f += self.inner_lr * advantage * g;
}
}

View File

@ -10,9 +10,10 @@
use crate::types::{NodeId, Position3D};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum FlightPattern {
Boustrophedon,
#[default]
PartitionedLawnmower,
Spiral,
Pheromone,
@ -20,13 +21,9 @@ pub enum FlightPattern {
LevyFlight,
}
impl Default for FlightPattern {
fn default() -> Self {
FlightPattern::PartitionedLawnmower
}
}
impl FlightPattern {
// Intentional inherent infallible parser (returns Self, not Result); shipped API.
#[allow(clippy::should_implement_trait)]
pub fn from_str(s: &str) -> Self {
match s.to_lowercase().as_str() {
"boustrophedon" | "lawnmower" => FlightPattern::Boustrophedon,