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(build): restore generated Tauri command registry

Louis Beaumont3e5cab2f0fb0
diff --git a/apps/screenpipe-app-tauri/src-tauri/build.rs b/apps/screenpipe-app-tauri/src-tauri/build.rs
index 86da9886d..8e887d98a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/build.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/build.rs
@@ -315,8 +315,44 @@ fn ensure_frontend_dist() {
.expect("write frontendDist placeholder");
}
+fn generate_and_validate_tauri_commands() {
+ // This Cargo.toml is both the app package and a workspace containing the
+ // Windows WER helper. The helper defaults to scanning workspace members;
+ // once `wer-dump-helper` was added, that excluded the root app package and
+ // silently produced `tauri::generate_handler![]` in release builds.
+ let options = tauri_helper::TauriHelperOptions {
+ members: Some(vec![".".to_string()]),
+ };
+ tauri_helper::generate_command_file(options);
+
+ // Never publish another native binary with an empty or partial command
+ // registry. These sentinels cover startup, authentication, and build-policy
+ // checks that the frontend needs before it can render the normal app.
+ let manifest_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
+ let commands_path = manifest_dir
+ .join("target")
+ .join("tauri_commands_list")
+ .join("screenpipe_app.txt");
+ let commands = std::fs::read_to_string(&commands_path).unwrap_or_else(|error| {
+ panic!(
+ "missing generated Tauri command registry at {}: {error}",
+ commands_path.display()
+ )
+ });
+ for required in [
+ "screenpipe_app::config::get_screenpipe_base_dir",
+ "screenpipe_app::commands::get_cloud_token",
+ "screenpipe_app::commands::is_enterprise_build_cmd",
+ ] {
+ assert!(
+ commands.lines().any(|command| command == required),
+ "generated Tauri command registry is missing required command {required}"
+ );
+ }
+}
+
fn main() {
- tauri_helper::generate_command_file(tauri_helper::TauriHelperOptions::default());
+ generate_and_validate_tauri_commands();
ensure_frontend_dist();
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 04da1658f..36fd376ac 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -273,6 +273,15 @@ async fn is_server_running(app: AppHandle) -> Result<bool, String> {
Ok(response.is_ok())
}
+// `tauri_collect_commands!` historically degraded to an empty handler when
+// its generated registry was missing. Make the same compile-time view a hard
+// build invariant so a commandless native app can never be published again.
+const TAURI_COMMAND_COUNT: usize = tauri_helper::array_collect_commands!(false).len();
+const _: () = assert!(
+ TAURI_COMMAND_COUNT > 0,
+ "generated Tauri command registry must not be empty"
+);
+
/// Shared tauri-specta registry body.
macro_rules! define_specta_builder {
() => {{