Skip to content

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

style: cargo fmt on pipes/mod.rs and meeting_detector.rs

Louis Beaumontc5f468d68053
diff --git a/crates/screenpipe-core/src/pipes/mod.rs b/crates/screenpipe-core/src/pipes/mod.rs
index ee6c718de..cd7020dc6 100644
--- a/crates/screenpipe-core/src/pipes/mod.rs
+++ b/crates/screenpipe-core/src/pipes/mod.rs
@@ -4803,7 +4803,11 @@ mod tests {
// Must not contain duplicate trigger keys
let trigger_count = serialized.matches("trigger:").count();
- assert_eq!(trigger_count, 1, "serialized YAML has duplicate 'trigger:' keys:\n{}", serialized);
+ assert_eq!(
+ trigger_count, 1,
+ "serialized YAML has duplicate 'trigger:' keys:\n{}",
+ serialized
+ );
// Round-trip must parse back identically
let (config2, body2) = parse_frontmatter(&serialized).unwrap();
@@ -4820,7 +4824,11 @@ mod tests {
assert!(config.trigger.is_none());
let serialized = serialize_pipe(&config, &body).unwrap();
- assert!(!serialized.contains("trigger:"), "trigger: should not appear when None:\n{}", serialized);
+ assert!(
+ !serialized.contains("trigger:"),
+ "trigger: should not appear when None:\n{}",
+ serialized
+ );
let (config2, _) = parse_frontmatter(&serialized).unwrap();
assert!(config2.trigger.is_none());
@@ -4834,9 +4842,27 @@ mod tests {
let serialized = serialize_pipe(&config, &body).unwrap();
// Check no known field appears more than once
- for field in &["schedule:", "enabled:", "model:", "provider:", "preset:", "connections:", "timeout:", "trigger:", "source_slug:", "installed_version:", "source_hash:"] {
+ for field in &[
+ "schedule:",
+ "enabled:",
+ "model:",
+ "provider:",
+ "preset:",
+ "connections:",
+ "timeout:",
+ "trigger:",
+ "source_slug:",
+ "installed_version:",
+ "source_hash:",
+ ] {
let count = serialized.matches(field).count();
- assert!(count <= 1, "field '{}' appears {} times in serialized YAML:\n{}", field, count, serialized);
+ assert!(
+ count <= 1,
+ "field '{}' appears {} times in serialized YAML:\n{}",
+ field,
+ count,
+ serialized
+ );
}
// Must round-trip
@@ -4868,7 +4894,11 @@ mod tests {
// serialize_pipe should have cleaned the duplicate from extras
let trigger_count = serialized.matches("trigger:").count();
- assert_eq!(trigger_count, 1, "duplicate trigger: not cleaned from extras:\n{}", serialized);
+ assert_eq!(
+ trigger_count, 1,
+ "duplicate trigger: not cleaned from extras:\n{}",
+ serialized
+ );
// Must still parse correctly
let (config2, _) = parse_frontmatter(&serialized).unwrap();
@@ -4882,31 +4912,81 @@ mod tests {
let (mut config, body) = parse_frontmatter(content).unwrap();
// Insert every known field into extras HashMap (worst case scenario)
- config.config.insert("schedule".to_string(), serde_json::json!("every 2h"));
- config.config.insert("enabled".to_string(), serde_json::json!(false));
- config.config.insert("model".to_string(), serde_json::json!("gpt-4"));
- config.config.insert("provider".to_string(), serde_json::json!("openai"));
- config.config.insert("trigger".to_string(), serde_json::json!({"events": ["x"]}));
- config.config.insert("connections".to_string(), serde_json::json!(["slack"]));
- config.config.insert("timeout".to_string(), serde_json::json!(300));
- config.config.insert("source_slug".to_string(), serde_json::json!("test"));
- config.config.insert("installed_version".to_string(), serde_json::json!(1));
- config.config.insert("source_hash".to_string(), serde_json::json!("abc"));
- config.config.insert("preset".to_string(), serde_json::json!("my-preset"));
- config.config.insert("name".to_string(), serde_json::json!("test-pipe"));
- config.config.insert("config".to_string(), serde_json::json!({"old": true}));
+ config
+ .config
+ .insert("schedule".to_string(), serde_json::json!("every 2h"));
+ config
+ .config
+ .insert("enabled".to_string(), serde_json::json!(false));
+ config
+ .config
+ .insert("model".to_string(), serde_json::json!("gpt-4"));
+ config
+ .config
+ .insert("provider".to_string(), serde_json::json!("openai"));
+ config
+ .config
+ .insert("trigger".to_string(), serde_json::json!({"events": ["x"]}));
+ config
+ .config
+ .insert("connections".to_string(), serde_json::json!(["slack"]));
+ config
+ .config
+ .insert("timeout".to_string(), serde_json::json!(300));
+ config
+ .config
+ .insert("source_slug".to_string(), serde_json::json!("test"));
+ config
+ .config
+ .insert("installed_version".to_string(), serde_json::json!(1));
+ config
+ .config
+ .insert("source_hash".to_string(), serde_json::json!("abc"));
+ config
+ .config
+ .insert("preset".to_string(), serde_json::json!("my-preset"));
+ config
+ .config
+ .insert("name".to_string(), serde_json::json!("test-pipe"));
+ config
+ .config
+ .insert("config".to_string(), serde_json::json!({"old": true}));
let serialized = serialize_pipe(&config, &body).unwrap();
// Every known field should appear at most once
- for field in &["schedule:", "enabled:", "model:", "trigger:", "connections:", "timeout:", "source_slug:", "installed_version:", "source_hash:"] {
+ for field in &[
+ "schedule:",
+ "enabled:",
+ "model:",
+ "trigger:",
+ "connections:",
+ "timeout:",
+ "source_slug:",
+ "installed_version:",
+ "source_hash:",
+ ] {
let count = serialized.matches(field).count();
- assert!(count <= 1, "field '{}' appears {} times after cleanup:\n{}", field, count, serialized);
+ assert!(
+ count <= 1,
+ "field '{}' appears {} times after cleanup:\n{}",
+ field,
+ count,
+ serialized
+ );
}
// "config:" and "name:" should not appear at all (they're stripped)
- assert!(!serialized.contains("\nconfig:"), "legacy 'config:' not cleaned:\n{}", serialized);
- assert!(!serialized.contains("\nname:"), "'name:' should be stripped:\n{}", serialized);
+ assert!(
+ !serialized.contains("\nconfig:"),
+ "legacy 'config:' not cleaned:\n{}",
+ serialized
+ );
+ assert!(
+ !serialized.contains("\nname:"),
+ "'name:' should be stripped:\n{}",
+ serialized
+ );
// Must still parse without error
parse_frontmatter(&serialized).expect("round-trip parse failed after extras cleanup");
@@ -4919,14 +4999,18 @@ mod tests {
let (mut config, body) = parse_frontmatter(content).unwrap();
// Simulate the update_config match arm for "trigger"
- let trigger_json = serde_json::json!({"events": ["new_event"], "custom": ["when I open chrome"]});
+ let trigger_json =
+ serde_json::json!({"events": ["new_event"], "custom": ["when I open chrome"]});
match serde_json::from_value::<TriggerConfig>(trigger_json.clone()) {
Ok(t) => config.trigger = Some(t),
Err(_) => panic!("trigger deserialization should succeed"),
}
// Verify trigger is NOT in extras
- assert!(!config.config.contains_key("trigger"), "trigger leaked into extras HashMap");
+ assert!(
+ !config.config.contains_key("trigger"),
+ "trigger leaked into extras HashMap"
+ );
let serialized = serialize_pipe(&config, &body).unwrap();
let trigger_count = serialized.matches("trigger:").count();
@@ -4950,7 +5034,11 @@ mod tests {
let serialized = serialize_pipe(&config, &body).unwrap();
let trigger_count = serialized.matches("trigger:").count();
- assert_eq!(trigger_count, 1, "trigger duplicated on iteration {}:\n{}", i, serialized);
+ assert_eq!(
+ trigger_count, 1,
+ "trigger duplicated on iteration {}:\n{}",
+ i, serialized
+ );
// Re-parse for next iteration (simulates read-modify-write cycle)
let (new_config, _) = parse_frontmatter(&serialized).unwrap();
@@ -4967,11 +5055,26 @@ mod tests {
// Extra fields that are NOT known should survive round-trip
let content = "---\nschedule: every 1h\nenabled: true\nmy_custom_field: hello\nanother: 42\n---\n\nTest";
let (config, body) = parse_frontmatter(content).unwrap();
- assert_eq!(config.config.get("my_custom_field").and_then(|v| v.as_str()), Some("hello"));
+ assert_eq!(
+ config
+ .config
+ .get("my_custom_field")
+ .and_then(|v| v.as_str()),
+ Some("hello")
+ );
let serialized = serialize_pipe(&config, &body).unwrap();
let (config2, _) = parse_frontmatter(&serialized).unwrap();
- assert_eq!(config2.config.get("my_custom_field").and_then(|v| v.as_str()), Some("hello"));
- assert_eq!(config2.config.get("another").and_then(|v| v.as_i64()), Some(42));
+ assert_eq!(
+ config2
+ .config
+ .get("my_custom_field")
+ .and_then(|v| v.as_str()),
+ Some("hello")
+ );
+ assert_eq!(
+ config2.config.get("another").and_then(|v| v.as_i64()),
+ Some(42)
+ );
}
}
diff --git a/crates/screenpipe-engine/src/meeting_detector.rs b/crates/screenpipe-engine/src/meeting_detector.rs
index dd3631270..7ddaef154 100644
--- a/crates/screenpipe-engine/src/meeting_detector.rs
+++ b/crates/screenpipe-engine/src/meeting_detector.rs
@@ -2511,7 +2511,13 @@ mod tests {
});
assert!(teams.is_some(), "Teams profile not found");
let teams_profile = teams.unwrap();
- assert!(teams_profile.app_identifiers.macos_app_names.contains(&"msteams"), "MSTeams not added to macos_app_names");
+ assert!(
+ teams_profile
+ .app_identifiers
+ .macos_app_names
+ .contains(&"msteams"),
+ "MSTeams not added to macos_app_names"
+ );
}
#[test]