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

Keep desktop diagnostics at five minutes and flush on graceful shutdown

Louis Beaumont72389cd33659
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
index b1f20516c..bf702f167 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
@@ -651,7 +651,7 @@ impl ServerCore {
let resource_reporter = ResourceTelemetryReporter::new(config.analytics_enabled);
resource_reporter.start_monitoring(
Duration::from_secs(30),
- Some(screenpipe_engine::telemetry_reporting::DIAGNOSTIC_REPORT_INTERVAL),
+ Some(screenpipe_engine::telemetry_reporting::DESKTOP_DIAGNOSTIC_REPORT_INTERVAL),
);
start_sleep_monitor();
@@ -666,6 +666,10 @@ impl ServerCore {
config.use_pii_removal,
config.video_quality.clone(),
);
+ let diagnostic_shutdown = resource_reporter.shutdown_handle();
+ server.diagnostic_shutdown = diagnostic_shutdown.clone();
+ server.diagnostic_report_interval =
+ screenpipe_engine::telemetry_reporting::DESKTOP_DIAGNOSTIC_REPORT_INTERVAL;
server.workflow_catalog_dir = workflow_catalog_dir;
server.vision_metrics = vision_metrics.clone();
server.audio_metrics = audio_manager.metrics.clone();
@@ -1141,6 +1145,7 @@ impl ServerCore {
// Err means the sender dropped, which only happens when
// the whole ServerCore is gone — treat as shutdown.
let _ = shutdown_rx.wait_for(|stop| *stop).await;
+ diagnostic_shutdown.flush().await;
},
))
.catch_unwind()
diff --git a/crates/screenpipe-engine/src/analytics.rs b/crates/screenpipe-engine/src/analytics.rs
index 3469b36ea..f3bddabaf 100644
--- a/crates/screenpipe-engine/src/analytics.rs
+++ b/crates/screenpipe-engine/src/analytics.rs
@@ -208,6 +208,15 @@ pub fn capture_event_nonblocking(event: &'static str, properties: Value) {
});
}
+/// Routine diagnostics stay nonblocking; graceful shutdown awaits a bounded send.
+pub(crate) async fn capture_diagnostic(event: &'static str, properties: Value, final_report: bool) {
+ if final_report {
+ crate::telemetry_reporting::finish_report(capture_event(event, properties)).await;
+ } else {
+ capture_event_nonblocking(event, properties);
+ }
+}
+
/// Parse macOS version string (e.g., "14.5" or "10.15.7") into major version number
#[cfg(target_os = "macos")]
fn parse_macos_major_version(version_str: &str) -> Option<u32> {
diff --git a/crates/screenpipe-engine/src/bin/screenpipe-engine.rs b/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
index 2f4c6e636..18438bbdf 100644
--- a/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
+++ b/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
@@ -1069,7 +1069,7 @@ async fn run(cli: Cli, record_arg_sources: RecordArgSources) -> anyhow::Result<(
let resource_reporter = ResourceTelemetryReporter::new(config.analytics_enabled);
resource_reporter.start_monitoring(
Duration::from_secs(30),
- Some(screenpipe_engine::telemetry_reporting::DIAGNOSTIC_REPORT_INTERVAL),
+ Some(screenpipe_engine::telemetry_reporting::CLI_DIAGNOSTIC_REPORT_INTERVAL),
);
// Initialize analytics for API tracking
@@ -1506,6 +1506,7 @@ async fn run(cli: Cli, record_arg_sources: RecordArgSources) -> anyhow::Result<(
config.use_pii_removal,
config.video_quality.clone(),
);
+ server.diagnostic_shutdown = resource_reporter.shutdown_handle();
server.vision_metrics = vision_metrics;
server.audio_metrics = audio_manager.metrics.clone();
server.hot_frame_cache = Some(hot_frame_cache);
@@ -2486,6 +2487,7 @@ async fn run(cli: Cli, record_arg_sources: RecordArgSources) -> anyhow::Result<(
handle.stop();
}
let teardown = async {
+ resource_reporter.shutdown().await;
if let Err(error) = audio_manager.shutdown().await {
warn!("audio shutdown during database recovery: {error}");
}
diff --git a/crates/screenpipe-engine/src/resource_monitor.rs b/crates/screenpipe-engine/src/resource_monitor.rs
index d0759a486..b05acd227 100644
--- a/crates/screenpipe-engine/src/resource_monitor.rs
+++ b/crates/screenpipe-engine/src/resource_monitor.rs
@@ -19,6 +19,7 @@ use tracing::{error, info, warn};
use crate::resource_summary::ResourceReportWindow;
use crate::telemetry_context::TelemetryContext;
+use crate::telemetry_reporting::{finish_report, DiagnosticShutdown};
const RESOURCE_PROCESS_GROUPS: [(&str, &str); 5] = [
("screenpipe_app", "app"),
@@ -152,6 +153,7 @@ fn analyze_memory_trend(samples: &[(f64, f64)]) -> Option<LeakStats> {
/// governance live in `screenpipe-resource`; this type owns only reporting,
/// leak policy, and engine telemetry integrations.
pub struct ResourceTelemetryReporter {
+ diagnostic_shutdown: Arc<DiagnosticShutdown>,
start_time: Instant,
resource_log_file: Option<String>, // analyse output here: https://colab.research.google.com/drive/1zELlGdzGdjChWKikSqZTHekm5XRxY-1r?usp=sharing
posthog_client: Option<Client>,
@@ -449,6 +451,7 @@ impl ResourceTelemetryReporter {
);
Arc::new(Self {
+ diagnostic_shutdown: Arc::default(),
start_time: Instant::now(),
resource_log_file,
posthog_client,
@@ -783,6 +786,10 @@ impl ResourceTelemetryReporter {
}
}
+ pub fn shutdown_handle(&self) -> Arc<DiagnosticShutdown> {
+ self.diagnostic_shutdown.clone()
+ }
+
pub fn start_monitoring(
self: &Arc<Self>,
interval: Duration,
@@ -796,11 +803,26 @@ impl ResourceTelemetryReporter {
let mut last_posthog_update: Option<Instant> = None;
let mut window = ResourceReportWindow::default();
- tokio::spawn(async move {
+ let shutdown = self.diagnostic_shutdown.clone();
+ tokio::spawn(self.diagnostic_shutdown.track(async move {
let mut sampler = ResourceSampler::new();
loop {
tokio::select! {
+ biased;
+ _ = shutdown.cancelled() => {
+ // Refresh once more so sessions shorter than the local
+ // sampling interval and the last partial window survive.
+ sampler.refresh();
+ let snapshot = sampler.snapshot();
+ window.observe(
+ f64::from(snapshot.total_cpu_percent),
+ snapshot.total_memory_gb,
+ snapshot.phys_footprint_gb,
+ );
+ finish_report(monitor.log_status(&snapshot, &window)).await;
+ break;
+ }
_ = tokio::time::sleep(interval) => {
sampler.refresh();
@@ -848,7 +870,7 @@ impl ResourceTelemetryReporter {
}
}
}
- });
+ }));
}
async fn log_status_local(&self, snapshot: &ResourceSnapshot) {
@@ -864,15 +886,13 @@ impl ResourceTelemetryReporter {
}
pub async fn shutdown(&self) {
+ self.diagnostic_shutdown.flush().await;
if let Some(ref file) = self.resource_log_file {
if let Ok(mut f) = OpenOptions::new().write(true).open(file) {
let _ = f.flush();
}
}
- if self.posthog_client.is_some() {
- tokio::time::sleep(Duration::from_millis(100)).await;
- }
}
}
diff --git a/crates/screenpipe-engine/src/server.rs b/crates/screenpipe-engine/src/server.rs
index c6e597279..5f1c97431 100644
--- a/crates/screenpipe-engine/src/server.rs
+++ b/crates/screenpipe-engine/src/server.rs
@@ -13,7 +13,9 @@ use screenpipe_audio::audio_manager::AudioManager;
use screenpipe_core::sync::SyncServiceHandle;
use tracing::{debug, error, info};
-use crate::telemetry_reporting::HealthReportSchedule;
+use crate::telemetry_reporting::{
+ DiagnosticShutdown, HealthReportSchedule, CLI_DIAGNOSTIC_REPORT_INTERVAL,
+};
use crate::{
analytics,
@@ -255,6 +257,8 @@ pub struct AppState {
}
pub struct SCServer {
+ pub diagnostic_shutdown: Arc<DiagnosticShutdown>,
+ pub diagnostic_report_interval: Duration,
/// Exact catalog directory supplied by the desktop owner; never inferred from another app.
pub workflow_catalog_dir: Option<PathBuf>,
db: Arc<DatabaseManager>,
@@ -390,6 +394,8 @@ impl SCServer {
) -> Self {
let audio_metrics = audio_manager.metrics.clone();
SCServer {
+ diagnostic_shutdown: Arc::default(),
+ diagnostic_report_interval: CLI_DIAGNOSTIC_REPORT_INTERVAL,
workflow_catalog_dir: None,
db,
history_access: HistoryAccessPolicy::unrestricted(),
@@ -654,32 +660,40 @@ impl SCServer {
}
});
- // Check pipeline failures every minute; report healthy summaries every 15 minutes.
+ // Check failures every minute; use the owner-selected healthy cadence.
let metrics_for_posthog = self.vision_metrics.clone();
- telemetry_tasks.spawn(async move {
+ let shutdown = self.diagnostic_shutdown.clone();
+ let report_interval = self.diagnostic_report_interval;
+ telemetry_tasks.spawn(self.diagnostic_shutdown.track(async move {
let mut interval = tokio::time::interval(Duration::from_secs(60));
let started = std::time::Instant::now();
- let mut reports = HealthReportSchedule::new();
+ let mut reports = HealthReportSchedule::new(report_interval);
loop {
- interval.tick().await;
+ let stopping = tokio::select! {
+ biased;
+ _ = shutdown.cancelled() => true,
+ _ = interval.tick() => false,
+ };
let snap = metrics_for_posthog.snapshot();
// Only report if the pipeline has captured any frames
if snap.frames_captured > 0
- && reports.should_report(
- started.elapsed(),
- [snap.frames_dropped, snap.pipeline_stall_count],
- )
+ && (stopping
+ || reports.should_report(
+ started.elapsed(),
+ [snap.frames_dropped, snap.pipeline_stall_count],
+ ))
{
// Recording-coverage reliability metric: what % of the
// user's working time had healthy capture. Sampled
// independently (5s sampler); snapshotted here so the
// fleet sees coverage alongside raw pipeline counters.
let cov = crate::recording_coverage::coverage_snapshot();
- analytics::capture_event_nonblocking(
+ analytics::capture_diagnostic(
"vision_pipeline_health",
json!({
"uptime_secs": snap.uptime_secs,
- "telemetry_report_interval_secs": crate::telemetry_reporting::DIAGNOSTIC_REPORT_INTERVAL.as_secs(),
+ "telemetry_report_interval_secs": report_interval.as_secs(),
+ "shutdown_report": stopping,
"frames_captured": snap.frames_captured,
"frames_skipped": snap.frames_skipped,
"ocr_completed": snap.ocr_completed,
@@ -711,20 +725,30 @@ impl SCServer {
"recording_active_paused_secs": cov.active_paused_secs,
"recording_idle_secs": cov.idle_secs,
}),
- );
+ stopping,
+ )
+ .await;
+ }
+ if stopping {
+ break;
}
}
- });
+ }));
// Keep minute-level failure/device checks without sending healthy polls.
let audio_metrics_for_posthog = self.audio_metrics.clone();
let audio_manager_for_posthog = self.audio_manager.clone();
- telemetry_tasks.spawn(async move {
+ let shutdown = self.diagnostic_shutdown.clone();
+ telemetry_tasks.spawn(self.diagnostic_shutdown.track(async move {
let mut interval = tokio::time::interval(Duration::from_secs(60));
let started = std::time::Instant::now();
- let mut reports = HealthReportSchedule::new();
+ let mut reports = HealthReportSchedule::new(report_interval);
loop {
- interval.tick().await;
+ let stopping = tokio::select! {
+ biased;
+ _ = shutdown.cancelled() => true,
+ _ = interval.tick() => false,
+ };
let snap = audio_metrics_for_posthog.snapshot();
// Only report if the pipeline has processed any chunks
if snap.chunks_sent > 0 || snap.vad_rejected > 0 {
@@ -742,16 +766,17 @@ impl SCServer {
snap.process_errors,
snap.transcription_errors,
];
- if !reports
- .should_report(started.elapsed(), (failure_counts, devices.clone()))
+ if !stopping
+ && !reports.should_report(started.elapsed(), (failure_counts, devices.clone()))
{
continue;
}
- analytics::capture_event_nonblocking(
+ analytics::capture_diagnostic(
"audio_pipeline_health",
json!({
"uptime_secs": snap.uptime_secs,
- "telemetry_report_interval_secs": crate::telemetry_reporting::DIAGNOSTIC_REPORT_INTERVAL.as_secs(),
+ "telemetry_report_interval_secs": report_interval.as_secs(),
+ "shutdown_report": stopping,
"chunks_sent": snap.chunks_sent,
"chunks_received": snap.chunks_received,
"chunks_channel_full": snap.chunks_channel_full,
@@ -778,10 +803,15 @@ impl SCServer {
"audio_devices": devices,
"audio_device_count": device_count,
}),
- );
+ stopping,
+ )
+ .await;
+ }
+ if stopping {
+ break;
}
}
- });
+ }));
// Permanent subscriber that forwards allowlisted piggyback telemetry
// (meeting summaries + mic capture health) from the in-process events
diff --git a/crates/screenpipe-engine/src/telemetry_reporting.rs b/crates/screenpipe-engine/src/telemetry_reporting.rs
index d75fee9ed..c413999a4 100644
--- a/crates/screenpipe-engine/src/telemetry_reporting.rs
+++ b/crates/screenpipe-engine/src/telemetry_reporting.rs
@@ -5,23 +5,72 @@ use std::time::Duration;
/// Healthy diagnostics are summaries, not activity events. Local sampling and
/// failure checks keep their existing cadence.
-pub const DIAGNOSTIC_REPORT_INTERVAL: Duration = Duration::from_secs(15 * 60);
+pub const DESKTOP_DIAGNOSTIC_REPORT_INTERVAL: Duration = Duration::from_secs(5 * 60);
+pub const CLI_DIAGNOSTIC_REPORT_INTERVAL: Duration = Duration::from_secs(15 * 60);
+
+const FINAL_REPORT_TIMEOUT: Duration = Duration::from_millis(750);
+
+/// Shared by resource and pipeline reporters in one engine generation. Flushes
+/// run concurrently and cannot hold up graceful quit on a slow network.
+#[derive(Default)]
+pub struct DiagnosticShutdown {
+ stop: tokio_util::sync::CancellationToken,
+ tasks: tokio_util::task::TaskTracker,
+}
+
+impl DiagnosticShutdown {
+ pub(crate) fn track(
+ &self,
+ future: impl std::future::Future<Output = ()> + Send + 'static,
+ ) -> impl std::future::Future<Output = ()> + Send + 'static {
+ self.tasks.track_future(future)
+ }
+
+ pub(crate) async fn cancelled(&self) {
+ self.stop.cancelled().await;
+ }
+
+ /// Best effort: a network failure must not prevent quitting or restarting.
+ pub async fn flush(&self) {
+ self.stop.cancel();
+ self.tasks.close();
+ if tokio::time::timeout(Duration::from_secs(1), self.tasks.wait())
+ .await
+ .is_err()
+ {
+ tracing::debug!("diagnostic shutdown flush timed out");
+ }
+ }
+}
+
+pub(crate) async fn finish_report(report: impl std::future::Future<Output = ()>) {
+ if tokio::time::timeout(FINAL_REPORT_TIMEOUT, report)
+ .await
+ .is_err()
+ {
+ tracing::debug!("final diagnostic report timed out");
+ }
+}
/// Report startup, changed failure/device state, and a periodic heartbeat.
/// State contains only failure counters and device identity, never work counters:
/// increasing frames/chunks must not turn every healthy sample into a report.
pub(crate) struct HealthReportSchedule<T> {
+ interval: Duration,
last_report: Option<(Duration, T)>,
}
impl<T: PartialEq> HealthReportSchedule<T> {
- pub(crate) fn new() -> Self {
- Self { last_report: None }
+ pub(crate) fn new(interval: Duration) -> Self {
+ Self {
+ interval,
+ last_report: None,
+ }
}
pub(crate) fn should_report(&mut self, elapsed: Duration, state: T) -> bool {
let report = self.last_report.as_ref().is_none_or(|(last, previous)| {
- elapsed.saturating_sub(*last) >= DIAGNOSTIC_REPORT_INTERVAL || *previous != state
+ elapsed.saturating_sub(*last) >= self.interval || *previous != state
});
if report {
self.last_report = Some((elapsed, state));
@@ -35,17 +84,17 @@ mod tests {
use super::*;
#[test]
- fn healthy_minute_checks_emit_four_snapshots_per_hour() {
- let mut schedule = HealthReportSchedule::new();
+ fn desktop_healthy_minute_checks_emit_twelve_snapshots_per_hour() {
+ let mut schedule = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
let reports: Vec<_> = (0..60)
.filter(|minute| schedule.should_report(Duration::from_secs(minute * 60), [0, 0]))
.collect();
- assert_eq!(reports, [0, 15, 30, 45]);
+ assert_eq!(reports, (0..60).step_by(5).collect::<Vec<_>>());
}
#[test]
fn new_failures_report_on_the_next_check_without_waiting_for_heartbeat() {
- let mut schedule = HealthReportSchedule::new();
+ let mut schedule = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
assert!(schedule.should_report(Duration::ZERO, [0, 0]));
assert!(schedule.should_report(Duration::from_secs(60), [1, 0]));
assert!(!schedule.should_report(Duration::from_secs(120), [1, 0]));
@@ -54,7 +103,7 @@ mod tests {
#[test]
fn repeated_failures_are_not_sampled_away() {
- let mut schedule = HealthReportSchedule::new();
+ let mut schedule = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
for minute in 0..60 {
assert!(schedule.should_report(Duration::from_secs(minute * 60), [minute]));
}
@@ -62,7 +111,7 @@ mod tests {
#[test]
fn device_replacement_with_same_count_is_reported() {
- let mut schedule = HealthReportSchedule::new();
+ let mut schedule = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
assert!(schedule.should_report(Duration::ZERO, ([0], vec!["mic-a"])));
assert!(schedule.should_report(Duration::from_secs(60), ([0], vec!["mic-b"])));
assert!(!schedule.should_report(Duration::from_secs(120), ([0], vec!["mic-b"])));
@@ -70,21 +119,84 @@ mod tests {
#[test]
fn counter_reset_and_fresh_reporter_are_reported() {
- let mut schedule = HealthReportSchedule::new();
+ let mut schedule = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
assert!(schedule.should_report(Duration::from_secs(300), [10]));
assert!(schedule.should_report(Duration::from_secs(360), [0]));
- let mut restarted = HealthReportSchedule::new();
+ let mut restarted = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
assert!(restarted.should_report(Duration::ZERO, [0]));
}
#[test]
fn exact_boundary_and_long_sleep_report_once() {
- let mut schedule = HealthReportSchedule::new();
+ let mut schedule = HealthReportSchedule::new(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL);
assert!(schedule.should_report(Duration::ZERO, [0]));
- assert!(!schedule.should_report(DIAGNOSTIC_REPORT_INTERVAL - Duration::from_secs(1), [0]));
- assert!(schedule.should_report(DIAGNOSTIC_REPORT_INTERVAL, [0]));
+ assert!(!schedule.should_report(
+ DESKTOP_DIAGNOSTIC_REPORT_INTERVAL - Duration::from_secs(1),
+ [0]
+ ));
+ assert!(schedule.should_report(DESKTOP_DIAGNOSTIC_REPORT_INTERVAL, [0]));
let after_sleep = Duration::from_secs(24 * 3600);
assert!(schedule.should_report(after_sleep, [0]));
assert!(!schedule.should_report(after_sleep, [0]));
}
+
+ #[test]
+ fn cli_healthy_minute_checks_emit_four_snapshots_per_hour() {
+ let mut schedule = HealthReportSchedule::new(CLI_DIAGNOSTIC_REPORT_INTERVAL);
+ let reports: Vec<_> = (0..60)
+ .filter(|minute| schedule.should_report(Duration::from_secs(minute * 60), [0]))
+ .collect();
+ assert_eq!(reports, [0, 15, 30, 45]);
+ }
+
+ #[tokio::test(start_paused = true)]
+ async fn shutdown_flushes_latest_partial_window_without_waiting_for_timer() {
+ use std::sync::{
+ atomic::{AtomicU64, Ordering},
+ Arc,
+ };
+ let shutdown = Arc::new(DiagnosticShutdown::default());
+ let latest = Arc::new(AtomicU64::new(0));
+ let (tx, rx) = tokio::sync::oneshot::channel();
+ let signal = shutdown.clone();
+ let snapshot = latest.clone();
+ let task = tokio::spawn(shutdown.track(async move {
+ signal.cancelled().await;
+ finish_report(async move {
+ let _ = tx.send(snapshot.load(Ordering::Relaxed));
+ })
+ .await;
+ }));
+ latest.store(123, Ordering::Relaxed);
+ // No five-minute tick has elapsed. The final snapshot is fresh.
+ shutdown.flush().await;
+ assert_eq!(rx.await.unwrap(), 123);
+ task.await.unwrap();
+ // Repeated shutdown must not emit another report or hang.
+ shutdown.flush().await;
+ }
+
+ #[tokio::test(start_paused = true)]
+ async fn slow_final_upload_is_cancelled_without_holding_up_quit() {
+ use std::sync::Arc;
+ let shutdown = Arc::new(DiagnosticShutdown::default());
+ let signal = shutdown.clone();
+ let task = tokio::spawn(shutdown.track(async move {
+ signal.cancelled().await;
+ finish_report(std::future::pending()).await;
+ }));
+ let start = tokio::time::Instant::now();
+ shutdown.flush().await;
+ assert!(start.elapsed() <= Duration::from_secs(1));
+ task.await.unwrap();
+ }
+
+ #[tokio::test]
+ async fn aborted_router_reporter_does_not_leave_flush_waiting_for_a_dead_task() {
+ let shutdown = DiagnosticShutdown::default();
+ let task = tokio::spawn(shutdown.track(std::future::pending()));
+ task.abort();
+ let _ = task.await;
+ shutdown.flush().await;
+ }
}
diff --git a/docs/COVERAGE.md b/docs/COVERAGE.md
index d757f1ff4..f1838c5f3 100644
--- a/docs/COVERAGE.md
+++ b/docs/COVERAGE.md
@@ -38,15 +38,15 @@ results and `cargo llvm-cov` data on top when judging release confidence.
- Mapped suites: 37
- Mapped Rust files: 407
-- Active test blocks: 3958
+- Active test blocks: 3962
- Ignored/manual test blocks: 189
-- Weighted coverage points: 3261.4
+- Weighted coverage points: 3264.2
| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| windows | 33 | 3795 | 171 | 3188.4 | 21 | 11 | 100% |
-| macos | 32 | 3838 | 150 | 3183.7 | 22 | 11 | 100% |
-| linux | 29 | 3373 | 146 | 2806.7 | 20 | 11 | 100% |
+| windows | 33 | 3799 | 171 | 3191.2 | 21 | 11 | 100% |
+| macos | 32 | 3842 | 150 | 3186.5 | 22 | 11 | 100% |
+| linux | 29 | 3377 | 146 | 2809.5 | 20 | 11 | 100% |
## Refresh
diff --git a/docs/coverage/CORE.md b/docs/coverage/CORE.md
index 831fb34e4..abb22dbd7 100644
--- a/docs/coverage/CORE.md
+++ b/docs/coverage/CORE.md
@@ -9,10 +9,10 @@ confidence, and criticality.
- Tracked crates: screenpipe-engine, screenpipe-db, screenpipe-sqlite-coordinator, screenpipe-audio, screenpipe-screen, screenpipe-a11y, screenpipe-fs
- Mapped suites: 37
- Mapped Rust files: 407
-- Active test blocks: 3958
+- Active test blocks: 3962
- Ignored/manual test blocks: 189
-- Declared test blocks: 4147
-- Weighted coverage points: 3261.4
+- Declared test blocks: 4151
+- Weighted coverage points: 3264.2
Confidence weights: strong=1.0, partial=0.7, conditional=0.4, smoke=0.3.
Criticality weights: high=1.0, medium=0.7, low=0.4.
@@ -23,15 +23,15 @@ are explicitly enabled in a runtime lane.
| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| windows | 33 | 3795 | 171 | 3188.4 | 21 | 11 | 100% |
-| macos | 32 | 3838 | 150 | 3183.7 | 22 | 11 | 100% |
-| linux | 29 | 3373 | 146 | 2806.7 | 20 | 11 | 100% |
+| windows | 33 | 3799 | 171 | 3191.2 | 21 | 11 | 100% |
+| macos | 32 | 3842 | 150 | 3186.5 | 22 | 11 | 100% |
+| linux | 29 | 3377 | 146 | 2809.5 | 20 | 11 | 100% |
## Crate Summary
| Crate | Suites | Integration files | Source unit files | Active tests | Ignored tests | Weighted points | Flows |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| screenpipe-engine | 12 | 22 | 133 | 1888 | 53 | 1452.3 | 10 |
+| screenpipe-engine | 12 | 22 | 133 | 1892 | 53 | 1455.1 | 10 |
| screenpipe-db | 5 | 69 | 29 | 640 | 32 | 609.2 | 9 |
| screenpipe-sqlite-coordinator | 1 | 0 | 3 | 27 | 0 | 27.0 | 2 |
| screenpipe-audio | 8 | 29 | 54 | 706 | 56 | 617.0 | 5 |
@@ -68,12 +68,12 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| configuration | 2 suites / 153 active / 3 ignored / 138.7 pts | 2 suites / 153 active / 3 ignored / 138.7 pts | 2 suites / 153 active / 3 ignored / 138.7 pts |
| database | 7 suites / 596 active / 28 ignored / 565.2 pts | 7 suites / 596 active / 28 ignored / 565.2 pts | 7 suites / 596 active / 28 ignored / 565.2 pts |
| db-search | 2 suites / 120 active / 9 ignored / 120.0 pts | 2 suites / 120 active / 9 ignored / 120.0 pts | 2 suites / 120 active / 9 ignored / 120.0 pts |
-| engine-lifecycle | 6 suites / 280 active / 1 ignored / 249.0 pts | 6 suites / 280 active / 1 ignored / 249.0 pts | 6 suites / 276 active / 9 ignored / 248.1 pts |
+| engine-lifecycle | 6 suites / 284 active / 1 ignored / 251.8 pts | 6 suites / 284 active / 1 ignored / 251.8 pts | 6 suites / 280 active / 9 ignored / 250.9 pts |
| local-api | 3 suites / 494 active / 12 ignored / 349.7 pts | 3 suites / 494 active / 12 ignored / 349.7 pts | 3 suites / 494 active / 12 ignored / 349.7 pts |
| meeting | 6 suites / 1765 active / 32 ignored / 1442.8 pts | 6 suites / 1765 active / 32 ignored / 1442.8 pts | 4 suites / 1411 active / 28 ignored / 1112.5 pts |
| ocr | 4 suites / 141 active / 7 ignored / 130.8 pts | 4 suites / 134 active / 7 ignored / 128.6 pts | 3 suites / 125 active / 6 ignored / 119.6 pts |
| os-integration | 1 suites / 6 active / 0 ignored / 1.7 pts | 1 suites / 6 active / 0 ignored / 1.7 pts | - |
-| performance | 13 suites / 1736 active / 87 ignored / 1532.5 pts | 14 suites / 1861 active / 95 ignored / 1582.5 pts | 13 suites / 1736 active / 87 ignored / 1532.5 pts |
+| performance | 13 suites / 1740 active / 87 ignored / 1535.3 pts | 14 suites / 1865 active / 95 ignored / 1585.3 pts | 13 suites / 1740 active / 87 ignored / 1535.3 pts |
| pipes | 1 suites / 554 active / 3 ignored / 387.8 pts | 1 suites / 554 active / 3 ignored / 387.8 pts | 1 suites / 554 active / 3 ignored / 387.8 pts |
| privacy | 5 suites / 1031 active / 43 ignored / 833.9 pts | 5 suites / 1087 active / 22 ignored / 835.6 pts | 5 suites / 989 active / 15 ignored / 798.8 pts |
| real-app | - | 1 suites / 125 active / 8 ignored / 50.0 pts | - |
@@ -90,7 +90,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| Flow | Required layers | windows | macos | linux |
| --- | --- | --- | --- | --- |
| Settings to engine recording config | configuration | covered (strong; engine-config-lifecycle, db-accessibility-ui-events) | covered (strong; engine-config-lifecycle, db-accessibility-ui-events) | covered (strong; engine-config-lifecycle, db-accessibility-ui-events) |
-| Engine health, sleep, and lifecycle | engine-lifecycle | covered (strong; engine-config-lifecycle, engine-db-recovery-cli) | covered (strong; engine-config-lifecycle, engine-db-recovery-cli) | covered (strong; engine-config-lifecycle, engine-db-recovery-cli) |
+| Engine health, sleep, and lifecycle | engine-lifecycle | covered (strong; engine-config-lifecycle, engine-telemetry-observability) | covered (strong; engine-config-lifecycle, engine-telemetry-observability) | covered (strong; engine-config-lifecycle, engine-telemetry-observability) |
| Capture, OCR, and frame persistence | vision-capture, ocr | covered (partial; screen-capture-ocr-contract, screen-windows-ocr) | covered (strong; screen-capture-ocr-contract, screen-macos-ocr) | covered (partial; screen-capture-ocr-contract) |
| Timeline frame and stream delivery | timeline | covered (strong; db-timeline-frames, engine-api-routes) | covered (strong; db-timeline-frames, engine-api-routes) | covered (strong; db-timeline-frames, engine-api-routes) |
| Local API search and indexing | local-api, db-search | covered (strong; engine-local-api-search-integration) | covered (strong; engine-local-api-search-integration) | covered (strong; engine-local-api-search-integration) |
@@ -146,7 +146,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| engine-meeting-privacy-sync | screenpipe-engine | windows, macos, linux | meeting, privacy, ui-events, pipes, sync | meeting-live-notes, privacy-and-redaction, accessibility-ui-events, performance-liveness | medium | strong | unit | 33 | 554 | 3 | Unit-heavy coverage for privacy filter policy, capture exclusions, UI recorder safety, pipes/live-view/structured-output helpers, sync helpers, and CLI parsing. Meeting detection moved to the engine-meeting-watcher suite. |
| engine-meeting-watcher | screenpipe-engine | windows, macos | meeting | meeting-live-notes | high | strong | mixed | 10 | 275 | 3 | Successor of src/meeting_detector.rs and src/meeting_telemetry.rs. Audio-process and UI-scan backend state machines, candidate resolution, shared telemetry, and a scored trajectory eval. ui_scan/macos.rs and ui_scan/windows.rs are cfg-gated and only execute on their target OS; both backends are null on Linux. |
| engine-retention-storage | screenpipe-engine | windows, macos, linux | storage, engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | mixed | 5 | 43 | 0 | Local retention deletion (including lean-mode heavy-text stripping), cloud archive watermarking, atomic state-file replacement, and the low-disk capture monitor. |
-| engine-telemetry-observability | screenpipe-engine | windows, macos, linux | engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | unit | 9 | 46 | 0 | PostHog capture gating, telemetry context shaping, piggyback telemetry forwarding, crash-log helpers, resource monitoring, and the recording-coverage reliability metric. |
+| engine-telemetry-observability | screenpipe-engine | windows, macos, linux | engine-lifecycle, performance | engine-health-lifecycle, performance-liveness | medium | strong | unit | 9 | 50 | 0 | PostHog capture gating, telemetry context shaping, piggyback telemetry forwarding, crash-log helpers, resource monitoring, and the recording-coverage reliability metric. |
| engine-workflows | screenpipe-engine | windows, macos, linux | local-api, storage | local-api-search | high | partial | mixed | 7 | 40 | 0 | Catalog identity and persistence, revision-scoped feedback, workflow evidence and pipeline contracts, and denial of agent-granted rollout access. Does not assert live cloud discovery quality. Workflow publication orchestration deadlines and nested query backpressure are covered with virtual-time router tests. |
| filesystem-durable-sync | screenpipe-fs | macos, linux, windows | database, vision-capture, audio | capture-ocr-pipeline, audio-record-transcribe, engine-health-lifecycle | high | strong | unit | 1 | 3 | 0 | Durable flushes preserve local full-sync behavior, fall back to fsync only for macOS ENOTSUP, and propagate real I/O or fallback failures. Real SMB migration and continued recording are covered by the marked-volume integration test. |
| screen-capture-ocr-contract | screenpipe-screen | windows, macos, linux | vision-capture, ocr | capture-ocr-pipeline | high | partial | unit | 3 | 18 | 0 | Cross-platform cached-OCR unit coverage for RawCaptureResult to CaptureResult metadata, browser URL, focus state, window-to-screen OCR coordinate transformation, Tesseract output parsing, and contour-based text-region detection for the meeting OCR gate. |
@@ -502,7 +502,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| engine-meeting-privacy-sync | screenpipe-engine | src/sync_api.rs | source | 13 | 0 | 13 |
| engine-meeting-privacy-sync | screenpipe-engine | src/sync_provider.rs | source | 4 | 0 | 4 |
| engine-telemetry-observability | screenpipe-engine | src/telemetry_context.rs | source | 8 | 0 | 8 |
-| engine-telemetry-observability | screenpipe-engine | src/telemetry_reporting.rs | source | 6 | 0 | 6 |
+| engine-telemetry-observability | screenpipe-engine | src/telemetry_reporting.rs | source | 10 | 0 | 10 |
| engine-telemetry-observability | screenpipe-engine | src/telemetry_tasks.rs | source | 2 | 0 | 2 |
| engine-meeting-privacy-sync | screenpipe-engine | src/ui_recorder.rs | source | 65 | 0 | 65 |
| engine-capture-timeline | screenpipe-engine | src/video_cache.rs | source | 4 | 0 | 4 |