feat(admin): router-style in-app error log view #322
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-327-admin-error-log-view"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Production auth/rate-limit problems on NC01 (unauthorized
/users/me, refresh failed/expired, revoked tokens, rate limiting) were only visible via SSH log inspection, and the app surfaced nothing when e.g. a verification-email send was throttled. This adds an admin-gated, filterable, rotated error-log view so the team can diagnose recurring issues in-product.Decisions (confirmed with the requester)
tracingLayer in the existing subscriber registry captures every ERROR-level event automatically, so anytracing::error!app-wide lands in the view with its structured fields. No per-call-site plumbing.category = "rate_limit"+ the affectedclient, so they surface in the errors-only view and stay attributable. Other warnings staywarnand are excluded by construction.API (bunyip-api)
error_logmodule:ErrorLogBuffer(bounded, thread-safeArc<Mutex<VecDeque>>, newest-first snapshot with optional category filter) +ErrorLogLayer(ERROR-only capture, splitsmessage/category/route/clientout of the fields, retains the rest).init_tracing; buffer registered as app data.GET /v1/admin/logs(AdminUser-gated): newest-first entries, optional?category=, withmatched/buffered/capacityfor rotation reporting.check_rate_limitchokepoint (login/registration/magic-link/password-reset) and the two email-resend limits inbunyip-domain. Client IP is whatever the caller passes today; the external-IP companion issue refines attribution.Web (bunyip-web)
/admin/logspage mirroring the audit-log view: category filter (All / Rate limit), per-entry message, Error + category badges, thetarget • route • clientattribution line, and any extra fields. Sidebar nav entry added.error_logs()api client +AdminErrorLog/ErrorLogsResponsetypes.Acceptance criteria
/admin/logs.category="rate_limit"+clientfield, rendered on the attribution line.Tests
error_logunit tests: ERROR captured / WARN not; category filter; ring rotates oldest at capacity; extra fields retained.Verification
just check-containergreen (fmt + clippy-D warnings+ workspace lib tests, incl. the 4 newerror_logtests).cargo test -p bunyip-web --binsgreen (73 passed, incl. the render test).Not in scope
External client-IP attribution (companion issue) and log persistence across restarts (in-memory by design for v1).
Fixes BUNYIP-327.