mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-30 12:13:34 +00:00
fix(ci): cargo fmt + restore workspace unused_unit lint allow
- Run cargo fmt --all across all 9 files that drifted from rustfmt style (prime-radiant/energy.rs, ruvector-dag/bottleneck.rs+reasoning_bank.rs, ruvector-server/points.rs, ruvllm/pretrain_pipeline.rs+report.rs+registry.rs, rvagent-cli/app.rs, rvagent-wasm/gallery.rs) - Add [workspace.lints.clippy] unused_unit = "allow" to root Cargo.toml; the per-crate entries removed in the security commit were still needed — moving to workspace-level is cleaner and restores -D warnings CI pass Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
8dc5dbe923
commit
fc775d6a67
10 changed files with 66 additions and 21 deletions
|
|
@ -236,6 +236,9 @@ members = [
|
|||
]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
unused_unit = "allow"
|
||||
|
||||
[workspace.package]
|
||||
version = "2.2.3"
|
||||
edition = "2021"
|
||||
|
|
|
|||
|
|
@ -123,7 +123,11 @@ impl HyperbolicEnergy {
|
|||
self.edge_energies
|
||||
.iter()
|
||||
// Use unwrap_or to handle NaN weighted_energy gracefully instead of panicking.
|
||||
.max_by(|a, b| a.weighted_energy.partial_cmp(&b.weighted_energy).unwrap_or(std::cmp::Ordering::Equal))
|
||||
.max_by(|a, b| {
|
||||
a.weighted_energy
|
||||
.partial_cmp(&b.weighted_energy)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
})
|
||||
}
|
||||
|
||||
/// Find deepest edge
|
||||
|
|
@ -131,7 +135,11 @@ impl HyperbolicEnergy {
|
|||
self.edge_energies
|
||||
.iter()
|
||||
// Use unwrap_or to handle NaN depth gracefully instead of panicking.
|
||||
.max_by(|a, b| a.avg_depth().partial_cmp(&b.avg_depth()).unwrap_or(std::cmp::Ordering::Equal))
|
||||
.max_by(|a, b| {
|
||||
a.avg_depth()
|
||||
.partial_cmp(&b.avg_depth())
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
})
|
||||
}
|
||||
|
||||
/// Get edges above energy threshold
|
||||
|
|
|
|||
|
|
@ -42,7 +42,11 @@ impl BottleneckAnalysis {
|
|||
|
||||
// Sort by score descending
|
||||
// Use unwrap_or to handle NaN scores gracefully instead of panicking.
|
||||
bottlenecks.sort_by(|a, b| b.score.partial_cmp(&a.score).unwrap_or(std::cmp::Ordering::Equal));
|
||||
bottlenecks.sort_by(|a, b| {
|
||||
b.score
|
||||
.partial_cmp(&a.score)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
});
|
||||
|
||||
// Calculate total cost by iterating over all node IDs
|
||||
let total_cost: f64 = (0..dag.node_count())
|
||||
|
|
|
|||
|
|
@ -167,7 +167,9 @@ impl DagReasoningBank {
|
|||
let score_a = a.quality_score * (a.usage_count as f32 + 1.0).ln();
|
||||
let score_b = b.quality_score * (b.usage_count as f32 + 1.0).ln();
|
||||
// Use unwrap_or to handle NaN scores gracefully instead of panicking.
|
||||
score_a.partial_cmp(&score_b).unwrap_or(std::cmp::Ordering::Equal)
|
||||
score_a
|
||||
.partial_cmp(&score_b)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
})
|
||||
.map(|(i, _)| i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,7 +112,9 @@ async fn search_points(
|
|||
)));
|
||||
}
|
||||
if req.vector.is_empty() {
|
||||
return Err(Error::InvalidRequest("query vector must not be empty".into()));
|
||||
return Err(Error::InvalidRequest(
|
||||
"query vector must not be empty".into(),
|
||||
));
|
||||
}
|
||||
if req.vector.len() > MAX_VECTOR_DIM {
|
||||
return Err(Error::InvalidRequest(format!(
|
||||
|
|
|
|||
|
|
@ -982,7 +982,11 @@ impl PretrainPipeline {
|
|||
// Pre-sort trajectories once (highest quality first for importance sampling)
|
||||
let mut sorted_trajectories = self.successful_trajectories.clone();
|
||||
// Use unwrap_or to handle NaN quality scores gracefully instead of panicking.
|
||||
sorted_trajectories.sort_by(|a, b| b.quality.partial_cmp(&a.quality).unwrap_or(std::cmp::Ordering::Equal));
|
||||
sorted_trajectories.sort_by(|a, b| {
|
||||
b.quality
|
||||
.partial_cmp(&a.quality)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
});
|
||||
|
||||
// Replay successful trajectories multiple times
|
||||
for replay_idx in 0..self.config.reinforce_replays {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,11 @@ impl EvalReport {
|
|||
.collect();
|
||||
|
||||
// Sort by success rate (descending). Use unwrap_or to handle NaN gracefully.
|
||||
entries.sort_by(|a, b| b.success_rate.partial_cmp(&a.success_rate).unwrap_or(std::cmp::Ordering::Equal));
|
||||
entries.sort_by(|a, b| {
|
||||
b.success_rate
|
||||
.partial_cmp(&a.success_rate)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
});
|
||||
|
||||
// Assign ranks
|
||||
for (i, entry) in entries.iter_mut().enumerate() {
|
||||
|
|
|
|||
|
|
@ -336,7 +336,11 @@ impl RuvLtraRegistry {
|
|||
.collect();
|
||||
|
||||
// Sort by parameters (largest that fits). Use unwrap_or to handle NaN gracefully.
|
||||
candidates.sort_by(|a, b| b.params_b.partial_cmp(&a.params_b).unwrap_or(std::cmp::Ordering::Equal));
|
||||
candidates.sort_by(|a, b| {
|
||||
b.params_b
|
||||
.partial_cmp(&a.params_b)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
});
|
||||
|
||||
candidates.first().copied()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,13 +335,25 @@ impl rvagent_tools::Backend for LocalFsBackend {
|
|||
// Security: environment sanitization — strip sensitive variables (SEC-005 / ADR-103 C2).
|
||||
// Only pass through a safe allowlist of environment variables.
|
||||
const SAFE_ENV_VARS: &[&str] = &[
|
||||
"PATH", "HOME", "USER", "SHELL", "LANG", "LC_ALL", "LC_CTYPE", "TERM", "TMPDIR",
|
||||
"TZ",
|
||||
"PATH", "HOME", "USER", "SHELL", "LANG", "LC_ALL", "LC_CTYPE", "TERM", "TMPDIR", "TZ",
|
||||
];
|
||||
// Patterns that identify sensitive env vars that must never reach child processes.
|
||||
const SENSITIVE_PATTERNS: &[&str] = &[
|
||||
"SECRET", "KEY", "TOKEN", "PASSWORD", "CREDENTIAL", "AWS_", "AZURE_", "GCP_",
|
||||
"DATABASE_URL", "PRIVATE", "API_KEY", "AUTH", "BEARER", "JWT", "SESSION",
|
||||
"SECRET",
|
||||
"KEY",
|
||||
"TOKEN",
|
||||
"PASSWORD",
|
||||
"CREDENTIAL",
|
||||
"AWS_",
|
||||
"AZURE_",
|
||||
"GCP_",
|
||||
"DATABASE_URL",
|
||||
"PRIVATE",
|
||||
"API_KEY",
|
||||
"AUTH",
|
||||
"BEARER",
|
||||
"JWT",
|
||||
"SESSION",
|
||||
];
|
||||
|
||||
let mut cmd = Command::new("sh");
|
||||
|
|
@ -350,9 +362,7 @@ impl rvagent_tools::Backend for LocalFsBackend {
|
|||
for var in SAFE_ENV_VARS {
|
||||
if let Ok(val) = std::env::var(var) {
|
||||
let upper = var.to_uppercase();
|
||||
let sensitive = SENSITIVE_PATTERNS
|
||||
.iter()
|
||||
.any(|pat| upper.contains(pat));
|
||||
let sensitive = SENSITIVE_PATTERNS.iter().any(|pat| upper.contains(pat));
|
||||
if !sensitive {
|
||||
cmd.env(var, val);
|
||||
}
|
||||
|
|
@ -367,16 +377,16 @@ impl rvagent_tools::Backend for LocalFsBackend {
|
|||
|
||||
// Poll for completion with a deadline to enforce the timeout.
|
||||
loop {
|
||||
match child.try_wait().map_err(|e| format!("wait failed: {}", e))? {
|
||||
match child
|
||||
.try_wait()
|
||||
.map_err(|e| format!("wait failed: {}", e))?
|
||||
{
|
||||
Some(_) => break,
|
||||
None => {
|
||||
if std::time::Instant::now() >= deadline {
|
||||
let _ = child.kill();
|
||||
return Ok(rvagent_tools::ExecuteResponse {
|
||||
output: format!(
|
||||
"Command timed out after {} seconds",
|
||||
timeout
|
||||
),
|
||||
output: format!("Command timed out after {} seconds", timeout),
|
||||
exit_code: -1,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -754,7 +754,11 @@ impl WasmGallery {
|
|||
.collect();
|
||||
|
||||
// Sort by relevance. Use unwrap_or to handle NaN gracefully instead of panicking.
|
||||
results.sort_by(|a, b| b.relevance.partial_cmp(&a.relevance).unwrap_or(std::cmp::Ordering::Equal));
|
||||
results.sort_by(|a, b| {
|
||||
b.relevance
|
||||
.partial_cmp(&a.relevance)
|
||||
.unwrap_or(std::cmp::Ordering::Equal)
|
||||
});
|
||||
|
||||
to_js_value(&results)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue