docs: architecture map (initial 5-slice generation, 105 pages)

Five-slice navigable map of the entire codebase under
docs/architecture-map/. Each slice is a self-contained
breadcrumbed sub-tree:

  01-frontend (16)              Svelte/SvelteKit UI
  02-tauri-runtime (26)         src-tauri commands + lifecycle
  03-audio-transcription (16)   audio + transcription crates
  04-llm-formatting-mcp (19)    llm, ai-formatting, mcp, cloud
  05-core-storage-hotkey-build  core, storage, hotkey, workspace,
                          (26) CI, dev glue

Plus master README.md and data-flow-end-to-end.md tracing
audio bytes from microphone to FTS5 search to MCP read.

Generated by 5 parallel subagents on 2026/05/09 against
HEAD 3c47000. Each page has YAML frontmatter, file:line code
refs, sibling cross-links, plain-English summaries.

Aggregated debt surfaced (full lists in master README):
RB-08 macOS power assertion, schema head drift v14 vs v15,
VAD blocked on ort version conflict, streaming primitives
not wired into live.rs, no prompt versioning, MCP has no
auth, cloud-providers in-memory keystore, SettingsPage
2 484 LOC, commands/live.rs 1 737 LOC, dual theme system,
brand rename to Lumenote pending across the codebase.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jars
2026-05-09 14:04:13 +01:00
parent 3c47000ea9
commit a1f3f3f134
105 changed files with 11266 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
---
name: Workspace Cargo.toml
type: architecture-map-page
slice: 05-core-storage-hotkey-build
last_verified: 2026/05/09
---
# Workspace Cargo.toml
> **Where you are:** [Architecture map](../README.md) → [Core, Storage, Hotkey, Build](README.md) → Workspace Cargo.toml
**Plain English summary.** The repo-root `Cargo.toml`. Tiny — 161 bytes. Defines the Cargo workspace (one binary at `src-tauri/`, every crate under `crates/*`) and the release profile that produces the Tauri bundle artefacts.
## At a glance
- File: `/Cargo.toml` (repo root, 161 bytes).
- External: none. The workspace root has no dependencies of its own; member crates pin their own versions.
- Consumers: every Cargo invocation. `cargo check --workspace` from the repo root walks the members.
## Contents
```toml
[workspace]
members = ["src-tauri", "crates/*"]
resolver = "2"
[profile.release]
codegen-units = 1
lto = "thin"
opt-level = 3
panic = "abort"
strip = "symbols"
```
## Members
The `crates/*` glob picks up every directory under `crates/` that contains a `Cargo.toml`. Members at the time of writing:
- `crates/core/``magnotia-core`
- `crates/storage/``magnotia-storage`
- `crates/hotkey/``magnotia-hotkey`
- `crates/audio/` → audio capture (slice 3)
- `crates/transcription/` → transcription engines (slice 3)
- `crates/llm/``magnotia-llm` (slice 4)
- `crates/ai-formatting/``magnotia-ai-formatting` (slice 4)
- `crates/mcp/``magnotia-mcp` (slice 4)
- `crates/cloud-providers/``magnotia-cloud-providers` (slice 4)
- `src-tauri/` → the Tauri binary `magnotia` (slice 2)
## Resolver
`resolver = "2"` is mandatory for any workspace that mixes feature flags across `[dependencies]` and `[build-dependencies]` or `[dev-dependencies]`. Without it, features unify in surprising ways (a build-script-only feature can silently affect the runtime crate). Tauri 2's docs require resolver 2.
## Release profile
```toml
codegen-units = 1 # one codegen unit; longer compile, better optimisation
lto = "thin" # cross-crate inlining without full LTO's compile blow-up
opt-level = 3 # standard optimised
panic = "abort" # smaller binaries; no unwind tables; mandatory for embedded panics
strip = "symbols" # debug symbols stripped from release artefacts
```
The `panic = "abort"` setting is a deliberate trade-off:
- **Plus:** smaller binary, no `__rust_panic_unwind` machinery, faster cold start.
- **Minus:** any panic is fatal. The crash hook (slice 2) writes a `.crash` file before the process dies; the diagnostic-report bundler in Settings → About surfaces it on next launch.
`lto = "thin"` not `"fat"` because thin LTO gives most of the optimisation benefit at a fraction of the compile time. Whisper-rs-sys + llama-cpp-sys-2 are already huge C++ builds; saving build time matters more than the last 5% of optimisation.
## Watch-outs
- **No `[workspace.dependencies]` block.** Each member crate pins its own dep versions independently. Side effect: `sqlx 0.8` in `magnotia-storage` and `sysinfo 0.35` in `magnotia-core` could drift between members. A future tidy would centralise common pins.
- **No `[patch]` overrides.** Useful to know — every crate is consumed at its registered version.
- **`codegen-units = 1` makes release builds slow.** ~10 minutes on Jake's Monolith for a clean `cargo tauri build`. Acceptable for release; use `cargo tauri dev` (debug, default) for iteration.
- **No `[profile.dev]` overrides.** Default debug build. `cargo build` produces a binary in `target/debug/`. The workspace target dir is `./target` at the repo root, **not `src-tauri/target`** — this caught the CI cache step (see [`ci-pipeline.md`](ci-pipeline.md)).
## See also
- [CI pipeline](ci-pipeline.md) — uses this profile for release builds.
- [Dev launcher and scripts](dev-launcher-and-scripts.md) — `npm run tauri dev` uses the default debug profile.
- [Storage Cargo configuration](storage-overview.md) — the per-crate sqlx feature stripping.