Skip to content

Engine: paths and events come from the shell, not from Tauri state - #1281

Merged
vmillet-dev merged 3 commits into
dev/0.18.0from
engine/paths-event-sink
Nov 2, 2026
Merged

vmillet-dev merged 3 commits into
dev/0.18.0from
engine/paths-event-sink

Conversation

@vmillet-dev

@vmillet-dev vmillet-dev commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Closes #1147

Phase 1, step 2 of docs/egui-migration-plan.md (§ 3.3.2, § 3.3.4).

  • Engine (engine/src/lib.rs) owns the core's state: the Db slot, Restored, Sending, Runs, Sockets, the Paths and the EventSink. The shell builds it in setup and manages one Arc<Engine> instead of five Tauri states.
  • host.rs: Paths { profile, resources }, EventSink, EngineEvent { Socket, Console, Run }, RecordingSink. Paths is a struct, not the trait the plan sketched: every host only fills in two paths, so a trait would have no second use (the plan is updated). The plaintext copies stay profile/open/.
  • TauriHost (src-tauri/src/host.rs) resolves the paths from app_data_dir()/resource_dir() and emits each event under its current name, so the front end and bindings.ts do not change (regenerated byte for byte).
  • app.state, app.path, app.emit and try_state are gone from the core: db::blocking hands its body &Engine, and blocking_on(Arc<Engine>, …) serves the HTTP flight, which now holds the engine instead of an AppHandle. WebSockets emit through the sink.
  • automaticBackups is read from <profile>/preferences.json by the core itself (serde_json); tauri-plugin-store leaves the engine. New test: missing file, "false", "true", unreadable.
  • Clipboard and opener leave the bodies that hold the lock: the clipboard image is read before the body and handed over as RGBA, the decrypted copy is written in the body and opened afterwards.
  • desktop.rs stays in the shell.

⚠️ What is left of tauri in the engine is the command layer itself (#[tauri::command], the AppHandle parameter, db::engine, async_runtime): it moves to the shell with #1149 (one-line wrappers) and #1148 (the runtime and the queue). The grep of « no use tauri in engine » closes with those.

Tests: the mock-runtime session builds an Engine over a temporary profile, with a sink that emits on the mock app as the shell does, so the console, run and socket tests are unchanged. Local: cargo fmt --all --check, cargo clippy --workspace --lib --bins --tests --benches --all-features -D warnings, cargo test --workspace --lib --bins --tests green. No local e2e (the machine is in use): CI runs the 35 scenarios, notably 11 attachments and 23 backups.

🤖 Generated with Claude Code

The shell manages one Arc<Engine> built from Tauri's paths and a TauriHost that emits the
engine's events under their current names. The core reads automaticBackups from
preferences.json itself; the clipboard and the opener are called outside the command bodies.
…r's coverage

The shell goes in phase 2 and the end-to-end scenarios exercise it.
@vmillet-dev
vmillet-dev merged commit 1f8407e into dev/0.18.0 Nov 2, 2026
19 checks passed
@vmillet-dev
vmillet-dev deleted the engine/paths-event-sink branch November 2, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructuring without behaviour change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant