Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/examples/create_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use sd_core::domain::memory::{DocumentType, FactType, MemoryFile, MemoryScope};
use std::path::PathBuf;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt().with_env_filter("info").init();

Expand Down
2 changes: 1 addition & 1 deletion core/examples/file_type_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use sd_core::filetype::FileTypeRegistry;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Create registry with built-in types
let registry = FileTypeRegistry::new();

Expand Down
2 changes: 1 addition & 1 deletion core/examples/indexing_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::path::PathBuf;
use tokio::time::{sleep, Duration};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging with more detail
tracing_subscriber::fmt()
.with_env_filter("sd_core=debug,desktop_indexing_demo=info")
Expand Down
2 changes: 1 addition & 1 deletion core/examples/job_logging_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::path::PathBuf;
use tokio::time::{sleep, Duration};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt()
.with_env_filter("sd_core=debug")
Expand Down
5 changes: 3 additions & 2 deletions core/examples/library_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::path::PathBuf;
use uuid::Uuid;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt()
.with_env_filter("sd_core=debug")
Expand Down Expand Up @@ -125,8 +125,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
accessed_at: Set(None),
indexed_at: Set(None),
permissions: Set(None),
device_id: Set(Some(inserted_device.id)),
inode: Set(None),
volume_id: Set(None),
};
let entry_record = entry.insert(db.conn()).await?;

Expand All @@ -143,6 +143,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
error_message: Set(None),
total_file_count: Set(0),
total_byte_size: Set(0),
volume_id: Set(None),
job_policies: Set(None),
created_at: Set(chrono::Utc::now()),
updated_at: Set(chrono::Utc::now()),
Expand Down
2 changes: 1 addition & 1 deletion core/examples/pause_resume_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use tempfile::TempDir;
use tokio::time::sleep;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt::init();

Expand Down
2 changes: 1 addition & 1 deletion core/examples/shutdown_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::time::Duration;
use tokio::time::sleep;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt::init();

Expand Down
2 changes: 1 addition & 1 deletion core/examples/simple_pause_resume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::time::Duration;
use tokio::time::sleep;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt::init();

Expand Down
2 changes: 1 addition & 1 deletion core/examples/test_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sea_orm::{ConnectionTrait, Database, Statement};
use sea_orm_migration::MigratorTrait;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion core/examples/volume_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::time::Duration;
use tokio::time::timeout;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
tracing_subscriber::fmt()
.with_env_filter("sd_core=info")
Expand Down
3 changes: 2 additions & 1 deletion core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ pub mod app_config;
pub mod migration;

pub use app_config::{
AppConfig, JobLoggingConfig, LogStreamConfig, LoggingConfig, ServiceConfig, SpacebotConfig,
AppConfig, JobLoggingConfig, LogStreamConfig, LoggingConfig, ProxyPairingConfig, ServiceConfig,
SpacebotConfig,
};
pub use migration::Migrate;

Expand Down
70 changes: 50 additions & 20 deletions core/tests/ephemeral_watcher_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ struct TestHarness {

impl TestHarness {
/// Setup the test environment with core and ephemeral watching
async fn setup() -> Result<Self, Box<dyn std::error::Error>> {
async fn setup() -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
// Setup logging
let _ = tracing_subscriber::fmt()
.with_env_filter("sd_core=debug,ephemeral_watcher_test=debug")
Expand Down Expand Up @@ -487,7 +487,7 @@ impl TestHarness {
&self,
name: &str,
content: &str,
) -> Result<(), Box<dyn std::error::Error>> {
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
tokio::fs::write(&path, content).await?;
println!("Created file: {}", name);
Expand All @@ -499,23 +499,30 @@ impl TestHarness {
&self,
name: &str,
new_content: &str,
) -> Result<(), Box<dyn std::error::Error>> {
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
tokio::fs::write(&path, new_content).await?;
println!("Modified file: {}", name);
Ok(())
}

/// Delete a file
async fn delete_file(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn delete_file(
&self,
name: &str,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
tokio::fs::remove_file(&path).await?;
println!("Deleted file: {}", name);
Ok(())
}

/// Rename/move a file
async fn rename_file(&self, from: &str, to: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn rename_file(
&self,
from: &str,
to: &str,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let from_path = self.path(from);
let to_path = self.path(to);
tokio::fs::rename(&from_path, &to_path).await?;
Expand All @@ -524,23 +531,26 @@ impl TestHarness {
}

/// Create a directory
async fn create_dir(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn create_dir(&self, name: &str) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
tokio::fs::create_dir_all(&path).await?;
println!("Created directory: {}", name);
Ok(())
}

/// Delete a directory recursively
async fn delete_dir(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn delete_dir(&self, name: &str) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
tokio::fs::remove_dir_all(&path).await?;
println!("Deleted directory recursively: {}", name);
Ok(())
}

/// Create multiple files at the top level (batch creation test)
async fn create_batch_files(&self, files: &[&str]) -> Result<(), Box<dyn std::error::Error>> {
async fn create_batch_files(
&self,
files: &[&str],
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
for file in files {
let full_path = self.path(file);
tokio::fs::write(&full_path, format!("Content of {}", file)).await?;
Expand All @@ -554,7 +564,7 @@ impl TestHarness {
&self,
name: &str,
trash_dir: &std::path::Path,
) -> Result<(), Box<dyn std::error::Error>> {
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let from_path = self.path(name);
let to_path = trash_dir.join(name);
tokio::fs::rename(&from_path, &to_path).await?;
Expand All @@ -567,7 +577,7 @@ impl TestHarness {
&self,
name: &str,
trash_dir: &std::path::Path,
) -> Result<(), Box<dyn std::error::Error>> {
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let from_path = trash_dir.join(name);
let to_path = self.path(name);
tokio::fs::rename(&from_path, &to_path).await?;
Expand All @@ -576,15 +586,21 @@ impl TestHarness {
}

/// Create multiple directories at the top level
async fn create_batch_dirs(&self, dirs: &[&str]) -> Result<(), Box<dyn std::error::Error>> {
async fn create_batch_dirs(
&self,
dirs: &[&str],
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
for dir in dirs {
self.create_dir(dir).await?;
}
Ok(())
}

/// Verify entry exists in ephemeral index
async fn verify_entry_exists(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn verify_entry_exists(
&self,
name: &str,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);

// Poll for the entry to appear (with timeout)
Expand All @@ -610,7 +626,10 @@ impl TestHarness {
}

/// Verify entry does NOT exist in ephemeral index
async fn verify_entry_not_exists(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn verify_entry_not_exists(
&self,
name: &str,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);

// Poll for the entry to be removed (with timeout)
Expand All @@ -636,7 +655,10 @@ impl TestHarness {
}

/// Verify entry is a directory
async fn verify_is_directory(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn verify_is_directory(
&self,
name: &str,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
let index = self.context.ephemeral_cache().get_global_index();
let mut index_lock = index.write().await;
Expand All @@ -657,7 +679,10 @@ impl TestHarness {
}

/// Verify entry is a file (not directory)
async fn verify_is_file(&self, name: &str) -> Result<(), Box<dyn std::error::Error>> {
async fn verify_is_file(
&self,
name: &str,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let path = self.path(name);
let index = self.context.ephemeral_cache().get_global_index();
let mut index_lock = index.write().await;
Expand Down Expand Up @@ -703,7 +728,7 @@ impl TestHarness {
async fn verify_children_count(
&self,
expected: usize,
) -> Result<(), Box<dyn std::error::Error>> {
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let count = self.get_children_count().await;
if count == expected {
println!("✓ Children count (list_directory) matches: {}", expected);
Expand All @@ -718,7 +743,10 @@ impl TestHarness {
}

/// Verify expected entry count
async fn verify_entry_count(&self, expected: usize) -> Result<(), Box<dyn std::error::Error>> {
async fn verify_entry_count(
&self,
expected: usize,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let count = self.get_entry_count().await;
if count == expected {
println!("✓ Entry count matches: {}", expected);
Expand Down Expand Up @@ -804,7 +832,7 @@ impl TestHarness {
}

/// Clean up test resources
async fn cleanup(self) -> Result<(), Box<dyn std::error::Error>> {
async fn cleanup(self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Dump events before cleanup
self.dump_events().await;

Expand All @@ -830,7 +858,9 @@ impl TestHarness {
}

/// Inner test logic that can fail
async fn run_test_scenarios(harness: &TestHarness) -> Result<(), Box<dyn std::error::Error>> {
async fn run_test_scenarios(
harness: &TestHarness,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Note: Entry counts include +1 for the root directory itself which is indexed

// ========================================================================
Expand Down Expand Up @@ -1206,7 +1236,7 @@ async fn run_test_scenarios(harness: &TestHarness) -> Result<(), Box<dyn std::er

/// Comprehensive "story" test demonstrating ephemeral watcher functionality
#[tokio::test]
async fn test_ephemeral_watcher() -> Result<(), Box<dyn std::error::Error>> {
async fn test_ephemeral_watcher() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
println!("\n=== Ephemeral Watcher Full Story Test ===\n");

let harness = TestHarness::setup().await?;
Expand Down
11 changes: 6 additions & 5 deletions core/tests/event_system_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use tokio::sync::Mutex;
use tokio::time::{timeout, Duration};

#[tokio::test]
async fn test_core_and_library_events() -> Result<(), Box<dyn std::error::Error>> {
async fn test_core_and_library_events() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let temp_dir = TempDir::new()?;

// Set up event collection
Expand Down Expand Up @@ -122,7 +122,7 @@ async fn test_core_and_library_events() -> Result<(), Box<dyn std::error::Error>
}

#[tokio::test]
async fn test_location_and_job_events() -> Result<(), Box<dyn std::error::Error>> {
async fn test_location_and_job_events() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let temp_dir = TempDir::new()?;
let core = Core::new(temp_dir.path().to_path_buf()).await?;

Expand Down Expand Up @@ -241,7 +241,7 @@ async fn test_location_and_job_events() -> Result<(), Box<dyn std::error::Error>
}

#[tokio::test]
async fn test_event_filtering() -> Result<(), Box<dyn std::error::Error>> {
async fn test_event_filtering() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let temp_dir = TempDir::new()?;
let core = Core::new(temp_dir.path().to_path_buf()).await?;

Expand Down Expand Up @@ -308,7 +308,8 @@ async fn test_event_filtering() -> Result<(), Box<dyn std::error::Error>> {
}

#[tokio::test]
async fn test_concurrent_event_subscribers() -> Result<(), Box<dyn std::error::Error>> {
async fn test_concurrent_event_subscribers() -> Result<(), Box<dyn std::error::Error + Send + Sync>>
{
let temp_dir = TempDir::new()?;
let core = Core::new(temp_dir.path().to_path_buf()).await?;

Expand Down Expand Up @@ -391,7 +392,7 @@ async fn test_concurrent_event_subscribers() -> Result<(), Box<dyn std::error::E
}

#[tokio::test]
async fn test_custom_events() -> Result<(), Box<dyn std::error::Error>> {
async fn test_custom_events() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let temp_dir = TempDir::new()?;
let core = Core::new(temp_dir.path().to_path_buf()).await?;

Expand Down
2 changes: 1 addition & 1 deletion core/tests/file_structure_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{sync::Arc, time::Duration};
use tempfile::TempDir;

#[tokio::test]
async fn map_file_structure_per_phase() -> Result<(), Box<dyn std::error::Error>> {
async fn map_file_structure_per_phase() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
tracing_subscriber::fmt::init();
eprintln!("\nMAPPING FILE STRUCTURE AT EACH PHASE\n");
eprintln!("{}", "=".repeat(80));
Expand Down
2 changes: 2 additions & 0 deletions core/tests/file_sync_simple_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ impl FileSyncTestSetup {
statistics_listener_enabled: false,
},
logging: sd_core::config::LoggingConfig::default(),
proxy_pairing: sd_core::config::ProxyPairingConfig::default(),
spacebot: sd_core::config::SpacebotConfig::default(),
};
config.save()?;

Expand Down
Loading