Files
Lumotia/docs/architecture-map/05-core-storage-hotkey-build/core-process-watch.md
Jake 26c7307607
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled
agent: lumotia-rebrand — docs, scripts, root config, residuals
Phase 9 of the rebrand cascade. Sweep covers everything the Phase 8
frontend pass deliberately skipped: docs/, root markdown, scripts,
Cargo.toml descriptions, code comments that survived earlier
word-boundary sed, plus a handful of identifiers caught on the final
verify pass.

transcription-app changes:
- README.md, HANDOVER.md, KNOWN-ISSUES.md, run.sh — magnotia/Magnotia
  -> lumotia/Lumotia.
- docs/ — sweep across all subdirs except docs/handovers/ (preserved
  as immutable audit trail). Includes architecture-map references
  to magnotia_core::*, magnotia_storage::*, etc. now pointing at
  lumotia_*; dev-setup.md tracing output examples (lumotia_startup
  target); brief/ + superpowers/ + issues/ + whisper-ecosystem/ +
  audit/.
- Cargo.toml descriptions on 9 crates (core, audio, cloud-providers,
  hotkey, llm, mcp, plus referenced others).
- crates/core/src/{error,hardware,recommendation,paths}.rs +
  crates/audio/src/wav.rs + crates/llm/src/model_manager.rs +
  crates/cloud-providers/src/keystore.rs + crates/mcp/src/lib.rs —
  doc comments and a model-manager user-agent string.
- Caught on final pass: BroadcastChannel("magnotia_task_sync") -> ...
  ("lumotia_task_sync"); magnotia_locale i18n localStorage key
  renamed + migration shim added; CSS keyframe names
  magnotiaPulse / magnotiaBar / magnotiaFade renamed in the design-
  system kit; magnotia_viewer_item / magnotia_viewer_mode handoff
  keys renamed in HistoryPage + viewer/+page.svelte; src/assets/
  wordmark.svg text.
- src-tauri/src/lib.rs comment cleanup ("magnotia era" was sed'd
  to "lumotia era" earlier — restored).

Preserved (intentional):
- crates/core/src/paths.rs — keeps "magnotia" / "Magnotia" / ".magnotia"
  legacy detection strings in legacy_and_target_paths() so the
  migration shim can still find user data from the magnotia era.
- src/lib/stores/{page,focusTimer}.svelte.ts + src/lib/i18n/index.ts
  — migration call sites reference the legacy magnotia keys
  deliberately.
- docs/handovers/ — historical audit trail.

cargo build --workspace passes. npm run check: 0 errors / 0 warnings
(3958 files). cargo test --workspace: 339 pass / 0 fail.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:38:03 +01:00

4.2 KiB
Raw Blame History

name, type, slice, last_verified
name type slice last_verified
Core process-watch (meeting detection) architecture-map-page 05-core-storage-hotkey-build 2026/05/09

Core process-watch

Where you are: Architecture mapCore, Storage, Hotkey, Build → Core process-watch

Plain English summary. A lightweight "is the user in a meeting right now?" probe. One signal only: poll the running-process list and match user-editable substrings. No mic-activity heuristic, no calendar integration. If the user has opted in, Lumotia surfaces a non-modal toast so they can choose to start recording. The app never starts recording on its own from this signal.

At a glance

  • File: crates/core/src/process_watch.rs (123 LOC, ~40 of which are tests).
  • External deps: sysinfo 0.35.
  • Public surface: ProcessLister (struct), list_running_process_names, match_meeting_patterns.
  • Consumers: slice 2 (a Tauri command holds a long-lived ProcessLister behind Mutex and polls every 15 s).

What's in here

ProcessListercrates/core/src/process_watch.rs:20

pub struct ProcessLister { system: System }
impl ProcessLister {
    pub fn new() -> Self;
    pub fn snapshot(&mut self) -> Vec<String>;  // lowercased exe names
}
impl Default for ProcessLister { ... }

Reusable wrapper around a sysinfo::System. The system is created once with RefreshKind::nothing().with_processes(ProcessRefreshKind::nothing()) and refreshed in place via refresh_processes(ProcessesToUpdate::All, true) on every call. On a busy host (~300 processes), System::new_with_specifics followed by refresh_processes walks /proc cold and costs ~50100 ms; reusing the same instance reuses sysinfo's per-process bookkeeping so subsequent refreshes are dominated by diffing rather than allocation.

list_running_process_names()crates/core/src/process_watch.rs:59

Convenience function. Allocates a fresh ProcessLister per call. Hot paths should hold a long-lived ProcessLister instead.

match_meeting_patterns(process_names, patterns) -> Vec<String>crates/core/src/process_watch.rs:67

Pure function. Case-insensitive substring match. Returns the set of patterns that matched at least once, in input order, deduped. Empty / whitespace-only patterns are skipped so a stray blank entry in the user's list never matches everything.

Data flow / contract

  • The slice-2 command holds the ProcessLister in tauri::State behind a Mutex and polls every 15 seconds.
  • Pattern list comes from user settings (the UI surfaces it as a comma-separated text box).
  • Match output drives a non-modal toast in the frontend. Lumotia never starts recording itself — the user decides.

Tests

4 tests in crates/core/src/process_watch.rs:84-122:

  • matches_are_case_insensitive_substrings — happy path with Zoom Meeting / Microsoft Teams / firefox.
  • empty_and_whitespace_patterns_are_ignored — guard.
  • matches_are_deduped — duplicate zoom patterns produce one match.
  • list_running_returns_something_on_this_host — smoke against the test runner's own process list.

Watch-outs

  • refresh_processes(ProcessesToUpdate::All, true) is still ~510 ms even reused. OK at 15 s cadence, would not be at sub-second cadence.
  • Substring match is broad. The pattern "zoom" matches a process named zoomies (a hypothetical screensaver). User-configurable so the user owns the false positive.
  • Lowercased once, searched many times. process_names are lowercased at snapshot time so the matcher itself can stay simple. If we ever want regex matching we will lose this optimisation.
  • Linux / macOS / Windows process-name conventions differ. Zoom on macOS, zoom on Linux, Zoom.exe on Windows. The case-insensitive substring match handles the case differences cleanly. The .exe suffix on Windows is fine because the pattern is a substring.
  • Privacy. Process names can leak metadata (other apps the user runs). The probe runs locally and the results never leave the machine, but it is a class of data to be careful with.

See also