Skip to content

feat(dashboard): add error logging to SQLite database#87

Merged
justinjdev merged 2 commits intofeat/command-dashboardfrom
worktree-fellowship-quest-error-logging
Mar 21, 2026
Merged

feat(dashboard): add error logging to SQLite database#87
justinjdev merged 2 commits intofeat/command-dashboardfrom
worktree-fellowship-quest-error-logging

Conversation

@justinjdev
Copy link
Copy Markdown
Owner

Summary

  • Add dashboard_errors SQLite table for persistent server-level error logging
  • Create LogError/ReadErrors/ClearErrors functions following the herald pattern
  • Add GET /api/errors and DELETE /api/errors API endpoints
  • Instrument all 500-error paths in server.go, ws.go, and data.go with best-effort DB logging
  • Add logFunc callback to Hub for WebSocket error logging without circular dependencies
  • Add auto-pruning (500 row retention limit) and recursion guard for error-logged WS events
  • Build frontend ErrorBanner component with expandable error list, dismiss/clear, and WS-triggered real-time updates
  • Integrate ErrorBanner into Shell component with error polling lifecycle

Test plan

  • TestLogErrorAndReadErrors — verify insert ordering and read-back
  • TestAPIErrors — verify GET /api/errors returns logged errors
  • TestAPIClearErrors — verify DELETE /api/errors clears all errors
  • All 19 dashboard tests pass
  • go vet clean
  • Frontend builds with npm run build

🤖 Generated with Claude Code

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d95139c7-dc25-454e-8df3-43f88bd26864

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-fellowship-quest-error-logging

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@justinjdev justinjdev marked this pull request as ready for review March 21, 2026 22:47
justinjdev and others added 2 commits March 21, 2026 17:52
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>
@justinjdev justinjdev force-pushed the worktree-fellowship-quest-error-logging branch from cc80dd2 to 2161af4 Compare March 21, 2026 22:52
@justinjdev justinjdev merged commit 4c59fcd into feat/command-dashboard Mar 21, 2026
@justinjdev justinjdev deleted the worktree-fellowship-quest-error-logging branch March 21, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant