| name | maintain-debug |
| description | Maintain the Debug destination's diagnostic list, filters, runtime metric cards, copy actions, refresh races, and verified native-log clear UI. Use when changing diagnostic presentation, controls, or debug accessibility. |
Maintain Debug
Role and boundary
Keep Debug a read-only projection of bounded frontend diagnostics and native snapshots, plus an explicitly confirmed native-log maintenance action. Do not fabricate telemetry, clear the frontend ring when clearing files, or move native operations into the WebView.
Source map
src/main.ts: wireDebugPage, wireDebugConnection, debugEntryLine, runtime/connection rendering, refresh/copy/clear handlers, revision guards, and Debug markup.
src/debug-page.ts: wireDebugConnection renders the read-only "intelligence connection" panel (provider, model, credential state) from injected readers — keep it injection-based so Debug never depends on the full assistant IPC module.
src/debug-contract.ts: DebugFilter, DebugEntry, snapshot/result types, filterDebugEntries, mergeDebugEntries, debugEntryCounts, nativeLogClearStatus, and runConfirmedNativeLogClear.
src/speech-metrics.ts: bounded text-free frontend diagnostic/metric ring and subscription API.
src-tauri/src/diagnostics.rs: native log discovery/verification/rotation clear, RuntimeDiagnosticsState, CPU/RSS/uptime metrics, and playback counters; src-tauri/src/lib.rs: read_diagnostics, read_runtime_diagnostics, clear_native_logs, and log-directory commands.
src/style.css: .debug-* layout, metric cards, filters, empty/error states; tests tests/debug-contract.test.ts, tests/debug-metrics.test.ts, and tests/assistant-activity.test.ts.
Cover
- Keep filters
all/info/warn/error, deterministic merge/order, copy-visible/copy-errors behavior, accessible status updates, and explicit empty/unavailable messages.
- Refresh native logs and runtime metrics through typed commands; hide stale native entries after a successful clear until a fresh refresh proves them present, and keep frontend in-memory diagnostics separate.
- Require the exact confirmation before clearing only verified active/rotated Voice Layer files; preserve bounded multi-pass stabilization, failure reporting, and app-log scoping.
- Label CPU sample semantics, unavailable first samples, RSS platform limits, Chat underrun counters, and Live qualifying
DataPlayedBack gap definitions honestly. Never treat counters as audible quality proof.
- Exclude conversation text, audio/PCM, credentials, and hidden reasoning from copied or persisted diagnostics; inspect current native schema before adding a field. The connection readout shows only the persisted provider/model and a redacted credential status (ChatGPT sign-in state or
sk-or-… snippet) — never the OpenRouter key.
- The Chat/Live sending statuses name the snapshotted provider (Local / ChatGPT subscription / OpenRouter) and must stay provider-aware if the route union grows.
Validate and accept
- Run
bun test tests/debug-contract.test.ts tests/debug-metrics.test.ts tests/assistant-activity.test.ts.
- Run
git diff --check against the actual files changed; run just check when the change crosses TypeScript/Rust/build boundaries. Exercise filter, refresh, copy, clear confirmation/cancel/failure, runtime unavailable states, and keyboard access in the packaged app via $test-voice-layer-app.
- Treat real app-log rotation, native metric sampling, and human decision to clear logs as operational/device acceptance beyond unit tests.
Relationships
Use $maintain-navigation for Debug entry/focus and $maintain-diagnostics for native metrics/log operations. Coordinate with $maintain-voice-output when interpreting playback counters.