π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Clean up Rust workspace reorg
Manav Rathib17cefd6abe7
diff --git a/.github/workflows/locker-lint.yml b/.github/workflows/locker-lint.ymlindex f2eb4f2f8a..c48ffd58a5 100644--- a/.github/workflows/locker-lint.yml+++ b/.github/workflows/locker-lint.yml@@ -9,10 +9,6 @@ on:- "mobile/packages/legacy/**"- "mobile/packages/rust/**"- "mobile/packages/sharing/**"- - "rust/crates/core/**"- - "rust/crates/contacts/**"- - "rust/Cargo.toml"- - "rust/Cargo.lock"- ".github/workflows/locker-lint.yml"- "mobile/scripts/check_source_arb_plurals.rb"@@ -65,10 +61,6 @@ jobs:- name: Install Flutter Rust Bridgerun: cargo install flutter_rust_bridge_codegen- - name: Check Rust API without generated bindings (Core package)- run: cargo check --locked- working-directory: mobile/packages/rust/rust-- name: Generate Rust bindings (Core package)run: flutter_rust_bridge_codegen generateworking-directory: mobile/packages/rustdiff --git a/.github/workflows/mobile-lint.yml b/.github/workflows/mobile-lint.ymlindex 2fa73a308e..308314800d 100644--- a/.github/workflows/mobile-lint.yml+++ b/.github/workflows/mobile-lint.yml@@ -96,16 +96,6 @@ jobs:- run: flutter pub get --enforce-lockfile- - name: Check Rust API without generated bindings (ente_rust)- if: steps.rust_changes.outputs.ente_rust == 'true'- working-directory: mobile/packages/rust/rust- run: cargo check --locked-- - name: Check Rust API without generated bindings (ente_photos_rust)- if: steps.rust_changes.outputs.ente_photos_rust == 'true'- working-directory: mobile/apps/photos/rust- run: cargo check --locked-- name: Install Flutter Rust Bridgerun: cargo install flutter_rust_bridge_codegen@@ -129,17 +119,17 @@ jobs:- name: Run clippy (ente_rust)if: steps.rust_changes.outputs.ente_rust == 'true'working-directory: mobile/packages/rust/rust- run: cargo clippy --all-targets --all-features --locked+ run: cargo clippy --all-targets --all-features- name: Build (ente_rust)if: steps.rust_changes.outputs.ente_rust == 'true'working-directory: mobile/packages/rust/rust- run: cargo build --features frb-generated --locked+ run: cargo build- name: Test (ente_rust)if: steps.rust_changes.outputs.ente_rust == 'true'working-directory: mobile/packages/rust/rust- run: cargo test --features frb-generated --locked+ run: cargo test- name: Check formatting (ente_photos_rust)if: steps.rust_changes.outputs.ente_photos_rust == 'true'@@ -149,14 +139,14 @@ jobs:- name: Run clippy (ente_photos_rust)if: steps.rust_changes.outputs.ente_photos_rust == 'true'working-directory: mobile/apps/photos/rust- run: cargo clippy --all-targets --all-features --locked+ run: cargo clippy --all-targets --all-features- name: Build (ente_photos_rust)if: steps.rust_changes.outputs.ente_photos_rust == 'true'working-directory: mobile/apps/photos/rust- run: cargo build --features frb-generated --locked+ run: cargo build- name: Test (ente_photos_rust)if: steps.rust_changes.outputs.ente_photos_rust == 'true'working-directory: mobile/apps/photos/rust- run: cargo test --features frb-generated --locked+ run: cargo testdiff --git a/.github/workflows/mobile-packages-lint.yml b/.github/workflows/mobile-packages-lint.ymlindex dfc13fc85f..c66861c508 100644--- a/.github/workflows/mobile-packages-lint.yml+++ b/.github/workflows/mobile-packages-lint.yml@@ -1,18 +1,13 @@name: "Lint (mobile packages)"on:- # Run when mobile/packages or shared mobile Rust changes+ # Run when mobile/packages or shared photos Rust changespull_request:paths:- "mobile/packages/**"- "mobile/**/pubspec*.yaml"- "mobile/**/pubspec.lock"- "rust/photos/**"- - "rust/crates/core/**"- - "rust/crates/contacts/**"- - "rust/crates/image/**"- - "rust/Cargo.toml"- - "rust/Cargo.lock"- ".github/workflows/mobile-packages-lint.yml"- "mobile/scripts/check_frozen_pubspecs.rb"- "mobile/scripts/check_source_arb_plurals.rb"@@ -53,16 +48,10 @@ jobs:- 'mobile/packages/rust/**/*.rs'- 'mobile/packages/rust/**/Cargo.toml'- 'mobile/packages/rust/**/Cargo.lock'- - 'mobile/packages/rust/**/cargokit.yaml'- 'mobile/apps/photos/rust/**/*.rs'- 'mobile/apps/photos/rust/**/Cargo.toml'- - 'mobile/apps/photos/rust/**/cargokit.yaml'- 'rust/photos/**'- - 'rust/crates/core/**'- - 'rust/crates/contacts/**'- - 'rust/crates/image/**'- - 'rust/Cargo.toml'- - 'rust/Cargo.lock'+ - 'rust/crates/core/**/*.rs'workflow:- '.github/workflows/mobile-packages-lint.yml'analysis:@@ -151,10 +140,6 @@ jobs:- name: Install Flutter Rust Bridgerun: cargo install flutter_rust_bridge_codegen- - name: Check Rust API without generated bindings (Core)- run: cargo check --locked- working-directory: mobile/packages/rust/rust-- name: Generate Rust bindings (Core)run: flutter_rust_bridge_codegen generateworking-directory: mobile/packages/rust@@ -297,10 +282,6 @@ jobs:- name: Install Flutter Rust Bridgerun: cargo install flutter_rust_bridge_codegen- - name: Check Rust API without generated bindings (Core)- run: cargo check --locked- working-directory: mobile/packages/rust/rust-- name: Generate Rust bindings (Core)run: flutter_rust_bridge_codegen generateworking-directory: mobile/packages/rust@@ -311,19 +292,15 @@ jobs:- name: Run clippy (ente_rust)working-directory: mobile/packages/rust/rust- run: cargo clippy --all-targets --all-features --locked+ run: cargo clippy --all-targets --all-features- name: Build (ente_rust)working-directory: mobile/packages/rust/rust- run: cargo build --features frb-generated --locked+ run: cargo build- name: Test (ente_rust)working-directory: mobile/packages/rust/rust- run: cargo test --features frb-generated --locked-- - name: Check Rust API without generated bindings (photos app)- run: cargo check --locked- working-directory: mobile/apps/photos/rust+ run: cargo test- name: Generate Rust bindings (photos app)run: flutter_rust_bridge_codegen generate@@ -335,15 +312,15 @@ jobs:- name: Run clippy (ente_photos_rust)working-directory: mobile/apps/photos/rust- run: cargo clippy --all-targets --all-features --locked+ run: cargo clippy --all-targets --all-features- name: Build (ente_photos_rust)working-directory: mobile/apps/photos/rust- run: cargo build --features frb-generated --locked+ run: cargo build- name: Test (ente_photos_rust)working-directory: mobile/apps/photos/rust- run: cargo test --features frb-generated --locked+ run: cargo testapps-lint:needs: detect-changesdiff --git a/.github/workflows/rust-e2e-test.yml b/.github/workflows/rust-e2e-test.ymlindex c40a502706..5cf51da640 100644--- a/.github/workflows/rust-e2e-test.yml+++ b/.github/workflows/rust-e2e-test.yml@@ -5,7 +5,6 @@ on:paths:- "rust/e2e/**"- "rust/apps/cli/**"- - "rust/crates/accounts/**"- "rust/crates/contacts/**"- "rust/crates/core/**"- "rust/Cargo.lock"diff --git a/.github/workflows/rust-lint-cli.yml b/.github/workflows/rust-lint-cli.ymlindex c72d23b93d..2bd5450378 100644--- a/.github/workflows/rust-lint-cli.yml+++ b/.github/workflows/rust-lint-cli.yml@@ -9,8 +9,6 @@ on:pull_request:paths:- "rust/apps/cli/**"- - "rust/crates/accounts/**"- - "rust/crates/core/**"- "rust/Cargo.lock"- "rust/Cargo.toml"- ".github/workflows/rust-lint-cli.yml"diff --git a/.github/workflows/rust-lint.yml b/.github/workflows/rust-lint.ymlindex df8b054904..749588f831 100644--- a/.github/workflows/rust-lint.yml+++ b/.github/workflows/rust-lint.yml@@ -7,8 +7,6 @@ on:pull_request:paths:- "rust/crates/core/**"- - "rust/crates/contacts/**"- - "rust/crates/image/**"- "rust/photos/**"- "rust/Cargo.lock"- "rust/Cargo.toml"diff --git a/.github/workflows/web-lint.yml b/.github/workflows/web-lint.ymlindex ebdde270e2..eb1d259978 100644--- a/.github/workflows/web-lint.yml+++ b/.github/workflows/web-lint.yml@@ -6,7 +6,6 @@ on:paths:- "web/**"- "rust/crates/core/**"- - "rust/crates/contacts/**"- ".github/workflows/web-lint.yml"permissions:diff --git a/mobile/apps/photos/rust/Cargo.toml b/mobile/apps/photos/rust/Cargo.tomlindex a31be19d57..8781925746 100644--- a/mobile/apps/photos/rust/Cargo.toml+++ b/mobile/apps/photos/rust/Cargo.toml@@ -16,7 +16,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }[features]default = []-frb-generated = [][profile.dev.package."*"]opt-level = 2diff --git a/mobile/apps/photos/rust/cargokit.yaml b/mobile/apps/photos/rust/cargokit.yamldeleted file mode 100644index 020d511756..0000000000--- a/mobile/apps/photos/rust/cargokit.yaml+++ /dev/null@@ -1,7 +0,0 @@-cargo:- debug:- extra_flags: ["--features", "frb-generated"]- release:- extra_flags: ["--features", "frb-generated"]- profile:- extra_flags: ["--features", "frb-generated"]diff --git a/mobile/apps/photos/rust/src/lib.rs b/mobile/apps/photos/rust/src/lib.rsindex 9f9dee1a84..cbb071f8bf 100644--- a/mobile/apps/photos/rust/src/lib.rs+++ b/mobile/apps/photos/rust/src/lib.rs@@ -1,4 +1,2 @@pub mod api;--#[cfg(feature = "frb-generated")]mod frb_generated;diff --git a/mobile/packages/rust/rust/Cargo.toml b/mobile/packages/rust/rust/Cargo.tomlindex 2166f4c2c7..688ae878a9 100644--- a/mobile/packages/rust/rust/Cargo.toml+++ b/mobile/packages/rust/rust/Cargo.toml@@ -14,7 +14,3 @@ ente-contacts = { path = "../../../../rust/crates/contacts" }[lints.rust]unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }missing_docs = "warn"--[features]-default = []-frb-generated = []diff --git a/mobile/packages/rust/rust/cargokit.yaml b/mobile/packages/rust/rust/cargokit.yamldeleted file mode 100644index 020d511756..0000000000--- a/mobile/packages/rust/rust/cargokit.yaml+++ /dev/null@@ -1,7 +0,0 @@-cargo:- debug:- extra_flags: ["--features", "frb-generated"]- release:- extra_flags: ["--features", "frb-generated"]- profile:- extra_flags: ["--features", "frb-generated"]diff --git a/mobile/packages/rust/rust/src/lib.rs b/mobile/packages/rust/rust/src/lib.rsindex 9d18cd2e7e..fe77e8251d 100644--- a/mobile/packages/rust/rust/src/lib.rs+++ b/mobile/packages/rust/rust/src/lib.rs@@ -1,6 +1,4 @@//! Flutter Rust Bridge bindings for Ente mobile apps.pub mod api;--#[cfg(feature = "frb-generated")]mod frb_generated;diff --git a/rust/Cargo.toml b/rust/Cargo.tomlindex 46e98927d7..30cb235d55 100644--- a/rust/Cargo.toml+++ b/rust/Cargo.toml@@ -19,8 +19,6 @@ members = []exclude = ["apps/ensu/src-tauri",- # Photos stays outside the root workspace until its app-provided ONNX Runtime- # can move from ort rc.4 to the workspace's ort rc.12."photos","e2e",]diff --git a/rust/README.md b/rust/README.mdindex 857deb2091..614aa9a951 100644--- a/rust/README.md+++ b/rust/README.md@@ -2,7 +2,7 @@```βββββββββββββββββββββββββββββββββββββββββ- β rust/crates/core/ β+ β rust/crates/core/ ββ (ente-core crate) ββ ββ Pure Rust - NO FFI annotations β@@ -34,20 +34,17 @@β (ente_photos_rust crate) ββ ββ Thin app-specific #[frb] β-β wrappers for rust/photos β+β wrappers for rust/photos ββββββββββββββββββββββββββββββ```## Contents (this repo)- `rust/crates/core/` (`ente-core`) - shared, pure Rust code used by clients (crypto + auth, plus small HTTP/URL helpers).-- `rust/crates/accounts/` (`ente-accounts`) - shared account/auth flows built on `ente-core`.-- `rust/crates/contacts/` (`ente-contacts`) - shared contacts/domain logic.- `rust/photos/` (`ente_photos`) - shared Photos Rust logic (motion photo, ML, image processing, vector DB).-- `rust/crates/ensu/` - shared Ensu logic (see `rust/crates/ensu/README.md`).-- `rust/bindings/uniffi/` - UniFFI bindings for core crypto/auth + Ensu.- `rust/apps/cli/` (`ente-rs`) - Rust CLI.- `rust/e2e/` (`ente-e2e`) - live Museum-backed Rust end-to-end tests.+- `rust/crates/ensu/` - LLM chat stack (see `rust/crates/ensu/README.md`).## Directory Structure@@ -64,33 +61,37 @@ rust/β βββ Cargo.tomlββββ crates/-β βββ accounts/ # Shared account/auth flows-β βββ contacts/ # Shared contacts/domain logic-β βββ core/ # Pure Rust shared logic (ente-core)-β β βββ src/-β β βββ docs/-β β βββ Cargo.toml-β βββ ensu/ # Ensu shared logic-β β βββ db/-β β βββ inference/-β β βββ sync/-β β βββ transcription/β βββ image/ # Shared image crateβ-βββ photos/ # Shared Photos Rust logic+βββ e2e/ # Rust e2e tests requiring live Museumβ βββ src/+β β βββ lib.rs+β βββ tests/β βββ Cargo.tomlβ-βββ bindings/-β βββ uniffi/ # UniFFI bindings for core crypto/auth + Ensu-β βββ core/-β βββ ensu/+βββ core/ # Pure Rust shared logic (ente-core)+β βββ src/+β β βββ lib.rs+β β βββ crypto/+β β βββ auth/+β βββ docs/+β β βββ crypto.md+β β βββ auth.md+β βββ Cargo.tomlβ-βββ e2e/ # Rust e2e tests requiring live Museum+βββ photos/ # Shared Photos Rust logicβ βββ src/-β β βββ lib.rs-β βββ tests/+β β βββ lib.rs+β β βββ image/+β β βββ ml/+β β βββ vector_db.rsβ βββ Cargo.toml+β+βββ ensu/ # LLM chat stack (see rust/crates/ensu/README.md)++rust/bindings/uniffi/ # UniFFI bindings for core crypto/auth + ensu+βββ core/+βββ ensu/web/packages/wasm/ # WASM bindings (lives in web workspace)βββ src/@@ -119,10 +120,7 @@ mobile/apps/photos/rust/ # Photos app-specific FRB bindings- `ente-core` - shared business logic (pure Rust, no FFI)- Docs: `rust/crates/core/docs/crypto.md`, `rust/crates/core/docs/auth.md`-- `ente-accounts` - shared account/auth flows-- `ente-contacts` - shared contacts/domain logic- `ente_photos` - shared Photos Rust logic-- `ensu-db`, `ensu-sync`, `inference_rs`, `ensu-transcription` - shared Ensu Rust logic- `ente-rs` - Rust CLI package (`ente-cli` binary)- `ente-e2e` - ignored Rust integration tests that run against a live Museum- `ente-wasm` - wasm-bindgen wrappers for webdiff --git a/rust/crates/accounts/src/flow.rs b/rust/crates/accounts/src/flow.rsindex 4083948239..d3fa730aed 100644--- a/rust/crates/accounts/src/flow.rs+++ b/rust/crates/accounts/src/flow.rs@@ -206,6 +206,7 @@ impl fmt::Debug for CheckSessionValidityParams {/// Outcome of a session-validity check.#[derive(Debug)]+#[expect(clippy::large_enum_variant)]pub enum SessionValidity {/// Token is invalid.Invalid,diff --git a/rust/crates/ensu/sync/tests/sync_integration.rs b/rust/crates/ensu/sync/tests/sync_integration.rsindex 3e365d7ffd..0f5607757f 100644--- a/rust/crates/ensu/sync/tests/sync_integration.rs+++ b/rust/crates/ensu/sync/tests/sync_integration.rs@@ -1,7 +1,4 @@-use std::sync::{Mutex, MutexGuard};-use ensu_db::EnsuDb;-use ensu_db::SyncStateDb;use ensu_db::crypto::KEY_BYTES;use ensu_sync::SyncAuth;use ensu_sync::SyncEngine;@@ -16,8 +13,6 @@ use tempfile::TempDir;use uuid::Uuid;use zeroize::Zeroizing;-static SYNC_TEST_LOCK: Mutex<()> = Mutex::new(());-struct TestEnv {_dir: TempDir,main_db_path: String,@@ -45,10 +40,6 @@ impl TestEnv {}}-fn sync_test_lock() -> MutexGuard<'static, ()> {- SYNC_TEST_LOCK.lock().unwrap_or_else(|err| err.into_inner())-}-fn make_auth(server: &MockServer, master_key: Vec<u8>) -> SyncAuth {SyncAuth {base_url: server.base_url(),@@ -85,7 +76,6 @@ fn mock_empty_diff(server: &MockServer, timestamp: i64) {#[test]fn pull_applies_remote_sessions_and_messages() {- let _guard = sync_test_lock();let env = TestEnv::new();let db_key = vec![42u8; KEY_BYTES];let engine = SyncEngine::new(@@ -174,7 +164,6 @@ fn pull_applies_remote_sessions_and_messages() {#[test]fn push_only_needs_sync_messages() {- let _guard = sync_test_lock();let env = TestEnv::new();let db_key = vec![11u8; KEY_BYTES];let engine = SyncEngine::new(@@ -203,10 +192,6 @@ fn push_only_needs_sync_messages() {.expect("message two");db.mark_message_synced(message_one.uuid).expect("mark synced");- SyncStateDb::open_sqlite_with_defaults(env.attachments_db_path.clone())- .expect("sync state")- .set_message_state(message_one.uuid, Some(&Uuid::new_v4().to_string()), Some(5))- .expect("message sync state");let master_key = vec![7u8; KEY_BYTES];let chat_key = ente_core::crypto::keys::generate_stream_key();@@ -216,18 +201,12 @@ fn push_only_needs_sync_messages() {let session_mock = server.mock(|when, then| {when.method(POST).path("/llmchat/chat/session");- then.status(200).json_body_obj(&serde_json::json!({- "sessionUUID": Uuid::new_v4().to_string(),- "updatedAt": 20,- }));+ then.status(200).json_body_obj(&serde_json::json!({}));});let message_mock = server.mock(|when, then| {when.method(POST).path("/llmchat/chat/message");- then.status(200).json_body_obj(&serde_json::json!({- "messageUUID": Uuid::new_v4().to_string(),- "updatedAt": 21,- }));+ then.status(200).json_body_obj(&serde_json::json!({}));});let auth = make_auth(&server, master_key);@@ -242,7 +221,6 @@ fn push_only_needs_sync_messages() {#[test]fn tombstone_removes_messages() {- let _guard = sync_test_lock();let env = TestEnv::new();let db_key = vec![3u8; KEY_BYTES];let engine = SyncEngine::new(diff --git a/rust/e2e/Cargo.lock b/rust/e2e/Cargo.lockindex fcc77991e1..8ac0a0762a 100644--- a/rust/e2e/Cargo.lock+++ b/rust/e2e/Cargo.lock@@ -2465,9 +2465,9 @@ dependencies = [[[package]]name = "sqlite-wasm-rs"-version = "0.5.3"+version = "0.5.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1b2c760607300407ddeaee518acf28c795661b7108c75421303dbefb237d3a36"+checksum = "2f4206ed3a67690b9c29b77d728f6acc3ce78f16bf846d83c94f76400320181b"dependencies = ["cc","js-sys",