Skip to content

Commit 6ad30bc

Browse files
committed
Merge pull request 'Fix #2508: prefix stub params and remove clippy::all allow in terraphim_validation' (#2853) from task/2508-validation-stub-params into main
2 parents cc06286 + 2a9550f commit 6ad30bc

18 files changed

Lines changed: 126 additions & 132 deletions

crates/terraphim_validation/src/artifacts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl ReleaseArtifact {
146146
fn extract_filename(&self) -> String {
147147
self.download_url
148148
.split('/')
149-
.last()
149+
.next_back()
150150
.unwrap_or("unknown")
151151
.to_string()
152152
}

crates/terraphim_validation/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// TODO: Gradually remove these allows as the crate matures
1010
#![allow(unused)]
1111
#![allow(ambiguous_glob_reexports)]
12-
#![allow(clippy::all)]
12+
// #![allow(clippy::all)] -- removed: see issue #2508
1313

1414
pub mod artifacts;
1515
pub mod orchestrator;

crates/terraphim_validation/src/performance/benchmarking.rs

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ impl PerformanceBenchmarker {
703703
max_time: Duration::from_millis(200),
704704
ops_per_second: user_count as f64 * 2.0,
705705
success_rate: 0.9,
706-
error_count: (user_count / 10) as u32,
706+
error_count: (user_count / 10),
707707
resource_usage: self.capture_resource_usage().await?,
708708
};
709709

@@ -772,11 +772,8 @@ impl PerformanceBenchmarker {
772772
let disk_write_bytes = 0; // Not easily available from sysinfo
773773

774774
let networks = Networks::new_with_refreshed_list();
775-
let network_rx_bytes = networks.iter().map(|(_, network)| network.received()).sum();
776-
let network_tx_bytes = networks
777-
.iter()
778-
.map(|(_, network)| network.transmitted())
779-
.sum();
775+
let network_rx_bytes = networks.values().map(|network| network.received()).sum();
776+
let network_tx_bytes = networks.values().map(|network| network.transmitted()).sum();
780777

781778
Ok(ResourceUsage {
782779
cpu_percent,
@@ -867,18 +864,16 @@ impl PerformanceBenchmarker {
867864
});
868865
}
869866
}
870-
"resource_monitoring_load" => {
871-
if result.resource_usage.cpu_percent > self.config.slos.max_cpu_load_percent {
872-
violations.push(SLOViolation {
873-
metric: "CPU usage during load".to_string(),
874-
actual_value: format!("{:.1}%", result.resource_usage.cpu_percent),
875-
threshold_value: format!(
876-
"{:.1}%",
877-
self.config.slos.max_cpu_load_percent
878-
),
879-
severity: ViolationSeverity::Warning,
880-
});
881-
}
867+
"resource_monitoring_load"
868+
if result.resource_usage.cpu_percent
869+
> self.config.slos.max_cpu_load_percent =>
870+
{
871+
violations.push(SLOViolation {
872+
metric: "CPU usage during load".to_string(),
873+
actual_value: format!("{:.1}%", result.resource_usage.cpu_percent),
874+
threshold_value: format!("{:.1}%", self.config.slos.max_cpu_load_percent),
875+
severity: ViolationSeverity::Warning,
876+
});
882877
}
883878
_ => {} // Other operations don't have specific SLOs yet
884879
}

crates/terraphim_validation/src/performance/ci_integration.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ impl CIPerformanceRunner {
273273
self.generate_markdown_report(report).await?;
274274
}
275275

276-
if self.config.reporting.upload_external {
277-
if let Some(url) = &self.config.reporting.upload_url {
278-
self.upload_report(report, url).await?;
279-
}
276+
if self.config.reporting.upload_external
277+
&& let Some(url) = &self.config.reporting.upload_url
278+
{
279+
self.upload_report(report, url).await?;
280280
}
281281

282282
Ok(())
@@ -362,7 +362,7 @@ impl CIPerformanceRunner {
362362
));
363363
}
364364

365-
content.push_str("\n");
365+
content.push('\n');
366366

367367
// SLO violations
368368
if !report.slo_compliance.violations.is_empty()
@@ -384,7 +384,7 @@ impl CIPerformanceRunner {
384384
));
385385
}
386386

387-
content.push_str("\n");
387+
content.push('\n');
388388
}
389389

390390
// Performance trends
@@ -396,7 +396,7 @@ impl CIPerformanceRunner {
396396
for (operation, change) in &trends.improvements {
397397
content.push_str(&format!("✅ **{}:** {:.1}% faster\n", operation, change));
398398
}
399-
content.push_str("\n");
399+
content.push('\n');
400400
}
401401

402402
if !trends.regressions.is_empty() {
@@ -408,15 +408,15 @@ impl CIPerformanceRunner {
408408
change.abs()
409409
));
410410
}
411-
content.push_str("\n");
411+
content.push('\n');
412412
}
413413

414414
if !trends.new_operations.is_empty() {
415415
content.push_str("### New Operations\n\n");
416416
for operation in &trends.new_operations {
417417
content.push_str(&format!("🆕 **{}:** New benchmark added\n", operation));
418418
}
419-
content.push_str("\n");
419+
content.push('\n');
420420
}
421421
}
422422

@@ -563,10 +563,10 @@ impl CLIInterface {
563563
println!("🚫 {}", failure.message);
564564
}
565565

566-
return Ok(1); // Non-zero exit code for CI failure
566+
Ok(1) // Non-zero exit code for CI failure
567567
} else {
568568
println!("✅ All performance gates passed");
569-
return Ok(0); // Success exit code
569+
Ok(0) // Success exit code
570570
}
571571
}
572572
Err(e) => {

crates/terraphim_validation/src/testing/desktop_ui/accessibility.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct AccessibilityTestConfig {
1818
}
1919

2020
#[derive(Debug, Clone, Serialize, Deserialize)]
21+
#[allow(clippy::upper_case_acronyms)] // AAA is the established WCAG accessibility conformance level name
2122
pub enum WCAGLevel {
2223
A,
2324
AA,
@@ -95,7 +96,7 @@ impl AccessibilityTester {
9596

9697
for screen_reader in &self.config.screen_readers {
9798
if screen_reader.enabled {
98-
results.push(self.test_screen_reader(&screen_reader).await?);
99+
results.push(self.test_screen_reader(screen_reader).await?);
99100
}
100101
}
101102

crates/terraphim_validation/src/testing/desktop_ui/cross_platform.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ impl CrossPlatformUITester {
117117
}
118118

119119
// Test Touch Bar
120-
if let Some(touch_bar) = &macos_config.touch_bar {
121-
if touch_bar.enabled {
122-
results.push(self.test_macos_touch_bar().await?);
123-
}
120+
if let Some(touch_bar) = &macos_config.touch_bar
121+
&& touch_bar.enabled
122+
{
123+
results.push(self.test_macos_touch_bar().await?);
124124
}
125125
}
126126

crates/terraphim_validation/src/testing/desktop_ui/harness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::testing::ValidationResult;
77
use anyhow::{Result, anyhow};
88
use serde::{Deserialize, Serialize};
99
use std::collections::HashMap;
10-
use std::path::PathBuf;
10+
use std::path::{Path, PathBuf};
1111
use std::process::Stdio;
1212
use std::time::{Duration, Instant};
1313
use tokio::process::Command;
@@ -261,7 +261,7 @@ impl PlaywrightClient {
261261
Ok(vec!["main".to_string()])
262262
}
263263

264-
async fn take_screenshot(&self, path: &PathBuf) -> Result<()> {
264+
async fn take_screenshot(&self, path: &Path) -> Result<()> {
265265
// Take screenshot using Playwright
266266
Ok(())
267267
}

crates/terraphim_validation/src/testing/desktop_ui/orchestrator.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,26 +399,25 @@ impl DesktopUITestOrchestrator {
399399
UITestStatus::Error => "fail",
400400
};
401401

402+
let status_str = format!("{:?}", result.status);
403+
let message_html = result
404+
.message
405+
.as_ref()
406+
.map(|msg| format!("<p><strong>Message:</strong> {}</p>", msg))
407+
.unwrap_or_default();
408+
let details_html = result
409+
.details
410+
.as_ref()
411+
.map(|details| format!("<p><strong>Details:</strong> {}</p>", details))
412+
.unwrap_or_default();
402413
format!(
403414
r#"<div class="test-result {}">
404415
<h3>{}</h3>
405416
<p><strong>Status:</strong> {}</p>
406417
{}
407418
{}
408419
</div>"#,
409-
css_class,
410-
result.name,
411-
format!("{:?}", result.status),
412-
result
413-
.message
414-
.as_ref()
415-
.map(|msg| format!("<p><strong>Message:</strong> {}</p>", msg))
416-
.unwrap_or_default(),
417-
result
418-
.details
419-
.as_ref()
420-
.map(|details| format!("<p><strong>Details:</strong> {}</p>", details))
421-
.unwrap_or_default()
420+
css_class, result.name, status_str, message_html, details_html
422421
)
423422
})
424423
.collect::<Vec<_>>()

crates/terraphim_validation/src/testing/desktop_ui/performance.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ impl PerformanceTester {
266266
}
267267

268268
let avg_time = times.iter().sum::<Duration>() / times.len() as u32;
269-
let min_time = times.iter().min().unwrap().clone();
270-
let max_time = times.iter().max().unwrap().clone();
269+
let min_time = *times.iter().min().unwrap();
270+
let max_time = *times.iter().max().unwrap();
271271

272272
Ok(BenchmarkResult {
273273
operation: operation.name.clone(),

crates/terraphim_validation/src/testing/desktop_ui/utils.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,27 @@ pub struct ScreenshotComparison {
108108
pub struct ElementUtils;
109109

110110
impl ElementUtils {
111-
/// Wait for element to be visible with timeout
112-
pub async fn wait_for_element_visible(selector: &str, timeout: Duration) -> Result<bool> {
113-
// Implementation would use Playwright to wait for element
111+
/// Wait for element to be visible with timeout.
112+
/// Stub: Playwright integration not yet implemented; always returns Ok(true).
113+
pub async fn wait_for_element_visible(_selector: &str, _timeout: Duration) -> Result<bool> {
114114
tokio::time::sleep(Duration::from_millis(100)).await;
115115
Ok(true)
116116
}
117117

118-
/// Wait for element to contain specific text
118+
/// Wait for element to contain specific text.
119+
/// Stub: Playwright integration not yet implemented; always returns Ok(true).
119120
pub async fn wait_for_text(
120-
selector: &str,
121-
expected_text: &str,
122-
timeout: Duration,
121+
_selector: &str,
122+
_expected_text: &str,
123+
_timeout: Duration,
123124
) -> Result<bool> {
124-
// Implementation would wait for text to appear
125125
tokio::time::sleep(Duration::from_millis(100)).await;
126126
Ok(true)
127127
}
128128

129-
/// Wait for element to be clickable
130-
pub async fn wait_for_clickable(selector: &str, timeout: Duration) -> Result<bool> {
131-
// Implementation would wait for element to be clickable
129+
/// Wait for element to be clickable.
130+
/// Stub: Playwright integration not yet implemented; always returns Ok(true).
131+
pub async fn wait_for_clickable(_selector: &str, _timeout: Duration) -> Result<bool> {
132132
tokio::time::sleep(Duration::from_millis(100)).await;
133133
Ok(true)
134134
}

0 commit comments

Comments
 (0)