|
| 1 | +# Letter to Myself (Session Handoff) |
| 2 | + |
| 3 | +**Date:** 2026-05-17 |
| 4 | + |
| 5 | +## 1. Executive Summary |
| 6 | +* **Goal:** Autonomous crash-stability audit of Aurus (Sub-Project B in the brainstormed roadmap) — full-stack, parallel persona-lens, TDD fixes, iOS lookahead. |
| 7 | +* **Current Status:** **Complete.** 20+ commits shipped, smoke checklist deferred to user for hands-on verification. User was shopping; they should pull and run `pnpm tauri dev` to walk through `docs/superpowers/audits/2026-05-17/smoke.md`. |
| 8 | + |
| 9 | +## 2. The "Done" List (Context Anchor) |
| 10 | + |
| 11 | +### Brainstorm + Plan |
| 12 | +* `docs/superpowers/specs/2026-05-17-crash-stability-audit-design.md` — full design, sections approved |
| 13 | +* `docs/superpowers/plans/2026-05-17-crash-stability-audit.md` — phased plan with TDD per finding |
| 14 | + |
| 15 | +### Audit (Phase 1+2) |
| 16 | +* 5 lens-agents dispatched in parallel, **read-only** (Nemesis, Aletheia, Ipcha, Athena, Metis) → 57 raw findings in `docs/superpowers/audits/2026-05-17/raw/*.md` |
| 17 | +* Cael judge consolidated → `docs/superpowers/audits/2026-05-17/findings.md` (7C, 11H, 18M, 7L = 43 canonical) |
| 18 | +* Triage rule: C1+C2 are iOS-only architectural → deferred to Sub-Project A as nyxCore Action Points |
| 19 | + |
| 20 | +### Test Foundation (Phase 3) |
| 21 | +* `proptest = "1"` in `src-tauri/Cargo.toml` dev-deps |
| 22 | +* 8 property tests in `audio.rs::tests`: resampler/VAD/mono never panic on adversarial input; energy stays finite + ≥0 even with NaN/Inf (L1 fixed inline as a side effect) |
| 23 | +* 4 negative tests in `transcription.rs::tests`: deeply-nested JSON / truncated / wrong-shape never panic |
| 24 | + |
| 25 | +### Critical+High Fixes (Phase 4 — 16 commits) |
| 26 | +* **C3** `8cc0e10` — `RecordingGuard` RAII + `catch_unwind` in spawned audio thread, `.expect` → `?` |
| 27 | +* **C4** `7ade5c1` — first-run `has_api_keys` probe + amber banner with focus-rechecking |
| 28 | +* **C5** `7bbfcda` — `agents::classify_api_error(StatusCode)` for 401/402/429/408/504/5xx; 6 agent files migrated |
| 29 | +* **C6** `561d397` — `AUDIO_CHUNKS_SEEN` counter + 3s watchdog emitting `mic-permission-denied` |
| 30 | +* **C7** `0c86545` — Rust emits classified `deepgram-disconnected` event; frontend `useTauriEvents` drives exponential-backoff reconnect (250 ms→8 s, 5 attempts) |
| 31 | +* **H1** `f28bdfb` — webrtc mutex `.expect("poisoned")` → `.unwrap_or_else(|p| p.into_inner())` × 5 callbacks |
| 32 | +* **H2** `9e12a59` — extracted `creator_handshake()` + accept-loop with MAX_PAIRING_ATTEMPTS=16 |
| 33 | +* **H3** `bea4f80` — `wait_for_capture_end` supervisor + `stream_healthy` flag set by error callback |
| 34 | +* **H4** `45dd99b` — `CONSECUTIVE_AUDIO_DROPS` counter; emit `transcription-degraded` at threshold 3 |
| 35 | +* **H5** `a34622c` — `toggle_window` (Rust) + `useEscapeKey` (frontend) both call `stop_recording` before hide |
| 36 | +* **H6** `fdd1afb` — `GlobalListeners` wraps `useTauriEvents` + `useAudioForwarding` in root `layout.tsx` |
| 37 | +* **H7** `0d4f195` + `11ec01f` — `append_with_cap()` for Rust `RECORDING_BUFFER` (30 min cap) + 50k-char transcript cap in Zustand |
| 38 | +* **H8** `040b338` — `.unwrap_or("")` → `.ok_or(...)?`; `#[serde(default)]` on `ActionItem` fields |
| 39 | +* **H9** `f300b40` — new `app/components/ErrorBoundary.tsx` wired into layout |
| 40 | +* **H10** `6a105e2` — `WebSocketConfig::max_message_size = Some(64 * 1024)` via `connect_async_with_config` |
| 41 | +* **H11** `3e91497` — new `SyncDocument::approximate_state_bytes()`; transport.rs enforces 20 MiB peer budget |
| 42 | + |
| 43 | +### Drive-by Fixes |
| 44 | +* Pre-existing `v1.2.0` version bump from prior session committed (`59c266e`) |
| 45 | +* 5 pre-existing clippy warnings cleaned (path-statement, needless `return`, missing `Default` impl) |
| 46 | + |
| 47 | +### nyxCore Backlog (Phase 5) |
| 48 | +* 26 action points created on project `9dea4fc7-a2e8-4f1b-b30c-2aef7532a772` — all tagged with title-prefix `[C1|C2|M*|L*]` and reference `audit-2026-05-17` in the description |
| 49 | + |
| 50 | +### Test results at session close |
| 51 | +* `cargo test` → **97/97** green |
| 52 | +* `cargo clippy --tests -- -D warnings` → clean |
| 53 | +* `pnpm tsc --noEmit` → only pre-existing `__tests__/agents.test.ts` `unknown` type errors (not introduced) |
| 54 | + |
| 55 | +## 3. The "Pain" Log (CRITICAL) |
| 56 | + |
| 57 | +* **Tried:** Cael judge agent writing `findings.md` directly via Write tool. |
| 58 | + **Failed:** Harness blocked the write despite explicit instruction. |
| 59 | + **Workaround:** Cael returned full content inline; main session wrote the file from its hands. Lesson: sub-agents writing critical artifacts should be considered advisory — main session must always be ready to persist. |
| 60 | + |
| 61 | +* **Tried:** `connect_async_with_config(request, Some(ws_config), false)` per docs. |
| 62 | + **Failed:** `async_tungstenite::tokio::connect_async_with_config` has only 2 args, not 3. |
| 63 | + **Workaround:** Dropped the `disable_nagle` param. Lesson: async-tungstenite signature differs from upstream tungstenite — always verify against `cargo doc` or rust-docs. |
| 64 | + |
| 65 | +* **Tried:** Initial H2 refactor that tried to reuse `update_rx: mpsc::Receiver` across multiple SPAKE2 attempts by recreating the channel inside the loop. |
| 66 | + **Failed:** `update_rx` is consumed by handle_creator_connection on Err too; recreating the rx breaks the wiring to the externally-held `TransportHandle::update_tx`. |
| 67 | + **Workaround:** Split into `creator_handshake()` (handshake-only, retryable) + `run_creator_session()` (post-handshake, consumes rx exactly once). Lesson: when a moved value must survive multiple fallible attempts, the function boundary must move with it — refactor the function, don't try to clone/recreate the value. |
| 68 | + |
| 69 | +* **Tried:** `assert!(DEEPGRAM_MAX_FRAME_BYTES >= 4 * 1024, "msg")` in a `#[test]`. |
| 70 | + **Failed:** clippy `-D warnings` flagged `assertions_on_constants`. |
| 71 | + **Workaround:** Use `const _: () = assert!(DEEPGRAM_MAX_FRAME_BYTES >= 4 * 1024)` for compile-time guard. Lesson: clippy considers runtime asserts on consts dead code; use const-eval asserts. |
| 72 | + |
| 73 | +* **Tried:** Running `cargo` commands from repo root. |
| 74 | + **Failed:** `error: could not find Cargo.toml` repeatedly. |
| 75 | + **Workaround:** Always `cd /Users/oli/Projects/aurus-voiceintelligence/src-tauri && cargo ...`. Lesson: this is a Rust crate nested under the JS root, not a workspace. |
| 76 | + |
| 77 | +## 4. Active Variable State |
| 78 | + |
| 79 | +* nyxCore project id for Aurus: `9dea4fc7-a2e8-4f1b-b30c-2aef7532a772` |
| 80 | +* All 26 action points tagged via the title prefix and `audit-2026-05-17` reference in description |
| 81 | +* MCP supports filter by description, not by tags — use `nyxcore_search` with `query="audit-2026-05-17"` to retrieve |
| 82 | +* Version still at 1.2.0 (not bumped despite the hardening — user's call when to bump → 1.3.0 with the [Unreleased] section now full) |
| 83 | +* Working tree: only `.claude/settings.local.json` (system-managed) and `.memory/` modifications |
| 84 | + |
| 85 | +## 5. Immediate Next Steps |
| 86 | + |
| 87 | +1. [ ] User runs `pnpm tauri dev` and walks through `docs/superpowers/audits/2026-05-17/smoke.md` |
| 88 | +2. [ ] Tag a release once smoke is green: `git tag v1.3.0` + `gh release create v1.3.0` using the `[Unreleased]` CHANGELOG section. Move [Unreleased] → [1.3.0] - 2026-05-17. |
| 89 | +3. [ ] Pick the next Aurus sub-project from the brainstorm decomposition: |
| 90 | + - **A** iOS-App lauffähig (Tauri Mobile target — picks up C1+C2, M9, plus the actual iOS audio path) |
| 91 | + - **C** Sprechererkennung im Stream (Deepgram `diarize=true` — fast win, demo-friendly) |
| 92 | + - **D+E** Settings UI for Persona/nyxCore tokens + Persona-tuned outputs (highest user-visible value) |
| 93 | + - **F** Todo output refinement (small, polish-tier) |
| 94 | +4. [ ] If a follow-up audit is desired before sub-project A: re-run Phase 1 only against `src-tauri/src/platform/audio/mobile.rs` once it exists (currently a NotSupported stub). |
| 95 | +5. [ ] Consider dispatching a Nemesis review pass against the 16 fixes — I skipped per-fix Nemesis review due to token budget. The fixes are solid but a dedicated red-team pass would harden them further. |
0 commit comments