mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-07 07:36:37 +00:00
fix(errors): serve /api/v3/errors/* from the display service; add a Plugin errors panel (#614)
* fix(errors): serve /api/v3/errors/* from the display service's aggregator The error aggregator is a per-process singleton and only the display service runs plugins, so only its aggregator records anything. The routes read the web process's own, empty one and always reported no errors. The display service now publishes a bounded snapshot of its aggregator to the shared cache (plugin_error_snapshot) from a daemon thread: at most once every 10 s and only when something changed, never raising into the caller. The routes read it and keep their response shapes, adding snapshot_available, generated_at and clear_pending; exception text has credentials redacted. POST /errors/clear writes a clear request (plugin_error_clear_request) that the display applies on its next 5 s tick via the new clear_before(), which keeps errors recorded after the cutoff and rebuilds the counts. Until the snapshot acknowledges the request, reads hide everything before the cutoff, so a snapshot written just before the click cannot bring errors back. Adds "all": true; cleared_count is null when only the display can know it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(web): show plugin errors in the Logs tab A compact panel under the log viewer: per-plugin error counts, repeating errors (type, count, affected plugins, a sample message, last seen) and a Clear button, with empty states for "no errors" and "display service hasn't reported yet". Polls every 15 s while the tab is active; all text goes through escapeHtml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: describe where plugin error reports come from and how clear works Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(errors): redact the published snapshot before clipping it Keeping only a traceback's tail (or clipping a message) could cut an `api_key=` marker off while keeping the secret after it, and the web side's redaction would then have nothing to match. The display now redacts every free-text field of the snapshot first. The patterns move to a Flask-free src/redaction.py so the display service can use them; redact_text in the web error handler uses the same function, unchanged in behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,6 +89,23 @@ floor on the release that ships them):
|
||||
longer set `Accept-Encoding: ... br` by hand (brotli is not installed, so a
|
||||
`br` response could not be decoded); requests picks the encodings.
|
||||
|
||||
### Plugin error reporting
|
||||
|
||||
- `/api/v3/errors/summary` and `/api/v3/errors/plugin/<id>` report the errors
|
||||
the display service recorded. They used to read the web process's own error
|
||||
aggregator, which never records anything, so they always answered "no
|
||||
errors". The display service now publishes a bounded snapshot to the shared
|
||||
cache (`plugin_error_snapshot`, at most every 10 seconds and only on change;
|
||||
`src/error_aggregator.py`, started from `DisplayController.__init__`).
|
||||
Responses keep their shape and add `snapshot_available`, `generated_at` and
|
||||
`clear_pending`; exception text has credentials redacted.
|
||||
- `POST /api/v3/errors/clear` records a request (`plugin_error_clear_request`)
|
||||
the display service applies within about 5 seconds; reads hide the cleared
|
||||
errors at once. It accepts `"all": true`, and `cleared_count` can be `null`
|
||||
when the count is only known to the display service.
|
||||
- The Logs tab has a **Plugin errors** panel: per-plugin counts, repeating
|
||||
errors and a Clear button.
|
||||
|
||||
## 3.5.0
|
||||
|
||||
New modules a plugin may import via `src.*` (floor on 3.5.0):
|
||||
|
||||
Reference in New Issue
Block a user