Diagnostics: opt-in debug capture with one-click copy from Preferences - #111
Open
daiverd wants to merge 2 commits into
Open
Diagnostics: opt-in debug capture with one-click copy from Preferences#111daiverd wants to merge 2 commits into
daiverd wants to merge 2 commits into
Conversation
Adds a bounded, in-memory-only ring buffer (src/diagnostics) that records console warnings/errors, connection lifecycle events, and sampled counters (inbound messages/sec, output lines/sec, long-task count/duration) while capture is enabled. A new Preferences > Diagnostics tab exposes an off-by-default "Capture diagnostics" checkbox, a "redact message text" toggle, and a "Copy diagnostics" button that serializes the buffer plus an environment/session snapshot to the clipboard as Markdown ready to paste into a GitHub issue. The UI states what the export contains before copying. The buffer never persists to localStorage/IndexedDB, disabling it is a zero-allocation no-op on the record() hot path, and record(category, data) is intentionally generic so the performance watchdog (issue #103) can feed it once both land. Fixes #100 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
daiverd
added a commit
that referenced
this pull request
Aug 12, 2026
Matches the identical hunk in the diagnostics branch (#111) so the two PRs merge cleanly in either order. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/diagnostics/, a bounded, in-memory-only ring buffer (DiagnosticsRingBuffer) capped by both record count and a rough byte estimate.record(category, data)is a zero-allocation no-op while disabled, so it stays cheap to call from hot paths.console.warn/console.error(wrapped once, original behavior preserved, message capped to 500 chars), connection lifecycle transitions + reconnect count (viauseConnectionStore), and counters sampled every 5s (inbound messages/sec and output lines/sec, fromuseChannelHistoryStore/useOutputStoreentry-id deltas — no per-event hooks) plus long-task count/duration viaPerformanceObserver.getDiagnosticsMarkdown()/copyDiagnosticsToClipboard()assemble an environment + session snapshot (UA, platform, hardwareConcurrency, deviceMemory, window size, devicePixelRatio, page uptime, app version frompackage.json, connection status, live subsystems — audio viaclient.media.cacophony.context.state, MIDI enabled pref, editors open, file transfers) plus the buffer contents, and serialize everything to Markdown ready to paste into a GitHub issue.openEditorCount/activeTransferCountgetters toEditorManager/FileTransferManagerso the environment snapshot can report live subsystem state without reaching into private internals.preferencesStore(persisted like other preferences); the ring buffer contents themselves are never persisted to localStorage/IndexedDB, per the issue's privacy requirements.record(category, data)is intentionally generic/decoupled from any specific producer, so the performance watchdog (issue Performance watchdog: detect and attribute sustained main-thread work while idle #103, built in parallel) can call it once both land — this PR has no dependency on or reference to watchdog code.Test plan
npx vitest run— 113 test files / 1101 tests passing, including 7 new colocated test files undersrc/diagnostics/covering ring buffer bounding (record count + byte estimate) and FIFO eviction, disable = no-op (record count andJSON.stringifyspy), console capture wrapping + message capping, connection lifecycle + reconnect counting, counter/long-task sampling, environment snapshot assembly, and Markdown shape + redaction behavior.npm run typecheck— cleannpx biome linton new/changed files — clean (two pre-existing, unrelated warnings inApp.tsxpredate this change)Fixes #100
🤖 Generated with Claude Code