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(storage): recover credentials-only migration sources (#7175)

Ezra Ellettecb3b21373aa8
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index e72ccd9ab..a8491fca9 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -11565,6 +11565,7 @@ dependencies = [
"screenpipe-config",
"screenpipe-fs",
"screenpipe-resource",
+ "screenpipe-secrets",
"screenpipe-semantic",
"screenpipe-sqlite-coordinator",
"serde",
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs b/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs
index bcdb8697e..9972013c3 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/feedback_upload.rs
@@ -864,6 +864,83 @@ mod tests {
.await;
}
+ #[tokio::test]
+ async fn migration_credential_failure_reaches_support_after_log_rotation_and_redaction() {
+ use screenpipe_db::{storage, DatabaseManager};
+ use screenpipe_secrets::{secrets_database_path, shared_secret_pool, SecretStore};
+ let root = tempfile::tempdir().unwrap();
+ let source = root.path().join("db.sqlite");
+ let db = DatabaseManager::new(source.to_str().unwrap(), Default::default())
+ .await
+ .unwrap();
+ db.execute_raw_sql_write(
+ "INSERT INTO frames(id,timestamp,full_text) VALUES(1,'2026-09-20','private history')",
+ )
+ .await
+ .unwrap();
+ db.close().await;
+ let report = storage::migrate(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap();
+ let descriptor = storage::StorageDescriptor::read(root.path())
+ .unwrap()
+ .unwrap();
+ SecretStore::open_for_data_dir(root.path(), None)
+ .await
+ .unwrap();
+ let pool = shared_secret_pool(secrets_database_path(root.path()).to_str().unwrap())
+ .await
+ .unwrap();
+ pool.close().await;
+ rusqlite::Connection::open(secrets_database_path(root.path()))
+ .unwrap()
+ .execute_batch("CREATE TRIGGER refuse_recovery BEFORE INSERT ON secrets BEGIN SELECT RAISE(ABORT,'credential destination refused write'); END")
+ .unwrap();
+ let legacy = SecretStore::open(source.to_str().unwrap(), None)
+ .await
+ .unwrap();
+ legacy
+ .set("recovered-token", b"private history")
+ .await
+ .unwrap();
+ shared_secret_pool(source.to_str().unwrap())
+ .await
+ .unwrap()
+ .close()
+ .await;
+ std::fs::write(
+ root.path().join("storage-migration.json"),
+ serde_json::to_vec(&json!({
+ "format": 2, "phase": "paused", "descriptor": descriptor,
+ "source": report.tables, "snapshot": null, "report": null
+ }))
+ .unwrap(),
+ )
+ .unwrap();
+ let error = storage::migrate(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap_err();
+ assert!(
+ error
+ .to_string()
+ .contains("credential destination refused write"),
+ "{error}"
+ );
+ assert!(source.is_file());
+ assert_migration_failure_uploaded(
+ root.path(),
+ &[
+ "credential destination refused write",
+ "recovering_migration_secrets",
+ "\"table\": \"secrets\"",
+ "\"status\": \"failed\"",
+ "\"source_exists\": true",
+ "\"index_exists\": true",
+ ],
+ )
+ .await;
+ }
+
async fn assert_migration_failure_uploaded(root: &std::path::Path, expected: &[&str]) {
timeout(Duration::from_secs(3), async {
loop {
@@ -893,6 +970,7 @@ mod tests {
);
}
assert!(!redacted.contains("private history"));
+ assert!(!redacted.contains("cHJpdmF0ZSBoaXN0b3J5"));
let server = MockServer::start().await;
Mock::given(method("POST"))
diff --git a/crates/screenpipe-db/Cargo.toml b/crates/screenpipe-db/Cargo.toml
index 350f94dba..2eeea94cf 100644
--- a/crates/screenpipe-db/Cargo.toml
+++ b/crates/screenpipe-db/Cargo.toml
@@ -34,6 +34,7 @@ screenpipe-config = { path = "../screenpipe-config" }
screenpipe-semantic = { path = "../screenpipe-semantic" }
screenpipe-resource = { path = "../screenpipe-resource" }
screenpipe-sqlite-coordinator = { path = "../screenpipe-sqlite-coordinator" }
+screenpipe-secrets = { path = "../screenpipe-secrets" }
zerocopy = { version = "0.7.32" }
tokio = { workspace = true }
@@ -60,7 +61,6 @@ windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_Storage
[dev-dependencies]
screenpipe-core = { path = "../screenpipe-core" }
-screenpipe-secrets = { path = "../screenpipe-secrets" }
[[bench]]
name = "db_benchmarks"
diff --git a/crates/screenpipe-db/src/storage/lifecycle.rs b/crates/screenpipe-db/src/storage/lifecycle.rs
index 34f6c1587..36dcc0ed5 100644
--- a/crates/screenpipe-db/src/storage/lifecycle.rs
+++ b/crates/screenpipe-db/src/storage/lifecycle.rs
@@ -382,9 +382,9 @@ async fn reconcile_migration_source(root: &Path, journal: &mut Journal) -> Resul
return Ok(());
}
- // Older explicit retries could create an empty legacy database while the
- // real index was awaiting descriptor publication. Only retire that empty
- // artifact, and only beside an index with this journal's stored identity.
+ // Older retries/credential writers could recreate the legacy database while
+ // the real history was in this journal's index. Retire only an empty or
+ // credentials-only source, preserving its file and any credentials first.
crate::db::register_sqlite_extensions()?;
let _index_owner = screenpipe_sqlite_coordinator::acquire_sqlite_manager_lease(&index)
.map_err(storage_error)?;
@@ -422,47 +422,63 @@ async fn reconcile_migration_source(root: &Path, journal: &mut Journal) -> Resul
.busy_timeout(std::time::Duration::from_secs(5)),
)
.await?;
- let empty = async {
+ let recoverable = async {
sqlx::query("BEGIN EXCLUSIVE").execute(&mut conn).await?;
// Shadow tables belong to their virtual table. Query every logical
// table, including unknown extensions, rather than just frames/audio.
// SQLite statistics/sequences and SQLx's ledger contain no history.
+ // Credentials are handled separately only after all tables are checked.
let tables: Vec<String> = sqlx::query_scalar("SELECT name FROM pragma_table_list WHERE schema='main' AND type!='shadow' AND name NOT GLOB 'sqlite_*' AND name!='_sqlx_migrations'")
.fetch_all(&mut conn).await?;
+ let mut has_secrets = false;
for table in tables {
let populated: bool = sqlx::query_scalar(sqlx::AssertSqlSafe(format!("SELECT EXISTS(SELECT 1 FROM {} LIMIT 1)", quote(&table))))
.fetch_one(&mut conn).await?;
if populated {
+ if table == "secrets" {
+ has_secrets = true;
+ continue;
+ }
super::diagnostics::batch(&table, None, None, None, None);
return Err(storage_error(format!("migration source conflicts with existing index: source contains recorded history in {table}; both files have been kept")));
}
}
+ if has_secrets {
+ super::diagnostics::stage("recovering_migration_secrets");
+ super::diagnostics::batch("secrets", None, None, None, None);
+ screenpipe_secrets::SecretStore::recover_legacy_source(root, &mut conn)
+ .await
+ .map_err(|error| storage_error(format!("credential recovery failed: {error:#}; both files have been kept")))?;
+ super::faults::checkpoint("migration_source_secrets_copied");
+ }
+ super::diagnostics::stage("retaining_migration_source");
sqlx::query("COMMIT").execute(&mut conn).await?;
// Checkpoint before moving the closed file; never orphan a WAL.
let mode: String = sqlx::query_scalar("PRAGMA journal_mode=DELETE").fetch_one(&mut conn).await?;
if mode != "delete" {
- return Err(storage_error("empty migration source is still in use; both files have been kept"));
+ return Err(storage_error("migration source is still in use; both files have been kept"));
}
- Ok::<_, sqlx::Error>(())
+ Ok::<_, sqlx::Error>(has_secrets)
}.await;
- if let Err(error) = &empty {
+ if let Err(error) = &recoverable {
super::diagnostics::failure(error);
}
conn.close().await?;
- empty?;
+ let has_secrets = recoverable?;
// The old retry may have overwritten receipts with the empty DB's counts.
// Persist the need to refresh them before moving anything, so interruption
// after the rename cannot make a later retry trust those stale receipts.
journal.phase = Phase::Paused;
durable_json(&root.join("storage-migration.json"), journal)?;
let retained = index.parent().unwrap().join(format!(
- "recovered-empty-source-{}.sqlite",
+ "recovered-{}-source-{}.sqlite",
+ if has_secrets { "secrets" } else { "empty" },
uuid::Uuid::new_v4()
));
std::fs::rename(&source_path, &retained)?;
sync_directory(index.parent().unwrap())?;
sync_directory(root)?;
- super::faults::checkpoint("migration_empty_source_retired");
+ super::faults::checkpoint("migration_source_retired");
Ok(())
}
diff --git a/crates/screenpipe-db/tests/migration_source_recovery.rs b/crates/screenpipe-db/tests/migration_source_recovery.rs
index d56c1ef1e..e4cfa1d06 100644
--- a/crates/screenpipe-db/tests/migration_source_recovery.rs
+++ b/crates/screenpipe-db/tests/migration_source_recovery.rs
@@ -9,6 +9,221 @@ use screenpipe_db::{
};
use std::path::Path;
+const RECOVERY_KEY: [u8; 32] = [7; 32];
+
+async fn credential_source(root: &Path) {
+ use screenpipe_secrets::{secrets_database_path, shared_secret_pool, SecretStore};
+ // Seal the old one-time import before a legacy process recreates db.sqlite.
+ let dedicated = SecretStore::open_for_data_dir(root, Some(RECOVERY_KEY))
+ .await
+ .unwrap();
+ dedicated
+ .set("dedicated-newer", b"current token")
+ .await
+ .unwrap();
+ dedicated.set("source-newer", b"old token").await.unwrap();
+ let pool = shared_secret_pool(secrets_database_path(root).to_str().unwrap())
+ .await
+ .unwrap();
+ sqlx::query("UPDATE secrets SET updated_at=CASE key WHEN 'dedicated-newer' THEN '2026-09-21' ELSE '2026-09-19' END")
+ .execute(&pool).await.unwrap();
+ pool.close().await;
+
+ let source = root.join("db.sqlite");
+ let store = SecretStore::open(source.to_str().unwrap(), Some(RECOVERY_KEY))
+ .await
+ .unwrap();
+ store
+ .set("recovered-only", b"preserved token")
+ .await
+ .unwrap();
+ store.set("dedicated-newer", b"stale token").await.unwrap();
+ store.set("source-newer", b"refreshed token").await.unwrap();
+ let pool = shared_secret_pool(source.to_str().unwrap()).await.unwrap();
+ sqlx::query("UPDATE secrets SET created_at='2026-09-14', updated_at='2026-09-20', expires_at='2099-01-01'")
+ .execute(&pool).await.unwrap();
+ pool.close().await;
+}
+
+async fn verify_recovered_credentials(root: &Path) {
+ use screenpipe_secrets::{secrets_database_path, shared_secret_pool, SecretStore};
+ let path = secrets_database_path(root);
+ shared_secret_pool(path.to_str().unwrap())
+ .await
+ .unwrap()
+ .close()
+ .await;
+ let store = SecretStore::open_for_data_dir(root, Some(RECOVERY_KEY))
+ .await
+ .unwrap();
+ for (key, expected) in [
+ ("recovered-only", "preserved token"),
+ ("dedicated-newer", "current token"),
+ ("source-newer", "refreshed token"),
+ ] {
+ assert_eq!(store.get(key).await.unwrap().unwrap(), expected.as_bytes());
+ }
+ let pool = shared_secret_pool(path.to_str().unwrap()).await.unwrap();
+ let dates: (String, String, String) = sqlx::query_as(
+ "SELECT created_at,updated_at,expires_at FROM secrets WHERE key='recovered-only'",
+ )
+ .fetch_one(&pool)
+ .await
+ .unwrap();
+ assert_eq!(
+ dates,
+ (
+ "2026-09-14".into(),
+ "2026-09-20".into(),
+ "2099-01-01".into()
+ )
+ );
+ pool.close().await;
+
+ let descriptor = screenpipe_db::storage::StorageDescriptor::read(root)
+ .unwrap()
+ .unwrap();
+ let retained: Vec<_> = std::fs::read_dir(root.join(descriptor.index).parent().unwrap())
+ .unwrap()
+ .filter_map(Result::ok)
+ .filter(|entry| {
+ entry
+ .file_name()
+ .to_string_lossy()
+ .starts_with("recovered-secrets-source-")
+ })
+ .collect();
+ assert_eq!(retained.len(), 1);
+ let conn = rusqlite::Connection::open_with_flags(
+ retained[0].path(),
+ rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY,
+ )
+ .unwrap();
+ assert_eq!(
+ conn.query_row("SELECT count(*) FROM secrets", [], |row| row
+ .get::<_, i64>(0))
+ .unwrap(),
+ 3
+ );
+}
+
+#[tokio::test]
+async fn retry_recovers_credentials_only_source_and_preserves_newer_secrets() {
+ for (active, startup_recovery) in [(false, false), (true, false), (false, true)] {
+ let root = paused_before_activation().await;
+ if active {
+ recover_interrupted_migration(root.path(), Default::default())
+ .await
+ .unwrap();
+ }
+ credential_source(root.path()).await;
+ if startup_recovery {
+ recover_interrupted_migration(root.path(), Default::default())
+ .await
+ .unwrap();
+ assert!(root.path().join("storage-migration.json").is_file());
+ assert!(!root.path().join("storage-migration-complete.json").exists());
+ }
+ finish_and_verify(root.path()).await;
+ verify_recovered_credentials(root.path()).await;
+ }
+}
+
+#[tokio::test]
+async fn credentials_recovery_survives_copy_and_retirement_interruptions() {
+ for point in [
+ "migration_source_secrets_copied",
+ "migration_source_retired",
+ ] {
+ let root = paused_before_activation().await;
+ recover_interrupted_migration(root.path(), Default::default())
+ .await
+ .unwrap();
+ credential_source(root.path()).await;
+ crash_migration(root.path(), point);
+ finish_and_verify(root.path()).await;
+ verify_recovered_credentials(root.path()).await;
+ }
+}
+
+#[tokio::test]
+async fn failed_credential_recovery_is_atomic_and_retryable() {
+ use screenpipe_secrets::{secrets_database_path, shared_secret_pool};
+ let root = paused_before_activation().await;
+ credential_source(root.path()).await;
+ let source = root.path().join("db.sqlite");
+ let before = std::fs::read(&source).unwrap();
+ let journal = std::fs::read(root.path().join("storage-migration.json")).unwrap();
+ let pool = shared_secret_pool(secrets_database_path(root.path()).to_str().unwrap())
+ .await
+ .unwrap();
+ sqlx::query("CREATE TRIGGER refuse_recovery BEFORE INSERT ON secrets WHEN NEW.key='source-newer' BEGIN SELECT RAISE(ABORT,'credential destination refused write'); END")
+ .execute(&pool).await.unwrap();
+ let error = migrate(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap_err();
+ assert!(
+ error
+ .to_string()
+ .contains("credential destination refused write"),
+ "{error}"
+ );
+ assert_eq!(std::fs::read(&source).unwrap(), before);
+ assert_eq!(
+ std::fs::read(root.path().join("storage-migration.json")).unwrap(),
+ journal
+ );
+ let partial: bool =
+ sqlx::query_scalar("SELECT EXISTS(SELECT 1 FROM secrets WHERE key='recovered-only')")
+ .fetch_one(&pool)
+ .await
+ .unwrap();
+ assert!(!partial, "failed import must roll back every credential");
+ sqlx::query("DROP TRIGGER refuse_recovery")
+ .execute(&pool)
+ .await
+ .unwrap();
+ pool.close().await;
+ finish_and_verify(root.path()).await;
+ verify_recovered_credentials(root.path()).await;
+}
+
+#[tokio::test]
+async fn credentials_do_not_hide_other_source_history() {
+ use screenpipe_secrets::{secrets_database_path, shared_secret_pool};
+ let root = paused_before_activation().await;
+ credential_source(root.path()).await;
+ let source = root.path().join("db.sqlite");
+ {
+ let conn = rusqlite::Connection::open(&source).unwrap();
+ conn.execute_batch("CREATE TABLE extension_history(text TEXT); INSERT INTO extension_history VALUES('additional history')").unwrap();
+ }
+ let before = std::fs::read(&source).unwrap();
+ let error = migrate(root.path(), Default::default(), Default::default())
+ .await
+ .unwrap_err();
+ assert!(
+ error
+ .to_string()
+ .contains("source contains recorded history in extension_history"),
+ "{error}"
+ );
+ assert_eq!(std::fs::read(source).unwrap(), before);
+ let pool = shared_secret_pool(secrets_database_path(root.path()).to_str().unwrap())
+ .await
+ .unwrap();
+ let imported: bool =
+ sqlx::query_scalar("SELECT EXISTS(SELECT 1 FROM secrets WHERE key='recovered-only')")
+ .fetch_one(&pool)
+ .await
+ .unwrap();
+ assert!(
+ !imported,
+ "validate every source table before importing credentials"
+ );
+ pool.close().await;
+}
+
async fn seed(path: &Path, text: Option<&str>) {
let db = DatabaseManager::new(path.to_str().unwrap(), Default::default())
.await
@@ -206,7 +421,7 @@ async fn conflicting_nonempty_source_is_preserved_and_diagnosed() {
async fn retry_resumes_if_interrupted_after_retaining_the_empty_source() {
let root = paused_before_activation().await;
recreate_old_retry(root.path()).await;
- crash_migration(root.path(), "migration_empty_source_retired");
+ crash_migration(root.path(), "migration_source_retired");
assert!(!root.path().join("db.sqlite").exists());
// An explicit retry must also work without another startup recovery first.
finish_and_verify(root.path()).await;
diff --git a/crates/screenpipe-secrets/src/store.rs b/crates/screenpipe-secrets/src/store.rs
index 6267d41a4..c061f5fec 100644
--- a/crates/screenpipe-secrets/src/store.rs
+++ b/crates/screenpipe-secrets/src/store.rs
@@ -9,8 +9,8 @@ use std::time::Duration;
use anyhow::{Context, Result};
use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
-use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions};
-use sqlx::{Row, SqlitePool};
+use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions, SqliteRow};
+use sqlx::{Row, SqliteConnection, SqlitePool};
use tokio::sync::{Mutex as AsyncMutex, OwnedSemaphorePermit, Semaphore};
use crate::crypto;
@@ -25,6 +25,8 @@ use screenpipe_sqlite_coordinator::{
pub const SECRETS_DATABASE_FILENAME: &str = "secrets.sqlite";
const LEGACY_DATABASE_FILENAME: &str = "db.sqlite";
const LEGACY_MIGRATION_KEY: &str = "legacy_main_db_migrated_v1";
+const LEGACY_SECRET_ROWS: &str =
+ "SELECT key, value, nonce, created_at, updated_at, expires_at FROM secrets";
pub fn secrets_database_path(data_dir: impl AsRef<Path>) -> PathBuf {
data_dir.as_ref().join(SECRETS_DATABASE_FILENAME)
@@ -326,6 +328,39 @@ impl SecretStore {
Self::open_for_data_dir(data_dir, key).await
}
+ /// Import credentials from a recreated legacy source before storage recovery
+ /// retains that file. The caller must hold exclusive source ownership until
+ /// retirement. Replays deliberately bypass the one-time import marker: an
+ /// older process may have written these rows after that import completed.
+ /// Ciphertext, nonces and expiry are copied unchanged without a vault key.
+ pub async fn recover_legacy_source(
+ data_dir: &Path,
+ source: &mut SqliteConnection,
+ ) -> Result<()> {
+ let legacy_path = data_dir.join(LEGACY_DATABASE_FILENAME);
+ if let Some(code) = registered_sqlite_hard_fault(&legacy_path) {
+ anyhow::bail!("legacy credential source needs verification (SQLite code {code})");
+ }
+ let rows = sqlx::query(LEGACY_SECRET_ROWS).fetch_all(source).await;
+ if let Err(error) = &rows {
+ latch_sqlite_error(&legacy_path, error);
+ }
+ let rows = rows.context("failed to read legacy secrets")?;
+ let path = secrets_database_path(data_dir);
+ let store = Self::open(&path.to_string_lossy(), None).await?;
+ crate::migration::fix_secret_file_permissions(data_dir);
+ let (pool, write_lock) = store.operation_database().await?;
+ let _write_permit = acquire_write_permit(&write_lock).await?;
+ let mut transaction = store
+ .observe(pool.begin().await)
+ .context("failed to begin credential recovery")?;
+ store.copy_legacy_rows(&mut transaction, rows).await?;
+ store
+ .observe(transaction.commit().await)
+ .context("failed to commit credential recovery")?;
+ Ok(())
+ }
+
async fn migrate_legacy_main_database(&self, legacy_path: &Path) -> Result<()> {
let (pool, write_lock) = self.operation_database().await?;
let _write_permit = acquire_write_permit(&write_lock).await?;
@@ -394,11 +429,9 @@ impl SecretStore {
}
};
let rows = if has_table {
- match sqlx::query(
- "SELECT key, value, nonce, created_at, updated_at, expires_at FROM secrets",
- )
- .fetch_all(&legacy_pool)
- .await
+ match sqlx::query(LEGACY_SECRET_ROWS)
+ .fetch_all(&legacy_pool)
+ .await
{
Ok(rows) => rows,
Err(error) => {
@@ -419,6 +452,24 @@ impl SecretStore {
let mut transaction = self
.observe(pool.begin().await)
.context("failed to begin legacy secret migration")?;
+ self.copy_legacy_rows(&mut transaction, rows).await?;
+ self.observe(
+ sqlx::query("INSERT INTO secret_store_metadata (key, value) VALUES (?, 'complete')")
+ .bind(LEGACY_MIGRATION_KEY)
+ .execute(&mut *transaction)
+ .await,
+ )
+ .context("failed to seal legacy secret migration")?;
+ self.observe(transaction.commit().await)
+ .context("failed to commit legacy secret migration")?;
+ Ok(())
+ }
+
+ async fn copy_legacy_rows(
+ &self,
+ transaction: &mut SqliteConnection,
+ rows: Vec<SqliteRow>,
+ ) -> Result<()> {
for row in rows {
self.observe(
sqlx::query(
@@ -443,15 +494,6 @@ impl SecretStore {
)
.context("failed to copy a legacy secret")?;
}
- self.observe(
- sqlx::query("INSERT INTO secret_store_metadata (key, value) VALUES (?, 'complete')")
- .bind(LEGACY_MIGRATION_KEY)
- .execute(&mut *transaction)
- .await,
- )
- .context("failed to seal legacy secret migration")?;
- self.observe(transaction.commit().await)
- .context("failed to commit legacy secret migration")?;
Ok(())
}
diff --git a/docs/COVERAGE.md b/docs/COVERAGE.md
index 58f223117..0b0c5bde4 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: 34
- Mapped Rust files: 366
-- Active test blocks: 3572
+- Active test blocks: 3576
- Ignored/manual test blocks: 150
-- Weighted coverage points: 2953.0
+- Weighted coverage points: 2957.0
| Platform | Suites | Active tests | Ignored tests | Weighted points | Layers | Flows | Critical score |
| --- | --- | --- | --- | --- | --- | --- | --- |
-| 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% |
+| windows | 31 | 3433 | 144 | 2891.9 | 21 | 11 | 100% |
+| macos | 31 | 3495 | 124 | 2905.9 | 22 | 11 | 100% |
+| linux | 27 | 3055 | 116 | 2543.2 | 20 | 11 | 100% |
## Refresh
diff --git a/docs/coverage/CORE.md b/docs/coverage/CORE.md
index 035b87f24..7c8c8cfc9 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: 34
- Mapped Rust files: 366
-- Active test blocks: 3572
+- Active test blocks: 3576
- Ignored/manual test blocks: 150
-- Declared test blocks: 3722
-- Weighted coverage points: 2953.0
+- Declared test blocks: 3726
+- Weighted coverage points: 2957.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 | 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% |
+| windows | 31 | 3433 | 144 | 2891.9 | 21 | 11 | 100% |
+| macos | 31 | 3495 | 124 | 2905.9 | 22 | 11 | 100% |
+| linux | 27 | 3055 | 116 | 2543.2 | 20 | 11 | 100% |
## Crate Summary
| Crate | Suites | Integration files | Source unit files | Active tests | Ignored tests | Weighted points | Flows |
| --- | --- | --- | --- | --- | --- | --- | --- |
| screenpipe-engine | 11 | 20 | 121 | 1742 | 43 | 1342.9 | 10 |
-| screenpipe-db | 5 | 62 | 24 | 564 | 25 | 537.0 | 9 |
+| screenpipe-db | 5 | 62 | 24 | 568 | 25 | 541.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 / 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 |
+| database | 7 suites / 519 active / 21 ignored / 492.0 pts | 7 suites / 519 active / 21 ignored / 492.0 pts | 7 suites / 519 active / 21 ignored / 492.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 / 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 / 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 |
+| performance | 13 suites / 1577 active / 76 ignored / 1396.3 pts | 14 suites / 1684 active / 80 ignored / 1439.1 pts | 13 suites / 1577 active / 76 ignored / 1396.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 / 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 |
+| storage | 4 suites / 642 active / 38 ignored / 533.1 pts | 4 suites / 642 active / 38 ignored / 533.1 pts | 4 suites / 642 active / 38 ignored / 533.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 / 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 |
+| timeline | 4 suites / 1182 active / 43 ignored / 968.4 pts | 4 suites / 1182 active / 43 ignored / 968.4 pts | 4 suites / 1182 active / 43 ignored / 968.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 |
@@ -133,7 +133,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 | 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 | 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 | 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. |
+| db-timeline-frames | screenpipe-db | windows, macos, linux | database, timeline, storage, performance | timeline-streaming, performance-liveness | high | strong | mixed | 35 | 279 | 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. |
@@ -319,7 +319,7 @@ bun run coverage:core -- --llvm-cov-summary ../../docs/coverage/core-llvm-cov-su
| 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-timeline-frames | screenpipe-db | tests/migration_source_recovery.rs | integration | 11 | 0 | 11 |
| 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 |
| db-accessibility-ui-events | screenpipe-db | tests/on_screen_filter_test.rs | integration | 5 | 0 | 5 |
diff --git a/packages/sdk/Cargo.lock b/packages/sdk/Cargo.lock
index 9afa64564..e64e1d573 100644
--- a/packages/sdk/Cargo.lock
+++ b/packages/sdk/Cargo.lock
@@ -7013,6 +7013,7 @@ dependencies = [
"screenpipe-config",
"screenpipe-fs",
"screenpipe-resource",
+ "screenpipe-secrets",
"screenpipe-semantic",
"screenpipe-sqlite-coordinator",
"serde",
diff --git a/packages/sdk/examples/tauri-app/src-tauri/Cargo.lock b/packages/sdk/examples/tauri-app/src-tauri/Cargo.lock
index 5b7837662..89d56650e 100644
--- a/packages/sdk/examples/tauri-app/src-tauri/Cargo.lock
+++ b/packages/sdk/examples/tauri-app/src-tauri/Cargo.lock
@@ -7139,6 +7139,7 @@ dependencies = [
"screenpipe-config",
"screenpipe-fs",
"screenpipe-resource",
+ "screenpipe-secrets",
"screenpipe-semantic",
"screenpipe-sqlite-coordinator",
"serde",