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

refactor(enterprise): merge enterprise-telemetry into enterprise-build

Louis Beaumont77cdb0dc768b
diff --git a/.github/workflows/release-enterprise.yml b/.github/workflows/release-enterprise.yml
index 2f8686255..ab516c991 100644
--- a/.github/workflows/release-enterprise.yml
+++ b/.github/workflows/release-enterprise.yml
@@ -188,7 +188,7 @@ jobs:
GGML_AVX512_BF16: "OFF"
CMAKE_ARGS: "-DGGML_NATIVE=OFF -DGGML_AVX512=OFF -DGGML_AVX512_VBMI=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AVX512_BF16=OFF"
with:
- args: "--target x86_64-pc-windows-msvc --features enterprise-build,enterprise-telemetry"
+ args: "--target x86_64-pc-windows-msvc --features enterprise-build"
projectPath: "./apps/screenpipe-app-tauri"
tauriScript: bunx tauri -v
retryAttempts: 3
@@ -443,7 +443,7 @@ jobs:
fi
cd apps/screenpipe-app-tauri
- if bunx tauri build -v --target aarch64-apple-darwin --features metal,parakeet-mlx,enterprise-build,enterprise-telemetry 2>&1 | tee /tmp/tauri-build-$attempt.log; then
+ if bunx tauri build -v --target aarch64-apple-darwin --features metal,parakeet-mlx,enterprise-build 2>&1 | tee /tmp/tauri-build-$attempt.log; then
echo "Build succeeded on attempt $attempt"
cd ../..
break
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 38f0c71e4..f0e76344c 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -10057,6 +10057,7 @@ dependencies = [
"tauri-specta",
"tauri-utils",
"tempfile",
+ "thiserror 1.0.69",
"tikv-jemallocator",
"tokio",
"tokio-tungstenite",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index baae2e5f3..7e7833a17 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -144,6 +144,10 @@ icalendar = "0.17"
# jemalloc — aggressively returns freed pages to OS, reducing RSS bloat
[target.'cfg(not(target_os = "windows"))'.dependencies]
tikv-jemallocator = { version = "0.6", optional = true }
+# Used only by the path-included `ee/desktop-rust/enterprise_sync.rs`. Gated
+# behind enterprise-build via the `dep:thiserror` syntax below so cargo-machete
+# (which doesn't follow `#[path = ...]` imports) doesn't flag this as unused.
+thiserror = { version = "1.0", optional = true }
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
tauri-plugin-cli = "2.4.1"
@@ -213,15 +217,13 @@ custom-protocol = ["tauri/custom-protocol"]
# Source builds without this flag will show "auto-updates unavailable"
official-build = []
-# Enterprise build: updates managed by IT (Intune/RoboPack). Set by enterprise release workflow.
+# Enterprise build: updates managed by IT (Intune/RoboPack), tauri.enterprise
+# bundle identifier, and the periodic telemetry sync that pushes screen + audio
+# activity to the screenpipe enterprise ingest endpoint scoped by license key.
+# Source for the sync lives under `ee/desktop-rust/enterprise_sync.rs` (EE-licensed).
+# Consumer builds never compile this code.
# Do NOT add official-build here — we skip all in-app update logic for enterprise.
-enterprise-build = []
-
-# Enterprise telemetry sync — periodically pushes screen + audio activity to
-# the screenpipe enterprise ingest endpoint, scoped by license key. Source
-# lives under `ee/desktop-rust/enterprise_sync.rs` (EE-licensed). MUST be
-# accompanied by `enterprise-build`; consumer builds never compile this code.
-enterprise-telemetry = ["enterprise-build"]
+enterprise-build = ["dep:thiserror"]
# On-device AI via Apple Foundation Models (macOS 26+ / Xcode 26+ only)
apple-intelligence = ["screenpipe-engine/apple-intelligence"]
@@ -235,7 +237,7 @@ jemalloc = ["tikv-jemallocator"]
[dev-dependencies]
# Used by ee/desktop-rust/enterprise_sync.rs tests (compiled in only when the
-# enterprise-telemetry feature is on).
+# enterprise-build feature is on).
tempfile = "3"
wiremock = "0.6"
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs
index af36f2457..fe23d2386 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs
@@ -13,14 +13,14 @@
//! - resolves the app data dir for the cursor file
//! - spawns the long-running task with a tokio shutdown channel
//!
-//! Everything is gated by `#[cfg(feature = "enterprise-telemetry")]` — consumer
+//! Everything is gated by `#[cfg(feature = "enterprise-build")]` — consumer
//! builds compile this file as a no-op.
-#[cfg(feature = "enterprise-telemetry")]
+#[cfg(feature = "enterprise-build")]
#[path = "../../../../ee/desktop-rust/enterprise_sync.rs"]
mod ee_sync;
-#[cfg(feature = "enterprise-telemetry")]
+#[cfg(feature = "enterprise-build")]
mod imp {
use super::ee_sync;
use crate::recording::local_api_context_from_app;
@@ -218,14 +218,15 @@ mod imp {
since_ts: Option<&str>,
limit: u32,
) -> Result<Vec<UiEventRow>, EnterpriseSyncError> {
- // Local /search content_type=ui returns rows from the
+ // Local /search content_type=input returns rows from the
// `ui_events` table — clicks, keystrokes, focus changes,
- // clipboard. Only sync events that have an element_name
- // (real AX-resolved targets) — keystroke noise without
- // element context isn't useful for SOP synthesis and
- // bloats the corpus.
+ // clipboard. (The DB enum is `Input`, not `UI` — `UiContent`
+ // is a separate deprecated content type for AX text snapshots.)
+ // Only sync events that have an element_name (real AX-resolved
+ // targets) — keystroke noise without element context isn't
+ // useful for SOP synthesis and bloats the corpus.
let mut url = format!(
- "{}/search?content_type=ui&limit={}",
+ "{}/search?content_type=input&limit={}",
self.api_url_base, limit
);
if let Some(ts) = since_ts {
@@ -450,11 +451,11 @@ mod imp {
}
}
-#[cfg(feature = "enterprise-telemetry")]
+#[cfg(feature = "enterprise-build")]
pub use imp::spawn;
/// No-op stub for non-enterprise builds. Returns None so callers can ignore.
-#[cfg(not(feature = "enterprise-telemetry"))]
+#[cfg(not(feature = "enterprise-build"))]
pub fn spawn(_app: &tauri::AppHandle) -> Option<tokio::sync::watch::Sender<bool>> {
None
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/tests/enterprise_sync_test.rs b/apps/screenpipe-app-tauri/src-tauri/tests/enterprise_sync_test.rs
index 5943ff1f4..a1ddeb525 100644
--- a/apps/screenpipe-app-tauri/src-tauri/tests/enterprise_sync_test.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/tests/enterprise_sync_test.rs
@@ -8,7 +8,7 @@
//! (`ee/desktop-rust/enterprise_sync.rs`'s `#[cfg(test)] mod tests`). This
//! integration test file's only job is to provide a compile target that
//! pulls that module in via `#[path]` so the embedded tests run as part of
-//! `cargo test --features enterprise-telemetry --test enterprise_sync_test`.
+//! `cargo test --features enterprise-build --test enterprise_sync_test`.
//!
//! Why a separate test target: the desktop binary's main test build has
//! pre-existing compile errors in unrelated modules (pi.rs) that block
@@ -16,7 +16,7 @@
//! independently and avoids that bin tree entirely — keeping these tests
//! actually runnable in CI.
-#![cfg(feature = "enterprise-telemetry")]
+#![cfg(feature = "enterprise-build")]
#[path = "../../../../ee/desktop-rust/enterprise_sync.rs"]
mod ee_sync;
diff --git a/ee/desktop-rust/enterprise_sync.rs b/ee/desktop-rust/enterprise_sync.rs
index 1672b1161..d23709e7e 100644
--- a/ee/desktop-rust/enterprise_sync.rs
+++ b/ee/desktop-rust/enterprise_sync.rs
@@ -11,7 +11,7 @@
//! org's admin chat dashboard.
//!
//! This module is **only compiled into enterprise builds** (gated by the
-//! `enterprise-telemetry` Cargo feature, which itself requires `enterprise-build`).
+//! `enterprise-build` Cargo feature).
//! Consumer builds never reach this code path. All HTTP I/O is handled here so
//! the desktop crate stays a thin orchestration layer — only the
//! `LocalApiClient` trait is injected from outside (mockable for tests).
@@ -490,9 +490,19 @@ pub async fn run_one_sync(
let audio = local
.fetch_audio_since(cursor.last_audio_ts.as_deref(), PAGE_LIMIT)
.await?;
- let ui = local
+ // UI events are best-effort — a backend that doesn't expose them yet
+ // (or blocks the search query) shouldn't kill the whole sync batch.
+ // The frame + audio paths are the load-bearing ones.
+ let ui = match local
.fetch_ui_events_since(cursor.last_ui_ts.as_deref(), PAGE_LIMIT)
- .await?;
+ .await
+ {
+ Ok(rows) => rows,
+ Err(e) => {
+ warn!("enterprise sync: ui fetch failed (skipping): {}", e);
+ Vec::new()
+ }
+ };
// One snapshot per tick. Best-effort — failure to encode/fetch
// shouldn't block the rest of the batch.
let snapshots: Vec<SnapshotRow> = match local.fetch_latest_snapshot().await {