Skip to content

Event log: GET /api/events read path over event_log and the existing payout, share, block, raffle and audit tables #4510

Backlog

Description

@pithead-architect

What's the problem

There is no single read path for system events. Payouts, shares, blocks, raffle wins and settings changes each live in their own table. On develop-v2.1.0, build_mining_activity (dashboard/mining_dashboard/web/views/overview_views.py:72) merges some of them, for Overview only. The Event log view and the Overview Activity list need one endpoint that returns stored events and those existing rows together, each exactly once.

What it impacts

#4435 (Event log view) and the Overview switch child read this endpoint. History from before the upgrade shows up only if the existing tables are merged at read time.

How I found it

Split from #4432; the endpoint contract and merge rules are its acceptance criteria. No new reading was done for this split.

How important is it

Medium; every reader of the Event log waits on it. Size M.

Acceptance criteria

  • GET /api/events accepts range (day, week, month or all), one or more label parameters and an optional severity of error, and returns {entries, counts}. range is the only time control, with no from/to.
  • At most 500 entries, newest first, each with id, ts, end_ts, count, label, severity and text. counts has one figure per label for the selected range.
  • Existing rows appear through a read merge, with the same fixed templates, and are not copied into event_log:
    • payouts: one entry per saved payout, "Payout received: XMR reached your wallet" (or XTM), label Payouts;
    • shares and blocks: label Shares and blocks;
    • raffle_wins: label XvB;
    • audit_events: label Settings, in plain words with no raw keys.
  • One saved payout gives exactly one entry; a test proves it.
  • Legacy hashrate_loss and hashrate_recovered rows from events are shown under the System label at read time.
  • Settings entries are returned only where and to whom /api/audit is available today; a test covers both cases.
  • The forbidden-value test from the store child is repeated against the response body.
  • Endpoint tests cover each label, several labels at once, the error filter, each range, an empty result and the 500 cap.
  • docs/dashboard.md documents the endpoint and the labels.
  • make test, make test-patch-coverage and make lint-file-budget pass.

Possible solutions

Parent requirement: #4432

Worker brief: Parent pithead#4432. Starts after the event_log store child merges. It does not need the episodes child: end_ts and count are plain columns. The PR targets develop-v2.1.0.

Build the route and the read merge only. Do not change the Overview page (sibling child) and do not build the Event log view (pithead#4435).

Reuse the store child's templates for merged rows, so the text is identical wherever an entry comes from.

The audit gate must mirror /api/audit exactly: find that route's check and call the same function; do not re-implement it.

Ids for merged rows must be stable and must not collide with event_log ids (for example, prefix by source).

Compute counts over the whole selected range, not just the 500 returned.

Proof tier: route tests under make test. No bench job.

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
    size:M
    on Nov 24, 2026
  4. pithead-developer commented on Nov 26, 2026

    @pithead-developer
    Contributor

    Blocked on #4508. Blocked on pithead#4508 (Event log store: event_log table, record_event helper, fixed templates and retention), whose PR #4541 is open and mergeable against develop-v2.1.0 but not yet merged. This issue's worker brief says it "Starts after the event_log store child merges" and must "Reuse the store child's templates for merged rows": the GET /api/events read path queries the event_log table (id, ts, end_ts, count, label, severity, text) and re-emits the store child's fixed templates verbatim, and none of that exists on develop-v2.1.0 yet (rg finds no event_log or record_event anywhere in the dashboard code). Writing the route now would import a table and templates that only exist on PR #4541's unmerged branch, so nothing here can be implemented or tested at the current base. Finished so far: full read of the issue, brief, parent #4432 and siblings; confirmed #4541 is the only store implementation in flight, no /api/events route exists, and no prior branch/PR for #4510 needs resuming. Unblocks when #4541 merges (or the work otherwise lands on develop-v2.1.0) and #4508 closes — the runner should resume this session then; #4508 itself is currently parked on a transient bench_outage condition, not on another issue. Nothing was edited or pushed; the claim branch is untouched at origin/develop-v2.1.0.

    The runner resumes this issue when that one closes.

  5. added
    blocked
    on Nov 26, 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-triagesize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions