feat(dashboard): add error logging to SQLite database#87
Merged
justinjdev merged 2 commits intofeat/command-dashboardfrom Mar 21, 2026
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add a dedicated dashboard_errors table to record server-level errors (API handler failures, WebSocket errors) to the SQLite database instead of only writing to stderr. This enables the dashboard frontend to surface errors to the user. Backend changes: - Add dashboard_errors table to schema with timestamp, source, handler, message, and detail columns - Add LogError/ReadErrors/ClearErrors functions in errlog.go - Add GET /api/errors and DELETE /api/errors endpoints - Add Server.logError() best-effort helper that also broadcasts "error-logged" WS events - Instrument all 500-error paths in server.go, ws.go, and data.go - Add logFunc callback to Hub for WebSocket error logging Frontend changes: - Add DashboardError type to types.ts - Add errors store with WS-triggered refetch on "error-logged" events - Add ErrorBanner component with expandable error list and clear button - Integrate ErrorBanner into Shell component - Add "error-logged" to WSEventType union - Rebuild static assets Tests: - TestLogErrorAndReadErrors: verify insert and read ordering - TestAPIErrors: verify GET /api/errors returns logged errors - TestAPIClearErrors: verify DELETE /api/errors clears all errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Prevent infinite recursion in Broadcast by skipping logFunc for "error-logged" events (logError -> Broadcast -> marshal fail -> logFunc -> logError cycle) - Add auto-pruning to LogError: keep only the most recent 500 entries to prevent unbounded table growth - Add comment explaining why handleErrors/handleClearErrors don't self-log Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cc80dd2 to
2161af4
Compare
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
dashboard_errorsSQLite table for persistent server-level error loggingLogError/ReadErrors/ClearErrorsfunctions following the herald patternGET /api/errorsandDELETE /api/errorsAPI endpointsserver.go,ws.go, anddata.gowith best-effort DB logginglogFunccallback to Hub for WebSocket error logging without circular dependenciesErrorBannercomponent with expandable error list, dismiss/clear, and WS-triggered real-time updatesErrorBannerinto Shell component with error polling lifecycleTest plan
TestLogErrorAndReadErrors— verify insert ordering and read-backTestAPIErrors— verifyGET /api/errorsreturns logged errorsTestAPIClearErrors— verifyDELETE /api/errorsclears all errorsgo vetcleannpm run build🤖 Generated with Claude Code