YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
chore: delete dead test scaffolding to clear cargo warnings (#3470)
Louis Beaumontaff4413b32c0
diff --git a/crates/screenpipe-a11y/examples/linux_debug.rs b/crates/screenpipe-a11y/examples/linux_debug.rsindex fb6ee50e9..9f08eda7e 100644--- a/crates/screenpipe-a11y/examples/linux_debug.rs+++ b/crates/screenpipe-a11y/examples/linux_debug.rs@@ -104,7 +104,7 @@ fn has_state(states: &[u32], bit: u32) -> bool {let bit_in_word = bit % 32;states.get(word)- .map_or(false, |w| (w >> bit_in_word) & 1 == 1)+ .is_some_and(|w| (w >> bit_in_word) & 1 == 1)}fn main() {diff --git a/crates/screenpipe-a11y/examples/linux_deep.rs b/crates/screenpipe-a11y/examples/linux_deep.rsindex f6230c86a..924b3120c 100644--- a/crates/screenpipe-a11y/examples/linux_deep.rs+++ b/crates/screenpipe-a11y/examples/linux_deep.rs@@ -97,12 +97,6 @@ fn get_text(conn: &Connection, dest: &str, path: &str) -> Option<String> {.filter(|s| !s.trim().is_empty())}-fn get_interfaces(conn: &Connection, dest: &str, path: &str) -> Vec<String> {- get_prop(conn, dest, path, ATSPI_ACCESSIBLE, "GetInterfaces")- .and_then(|v| v.try_into().ok())- .unwrap_or_default()-}-fn dump_tree(conn: &Connection, dest: &str, path: &str, depth: usize, max_depth: usize) {if depth > max_depth {return;diff --git a/crates/screenpipe-a11y/src/config.rs b/crates/screenpipe-a11y/src/config.rsindex 9e0b64839..2f427b2f4 100644--- a/crates/screenpipe-a11y/src/config.rs+++ b/crates/screenpipe-a11y/src/config.rs@@ -116,6 +116,7 @@ pub struct UiCaptureConfig {/// 1. `mouse_hook_proc` / `keyboard_hook_proc` blocking locks → `try_lock` (fall back to None on contention)/// 2. UIA worker / app observer threads run at lower OS priority (see `extraction_thread_priority`)/// 3. UIA worker skips tree captures during a short window after any input (see `pause_extraction_on_input_ms`)+ ////// Intended for environments where users perceive mouse/keyboard lag and prefer/// responsiveness over event completeness.pub prioritize_input_latency: bool,@@ -136,21 +137,16 @@ pub struct UiCaptureConfig {/// OS thread priority for a11y extraction threads./// Maps to Windows `SetThreadPriority` constants; on non-Windows platforms this/// is recorded but currently has no effect.-#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]#[serde(rename_all = "snake_case")]pub enum ExtractionThreadPriority {Normal,+ #[default]BelowNormal,Lowest,Idle,}-impl Default for ExtractionThreadPriority {- fn default() -> Self {- Self::BelowNormal- }-}-impl std::str::FromStr for ExtractionThreadPriority {type Err = String;fn from_str(s: &str) -> Result<Self, Self::Err> {diff --git a/crates/screenpipe-audio-eval/src/bin/screenpipe_fixtures.rs b/crates/screenpipe-audio-eval/src/bin/screenpipe_fixtures.rsindex 1fbac08da..f168f70f8 100644--- a/crates/screenpipe-audio-eval/src/bin/screenpipe_fixtures.rs+++ b/crates/screenpipe-audio-eval/src/bin/screenpipe_fixtures.rs@@ -312,7 +312,7 @@ impl FixtureBuilder {fn append_silence(&mut self, seconds: f64) {let samples = (seconds.max(0.0) * SAMPLE_RATE as f64).round() as usize;- self.samples.extend(std::iter::repeat(1e-5).take(samples));+ self.samples.extend(std::iter::repeat_n(1e-5, samples));}fn add_echo(&mut self, delay_seconds: f64, gain: f32) {diff --git a/crates/screenpipe-audio/src/transcription/engine.rs b/crates/screenpipe-audio/src/transcription/engine.rsindex f73b26f0e..39387920d 100644--- a/crates/screenpipe-audio/src/transcription/engine.rs+++ b/crates/screenpipe-audio/src/transcription/engine.rs@@ -152,7 +152,7 @@ impl TranscriptionEngine {&oc_config.endpoint),oc_config.model,- oc_config.api_key.as_ref().map_or(false, |k| !k.is_empty()),+ oc_config.api_key.as_ref().is_some_and(|k| !k.is_empty()),);Ok(Self::OpenAICompatible {endpoint: oc_config.endpoint,diff --git a/crates/screenpipe-engine/src/calendar_speaker_id.rs b/crates/screenpipe-engine/src/calendar_speaker_id.rsindex d4ae74280..57bd32a12 100644--- a/crates/screenpipe-engine/src/calendar_speaker_id.rs+++ b/crates/screenpipe-engine/src/calendar_speaker_id.rs@@ -1305,7 +1305,7 @@ mod tests {let embedding: Vec<f32> = vec![0.1; 512];// Speaker A: already named "Louis"- let id_a = seed_speaker(&db, &embedding, Some("Louis")).await;+ seed_speaker(&db, &embedding, Some("Louis")).await;// Speaker B: unnamed (will be named "[email protected]" by calendar)let id_b = seed_speaker(&db, &embedding, None).await;diff --git a/crates/screenpipe-engine/src/cli/backup.rs b/crates/screenpipe-engine/src/cli/backup.rsindex 9611a94b6..bd6c6c374 100644--- a/crates/screenpipe-engine/src/cli/backup.rs+++ b/crates/screenpipe-engine/src/cli/backup.rs@@ -63,9 +63,8 @@ pub async fn handle_backup_command(screenpipe_db::DatabaseManager::new(&db_path.to_string_lossy(), Default::default()).await?;- db.backup_to(&dest).await.map_err(|e| {+ db.backup_to(&dest).await.inspect_err(|_e| {let _ = std::fs::remove_file(&dest);- e})?;let size = std::fs::metadata(&dest).map(|m| m.len()).unwrap_or(0);diff --git a/crates/screenpipe-engine/src/cli/db.rs b/crates/screenpipe-engine/src/cli/db.rsindex ce8ae99a0..ef0c57c48 100644--- a/crates/screenpipe-engine/src/cli/db.rs+++ b/crates/screenpipe-engine/src/cli/db.rs@@ -630,8 +630,9 @@ async fn cleanup(data_dir: &Path, apply: bool, force: bool) -> Result<()> {};let is_file = metadata.is_file();let is_dir = metadata.is_dir();- let matched = (is_file && FILE_EXACT.contains(&name.as_str()))- || (is_file && FILE_PREFIXES.iter().any(|p| name.starts_with(p)))+ let matched = (is_file+ && (FILE_EXACT.contains(&name.as_str())+ || FILE_PREFIXES.iter().any(|p| name.starts_with(p))))|| (is_dir && DIR_PREFIXES.iter().any(|p| name.starts_with(p)));if !matched {continue;diff --git a/crates/screenpipe-engine/src/cli/mod.rs b/crates/screenpipe-engine/src/cli/mod.rsindex 7081680bf..25812bf8a 100644--- a/crates/screenpipe-engine/src/cli/mod.rs+++ b/crates/screenpipe-engine/src/cli/mod.rs@@ -433,6 +433,7 @@ pub struct RecordArgs {/// 1. mouse/keyboard hook locks switch to try_lock (contended → app_name/window=None)/// 2. a11y extraction threads self-deprioritize via SetThreadPriority/// 3. UIA tree captures are skipped within N ms after the most recent input+ ////// Fine-tune via --extraction-thread-priority and --pause-extraction-on-input-ms.#[arg(long, default_value_t = false)]pub prioritize_input_latency: bool,@@ -1612,10 +1613,12 @@ mod tests {Cli::try_parse_from(["screenpipe", "record", "--port", "4040", "--disable-audio"]).unwrap();let sources = record_sources(["screenpipe", "record", "--port", "4040", "--disable-audio"]);- let mut settings = screenpipe_config::RecordingSettings::default();- settings.port = 3030;- settings.disable_audio = false;- settings.use_pii_removal = false;+ let mut settings = screenpipe_config::RecordingSettings {+ port: 3030,+ disable_audio: false,+ use_pii_removal: false,+ ..Default::default()+ };match cli.command {Command::Record(args) => {diff --git a/crates/screenpipe-engine/src/cli/presets.rs b/crates/screenpipe-engine/src/cli/presets.rsindex 8f7aed19a..d569fdf9a 100644--- a/crates/screenpipe-engine/src/cli/presets.rs+++ b/crates/screenpipe-engine/src/cli/presets.rs@@ -136,7 +136,7 @@ fn presets_array_mut(store: &mut Value) -> Result<&mut Vec<Value>> {Ok(presets_val.as_array_mut().unwrap())}-fn presets_array<'a>(store: &'a Value) -> &'a [Value] {+fn presets_array(store: &Value) -> &[Value] {store.pointer("/settings/aiPresets").and_then(|v| v.as_array())diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rsindex 5a18c4ef4..a81d4a441 100644--- a/crates/screenpipe-engine/src/connections_api.rs+++ b/crates/screenpipe-engine/src/connections_api.rs@@ -1136,7 +1136,7 @@ fn normalize_meeting_url(raw: Option<String>) -> Option<String> {let trimmed = raw?.trim().trim_matches(|c| matches!(c, '<' | '>' | '"' | '\''))- .trim_end_matches(|c| matches!(c, ')' | ']' | ',' | '.' | ';'))+ .trim_end_matches([')', ']', ',', '.', ';']).to_string();if trimmed.is_empty() {return None;diff --git a/crates/screenpipe-engine/src/drm_detector.rs b/crates/screenpipe-engine/src/drm_detector.rsindex da7222385..f5627eb2c 100644--- a/crates/screenpipe-engine/src/drm_detector.rs+++ b/crates/screenpipe-engine/src/drm_detector.rs@@ -805,7 +805,8 @@ mod tests {let _ = Command::new("open").args(["-a", "Comet", "https://netflix.com"]).spawn()- .expect("failed to open Comet — is it installed?");+ .expect("failed to open Comet — is it installed?")+ .wait();// Give the browser time to launch, load the page, and take focusthread::sleep(Duration::from_secs(5));diff --git a/crates/screenpipe-engine/src/recording_config.rs b/crates/screenpipe-engine/src/recording_config.rsindex cd5979977..9f05e0a48 100644--- a/crates/screenpipe-engine/src/recording_config.rs+++ b/crates/screenpipe-engine/src/recording_config.rs@@ -404,10 +404,11 @@ mod tests {use std::net::Ipv4Addr;fn settings_with(lan: bool, api_auth: bool) -> screenpipe_config::RecordingSettings {- let mut s = screenpipe_config::RecordingSettings::default();- s.listen_on_lan = lan;- s.api_auth = api_auth;- s+ screenpipe_config::RecordingSettings {+ listen_on_lan: lan,+ api_auth,+ ..Default::default()+ }}fn build(s: &screenpipe_config::RecordingSettings) -> RecordingConfig {diff --git a/crates/screenpipe-engine/src/retention.rs b/crates/screenpipe-engine/src/retention.rsindex 92dd229a5..dc07a56a6 100644--- a/crates/screenpipe-engine/src/retention.rs+++ b/crates/screenpipe-engine/src/retention.rs@@ -56,20 +56,17 @@ struct RetentionRuntime {/// What old data gets cleaned up. `Media` (default) keeps DB rows (search,/// timeline, transcripts) and only reclaims mp4/wav/jpeg files; `All` is the/// legacy behavior that wipes everything past the cutoff.-#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, OaSchema, ValueEnum)]+#[derive(+ Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, OaSchema, ValueEnum, Default,+)]#[serde(rename_all = "lowercase")]#[clap(rename_all = "lowercase")]pub enum RetentionMode {+ #[default]Media,All,}-impl Default for RetentionMode {- fn default() -> Self {- Self::Media- }-}-#[derive(Debug, Clone, Serialize, Deserialize)]pub struct RetentionConfig {pub enabled: bool,diff --git a/crates/screenpipe-engine/src/routes/retranscribe.rs b/crates/screenpipe-engine/src/routes/retranscribe.rsindex f7ca579ab..b965d1bae 100644--- a/crates/screenpipe-engine/src/routes/retranscribe.rs+++ b/crates/screenpipe-engine/src/routes/retranscribe.rs@@ -737,9 +737,8 @@ async fn resolve_engine(requested: Option<&str>,) -> Arc<AudioTranscriptionEngine> {if let Some(engine_str) = requested {- match engine_str.parse::<AudioTranscriptionEngine>() {- Ok(engine) => return Arc::new(engine),- Err(_) => {}+ if let Ok(engine) = engine_str.parse::<AudioTranscriptionEngine>() {+ return Arc::new(engine);}}state.audio_manager.transcription_engine().await@@ -811,15 +810,11 @@ fn group_meeting_chunks(let device = chunk_device(chunk);let should_start_new = if let Some(current_batch) = batches.last() {let last_device = chunk_device(current_batch[0]);- if last_device != device {- true- } else if (current_batch.len() as u64) * ASSUMED_AUDIO_CHUNK_SECS >= max_duration_secs {- true- } else {- let last_chunk = current_batch.last().expect("non-empty batch");- let gap = (chunk.timestamp - last_chunk.timestamp).num_seconds().abs();- gap > MEETING_RETRANSCRIBE_MAX_GAP_SECS- }+ let last_chunk = current_batch.last().expect("non-empty batch");+ let gap = (chunk.timestamp - last_chunk.timestamp).num_seconds().abs();+ last_device != device+ || (current_batch.len() as u64) * ASSUMED_AUDIO_CHUNK_SECS >= max_duration_secs+ || gap > MEETING_RETRANSCRIBE_MAX_GAP_SECS} else {true};diff --git a/crates/screenpipe-engine/tests/frame_extraction_test.rs b/crates/screenpipe-engine/tests/frame_extraction_test.rsindex 13173d4d0..72648f652 100644--- a/crates/screenpipe-engine/tests/frame_extraction_test.rs+++ b/crates/screenpipe-engine/tests/frame_extraction_test.rs@@ -4,12 +4,12 @@ use tempfile::TempDir;use tokio::io::AsyncWriteExt;use tokio::process::Command;-/// Test that reproduces the "moov atom not found" error from Sentry-/// Issue: SCREENPIPE-CLI-D, SCREENPIPE-CLI-X, SCREENPIPE-CLI-T-///-/// Root cause: User requests frame from video file that's still being written.-/// MP4 files have the moov atom (index/metadata) at the END, so incomplete-/// files cannot be read by ffmpeg.+// Test that reproduces the "moov atom not found" error from Sentry+// Issue: SCREENPIPE-CLI-D, SCREENPIPE-CLI-X, SCREENPIPE-CLI-T+//+// Root cause: User requests frame from video file that's still being written.+// MP4 files have the moov atom (index/metadata) at the END, so incomplete+// files cannot be read by ffmpeg./// Helper to find ffmpeg pathfn find_ffmpeg() -> String {@@ -31,35 +31,6 @@ fn find_ffmpeg() -> String {"ffmpeg".to_string()}-/// Simulate creating an incomplete MP4 file (still being written)-async fn create_incomplete_mp4(path: &str) -> Result<tokio::process::Child, std::io::Error> {- let ffmpeg = find_ffmpeg();-- // Start ffmpeg process that reads from stdin (simulating live encoding)- // This creates an MP4 file without a moov atom until the process finishes- let child = Command::new(&ffmpeg)- .args([- "-f",- "lavfi",- "-i",- "testsrc=duration=10:size=320x240:rate=1", // 10 second test pattern- "-c:v",- "libx264",- "-preset",- "ultrafast",- "-t",- "10",- "-y",- path,- ])- .stdin(Stdio::null())- .stdout(Stdio::piped())- .stderr(Stdio::piped())- .spawn()?;-- Ok(child)-}-/// Try to extract a frame from a video fileasync fn extract_frame(video_path: &str, output_path: &str) -> Result<(), String> {let ffmpeg = find_ffmpeg();@@ -226,20 +197,22 @@ async fn test_fragmented_mp4_allows_extraction_during_write() {println!("Extraction during fragmented recording: {:?}", result);// With fragmented MP4, this SHOULD succeed!- if result.is_ok() {- println!("SUCCESS: Frame extracted during recording with fragmented MP4!");- assert!(- std::path::Path::new(frame_path_str).exists(),- "Frame file should exist"- );- } else {- // May still fail if not enough data written yet, but shouldn't be moov error- let err = result.unwrap_err();- println!("Extraction failed (may be timing): {}", err);- assert!(- !err.contains("moov atom not found"),- "Should NOT get moov atom error with fragmented MP4"- );+ match result {+ Ok(()) => {+ println!("SUCCESS: Frame extracted during recording with fragmented MP4!");+ assert!(+ std::path::Path::new(frame_path_str).exists(),+ "Frame file should exist"+ );+ }+ Err(err) => {+ // May still fail if not enough data written yet, but shouldn't be moov error+ println!("Extraction failed (may be timing): {}", err);+ assert!(+ !err.contains("moov atom not found"),+ "Should NOT get moov atom error with fragmented MP4"+ );+ }}}@@ -488,8 +461,8 @@ async fn test_race_condition_during_recording() {// This SHOULD fail because recording is in progress// (may or may not fail depending on timing and ffmpeg buffering)- if result.is_err() {- println!("Expected failure during recording: {}", result.unwrap_err());+ if let Err(err) = result {+ println!("Expected failure during recording: {}", err);}}diff --git a/crates/screenpipe-engine/tests/health_debounce_test.rs b/crates/screenpipe-engine/tests/health_debounce_test.rsindex eb1e091c9..b742b7df0 100644--- a/crates/screenpipe-engine/tests/health_debounce_test.rs+++ b/crates/screenpipe-engine/tests/health_debounce_test.rs@@ -281,7 +281,7 @@ fn test_flicker_scenario_simulation() {let grace = Duration::from_secs(30);let threshold = CONSECUTIVE_FAILURES_THRESHOLD;let mut current = RecordingStatus::Recording;- let mut consecutive_failures: u32 = 0;+ let mut consecutive_failures: u32;// tick 1: healthycurrent = decide_status(diff --git a/crates/screenpipe-engine/tests/stream_frames_test.rs b/crates/screenpipe-engine/tests/stream_frames_test.rsindex bdb6d9de2..0068974d3 100644--- a/crates/screenpipe-engine/tests/stream_frames_test.rs+++ b/crates/screenpipe-engine/tests/stream_frames_test.rs@@ -1,8 +1,6 @@use chrono::{Duration, Utc};use futures::{SinkExt, StreamExt};-use screenpipe_db::DatabaseManager;use serde::{Deserialize, Serialize};-use std::sync::Arc;use tokio::time::timeout;use tokio_tungstenite::tungstenite::Message;@@ -18,47 +16,6 @@ struct StreamFramesRequest {#[derive(Debug, Deserialize)]struct StreamTimeSeriesResponse {timestamp: String,- devices: Vec<DeviceResponse>,-}--#[derive(Debug, Deserialize)]-struct DeviceResponse {- device_id: String,- frame_id: Option<i64>,-}--/// Helper to create a test database with frames-async fn create_test_db_with_frames(num_frames: i64) -> Arc<DatabaseManager> {- let db = Arc::new(- DatabaseManager::new("sqlite::memory:", Default::default())- .await- .expect("Failed to create test database"),- );-- // Create a video chunk first (requires device_name now)- let _video_chunk_id = db- .insert_video_chunk("test_video.mp4", "test_device")- .await- .expect("Failed to insert video chunk");-- let now = Utc::now();-- for i in 0..num_frames {- let timestamp = now - Duration::seconds(num_frames - i);- db.insert_frame(- "test_device",- Some(timestamp),- None, // browser_url- Some("test_app"),- Some("test_window"),- false, // focused (not Option)- Some(i), // offset_index- )- .await- .expect("Failed to insert frame");- }-- db}#[cfg(test)]diff --git a/crates/screenpipe-engine/tests/timeline_refresh_bug_test.rs b/crates/screenpipe-engine/tests/timeline_refresh_bug_test.rsindex 98ea49377..55897b4f1 100644--- a/crates/screenpipe-engine/tests/timeline_refresh_bug_test.rs+++ b/crates/screenpipe-engine/tests/timeline_refresh_bug_test.rs@@ -656,7 +656,6 @@ mod tests {async fn test_empty_frame_data_should_be_skipped() {// Simulate the fixed behaviorstruct MockFrame {- timestamp: String,frame_data: Vec<(&'static str, &'static str)>,}@@ -667,7 +666,6 @@ mod tests {// Frame with data - should be sentlet frame_with_data = MockFrame {- timestamp: "2026-01-25T14:15:00Z".to_string(),frame_data: vec![("Chrome", "Google")],};assert!(@@ -676,10 +674,7 @@ mod tests {);// Frame with empty data (all screenpipe filtered) - should NOT be sent- let frame_empty = MockFrame {- timestamp: "2026-01-25T14:15:03Z".to_string(),- frame_data: vec![],- };+ let frame_empty = MockFrame { frame_data: vec![] };assert!(!should_send_frame(&frame_empty),"Frames with empty frame_data should NOT be sent (this is the fix for 'Unknown')"@@ -773,14 +768,12 @@ mod tests {async fn test_frame_availability_response() {#[derive(Debug)]struct FrameResponse {- frame_id: i64,available: bool,error_type: Option<String>,- error_message: Option<String>,suggestion: Option<String>,}- fn create_error_response(frame_id: i64, error: &str) -> FrameResponse {+ fn create_error_response(error: &str) -> FrameResponse {let (error_type, suggestion) = if error.contains("not found") {("not_found",@@ -796,22 +789,20 @@ mod tests {};FrameResponse {- frame_id,available: false,error_type: Some(error_type.to_string()),- error_message: Some(error.to_string()),suggestion: Some(suggestion.to_string()),}}// Test not_found response- let response = create_error_response(12345, "Video file not found");+ let response = create_error_response("Video file not found");assert!(!response.available);assert_eq!(response.error_type, Some("not_found".to_string()));assert!(response.suggestion.unwrap().contains("deleted"));// Test server_error response- let response = create_error_response(12346, "ffmpeg process failed");+ let response = create_error_response("ffmpeg process failed");assert!(!response.available);assert_eq!(response.error_type, Some("server_error".to_string()));assert!(response.suggestion.unwrap().contains("corrupted"));@@ -826,7 +817,6 @@ mod tests {#[derive(Debug, Clone)]struct TimelineFrame {id: i64,- timestamp: String,video_path: String,}@@ -844,17 +834,14 @@ mod tests {let frames = vec![TimelineFrame {id: 1,- timestamp: "2026-01-25T10:00:00Z".to_string(),video_path: "/data/video1.mp4".to_string(),},TimelineFrame {id: 2,- timestamp: "2026-01-25T10:01:00Z".to_string(),video_path: "/data/video2.mp4".to_string(), // This one is missing},TimelineFrame {id: 3,- timestamp: "2026-01-25T10:02:00Z".to_string(),video_path: "/data/video3.mp4".to_string(),},];