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

fix: run SQLx migrations for existing compressed databases (#7469)

Louis Beaumont9d7d2cd3bd5c
diff --git a/crates/screenpipe-db/src/db/setup.rs b/crates/screenpipe-db/src/db/setup.rs
index 643808b8f..50d6b4584 100644
--- a/crates/screenpipe-db/src/db/setup.rs
+++ b/crates/screenpipe-db/src/db/setup.rs
@@ -534,14 +534,30 @@ impl DatabaseManager {
construction?;
}
crate::storage::schema::verify(&mut conn, &storage.descriptor).await?;
+ if !bootstrap_storage {
+ // Conversion retains _sqlx_migrations. Let SQLx apply only
+ // pending feature migrations, without legacy repair helpers
+ // that assume every logical table is still a SQLite table.
+ // Use the pool-based Acquire implementation so database
+ // startup remains Send when spawned by the engine. Release
+ // this handle first, including for single-connection pools.
+ drop(conn);
+ Self::sqlx_migrator().run(&db_manager.write_pool).await?;
+ conn = db_manager.write_pool.acquire().await?;
+ }
crate::storage::schema::upgrade_resident_frames(&mut conn).await?;
let upgraded =
crate::storage::schema::upgrade_recording(&mut conn, storage.has_bulk())
.await?;
crate::storage::read_schema::upgrade(&mut conn, storage).await?;
+ let resident_hooks_changed = crate::storage::schema::ensure_resident_table_hooks(
+ &mut conn,
+ storage.has_bulk(),
+ )
+ .await?;
storage.verify_catalog(&db_manager.pool).await?;
drop(conn);
- if upgraded {
+ if upgraded || resident_hooks_changed {
// Connections opened before the trigger migration need a
// schema read before their first DML preparation. Refresh
// every existing writer while startup still owns admission.
@@ -639,9 +655,14 @@ impl DatabaseManager {
}
}
- async fn run_migrations(pool: &SqlitePool) -> Result<(), sqlx::Error> {
+ fn sqlx_migrator() -> sqlx::migrate::Migrator {
let mut migrator = sqlx::migrate!("./src/migrations");
migrator.set_ignore_missing(true);
+ migrator
+ }
+
+ async fn run_migrations(pool: &SqlitePool) -> Result<(), sqlx::Error> {
+ let migrator = Self::sqlx_migrator();
Self::log_pending_heavy_migrations(pool, &migrator).await;
match migrator.run(pool).await {
Ok(_) => {}
diff --git a/crates/screenpipe-db/src/migrations/README.md b/crates/screenpipe-db/src/migrations/README.md
new file mode 100644
index 000000000..0ffad1746
--- /dev/null
+++ b/crates/screenpipe-db/src/migrations/README.md
@@ -0,0 +1,20 @@
+# Database migrations
+
+Add application schema changes as timestamped SQLx migrations in this directory.
+Both ordinary SQLite databases and existing compressed databases run this same
+migration set. Conversion preserves `_sqlx_migrations`, so SQLx applies only
+pending files and owns their transactions, checksums, and completion records.
+Keep applied SQL files immutable. Do not add feature-specific Rust migrations
+or entries to `_hybrid_migrations`; that ledger describes the physical storage
+format and its historical upgrades.
+
+New resident tables automatically receive storage revision and privacy hooks
+at startup. No recording rows are scanned to discover them. Internal tables
+and the specialized capture/archive tables retain their existing hooks.
+
+A migration that changes a logical table backed by compressed storage must
+account for that physical layout. Test both database modes, including reopening
+an older converted fixture and preserving its sealed history. SQLx tracks which
+migration ran; it does not make arbitrary SQL compatible with virtual tables.
+The old repair helpers in `db/setup.rs` still apply only to ordinary SQLite
+or initial bootstrap.
diff --git a/crates/screenpipe-db/src/storage/read_schema.rs b/crates/screenpipe-db/src/storage/read_schema.rs
index a0764718e..e1b1bed7c 100644
--- a/crates/screenpipe-db/src/storage/read_schema.rs
+++ b/crates/screenpipe-db/src/storage/read_schema.rs
@@ -58,25 +58,7 @@ pub(crate) async fn upgrade(
let tables: Vec<String> = sqlx::query_scalar("SELECT name FROM pragma_table_list WHERE schema='main' AND type='table' AND substr(name,1,1)!='_' AND name NOT LIKE 'sqlite_%' AND name NOT IN ('sqlite_sequence','storage_metadata','payload_files','frame_payloads','upload_bindings')")
.fetch_all(&mut *tx).await?;
for table in tables {
- let columns: Vec<String> = sqlx::query_scalar("SELECT name FROM pragma_table_info(?)")
- .bind(&table)
- .fetch_all(&mut *tx)
- .await?;
- let quoted = format!("\"{}\"", table.replace('"', "\"\""));
- sqlx::raw_sql(sqlx::AssertSqlSafe(format!(
- "CREATE TRIGGER IF NOT EXISTS \"hybrid_read_revoke_delete_{table}\" AFTER DELETE ON {quoted} BEGIN UPDATE _storage_revocation SET revision=revision+1; END;"
- ))).execute(&mut *tx).await?;
- let redacted = columns
- .iter()
- .filter(|c| c.ends_with("redacted_at"))
- .map(|c| format!("OLD.\"{c}\" IS NOT NULL OR NEW.\"{c}\" IS NOT NULL"))
- .collect::<Vec<_>>()
- .join(" OR ");
- if !redacted.is_empty() {
- sqlx::raw_sql(sqlx::AssertSqlSafe(format!(
- "CREATE TRIGGER IF NOT EXISTS \"hybrid_read_revoke_redaction_{table}\" AFTER UPDATE ON {quoted} WHEN (SELECT maintenance=0 FROM storage_metadata) AND ({redacted}) BEGIN UPDATE _storage_revocation SET revision=revision+1; END;"
- ))).execute(&mut *tx).await?;
- }
+ install_resident_hooks(&mut tx, &table).await?;
}
if storage.has_bulk() {
sqlx::raw_sql(LOOKUP).execute(&mut *tx).await?;
@@ -143,3 +125,31 @@ pub(crate) async fn upgrade(
tx.commit().await?;
Ok(())
}
+
+// Shared by initial conversion and tables introduced by later SQLx migrations.
+pub(super) async fn install_resident_hooks(
+ conn: &mut SqliteConnection,
+ table: &str,
+) -> Result<(), sqlx::Error> {
+ let columns: Vec<String> = sqlx::query_scalar("SELECT name FROM pragma_table_info(?)")
+ .bind(table)
+ .fetch_all(&mut *conn)
+ .await?;
+ let escaped = table.replace('"', "\"\"");
+ let quoted = format!("\"{escaped}\"");
+ sqlx::raw_sql(sqlx::AssertSqlSafe(format!(
+ "CREATE TRIGGER IF NOT EXISTS \"hybrid_read_revoke_delete_{escaped}\" AFTER DELETE ON {quoted} BEGIN UPDATE _storage_revocation SET revision=revision+1; END;"
+ ))).execute(&mut *conn).await?;
+ let redacted = columns
+ .iter()
+ .filter(|c| c.ends_with("redacted_at"))
+ .map(|c| format!("OLD.\"{c}\" IS NOT NULL OR NEW.\"{c}\" IS NOT NULL"))
+ .collect::<Vec<_>>()
+ .join(" OR ");
+ if !redacted.is_empty() {
+ sqlx::raw_sql(sqlx::AssertSqlSafe(format!(
+ "CREATE TRIGGER IF NOT EXISTS \"hybrid_read_revoke_redaction_{escaped}\" AFTER UPDATE ON {quoted} WHEN (SELECT maintenance=0 FROM storage_metadata) AND ({redacted}) BEGIN UPDATE _storage_revocation SET revision=revision+1; END;"
+ ))).execute(&mut *conn).await?;
+ }
+ Ok(())
+}
diff --git a/crates/screenpipe-db/src/storage/schema.rs b/crates/screenpipe-db/src/storage/schema.rs
index 44b2e617c..79fa11f35 100644
--- a/crates/screenpipe-db/src/storage/schema.rs
+++ b/crates/screenpipe-db/src/storage/schema.rs
@@ -425,6 +425,48 @@ pub(crate) async fn upgrade_recording(
Ok(true)
}
+/// Give tables added by ordinary SQLx migrations the same read tracking as
+/// tables present during conversion. Inspect schema metadata only; existing
+/// capture/archive tables keep their specialized triggers.
+pub(crate) async fn ensure_resident_table_hooks(
+ conn: &mut SqliteConnection,
+ has_bulk: bool,
+) -> Result<bool, sqlx::Error> {
+ let mut tables: Vec<String> = sqlx::query_scalar(
+ "SELECT t.name FROM sqlite_master t
+ WHERE t.type='table' AND substr(t.name,1,1)!='_'
+ AND t.name NOT LIKE 'sqlite_%' AND t.name NOT LIKE '%_fts%'
+ AND t.name NOT IN ('frames','frame_payloads','payload_files','storage_metadata','upload_bindings')
+ AND t.sql NOT LIKE 'CREATE VIRTUAL TABLE%'
+ AND (SELECT count(*) FROM sqlite_master h WHERE h.type='trigger' AND h.name IN (
+ 'hybrid_revision_' || t.name || '_INSERT',
+ 'hybrid_revision_' || t.name || '_UPDATE',
+ 'hybrid_revision_' || t.name || '_DELETE',
+ 'hybrid_read_revoke_delete_' || t.name)) < 4",
+ )
+ .fetch_all(&mut *conn)
+ .await?;
+ // Bulk column tables remain physical SQLite tables, but their specialized
+ // triggers suppress logical revisions while sealing. Do not reinstall the
+ // generic hooks deliberately removed by bulk::bootstrap.
+ tables.retain(|table| !has_bulk || !super::bulk::is_bulk_table(table));
+ if tables.is_empty() {
+ return Ok(false);
+ }
+ let mut tx = conn.begin().await?;
+ for table in tables {
+ let quoted = table.replace('"', "\"\"");
+ for event in ["INSERT", "UPDATE", "DELETE"] {
+ sqlx::raw_sql(sqlx::AssertSqlSafe(format!(
+ "CREATE TRIGGER IF NOT EXISTS \"hybrid_revision_{quoted}_{event}\" AFTER {event} ON \"{quoted}\" BEGIN UPDATE storage_metadata SET revision=revision+1; END;"
+ ))).execute(&mut *tx).await?;
+ }
+ super::read_schema::install_resident_hooks(&mut tx, &table).await?;
+ }
+ tx.commit().await?;
+ Ok(true)
+}
+
pub(crate) async fn bootstrap(
conn: &mut SqliteConnection,
descriptor: &StorageDescriptor,
diff --git a/crates/screenpipe-db/tests/fixtures/README.md b/crates/screenpipe-db/tests/fixtures/README.md
new file mode 100644
index 000000000..b2385e475
--- /dev/null
+++ b/crates/screenpipe-db/tests/fixtures/README.md
@@ -0,0 +1,41 @@
+# Historical compressed database fixture
+
+The ignored `historical_2_7_84_compressed_upgrade_preserves_data_and_restarts`
+test uses a disposable synthetic database created and compressed by the actual
+2.7.84 implementation at `8325934d5571b3d7d87ac068177d63c6dc5c9ce6`.
+It does not open a user's Screenpipe database.
+
+From the current repository, choose two new absolute paths outside the checkout:
+
+```sh
+old_checkout=/absolute/path/to/new-2.7.84-checkout
+fixture_root=/absolute/path/to/new-synthetic-fixture
+git worktree add --detach "$old_checkout" 8325934d5571b3d7d87ac068177d63c6dc5c9ce6
+cp crates/screenpipe-db/tests/fixtures/build_2_7_84_upgrade_fixture.rs.txt \
+ "$old_checkout/crates/screenpipe-db/tests/build_upgrade_fixture.rs"
+(
+ cd "$old_checkout"
+ SCREENPIPE_UPGRADE_FIXTURE_ROOT="$fixture_root" \
+ cargo test -p screenpipe-db --test build_upgrade_fixture -- --nocapture
+)
+SCREENPIPE_UPGRADE_FIXTURE_ROOT="$fixture_root" \
+ cargo test -p screenpipe-db --features storage-fault-injection \
+ --test hybrid_storage \
+ historical_2_7_84_compressed_upgrade_preserves_data_and_restarts \
+ -- --ignored --exact --nocapture
+```
+
+The builder refuses an existing destination. If interrupted, use a new path.
+It creates 128 frames with Unicode text and accessibility trees, plus eight
+rows each of audio transcripts, elements, UI events and meeting transcripts,
+and a frame tag. It snapshots the records, runs the old compression migration,
+and verifies the resulting payloads and migration ledger. Media paths are
+placeholders; this fixture does not test audio or screenshot playback.
+
+The current test copies the closed fixture to a temporary directory, runs normal
+database startup, and verifies all historical rows, payloads and SQLx checksums.
+It checks screen/audio search, stars, new capture writes, sealing, and two further
+restarts. SHA-256 hashes verify that historical Parquet files stay unchanged and
+that the original fixture is untouched. Startup runs in a spawned task to cover
+the engine's `Send` requirement. The small fixture is a correctness check, not a
+production-size performance benchmark.
diff --git a/crates/screenpipe-db/tests/fixtures/build_2_7_84_upgrade_fixture.rs.txt b/crates/screenpipe-db/tests/fixtures/build_2_7_84_upgrade_fixture.rs.txt
new file mode 100644
index 000000000..0103ba187
--- /dev/null
+++ b/crates/screenpipe-db/tests/fixtures/build_2_7_84_upgrade_fixture.rs.txt
@@ -0,0 +1,123 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+
+use screenpipe_db::{
+ storage::{migrate, Projection},
+ DatabaseManager,
+};
+use serde_json::json;
+
+#[tokio::test]
+async fn build_historical_upgrade_fixture() {
+ let root = std::path::PathBuf::from(std::env::var("SCREENPIPE_UPGRADE_FIXTURE_ROOT").unwrap());
+ assert!(
+ !root.exists(),
+ "fixture builder only creates a new directory"
+ );
+ std::fs::create_dir_all(&root).unwrap();
+ std::fs::write(
+ root.join(".synthetic-upgrade-fixture"),
+ "screenpipe-2.7.84\n",
+ )
+ .unwrap();
+ let path = root.join("db.sqlite");
+ let db = DatabaseManager::new(path.to_str().unwrap(), Default::default())
+ .await
+ .unwrap();
+ db.execute_raw_sql_write("INSERT INTO video_chunks(id,file_path,device_name) VALUES(1,'synthetic-screen.mp4','fixture-display'); INSERT INTO audio_chunks(id,file_path,timestamp) VALUES(1,'synthetic-audio.wav','2026-09-11T12:00:00Z'); INSERT INTO tags(id,name) VALUES(1,'upgrade-fixture'); INSERT INTO meetings(id,meeting_start,meeting_app) VALUES(1,'2026-09-11T12:00:00Z','fixture');").await.unwrap();
+ let mut tx = db.begin_immediate_with_retry().await.unwrap();
+ for id in 1..=128i64 {
+ let text = format!(
+ "historicalneedle frame {id} café 東京 {}",
+ "stored context ".repeat(160)
+ );
+ let tree = json!({"role":"AXText","text":text});
+ sqlx::query("INSERT INTO frames(id,video_chunk_id,timestamp,full_text,accessibility_text,accessibility_tree_json,app_name,window_name,device_name) VALUES(?,1,'2026-09-11T12:00:00Z',?,?,?,'Fixture','Historical data','fixture-display')")
+ .bind(id).bind(&text).bind(&text).bind(tree.to_string()).execute(&mut **tx.conn()).await.unwrap();
+ }
+ for id in 1..=8i64 {
+ let text = format!("historicalneedle spoken entry {id}");
+ sqlx::query("INSERT INTO audio_transcriptions(id,audio_chunk_id,offset_index,timestamp,transcription,device) VALUES(?,1,?,'2026-09-11T12:00:00Z',?,'fixture-mic')")
+ .bind(id).bind(id).bind(&text).execute(&mut **tx.conn()).await.unwrap();
+ sqlx::query("INSERT INTO elements(id,frame_id,source,role,text,properties) VALUES(?,?,'accessibility','AXText',?,'{\"fixture\":true}')")
+ .bind(id).bind(id).bind(format!("historicalneedle element {id}")).execute(&mut **tx.conn()).await.unwrap();
+ sqlx::query("INSERT INTO ui_events(id,timestamp,event_type,text_content) VALUES(?,'2026-09-11T12:00:00Z','text',?)")
+ .bind(id).bind(format!("historicalneedle typed {id}")).execute(&mut **tx.conn()).await.unwrap();
+ sqlx::query("INSERT INTO meeting_transcript_segments(id,meeting_id,provider,item_id,transcript,captured_at) VALUES(?,1,'fixture',?,?,'2026-09-11T12:00:00Z')")
+ .bind(id).bind(id.to_string()).bind(&text).execute(&mut **tx.conn()).await.unwrap();
+ }
+ sqlx::query("INSERT INTO vision_tags(vision_id,tag_id) VALUES(1,1)")
+ .execute(&mut **tx.conn())
+ .await
+ .unwrap();
+ tx.commit().await.unwrap();
+ let queries = [
+ "SELECT id,video_chunk_id,timestamp,app_name,window_name,device_name FROM frames ORDER BY id",
+ "SELECT id,audio_chunk_id,offset_index,timestamp,transcription,device FROM audio_transcriptions ORDER BY id",
+ "SELECT id,frame_id,source,role,text,properties FROM elements ORDER BY id",
+ "SELECT id,timestamp,event_type,text_content FROM ui_events ORDER BY id",
+ "SELECT id,meeting_id,provider,item_id,transcript,captured_at FROM meeting_transcript_segments ORDER BY id",
+ "SELECT vision_id,tag_id FROM vision_tags ORDER BY vision_id,tag_id",
+ "SELECT version,hex(checksum) AS checksum,success FROM _sqlx_migrations ORDER BY version",
+ ];
+ let mut snapshots = Vec::new();
+ for query in queries {
+ snapshots.push(json!({"query":query,"rows":db.query_raw_sql(query).await.unwrap()}));
+ }
+ let ids: Vec<i64> = (1..=128).collect();
+ let payloads = db.frame_payloads(&ids, Projection::All).await.unwrap();
+ db.close().await;
+ let report = migrate(&root, Default::default(), Default::default())
+ .await
+ .unwrap();
+ let db = DatabaseManager::new(path.to_str().unwrap(), Default::default())
+ .await
+ .unwrap();
+ db.verify_storage().await.unwrap();
+ for snapshot in &snapshots {
+ assert_eq!(
+ db.query_raw_sql(snapshot["query"].as_str().unwrap())
+ .await
+ .unwrap(),
+ snapshot["rows"]
+ );
+ }
+ let compressed_payloads = db.frame_payloads(&ids, Projection::All).await.unwrap();
+ assert_eq!(payloads.len(), compressed_payloads.len());
+ for (id, before) in &payloads {
+ let after = &compressed_payloads[id];
+ assert_eq!(before.full_text, after.full_text, "frame {id} full text");
+ assert_eq!(
+ before.accessibility_text, after.accessibility_text,
+ "frame {id} accessibility"
+ );
+ assert_eq!(
+ before.accessibility_tree_json, after.accessibility_tree_json,
+ "frame {id} tree"
+ );
+ assert_eq!(before.text_json, after.text_json, "frame {id} OCR");
+ }
+ let stars: i64 =
+ sqlx::query_scalar("SELECT count(*) FROM sqlite_master WHERE name='starred_sessions'")
+ .fetch_one(&db.pool)
+ .await
+ .unwrap();
+ assert_eq!(stars, 0);
+ let sealed: i64 =
+ sqlx::query_scalar("SELECT count(*) FROM frame_payloads WHERE state='sealed'")
+ .fetch_one(&db.pool)
+ .await
+ .unwrap();
+ assert_eq!(sealed, 128);
+ db.close().await;
+ let manifest = json!({"source_commit":"8325934d5571b3d7d87ac068177d63c6dc5c9ce6","app_version":"2.7.84","synthetic":true,"frames":128,"sealed_frames":sealed,"starred_table_present":false,"migration_report":report,"snapshots":snapshots,"payloads":compressed_payloads});
+ std::fs::write(
+ root.join("fixture-manifest.json"),
+ serde_json::to_vec_pretty(&manifest).unwrap(),
+ )
+ .unwrap();
+ println!(
+ "Historical 2.7.84 fixture created and verified at {}",
+ root.display()
+ );
+}
diff --git a/crates/screenpipe-db/tests/hybrid_storage.rs b/crates/screenpipe-db/tests/hybrid_storage.rs
index 5ed8c581b..e35d3ac6a 100644
--- a/crates/screenpipe-db/tests/hybrid_storage.rs
+++ b/crates/screenpipe-db/tests/hybrid_storage.rs
@@ -1079,3 +1079,513 @@ async fn migration_streams_large_payloads_with_bounded_temporary_space() {
db.verify_storage().await.unwrap();
db.close().await;
}
+
+#[tokio::test]
+async fn starred_upgrade_restores_older_hybrid_search_and_preserves_recordings() {
+ let root = tempfile::tempdir().unwrap();
+ let db = DatabaseManager::new_hybrid(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap();
+ seed(&db, 1, Some("starred upgrade history"), None).await;
+ db.seal_frame_payloads().await.unwrap();
+ let before = db.frame_payloads(&[1], Projection::All).await.unwrap();
+ // Reproduce a generation converted before starred sessions shipped. Only
+ // mutate this disposable fixture, through its existing serialized writer.
+ db.execute_raw_sql_write(
+ "DROP TABLE starred_sessions;
+ DELETE FROM _sqlx_migrations WHERE version=20261002190000;",
+ )
+ .await
+ .unwrap();
+ db.close().await;
+
+ let start = "2026-09-11T12:00:00.000Z";
+ let end = "2026-09-11T12:15:00.000Z";
+ for reopen in 0..2 {
+ let db = DatabaseManager::new(
+ root.path().join("db.sqlite").to_str().unwrap(),
+ Default::default(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(db.storage_mode(), StorageMode::HybridParquetV1);
+ db.verify_storage().await.unwrap();
+ assert_eq!(
+ sqlx::query_scalar::<_, i64>(
+ "SELECT count(*) FROM _sqlx_migrations WHERE version=20261002190000 AND success=1"
+ )
+ .fetch_one(&db.pool)
+ .await
+ .unwrap(),
+ 1,
+ );
+ assert_eq!(
+ before,
+ db.frame_payloads(&[1], Projection::All).await.unwrap()
+ );
+ assert_eq!(search(&db, "history").await.as_array().unwrap().len(), 1);
+ assert_eq!(
+ db.list_starred_sessions(start, end, 10, 0)
+ .await
+ .unwrap()
+ .len(),
+ reopen,
+ );
+ // Search response assembly calls this even without a starred filter.
+ assert_eq!(
+ db.starred_timestamps(&[start.into(), end.into()])
+ .await
+ .unwrap(),
+ vec![reopen == 1, false],
+ );
+ assert!(db.starred_timestamps(&[]).await.unwrap().is_empty());
+ if reopen == 0 {
+ assert!(db
+ .save_starred_session("upgrade", start, end, false, 0, start)
+ .await
+ .unwrap());
+ seed(&db, 2, Some("continued capture"), None).await;
+ db.seal_frame_payloads().await.unwrap();
+ } else {
+ assert_eq!(
+ db.get_starred_session("upgrade")
+ .await
+ .unwrap()
+ .unwrap()
+ .revision,
+ 1
+ );
+ assert_eq!(
+ db.starred_search_ranges(start, end).await.unwrap(),
+ vec![(start.into(), end.into())]
+ );
+ assert_eq!(search(&db, "continued").await.as_array().unwrap().len(), 1);
+ }
+ db.close().await;
+ }
+}
+
+#[tokio::test]
+async fn starred_upgrade_preserves_existing_sessions_and_tracks_mutations() {
+ let root = tempfile::tempdir().unwrap();
+ let db = DatabaseManager::new_hybrid(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap();
+ let start = "2026-09-11T12:00:00.000Z";
+ let end = "2026-09-11T12:15:00.000Z";
+ assert!(db
+ .save_starred_session("existing", start, end, true, 0, start)
+ .await
+ .unwrap());
+ // Already-applied SQLx migrations must preserve their data; missing
+ // generic storage hooks can still be installed without replaying the DDL.
+ db.execute_raw_sql_write(
+ "DROP TRIGGER IF EXISTS hybrid_revision_starred_sessions_INSERT;
+ DROP TRIGGER IF EXISTS hybrid_revision_starred_sessions_UPDATE;
+ DROP TRIGGER IF EXISTS hybrid_revision_starred_sessions_DELETE;
+ DROP TRIGGER IF EXISTS hybrid_read_revoke_delete_starred_sessions;",
+ )
+ .await
+ .unwrap();
+ db.close().await;
+
+ for _ in 0..2 {
+ let db = DatabaseManager::new(
+ root.path().join("db.sqlite").to_str().unwrap(),
+ Default::default(),
+ )
+ .await
+ .unwrap();
+ let session = db.get_starred_session("existing").await.unwrap().unwrap();
+ assert_eq!(session.revision, 1);
+ assert!(session.hd_requested);
+ let before = db.storage_read_token().await.unwrap().revision;
+ assert!(db
+ .save_starred_session("temporary", end, "2026-09-11T12:30:00.000Z", false, 0, end)
+ .await
+ .unwrap());
+ assert_eq!(db.storage_read_token().await.unwrap().revision, before + 1);
+ assert!(db
+ .save_starred_session("temporary", end, "2026-09-11T12:45:00.000Z", false, 1, end)
+ .await
+ .unwrap());
+ assert_eq!(db.storage_read_token().await.unwrap().revision, before + 2);
+ let revocation: i64 =
+ sqlx::query_scalar("SELECT revision FROM _storage_revocation WHERE id=1")
+ .fetch_one(&db.pool)
+ .await
+ .unwrap();
+ db.execute_raw_sql_write("DELETE FROM starred_sessions WHERE id='temporary'")
+ .await
+ .unwrap();
+ assert_eq!(db.storage_read_token().await.unwrap().revision, before + 3);
+ assert_eq!(
+ sqlx::query_scalar::<_, i64>("SELECT revision FROM _storage_revocation WHERE id=1")
+ .fetch_one(&db.pool)
+ .await
+ .unwrap(),
+ revocation + 1
+ );
+ db.close().await;
+ }
+}
+
+#[tokio::test]
+async fn later_resident_tables_receive_storage_and_privacy_hooks() {
+ let root = tempfile::tempdir().unwrap();
+ let db = DatabaseManager::new_hybrid(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap();
+ // A future resident feature needs no feature-specific Rust upgrade.
+ db.execute_raw_sql_write(
+ "CREATE TABLE feature_notes(id INTEGER PRIMARY KEY, text TEXT, redacted_at TEXT);",
+ )
+ .await
+ .unwrap();
+ db.close().await;
+ for _ in 0..2 {
+ let db = DatabaseManager::new(
+ root.path().join("db.sqlite").to_str().unwrap(),
+ Default::default(),
+ )
+ .await
+ .unwrap();
+ let before = db.storage_read_token().await.unwrap().revision;
+ db.execute_raw_sql_write("INSERT INTO feature_notes VALUES(1,'private',NULL)")
+ .await
+ .unwrap();
+ assert_eq!(db.storage_read_token().await.unwrap().revision, before + 1);
+ let token = db.storage_read_token().await.unwrap();
+ db.execute_raw_sql_write(
+ "UPDATE feature_notes SET text='redacted',redacted_at='2026-10-03' WHERE id=1",
+ )
+ .await
+ .unwrap();
+ assert!(token.admit(&db.pool).await.is_err());
+ drop(token);
+ assert_eq!(db.storage_read_token().await.unwrap().revision, before + 2);
+ let token = db.storage_read_token().await.unwrap();
+ db.execute_raw_sql_write("DELETE FROM feature_notes WHERE id=1")
+ .await
+ .unwrap();
+ assert!(token.admit(&db.pool).await.is_err());
+ drop(token);
+ assert_eq!(db.storage_read_token().await.unwrap().revision, before + 3);
+ db.close().await;
+ }
+}
+
+// Built by the unmodified 2.7.84 database implementation, not by removing
+// migrations from a database created with today's schema. See fixtures/README.md.
+#[tokio::test]
+#[ignore = "requires a synthetic fixture built with historical 2.7.84 code"]
+async fn historical_2_7_84_compressed_upgrade_preserves_data_and_restarts() {
+ use sha2::{Digest, Sha256};
+ use std::{collections::BTreeMap, path::Path};
+
+ fn copy_tree(source: &Path, destination: &Path) {
+ std::fs::create_dir_all(destination).unwrap();
+ for entry in std::fs::read_dir(source).unwrap() {
+ let entry = entry.unwrap();
+ let kind = entry.file_type().unwrap();
+ assert!(!kind.is_symlink(), "fixture must not contain symlinks");
+ let target = destination.join(entry.file_name());
+ if kind.is_dir() {
+ copy_tree(&entry.path(), &target);
+ } else {
+ assert!(kind.is_file());
+ std::fs::copy(entry.path(), target).unwrap();
+ }
+ }
+ }
+
+ fn hashes(root: &Path, parquet_only: bool) -> BTreeMap<std::path::PathBuf, Vec<u8>> {
+ fn visit(
+ root: &Path,
+ dir: &Path,
+ parquet_only: bool,
+ result: &mut BTreeMap<std::path::PathBuf, Vec<u8>>,
+ ) {
+ for entry in std::fs::read_dir(dir).unwrap() {
+ let entry = entry.unwrap();
+ let kind = entry.file_type().unwrap();
+ assert!(!kind.is_symlink());
+ if kind.is_dir() {
+ visit(root, &entry.path(), parquet_only, result);
+ } else if !parquet_only
+ || entry.path().extension().is_some_and(|ext| ext == "parquet")
+ {
+ result.insert(
+ entry.path().strip_prefix(root).unwrap().to_path_buf(),
+ Sha256::digest(std::fs::read(entry.path()).unwrap()).to_vec(),
+ );
+ }
+ }
+ }
+ let mut result = BTreeMap::new();
+ visit(root, root, parquet_only, &mut result);
+ result
+ }
+
+ let source = std::path::PathBuf::from(
+ std::env::var("SCREENPIPE_UPGRADE_FIXTURE_ROOT")
+ .expect("set the historical synthetic fixture directory"),
+ );
+ assert_eq!(
+ std::fs::read_to_string(source.join(".synthetic-upgrade-fixture")).unwrap(),
+ "screenpipe-2.7.84\n"
+ );
+ let manifest: serde_json::Value =
+ serde_json::from_slice(&std::fs::read(source.join("fixture-manifest.json")).unwrap())
+ .unwrap();
+ assert_eq!(
+ manifest["source_commit"],
+ "8325934d5571b3d7d87ac068177d63c6dc5c9ce6"
+ );
+ assert_eq!(manifest["synthetic"], true);
+ assert_eq!(manifest["sealed_frames"], 128);
+ assert_eq!(manifest["starred_table_present"], false);
+ let source_hashes = hashes(&source, false);
+ let root = tempfile::tempdir().unwrap();
+ copy_tree(&source, root.path());
+ let compressed_hashes = hashes(root.path(), true);
+ assert!(!compressed_hashes.is_empty());
+ let ids: Vec<i64> = (1..=128).collect();
+ let start = "2026-09-11T12:00:00.000Z";
+ let end = "2026-09-11T12:15:00.000Z";
+
+ for reopen in 0..3 {
+ let began = std::time::Instant::now();
+ // Spawning startup also guards the Send contract used by engine restart.
+ let path = root.path().join("db.sqlite");
+ let db = tokio::spawn(async move {
+ DatabaseManager::new(path.to_str().unwrap(), Default::default()).await
+ })
+ .await
+ .unwrap()
+ .unwrap();
+ println!("historical upgrade/open {reopen}: {:?}", began.elapsed());
+ assert_eq!(db.storage_mode(), StorageMode::HybridParquetV1);
+ db.verify_storage().await.unwrap();
+ for snapshot in manifest["snapshots"].as_array().unwrap() {
+ let rows = db
+ .query_raw_sql(snapshot["query"].as_str().unwrap())
+ .await
+ .unwrap();
+ let actual = rows.as_array().unwrap();
+ let expected = snapshot["rows"].as_array().unwrap();
+ // New migration and capture rows append; every historical row stays exact.
+ assert!(actual.len() >= expected.len());
+ assert_eq!(&actual[..expected.len()], expected, "{}", snapshot["query"]);
+ }
+ assert_eq!(
+ serde_json::to_value(db.frame_payloads(&ids, Projection::All).await.unwrap()).unwrap(),
+ manifest["payloads"]
+ );
+ assert_eq!(
+ sqlx::query_scalar::<_, i64>(
+ "SELECT count(*) FROM _sqlx_migrations WHERE version=20261002190000 AND success=1"
+ )
+ .fetch_one(&db.pool)
+ .await
+ .unwrap(),
+ 1
+ );
+ assert_eq!(
+ search(&db, "historicalneedle")
+ .await
+ .as_array()
+ .unwrap()
+ .len(),
+ 100
+ );
+ let audio = db
+ .search(
+ "historicalneedle",
+ ContentType::Audio,
+ 100,
+ 0,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
+ .await
+ .unwrap();
+ // Audio search includes the eight live meeting transcript segments.
+ assert_eq!(audio.len(), 16);
+ assert_eq!(
+ db.starred_timestamps(&[start.into(), end.into()])
+ .await
+ .unwrap(),
+ vec![reopen > 0, false]
+ );
+ assert_eq!(
+ db.list_starred_sessions(start, end, 10, 0)
+ .await
+ .unwrap()
+ .len(),
+ usize::from(reopen > 0)
+ );
+ // Startup must not rewrite or delete any historical compressed payload.
+ let now = hashes(root.path(), true);
+ for (path, digest) in &compressed_hashes {
+ assert_eq!(now.get(path), Some(digest), "{}", path.display());
+ }
+ if reopen == 0 {
+ assert_eq!(now, compressed_hashes);
+ db.save_starred_session("historical-upgrade", start, end, false, 0, start)
+ .await
+ .unwrap();
+ seed(&db, 129, Some("postupgradeneedle capture"), None).await;
+ db.execute_raw_sql_write("INSERT INTO audio_chunks(id,file_path,timestamp) VALUES(2,'post-upgrade.wav','2026-09-11T12:01:00Z'); INSERT INTO audio_transcriptions(id,audio_chunk_id,offset_index,timestamp,transcription,device) VALUES(9,2,9,'2026-09-11T12:01:00Z','postupgradeneedle speech','fixture-mic')").await.unwrap();
+ while db.seal_payloads().await.unwrap() != 0 {}
+ } else {
+ assert_eq!(
+ db.get_starred_session("historical-upgrade")
+ .await
+ .unwrap()
+ .unwrap()
+ .revision,
+ 1
+ );
+ assert_eq!(
+ search(&db, "postupgradeneedle")
+ .await
+ .as_array()
+ .unwrap()
+ .len(),
+ 1
+ );
+ assert_eq!(
+ db.frame_payloads(&[129], Projection::All)
+ .await
+ .unwrap()
+ .len(),
+ 1
+ );
+ assert_eq!(
+ db.search(
+ "postupgradeneedle",
+ ContentType::Audio,
+ 100,
+ 0,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None,
+ None
+ )
+ .await
+ .unwrap()
+ .len(),
+ 1
+ );
+ }
+ db.close().await;
+ }
+ assert_eq!(
+ hashes(&source, false),
+ source_hashes,
+ "original fixture remains untouched"
+ );
+}
+
+#[tokio::test]
+async fn pending_sqlx_migration_rolls_back_and_retries_on_compressed_storage() {
+ use screenpipe_db::storage::StorageDescriptor;
+ let root = tempfile::tempdir().unwrap();
+ let db = DatabaseManager::new_hybrid(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap();
+ seed(&db, 1, Some("migration retry history"), None).await;
+ db.seal_frame_payloads().await.unwrap();
+ let before = db.frame_payloads(&[1], Projection::All).await.unwrap();
+ // Fail the second statement of the pending migration, after CREATE TABLE.
+ db.execute_raw_sql_write(
+ "DROP TABLE starred_sessions;
+ DELETE FROM _sqlx_migrations WHERE version=20261002190000;
+ CREATE INDEX idx_starred_sessions_start_end ON tags(name);",
+ )
+ .await
+ .unwrap();
+ db.close().await;
+ let path = root.path().join("db.sqlite");
+ let error = match DatabaseManager::new(path.to_str().unwrap(), Default::default()).await {
+ Ok(db) => {
+ db.close().await;
+ panic!("conflicting index must fail startup");
+ }
+ Err(error) => error.to_string(),
+ };
+ assert!(error.contains("idx_starred_sessions_start_end"), "{error}");
+ // Inspect only this closed, disposable index. SQLx must roll back both DDL
+ // and its completion record before a corrected retry can proceed.
+ let descriptor = StorageDescriptor::read(root.path()).unwrap().unwrap();
+ let mut conn = sqlx::SqliteConnection::connect_with(
+ &sqlx::sqlite::SqliteConnectOptions::new().filename(root.path().join(descriptor.index)),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ sqlx::query_scalar::<_, i64>(
+ "SELECT count(*) FROM sqlite_master WHERE name='starred_sessions'"
+ )
+ .fetch_one(&mut conn)
+ .await
+ .unwrap(),
+ 0
+ );
+ assert_eq!(
+ sqlx::query_scalar::<_, i64>(
+ "SELECT count(*) FROM _sqlx_migrations WHERE version=20261002190000"
+ )
+ .fetch_one(&mut conn)
+ .await
+ .unwrap(),
+ 0
+ );
+ sqlx::query("DROP INDEX idx_starred_sessions_start_end")
+ .execute(&mut conn)
+ .await
+ .unwrap();
+ conn.close().await.unwrap();
+ let db = DatabaseManager::new(path.to_str().unwrap(), Default::default())
+ .await
+ .unwrap();
+ db.verify_storage().await.unwrap();
+ assert_eq!(
+ before,
+ db.frame_payloads(&[1], Projection::All).await.unwrap()
+ );
+ assert_eq!(search(&db, "history").await.as_array().unwrap().len(), 1);
+ assert_eq!(
+ sqlx::query_scalar::<_, i64>(
+ "SELECT count(*) FROM _sqlx_migrations WHERE version=20261002190000 AND success=1"
+ )
+ .fetch_one(&db.pool)
+ .await
+ .unwrap(),
+ 1
+ );
+ db.close().await;
+}
diff --git a/docs/COVERAGE.md b/docs/COVERAGE.md
index e196f28b0..c8050bc9a 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: 36
- Mapped Rust files: 382
-- Active test blocks: 3769
-- Ignored/manual test blocks: 169
-- Weighted coverage points: 3108.0
+- Active test blocks: 3773
+- Ignored/manual test blocks: 170
+- Weighted coverage points: 3112.0
| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| windows | 32 | 3623 | 155 | 3041.8 | 21 | 11 | 100% |
-| macos | 31 | 3649 | 130 | 3030.3 | 22 | 11 | 100% |
-| linux | 28 | 3206 | 130 | 2665.1 | 20 | 11 | 100% |
+| windows | 32 | 3627 | 156 | 3045.8 | 21 | 11 | 100% |
+| macos | 31 | 3653 | 131 | 3034.3 | 22 | 11 | 100% |
+| linux | 28 | 3210 | 131 | 2669.1 | 20 | 11 | 100% |
## Refresh
diff --git a/docs/coverage/CORE.md b/docs/coverage/CORE.md
index ef75ff767..15a88bbf4 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: 36
- Mapped Rust files: 382
-- Active test blocks: 3769
-- Ignored/manual test blocks: 169
-- Declared test blocks: 3938
-- Weighted coverage points: 3108.0
+- Active test blocks: 3773
+- Ignored/manual test blocks: 170
+- Declared test blocks: 3943
+- Weighted coverage points: 3112.0
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,16 +23,16 @@ are explicitly enabled in a runtime lane.
| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| windows | 32 | 3623 | 155 | 3041.8 | 21 | 11 | 100% |
-| macos | 31 | 3649 | 130 | 3030.3 | 22 | 11 | 100% |
-| linux | 28 | 3206 | 130 | 2665.1 | 20 | 11 | 100% |
+| windows | 32 | 3627 | 156 | 3045.8 | 21 | 11 | 100% |
+| macos | 31 | 3653 | 131 | 3034.3 | 22 | 11 | 100% |
+| linux | 28 | 3210 | 131 | 2669.1 | 20 | 11 | 100% |
## Crate Summary
| Crate | Suites | Integration files | Source unit files | Active tests | Ignored tests | Weighted points | Flows |
| --- | --- | --- | --- | --- | --- | --- | --- |
| screenpipe-engine | 12 | 21 | 127 | 1818 | 52 | 1399.1 | 10 |
-| screenpipe-db | 5 | 64 | 26 | 590 | 25 | 561.6 | 9 |
+| screenpipe-db | 5 | 64 | 26 | 594 | 26 | 565.6 | 9 |
| screenpipe-sqlite-coordinator | 1 | 0 | 3 | 27 | 0 | 27.0 | 2 |
| screenpipe-audio | 7 | 26 | 53 | 675 | 49 | 590.3 | 5 |
| screenpipe-screen | 6 | 9 | 19 | 272 | 9 | 242.3 | 4 |
@@ -66,21 +66,21 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| audio | 9 suites / 797 active / 50 ignored / 712.3 pts | 8 suites / 791 active / 50 ignored / 708.0 pts | 7 suites / 712 active / 49 ignored / 652.8 pts |
| audio-device | 2 suites / 234 active / 7 ignored / 210.3 pts | 2 suites / 234 active / 7 ignored / 210.3 pts | 1 suites / 155 active / 6 ignored / 155.0 pts |
| configuration | 2 suites / 151 active / 3 ignored / 136.7 pts | 2 suites / 151 active / 3 ignored / 136.7 pts | 2 suites / 151 active / 3 ignored / 136.7 pts |
-| database | 7 suites / 543 active / 21 ignored / 514.6 pts | 7 suites / 543 active / 21 ignored / 514.6 pts | 7 suites / 543 active / 21 ignored / 514.6 pts |
+| database | 7 suites / 547 active / 22 ignored / 518.6 pts | 7 suites / 547 active / 22 ignored / 518.6 pts | 7 suites / 547 active / 22 ignored / 518.6 pts |
| db-search | 2 suites / 116 active / 9 ignored / 116.0 pts | 2 suites / 116 active / 9 ignored / 116.0 pts | 2 suites / 116 active / 9 ignored / 116.0 pts |
| engine-lifecycle | 6 suites / 254 active / 1 ignored / 229.0 pts | 6 suites / 254 active / 1 ignored / 229.0 pts | 6 suites / 250 active / 9 ignored / 228.1 pts |
| local-api | 3 suites / 474 active / 11 ignored / 334.8 pts | 3 suites / 474 active / 11 ignored / 334.8 pts | 3 suites / 474 active / 11 ignored / 334.8 pts |
| meeting | 6 suites / 1705 active / 24 ignored / 1390.9 pts | 6 suites / 1705 active / 24 ignored / 1390.9 pts | 4 suites / 1356 active / 20 ignored / 1065.6 pts |
| ocr | 4 suites / 137 active / 7 ignored / 127.7 pts | 4 suites / 130 active / 7 ignored / 125.5 pts | 3 suites / 121 active / 6 ignored / 116.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 / 1642 active / 79 ignored / 1452.1 pts | 14 suites / 1750 active / 83 ignored / 1495.3 pts | 13 suites / 1642 active / 79 ignored / 1452.1 pts |
+| performance | 13 suites / 1646 active / 80 ignored / 1456.1 pts | 14 suites / 1754 active / 84 ignored / 1499.3 pts | 13 suites / 1646 active / 80 ignored / 1456.1 pts |
| pipes | 1 suites / 539 active / 3 ignored / 377.3 pts | 1 suites / 539 active / 3 ignored / 377.3 pts | 1 suites / 539 active / 3 ignored / 377.3 pts |
| privacy | 5 suites / 1000 active / 42 ignored / 807.4 pts | 5 suites / 1039 active / 17 ignored / 802.3 pts | 5 suites / 958 active / 14 ignored / 772.3 pts |
| real-app | - | 1 suites / 108 active / 4 ignored / 43.2 pts | - |
| speaker | 2 suites / 388 active / 11 ignored / 388.0 pts | 2 suites / 388 active / 11 ignored / 388.0 pts | 2 suites / 388 active / 11 ignored / 388.0 pts |
-| storage | 4 suites / 670 active / 38 ignored / 556.0 pts | 4 suites / 670 active / 38 ignored / 556.0 pts | 4 suites / 670 active / 38 ignored / 556.0 pts |
+| storage | 4 suites / 674 active / 39 ignored / 560.0 pts | 4 suites / 674 active / 39 ignored / 560.0 pts | 4 suites / 674 active / 39 ignored / 560.0 pts |
| sync | 1 suites / 539 active / 3 ignored / 377.3 pts | 1 suites / 539 active / 3 ignored / 377.3 pts | 1 suites / 539 active / 3 ignored / 377.3 pts |
-| timeline | 4 suites / 1217 active / 44 ignored / 996.5 pts | 4 suites / 1217 active / 44 ignored / 996.5 pts | 4 suites / 1217 active / 44 ignored / 996.5 pts |
+| timeline | 4 suites / 1221 active / 45 ignored / 1000.5 pts | 4 suites / 1221 active / 45 ignored / 1000.5 pts | 4 suites / 1221 active / 45 ignored / 1000.5 pts |
| transcription | 6 suites / 870 active / 48 ignored / 680.2 pts | 5 suites / 864 active / 48 ignored / 676.0 pts | 5 suites / 864 active / 48 ignored / 676.0 pts |
| ui-events | 4 suites / 816 active / 34 ignored / 619.3 pts | 3 suites / 747 active / 5 ignored / 571.0 pts | 3 suites / 747 active / 5 ignored / 571.0 pts |
| vision-capture | 6 suites / 572 active / 32 ignored / 450.5 pts | 6 suites / 565 active / 32 ignored / 448.3 pts | 5 suites / 556 active / 31 ignored / 439.3 pts |
@@ -134,7 +134,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| 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 | 17 | 119 | 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 | 16 | 47 | 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 | 14 | 106 | 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 | 36 | 290 | 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 | 36 | 294 | 13 | 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 | 44 | 429 | 6 | 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 | 306 | 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 | 13 | 123 | 1 | Fast logic coverage for the config bridge, health-endpoint identity, tray health debounce, sleep/power policies, and queue backpressure. |
@@ -316,7 +316,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| 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/hybrid_storage.rs | integration | 20 | 1 | 21 |
| db-timeline-frames | screenpipe-db | tests/in_place_migration.rs | integration | 19 | 5 | 24 |
| db-search-indexing | screenpipe-db | tests/keyword_search_accessibility_test.rs | integration | 7 | 0 | 7 |
| db-search-indexing | screenpipe-db | tests/keyword_search_order_test.rs | integration | 3 | 0 | 3 |