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
fix(db): restore startup after hybrid storage faults (#7170)
Ezra Ellette90ebd317d61d
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs b/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rsindex 0e12c71ac..bcdb8697e 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs@@ -638,7 +638,8 @@ async fn run_feedback_upload("{}{}\n\n=== Browser Console Logs ===\n{}\n\n=== Recording Diagnostics ===\n{}\n\n=== Storage Migration Diagnostics ===\n{}",request.chat_history, logs, request.console_log, recording_diagnostics, migration_diagnostics);- let raw_bundle = append_localization_diagnostics(raw_bundle, &crate::localization::diagnostics());+ let raw_bundle =+ append_localization_diagnostics(raw_bundle, &crate::localization::diagnostics());let redacted_logs =crate::feedback_redact::redact_pii_for_feedback(raw_bundle, request.settings_json.clone()).await@@ -926,6 +927,89 @@ mod tests {assert_eq!(upload.body, redacted.as_bytes());}+ #[tokio::test]+ async fn database_verification_failure_reaches_support_after_log_rotation() {+ let dir = tempfile::tempdir().unwrap();+ let database = dir.path().join("db.sqlite");+ let damaged = vec![0x5a; 4096];+ std::fs::write(&database, &damaged).unwrap();+ screenpipe_db::persist_sqlite_quarantine(+ &database,+ Some(11),+ "SQLite hard fault (extended result code 11)",+ )+ .unwrap();+ let failure = match screenpipe_db::DatabaseManager::new(+ database.to_str().unwrap(),+ Default::default(),+ )+ .await+ {+ Ok(db) => {+ db.close().await;+ panic!("verified damage must keep startup blocked");+ }+ Err(error) => error,+ };+ assert!(failure.to_string().contains("file is not a database"));+ assert_eq!(std::fs::read(&database).unwrap(), damaged);+ tokio::fs::write(+ dir.path().join("screenpipe-app.2026-09-20.log"),+ format!("ERROR boot phase → error: Failed to initialize database: {failure}\npassword=hunter2\n"),+ ).await.unwrap();+ tokio::fs::write(+ dir.path().join("screenpipe-app.2026-09-21.log"),+ "INFO app restarted; engine startup pending\n",+ )+ .await+ .unwrap();+ let files = crate::log_files::collect_log_files(&[dir.path().to_path_buf()]).await;+ let logs = collect_log_text_from_files(files).await;+ let redacted = crate::feedback_redact::redact_diagnostics_locally(logs)+ .await+ .unwrap();+ let server = MockServer::start().await;+ Mock::given(method("POST"))+ .and(path("/api/logs"))+ .respond_with(ResponseTemplate::new(200).set_body_json(json!({"data": {+ "signedUrl": format!("{}/upload/log", server.uri()), "path": "logs/report.log"+ }})))+ .mount(&server)+ .await;+ Mock::given(method("PUT"))+ .and(path("/upload/log"))+ .respond_with(ResponseTemplate::new(200))+ .mount(&server)+ .await;+ Mock::given(method("POST"))+ .and(path("/api/logs/confirm"))+ .respond_with(ResponseTemplate::new(200).set_body_json(json!({"data": {"id": 42}})))+ .mount(&server)+ .await;+ upload_report(+ &Client::new(),+ &server.uri(),+ &request(),+ redacted,+ None,+ None,+ )+ .await+ .unwrap();+ let requests = server.received_requests().await.unwrap();+ let upload = requests.iter().find(|r| r.method == "PUT").unwrap();+ let report = String::from_utf8_lossy(&upload.body);+ for expected in [+ "Failed to initialize database",+ "database has verified damage",+ "file is not a database",+ "engine startup pending",+ ] {+ assert!(report.contains(expected), "missing {expected}: {report}");+ }+ assert!(!report.contains("hunter2"));+ }+#[tokio::test]async fn transcription_gateway_failure_reaches_support_after_log_rotation() {let server = MockServer::start().await;diff --git a/crates/screenpipe-db/src/db/setup.rs b/crates/screenpipe-db/src/db/setup.rsindex 5d1e0d8f4..3e1891a7f 100644--- a/crates/screenpipe-db/src/db/setup.rs+++ b/crates/screenpipe-db/src/db/setup.rs@@ -82,6 +82,7 @@ fn preflight_existing_database_header(path: &Path) -> Result<(), SqlxError> {}pub(crate) fn register_sqlite_extensions() -> Result<(), sqlx::Error> {+ crate::storage::bulk::register_hash_extension()?;unsafe {// The current sqlite-vec Rust binding exposes this symbol as `fn()`, while its C// implementation uses SQLite's three-argument extension ABI.diff --git a/crates/screenpipe-db/src/recovery.rs b/crates/screenpipe-db/src/recovery.rsindex 2a3640c64..94a56c8ce 100644--- a/crates/screenpipe-db/src/recovery.rs+++ b/crates/screenpipe-db/src/recovery.rs@@ -21,9 +21,15 @@ pub struct RecoveryVerification {pub foreign_key_violations: usize,}-pub use screenpipe_sqlite_coordinator::{- inspect_database_health, DatabaseHealthError, QuarantineHealthProbe,-};+pub use screenpipe_sqlite_coordinator::{DatabaseHealthError, QuarantineHealthProbe};++/// Standalone recovery probes may run before any DatabaseManager exists.+pub async fn inspect_database_health(+ path: impl AsRef<Path>,+) -> Result<QuarantineHealthProbe, DatabaseHealthError> {+ crate::db::register_sqlite_extensions().map_err(DatabaseHealthError::Unavailable)?;+ screenpipe_sqlite_coordinator::inspect_database_health(path).await+}type LifecycleLocks = HashMap<PathBuf, Arc<tokio::sync::Mutex<()>>>;static LIFECYCLES: OnceLock<Mutex<LifecycleLocks>> = OnceLock::new();@@ -136,6 +142,7 @@ fn sqlite_sidecar(database_path: &Path, suffix: &str) -> PathBuf {}async fn open_offline_candidate(path: &Path) -> Result<SqliteConnection> {+ crate::db::register_sqlite_extensions()?;let options = SqliteConnectOptions::new().filename(path).create_if_missing(false)diff --git a/crates/screenpipe-db/src/storage/bulk/connection.rs b/crates/screenpipe-db/src/storage/bulk/connection.rsindex f839ce066..1271bc456 100644--- a/crates/screenpipe-db/src/storage/bulk/connection.rs+++ b/crates/screenpipe-db/src/storage/bulk/connection.rs@@ -138,10 +138,39 @@ async fn register(pub(crate) async fn register_hash(conn: &mut SqliteConnection) -> Result<(), sqlx::Error> {let mut locked = conn.lock_handle().await?;+ // SAFETY: SQLx holds the live connection exclusively during registration.+ let result = unsafe { register_hash_raw(locked.as_raw_handle().as_ptr()) };+ if result != ffi::SQLITE_OK {+ return Err(storage_error("cannot register payload identity function"));+ }+ Ok(())+}++/// Independent recovery connections evaluate the persistent payload-identity+/// index before storage pools exist, including on the first open after restart.+pub(crate) fn register_hash_extension() -> Result<(), sqlx::Error> {+ unsafe extern "C" fn init(+ db: *mut ffi::sqlite3,+ _: *mut *mut std::ffi::c_char,+ _: *const ffi::sqlite3_api_routines,+ ) -> c_int {+ register_hash_raw(db)+ }+ // SAFETY: init has SQLite's extension ABI and retains no connection state.+ let result = unsafe { ffi::sqlite3_auto_extension(Some(init)) };+ if result != ffi::SQLITE_OK {+ return Err(storage_error(format!(+ "cannot register payload identity extension: SQLite error code {result}"+ )));+ }+ Ok(())+}++unsafe fn register_hash_raw(db: *mut ffi::sqlite3) -> c_int {// SAFETY: the callback borrows only SQLite's argument and copies its result.- let result = unsafe {+ unsafe {ffi::sqlite3_create_function_v2(- locked.as_raw_handle().as_ptr(),+ db,c"screenpipe_payload_sha256".as_ptr(),1,ffi::SQLITE_UTF8 | ffi::SQLITE_DETERMINISTIC | ffi::SQLITE_INNOCUOUS,@@ -151,11 +180,7 @@ pub(crate) async fn register_hash(conn: &mut SqliteConnection) -> Result<(), sqlNone,None,)- };- if result != ffi::SQLITE_OK {- return Err(storage_error("cannot register payload identity function"));}- Ok(())}unsafe extern "C" fn hash(diff --git a/crates/screenpipe-db/src/storage/bulk/mod.rs b/crates/screenpipe-db/src/storage/bulk/mod.rsindex 9c03f2ee8..80dc717a2 100644--- a/crates/screenpipe-db/src/storage/bulk/mod.rs+++ b/crates/screenpipe-db/src/storage/bulk/mod.rs@@ -16,7 +16,7 @@ mod tests;use super::{storage_error, HybridStorage};pub(crate) use connection::pool_options;-pub(crate) use connection::register_hash;+pub(crate) use connection::{register_hash, register_hash_extension};pub(super) use lifecycle::export;pub(super) use schema::{bootstrap, bootstrap_in_place, finish_indexes, upgrade_recording};use std::sync::{atomic::AtomicUsize, Arc, Mutex};diff --git a/crates/screenpipe-db/tests/hybrid_recovery.rs b/crates/screenpipe-db/tests/hybrid_recovery.rsnew file mode 100644index 000000000..aa5a3ed6a--- /dev/null+++ b/crates/screenpipe-db/tests/hybrid_recovery.rs@@ -0,0 +1,133 @@+// screenpipe — AI that knows everything you've seen, said, or heard+// https://screenpipe.com++use screenpipe_db::{+ storage::{migrate, resolve_database_path},+ DatabaseManager,+};+use screenpipe_sqlite_coordinator as coordinator;+use std::{path::Path, process::Command};++const CHILD_ROOT: &str = "SCREENPIPE_HYBRID_RECOVERY_ROOT";+const CHILD_PHASE: &str = "SCREENPIPE_HYBRID_RECOVERY_PHASE";++async fn open(root: &Path) -> DatabaseManager {+ DatabaseManager::new(+ root.join("db.sqlite").to_str().unwrap(),+ screenpipe_config::DbConfig::for_tier(screenpipe_config::DeviceTier::Low),+ )+ .await+ .expect("healthy hybrid storage must reopen after a transient fault")+}++async fn insert_transcript(db: &DatabaseManager, id: i64, text: &str) {+ let mut tx = db.begin_immediate_with_retry().await.unwrap();+ sqlx::query("INSERT INTO audio_transcriptions(id,audio_chunk_id,offset_index,timestamp,transcription,device) VALUES(?,1,?,'2026-09-21T12:00:00Z',?,'test')")+ .bind(id).bind(id).bind(text).execute(&mut **tx.conn()).await.unwrap();+ tx.commit().await.unwrap();+}++#[tokio::test]+async fn pending_hybrid_fault_recovers_across_process_restarts() {+ if let Ok(root) = std::env::var(CHILD_ROOT) {+ let root = Path::new(&root);+ match std::env::var(CHILD_PHASE).unwrap().as_str() {+ "seed" => {+ let db = open(root).await;+ db.execute_raw_sql_write(+ "INSERT INTO audio_chunks(id,file_path) VALUES(1,'test.wav')",+ )+ .await+ .unwrap();+ insert_transcript(&db, 1, "archived transcript").await;+ db.close().await;+ migrate(root, Default::default(), Default::default())+ .await+ .unwrap();+ let db = open(root).await;+ let archived: i64 = sqlx::query_scalar("SELECT count(*) FROM main.audio_transcriptions WHERE _archive_file IS NOT NULL")+ .fetch_one(&db.pool).await.unwrap();+ assert_eq!(archived, 1);+ insert_transcript(&db, 2, "resident transcript 東京").await;+ db.close().await;+ let index = resolve_database_path(&root.join("db.sqlite")).unwrap();+ coordinator::latch_sqlite_hard_fault(&index, libsqlite3_sys::SQLITE_CORRUPT);+ assert!(coordinator::sqlite_verification_pending_exists(&index));+ assert!(!coordinator::sqlite_confirmed_corruption_exists(&index));+ }+ "probe" => {+ let index = resolve_database_path(&root.join("db.sqlite")).unwrap();+ let bytes = std::fs::read(&index).unwrap();+ let identity = coordinator::sqlite_file_identity(&index).unwrap();+ let probe = screenpipe_db::probe_quarantined_generation_health(&index)+ .await+ .expect("standalone probe must register schema functions on a cold start");+ assert_eq!(probe.file_identity, identity);+ assert_eq!(std::fs::read(&index).unwrap(), bytes);+ assert!(coordinator::sqlite_verification_pending_exists(&index));+ }+ phase @ ("resume" | "verify") => {+ let index = resolve_database_path(&root.join("db.sqlite")).unwrap();+ if phase == "resume" {+ assert!(coordinator::sqlite_verification_pending_exists(&index));+ }+ // This is the first database open in this process. No earlier+ // storage pool may accidentally register the missing function.+ let db = open(root).await;+ assert!(!coordinator::sqlite_verification_pending_exists(&index));+ assert!(!coordinator::sqlite_quarantine_exists(&index));+ let transcripts: Vec<String> = sqlx::query_scalar(+ "SELECT transcription FROM audio_transcriptions ORDER BY id",+ )+ .fetch_all(&db.pool)+ .await+ .unwrap();+ let mut expected = vec!["archived transcript", "resident transcript 東京"];+ if phase == "verify" {+ expected.push("recorded after recovery");+ }+ assert_eq!(transcripts, expected);+ if phase == "resume" {+ insert_transcript(&db, 3, "recorded after recovery").await;+ // The expression index must still enforce payload identity.+ let duplicate = db.execute_raw_sql_write("INSERT INTO audio_transcriptions(audio_chunk_id,offset_index,timestamp,transcription,device) VALUES(1,4,'2026-09-21T12:00:00Z','recorded after recovery','test')").await.unwrap_err();+ assert!(+ duplicate.to_string().contains("UNIQUE constraint failed"),+ "{duplicate}"+ );+ }+ db.verify_storage().await.unwrap();+ db.close().await;+ }+ phase => panic!("unknown child phase: {phase}"),+ }+ return;+ }++ let root = tempfile::tempdir().unwrap();+ let run = |phase: &str| {+ let output = Command::new(std::env::current_exe().unwrap())+ .args([+ "--exact",+ "pending_hybrid_fault_recovers_across_process_restarts",+ "--nocapture",+ ])+ .env(CHILD_ROOT, root.path())+ .env(CHILD_PHASE, phase)+ .output()+ .unwrap();+ assert!(+ output.status.success(),+ "{phase} failed:\n{}\n{}",+ String::from_utf8_lossy(&output.stdout),+ String::from_utf8_lossy(&output.stderr)+ );+ };+ run("seed");+ let index = resolve_database_path(&root.path().join("db.sqlite")).unwrap();+ let identity = coordinator::sqlite_file_identity(&index).unwrap();+ run("probe");+ run("resume");+ run("verify");+ assert_eq!(coordinator::sqlite_file_identity(&index).unwrap(), identity);+}diff --git a/docs/COVERAGE.md b/docs/COVERAGE.mdindex 0358bd90f..58f223117 100644--- a/docs/COVERAGE.md+++ b/docs/COVERAGE.md@@ -37,16 +37,16 @@ results and `cargo llvm-cov` data on top when judging release confidence.### Core Engine- Mapped suites: 34-- Mapped Rust files: 363-- Active test blocks: 3561+- Mapped Rust files: 366+- Active test blocks: 3572- Ignored/manual test blocks: 150-- Weighted coverage points: 2944.7+- Weighted coverage points: 2953.0| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score || --- | --- | --- | --- | --- | --- | --- | --- |-| windows | 31 | 3418 | 144 | 2879.6 | 21 | 11 | 100% |-| macos | 31 | 3480 | 124 | 2893.6 | 22 | 11 | 100% |-| linux | 27 | 3040 | 116 | 2530.9 | 20 | 11 | 100% |+| windows | 31 | 3429 | 144 | 2887.9 | 21 | 11 | 100% |+| macos | 31 | 3491 | 124 | 2901.9 | 22 | 11 | 100% |+| linux | 27 | 3051 | 116 | 2539.2 | 20 | 11 | 100% |## Refreshdiff --git a/docs/coverage/CORE.md b/docs/coverage/CORE.mdindex bd89b4a22..035b87f24 100644--- a/docs/coverage/CORE.md+++ b/docs/coverage/CORE.md@@ -8,11 +8,11 @@ confidence, and criticality.- Manifest: `docs/coverage/core-engine-map.json`- Tracked crates: screenpipe-engine, screenpipe-db, screenpipe-sqlite-coordinator, screenpipe-audio, screenpipe-screen, screenpipe-a11y, screenpipe-fs- Mapped suites: 34-- Mapped Rust files: 363-- Active test blocks: 3561+- Mapped Rust files: 366+- Active test blocks: 3572- Ignored/manual test blocks: 150-- Declared test blocks: 3711-- Weighted coverage points: 2944.7+- Declared test blocks: 3722+- Weighted coverage points: 2953.0Confidence 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,16 +23,16 @@ are explicitly enabled in a runtime lane.| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score || --- | --- | --- | --- | --- | --- | --- | --- |-| windows | 31 | 3418 | 144 | 2879.6 | 21 | 11 | 100% |-| macos | 31 | 3480 | 124 | 2893.6 | 22 | 11 | 100% |-| linux | 27 | 3040 | 116 | 2530.9 | 20 | 11 | 100% |+| windows | 31 | 3429 | 144 | 2887.9 | 21 | 11 | 100% |+| macos | 31 | 3491 | 124 | 2901.9 | 22 | 11 | 100% |+| linux | 27 | 3051 | 116 | 2539.2 | 20 | 11 | 100% |## Crate Summary| Crate | Suites | Integration files | Source unit files | Active tests | Ignored tests | Weighted points | Flows || --- | --- | --- | --- | --- | --- | --- | --- |-| screenpipe-engine | 11 | 20 | 120 | 1734 | 43 | 1337.3 | 10 |-| screenpipe-db | 5 | 60 | 24 | 561 | 25 | 534.3 | 9 |+| screenpipe-engine | 11 | 20 | 121 | 1742 | 43 | 1342.9 | 10 |+| screenpipe-db | 5 | 62 | 24 | 564 | 25 | 537.0 | 9 || screenpipe-sqlite-coordinator | 1 | 0 | 3 | 27 | 0 | 27.0 | 2 || screenpipe-audio | 6 | 25 | 51 | 625 | 44 | 549.6 | 5 || screenpipe-screen | 6 | 9 | 18 | 257 | 9 | 232.1 | 4 |@@ -66,21 +66,21 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| audio | 8 suites / 741 active / 45 ignored / 665.6 pts | 8 suites / 741 active / 45 ignored / 665.6 pts | 7 suites / 666 active / 44 ignored / 613.1 pts || audio-device | 2 suites / 222 active / 7 ignored / 199.5 pts | 2 suites / 222 active / 7 ignored / 199.5 pts | 1 suites / 147 active / 6 ignored / 147.0 pts || configuration | 2 suites / 143 active / 3 ignored / 129.2 pts | 2 suites / 143 active / 3 ignored / 129.2 pts | 2 suites / 143 active / 3 ignored / 129.2 pts |-| database | 7 suites / 512 active / 21 ignored / 485.3 pts | 7 suites / 512 active / 21 ignored / 485.3 pts | 7 suites / 512 active / 21 ignored / 485.3 pts |+| database | 7 suites / 515 active / 21 ignored / 488.0 pts | 7 suites / 515 active / 21 ignored / 488.0 pts | 7 suites / 515 active / 21 ignored / 488.0 pts || db-search | 2 suites / 113 active / 9 ignored / 113.0 pts | 2 suites / 113 active / 9 ignored / 113.0 pts | 2 suites / 113 active / 9 ignored / 113.0 pts || engine-lifecycle | 6 suites / 244 active / 1 ignored / 219.0 pts | 6 suites / 244 active / 1 ignored / 219.0 pts | 5 suites / 238 active / 1 ignored / 217.3 pts |-| local-api | 3 suites / 434 active / 10 ignored / 306.2 pts | 3 suites / 434 active / 10 ignored / 306.2 pts | 3 suites / 434 active / 10 ignored / 306.2 pts |+| local-api | 3 suites / 442 active / 10 ignored / 311.8 pts | 3 suites / 442 active / 10 ignored / 311.8 pts | 3 suites / 442 active / 10 ignored / 311.8 pts || meeting | 6 suites / 1637 active / 21 ignored / 1337.6 pts | 6 suites / 1637 active / 21 ignored / 1337.6 pts | 4 suites / 1292 active / 17 ignored / 1015.1 pts || ocr | 4 suites / 125 active / 7 ignored / 119.0 pts | 4 suites / 129 active / 7 ignored / 124.5 pts | 3 suites / 120 active / 6 ignored / 115.5 pts || os-integration | 1 suites / 6 active / 0 ignored / 1.7 pts | 1 suites / 6 active / 0 ignored / 1.7 pts | - |-| performance | 13 suites / 1570 active / 76 ignored / 1389.6 pts | 14 suites / 1677 active / 80 ignored / 1432.4 pts | 13 suites / 1570 active / 76 ignored / 1389.6 pts |+| performance | 13 suites / 1573 active / 76 ignored / 1392.3 pts | 14 suites / 1680 active / 80 ignored / 1435.1 pts | 13 suites / 1573 active / 76 ignored / 1392.3 pts || pipes | 1 suites / 512 active / 3 ignored / 358.4 pts | 1 suites / 512 active / 3 ignored / 358.4 pts | 1 suites / 512 active / 3 ignored / 358.4 pts || privacy | 5 suites / 943 active / 37 ignored / 764.5 pts | 5 suites / 1001 active / 17 ignored / 773.0 pts | 5 suites / 921 active / 14 ignored / 743.4 pts || real-app | - | 1 suites / 107 active / 4 ignored / 42.8 pts | - || speaker | 2 suites / 369 active / 9 ignored / 369.0 pts | 2 suites / 369 active / 9 ignored / 369.0 pts | 2 suites / 369 active / 9 ignored / 369.0 pts |-| storage | 4 suites / 628 active / 38 ignored / 521.5 pts | 4 suites / 628 active / 38 ignored / 521.5 pts | 4 suites / 628 active / 38 ignored / 521.5 pts |+| storage | 4 suites / 638 active / 38 ignored / 529.1 pts | 4 suites / 638 active / 38 ignored / 529.1 pts | 4 suites / 638 active / 38 ignored / 529.1 pts || sync | 1 suites / 512 active / 3 ignored / 358.4 pts | 1 suites / 512 active / 3 ignored / 358.4 pts | 1 suites / 512 active / 3 ignored / 358.4 pts |-| timeline | 4 suites / 1176 active / 43 ignored / 962.4 pts | 4 suites / 1176 active / 43 ignored / 962.4 pts | 4 suites / 1176 active / 43 ignored / 962.4 pts |+| timeline | 4 suites / 1178 active / 43 ignored / 964.4 pts | 4 suites / 1178 active / 43 ignored / 964.4 pts | 4 suites / 1178 active / 43 ignored / 964.4 pts || transcription | 5 suites / 814 active / 42 ignored / 637.8 pts | 5 suites / 814 active / 42 ignored / 637.8 pts | 5 suites / 814 active / 42 ignored / 637.8 pts || ui-events | 4 suites / 759 active / 29 ignored / 576.9 pts | 3 suites / 710 active / 5 ignored / 542.6 pts | 3 suites / 710 active / 5 ignored / 542.6 pts || vision-capture | 6 suites / 552 active / 32 ignored / 436.8 pts | 6 suites / 556 active / 32 ignored / 442.3 pts | 5 suites / 547 active / 31 ignored / 433.3 pts |@@ -131,9 +131,9 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| audio-transcription-pipeline | screenpipe-audio | windows, macos, linux | audio, transcription, performance | audio-record-transcribe, meeting-live-notes, performance-liveness | high | partial | mixed | 15 | 105 | 7 | Batch deferral, cleanup, language detection, result normalization, and real recording/transcription tests. Hardware/model-heavy tests are ignored by default. Also covers ffmpeg encode child reaping on error paths. || db-accessibility-ui-events | screenpipe-db | windows, macos, linux | database, configuration, accessibility, ui-events, performance | settings-to-engine-config, accessibility-ui-events, performance-liveness | medium | partial | integration | 7 | 27 | 2 | Elements bulk insert, on-screen filtering, UI event batching, DB tier config, and ignored heavy-read real-DB probes. || db-audio-meetings-speakers | screenpipe-db | windows, macos, linux | database, audio, meeting, speaker | audio-record-transcribe, audio-device-health, meeting-live-notes | high | strong | integration | 15 | 113 | 1 | Audio transcript dedupe, live meeting mirroring, end-generation and open-meeting invariants, liveness, and speaker reassignment coverage. |-| db-runtime-reliability | screenpipe-db | windows, macos, linux | database, performance | performance-liveness | high | partial | mixed | 15 | 43 | 6 | SQLite hard-fault classification, failpoint VFS injection, fresh-identity recovery verification with integrity/FK/write canaries, query cancellation, close-severs-connections regressions, multi-pool WAL parity, runtime version pinning, and WAL chaos plus memory-pressure probes, plus read-only quarantine self-heal verification for transient IOERR faults. |+| db-runtime-reliability | screenpipe-db | windows, macos, linux | database, performance | performance-liveness | high | partial | mixed | 16 | 44 | 6 | SQLite hard-fault classification, failpoint VFS injection, fresh-identity recovery verification with integrity/FK/write canaries, query cancellation, close-severs-connections regressions, multi-pool WAL parity, runtime version pinning, and WAL chaos plus memory-pressure probes, plus read-only quarantine self-heal verification for transient IOERR faults. || db-search-indexing | screenpipe-db | windows, macos, linux | db-search, ocr, accessibility, performance | local-api-search, capture-ocr-pipeline, accessibility-ui-events, performance-liveness | high | strong | mixed | 13 | 105 | 4 | FTS, tokenizer, OCR snapshot search, query planning, ordering, accessibility search, and contention coverage. |-| db-timeline-frames | screenpipe-db | windows, macos, linux | database, timeline, storage, performance | timeline-streaming, performance-liveness | high | strong | mixed | 34 | 273 | 12 | Frame/audio joins, timeline query shape, suggestions frames, write queue, DB primitives (src/db.rs split into src/db/ modules), feedback record upserts, media eviction anti-join regressions, SAF output registry, semantic storage, and timeline performance. |+| db-timeline-frames | screenpipe-db | windows, macos, linux | database, timeline, storage, performance | timeline-streaming, performance-liveness | high | strong | mixed | 35 | 275 | 12 | Frame/audio joins, timeline query shape, suggestions frames, write queue, DB primitives (src/db.rs split into src/db/ modules), feedback record upserts, media eviction anti-join regressions, SAF output registry, semantic storage, and timeline performance. || engine-api-routes | screenpipe-engine | windows, macos, linux | local-api, timeline, meeting, transcription | local-api-search, timeline-streaming, meeting-live-notes, audio-record-transcribe | high | partial | mixed | 41 | 411 | 5 | Route/unit coverage for search, health, streaming, meetings, time/timezone, and transcription. Legacy endpoint/websocket tests require local data and remain ignored. || engine-capture-timeline | screenpipe-engine | windows, macos, linux | vision-capture, timeline, storage, performance | capture-ocr-pipeline, timeline-streaming, performance-liveness | high | partial | mixed | 25 | 301 | 26 | Covers capture trigger logic, frame/audio linking, hot cache, timeline refresh regressions, fragmented MP4 extraction, and HD-mode control. Several real-data tests are intentionally ignored by default. || engine-config-lifecycle | screenpipe-engine | windows, macos, linux | configuration, engine-lifecycle, performance | settings-to-engine-config, engine-health-lifecycle, performance-liveness | high | strong | mixed | 12 | 116 | 1 | Fast logic coverage for the config bridge, health-endpoint identity, tray health debounce, sleep/power policies, and queue backpressure. |@@ -144,7 +144,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-meeting-watcher | screenpipe-engine | windows, macos | meeting | meeting-live-notes | high | strong | mixed | 10 | 270 | 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 | 39 | 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 | 6 | 30 | 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 | 4 | 15 | 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. |+| engine-workflows | screenpipe-engine | windows, macos, linux | local-api, storage | local-api-search | high | partial | mixed | 5 | 23 | 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. || 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 | 15 | 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. || screen-capture-windowing | screenpipe-screen | windows, macos, linux | vision-capture, timeline, performance, privacy | capture-ocr-pipeline, timeline-streaming, privacy-and-redaction, performance-liveness | high | strong | mixed | 14 | 191 | 0 | Window filtering, empty-window regressions, retry policy, URL timing, monitor cache, OCR cache, snapshots, and image comparison. |@@ -307,6 +307,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| db-search-indexing | screenpipe-db | tests/fts_contention_test.rs | integration | 4 | 0 | 4 || db-search-indexing | screenpipe-db | tests/fts_dots_test.rs | integration | 13 | 0 | 13 || db-accessibility-ui-events | screenpipe-db | tests/heavy_read_test.rs | integration | 0 | 2 | 2 |+| db-runtime-reliability | screenpipe-db | tests/hybrid_recovery.rs | integration | 1 | 0 | 1 || db-timeline-frames | screenpipe-db | tests/hybrid_storage.rs | integration | 16 | 0 | 16 || db-timeline-frames | screenpipe-db | tests/in_place_migration.rs | integration | 18 | 5 | 23 || db-search-indexing | screenpipe-db | tests/keyword_search_accessibility_test.rs | integration | 7 | 0 | 7 |@@ -317,6 +318,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| db-audio-meetings-speakers | screenpipe-db | tests/meeting_end_reason_test.rs | integration | 11 | 0 | 11 || db-audio-meetings-speakers | screenpipe-db | tests/meeting_transcript_dedup_test.rs | integration | 1 | 0 | 1 || db-runtime-reliability | screenpipe-db | tests/memory_pressure_test.rs | integration | 0 | 2 | 2 |+| db-timeline-frames | screenpipe-db | tests/migration_foreign_keys.rs | integration | 2 | 0 | 2 || db-timeline-frames | screenpipe-db | tests/migration_source_recovery.rs | integration | 7 | 0 | 7 || db-runtime-reliability | screenpipe-db | tests/multi_pool_wal_parity_test.rs | integration | 3 | 0 | 3 || db-accessibility-ui-events | screenpipe-db | tests/ocr_elements_bulk_test.rs | integration | 4 | 0 | 4 |@@ -452,6 +454,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su| engine-api-routes | screenpipe-engine | src/routes/timezone.rs | source | 8 | 0 | 8 || engine-api-routes | screenpipe-engine | src/routes/websocket.rs | source | 4 | 0 | 4 || engine-workflows | screenpipe-engine | src/routes/workflow_catalog.rs | source | 6 | 0 | 6 |+| engine-workflows | screenpipe-engine | src/routes/workflow_edits.rs | source | 8 | 0 | 8 || engine-workflows | screenpipe-engine | src/routes/workflow_pipeline.rs | source | 4 | 0 | 4 || engine-workflows | screenpipe-engine | src/routes/workflows.rs | source | 3 | 0 | 3 || engine-config-lifecycle | screenpipe-engine | src/schedule_monitor.rs | source | 8 | 0 | 8 |diff --git a/docs/coverage/core-engine-map.json b/docs/coverage/core-engine-map.jsonindex 808f9e4fe..972f90b42 100644--- a/docs/coverage/core-engine-map.json+++ b/docs/coverage/core-engine-map.json@@ -694,6 +694,7 @@"tests/hybrid_storage.rs","tests/in_place_migration.rs","tests/live_coverage_marker_test.rs",+ "tests/migration_foreign_keys.rs","tests/migration_source_recovery.rs","tests/orphan_chunk_null_poisoning_test.rs","tests/outputs_saf_test.rs",@@ -738,6 +739,7 @@"tests/cancellable_query_test.rs","tests/cancellation_performance_bench.rs","tests/close_severs_connections_test.rs",+ "tests/hybrid_recovery.rs","tests/memory_pressure_test.rs","tests/multi_pool_wal_parity_test.rs","tests/quarantine_self_heal_test.rs",@@ -1370,6 +1372,7 @@"crate": "screenpipe-engine","files": ["src/routes/workflow_catalog.rs",+ "src/routes/workflow_edits.rs","src/routes/workflow_pipeline.rs","src/routes/workflows.rs","tests/workflow_catalog_contract_test.rs"