Skip to content

d-miner5(p1): transport-agnostic miner notification engine (evaluator + core + email adapter) - #552

Merged
frstrtr merged 1 commit into
masterfrom
dashboard/d-miner5-notify-engine-p1
Jun 26, 2026
Merged

d-miner5(p1): transport-agnostic miner notification engine (evaluator + core + email adapter)#552
frstrtr merged 1 commit into
masterfrom
dashboard/d-miner5-notify-engine-p1

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 26, 2026

Copy link
Copy Markdown
Owner

D-MINER.5 P1 — transport-agnostic miner notification engine

Implements phase-1 of docs/design/d-miner-5-notify-engine.md (the design
merged via #547): event evaluator + transport-agnostic notification core +
email adapter
— the slice that doc marks as "shippable solo, web-owned".

What it does

scripts/miner_notify_engine.py reads the D-MINER.1 presence sqlite, diffs the
newest per-worker sample against carried worker_state, and emits typed events:

  • offline > N min (latched — fires once, not every dark sample)
  • back_online (only after a known-offline edge — no false positives on first sight)
  • hashrate_drop vs the worker's observed peak

A transport-agnostic core then applies per-worker subscription,
throttle/dedupe window, and quiet-hours (warn severity bypasses quiet),
and hands an abstract Message to a pluggable transport (email via smtplib,
logonly for dry-run). The V36 P2P relay (P2) and Telegram (P3) adapters plug
in at the same seam with no core change.

Charter honesty

  • online == observed hashrate > 0 — same source of truth as the dashboard;
    presence is never fabricated.
  • Every Message is recorded in notifications with an explicit status
    (delivered / undelivered / throttled / quiet). An alert that cannot be
    delivered is logged undelivered, never silently dropped.

Tests

Deterministic in-memory selftest KAT, 9/9 green (python3 scripts/miner_notify_engine.py selftest):
first-online silence, offline threshold + non-refire latch, back-online edge,
hashrate-drop, quiet-hours warn-bypass, throttle, unsubscribed→undelivered.
Script is stdlib-only; no new deps, no build/CI impact (web-owned tooling).

Implements D-MINER.5 phase-1 per docs/design/d-miner-5-notify-engine.md:
event evaluator + transport-agnostic notification core + email adapter.

- reads the D-MINER.1 presence sqlite (samples table), diffs the newest
  per-worker sample against carried worker_state into typed events:
  offline>N min, back_online, hashrate_drop (vs observed peak).
- notification core (no transport knowledge): per-worker subscription,
  throttle/dedupe window, quiet-hours (warn severity bypasses quiet).
- pluggable transport adapters: email (smtplib) + logonly; V36 P2P relay
  (P2) and Telegram (P3) plug in at the same seam with no core change.
- charter honesty: online == observed hashrate>0 (never fabricated); every
  Message is recorded in notifications with an explicit status
  (delivered/undelivered/throttled/quiet) — an undelivered alert is logged,
  never silently dropped.
- deterministic in-memory selftest KAT (9/9): first-online silence, offline
  threshold + non-refire latch, back-online edge, hashrate-drop, quiet-hours
  warn-bypass, throttle, and unsubscribed->undelivered.
selftest deterministic in-memory KAT of the evaluator + core (no network)
"""
import argparse
import json
updates worker_state. `sub_for(worker)` returns the effective subscription
(so thresholds are per worker). `at` overrides wall clock for testing.
"""
at = at if at is not None else now_ts()
@frstrtr
frstrtr merged commit 6f72145 into master Jun 26, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants