Skip to content

mesh,web: add central event log for GenericEvent history - #451

Merged
Variour merged 3 commits into
mainfrom
claude/issue-442-36rnpb
Jul 24, 2026
Merged

mesh,web: add central event log for GenericEvent history#451
Variour merged 3 commits into
mainfrom
claude/issue-442-36rnpb

Conversation

@Variour

@Variour Variour commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #442.

  • Adds EventLog (src/events/EventLog.h): a fixed-size (128-entry, ~9.5KB) RAM ring buffer recording GenericEvent broadcasts (e.g. buzzer presses/resets) in receipt order, with sender name resolved via PeerRegistry::nameFor (new).
  • Adds GET /api/events?eventType= to read the log, optionally filtered by event type, capped to the eventLogLimit device setting (default 10, most-recent-first).
  • Adds POST /api/events/clear to wipe the device's ring buffer and restart arrival order at 0, broadcasting t:'eventsCleared' so other open viewers stay in sync.
  • Adds a persisted eventLogLimit device setting (1–128, default 10) controlling how many of the most recent matching entries the endpoint above returns — configurable from Settings, applied live (no reboot).
  • Pushes new entries live over the existing WebSocket as a t:'event' message, alongside t:'log'|'peers'|'groups'.
  • Adds a read-only "Event log" card to the web UI (Settings tab): a "Max displayed" field, an eventType filter, a table of name/eventType/payload/arrival order updated live via the WebSocket push, and a confirm-gated "Clear event log" button.
  • Mirrors the endpoints, WS messages, and static sample data in the mock server (server/index.js) per the repo's device/mock/UI parity checklist.

Deviation from the issue's design: the issue calls for registering /api/events in the shared (ApiRequest, ApiResponse) dispatch table introduced by #436, so it's automatically reachable over serial. #436 is still an open, unmerged PR, so this endpoint (and the new clear endpoint) are registered directly against AsyncWebServerRequest for now (matching every other current endpoint) — they should move onto the shared dispatch table once #436 lands, at which point they'll also become serial-reachable.

Test plan

  • npm test (mock server test suite, 36/36) passes
  • npm run lint (ESLint) passes
  • clang-format --dry-run --Werror passes across the touched src/ files
  • Verified via Playwright against the mock server: initial GET /api/events render, eventType filter narrowing the list (including the empty-result case), changing/saving eventLogLimit and confirming the backend persists and applies it (most-recent-N slicing verified after reload), and the clear button (confirm dialog, backend ring buffer actually emptied, cancel path leaves everything untouched) — no console errors
  • Verified the live-push paths (_onEventPush, eventsCleared handler) by direct review, since the mock server's dashboard WebSocket is intentionally never opened when served from localhost (pre-existing behavior, see data/index.html:3010)
  • Not verified in this environment (no physical device): real mesh GenericEvent broadcasts arriving and being recorded/pushed end-to-end on hardware

Records GenericEvent broadcasts (buzzer presses, resets, ...) in receipt
order in a fixed-size RAM ring buffer, with a read endpoint and live
WebSocket push for a web UI viewer.

#436 (shared ApiRequest/ApiResponse dispatch table for serial reachability)
is still an open, unmerged PR, so GET /api/events is registered directly
against AsyncWebServerRequest for now instead of the shared dispatch table
the issue's design calls for — it should move onto that table once #436
lands.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMsq87s9e7zRUvfLYKxqvk
@Variour Variour added the enhancement New feature or request label Jul 24, 2026 — with Claude
@github-actions

Copy link
Copy Markdown

Preview

URL: https://batterylight-pr-451.blackpond-ef672c92.germanywestcentral.azurecontainerapps.io

Hosted on Azure Container Apps — accessible from the internet.

claude added 2 commits July 24, 2026 09:31
…clear

Adds a persisted eventLogLimit device setting (default 10) capping how
many of the most recent matching entries GET /api/events returns, and a
POST /api/events/clear endpoint that wipes the device's ring buffer and
restarts arrival order at 0, broadcasting to connected WebSocket clients
so other open viewers stay in sync.

Adds matching UI: a "Max displayed" field in the Settings save flow and a
confirm-gated "Clear event log" button.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CMsq87s9e7zRUvfLYKxqvk
@Variour
Variour merged commit 9fd35dc into main Jul 24, 2026
11 checks passed
@Variour
Variour deleted the claude/issue-442-36rnpb branch July 24, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add central event log + read endpoint for GenericEvent history

2 participants