Skip to content

Event log store: event_log table, record_event helper, fixed templates and retention #4508

Backlog

Description

@pithead-architect

What's the problem

The dashboard has no store for system events that carry a label and a severity. The events table (ts, type, detail, no id) is a chart-marker store held in memory and sent in chart.events, so it cannot hold entries that are updated later and should not grow with non-chart rows.

What it impacts

First piece of the Event log (#4431). The episodes child, the read endpoint child, #4433, #4434, #4435 and #3735 all write to or read from this store.

How I found it

Split from #4432, which read develop-v2.1.0 at bfd061f: storage_schema.py (the events table), service/storage_service.py:309 (add_event), config/config.py:535 (HISTORY_RETENTION_SEC, 30 days). No new reading was done for this split.

How important is it

Medium; it is the foundation the other Event log pieces wait on. Size M.

Acceptance criteria

  • A new event_log table, separate from events, with columns id, ts, end_ts, count, kind, subject, label, severity (info, warning or error) and text.
  • Producers call one helper, record_event(kind, subject, label, severity, text_template, slots).
  • Entry text comes only from fixed sentence templates. Payout text may state the chain and the amount.
  • A test feeds each forbidden kind of value through record_event and asserts none appears in the stored text:
    • a wallet or onion address, view key, password or token;
    • a transaction id, IP address, user name or rig hostname;
    • a raw exception class name, raw config key or URL.
  • add_event keeps feeding the chart unchanged; a test asserts the chart.events payload is the same before and after.
  • At most one new row per (kind, subject) per minute; a second call inside the minute increments count on the existing row.
  • Retention is 30 days (HISTORY_RETENTION_SEC) or 5,000 rows, whichever comes first, oldest first. A test inserts 20,000 events in one minute, then asserts at most 5,000 rows and that the last hour's error entries are still present.
  • No existing table's rows are copied into event_log.
  • make test, make test-patch-coverage and make lint-file-budget pass.

Possible solutions

Parent requirement: #4432

Worker brief: Parent pithead#4432 (tracker pithead#4431). The PR targets develop-v2.1.0.

Build only the write side: schema, record_event, the template table, the per-minute limit and retention. No episodes and no HTTP route (sibling children), and no UI. Leave end_ts and count usable by the episodes child.

Templates are the privacy boundary. Slots must be typed or allow-listed so a caller cannot pass free text through. Write the forbidden-value test first.

"A second call inside the minute increments count" is the product owner's reading of the parent's rate limit. If #4432 or its comments say otherwise, follow the issue and say so in the PR.

Proof tier: unit tests under make test with the suite's fake clock. No bench job is needed, because nothing on a box changes until a producer calls the helper.

Watch the file-budget lint; put the new code in its own module if the storage service is near its limit.

Activity

  1. added this to the v2.1.0 milestone on Nov 24, 2026
  2. added
    needs-triage
    on Nov 24, 2026
  3. added
    bug
    on Nov 24, 2026
  4. pithead-developer commented on Nov 26, 2026

    @pithead-developer
    Contributor

    Waiting on a transient bench_outage condition, not on another issue. the runner could not read the bench to confirm that no job still runs on the PR head (<urlopen error [Errno 61] Connection refused>). The runner re-checks it (first at 2026-11-26T23:33Z, at most 5 times).

  5. pithead-developer commented on Nov 29, 2026

    @pithead-developer
    Contributor

    Blocked on #4502. PR #4541 is blocked on pithead#4502, the operator's forward merge into develop-v2.1.0. The only failing required check at head 1b926fd is Build image (dashboard); adversarial-review is also red. The libzstd1 CVE behind the Build image failure (#4537) was fixed by #4604 on develop, but that fix is not an ancestor of origin/develop-v2.1.0. The base is 0 commits ahead of this branch, so there is nothing to merge in yet. This PR changes no image input, and I will not add a .trivyignore entry. Finished and unchanged: the event_log store, 47 unit tests, and a clean verifier and security-reviewer pass. Every other check is green and no bench job applies (dashboard-logic row). I posted this explanation on the PR. Once #4502 lands the fix on the base, merge the base in without rebasing, push, and re-check.

    The runner resumes this issue when that one closes.

  6. added
    blocked
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedbugneeds-triage

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions