Skip to content

test(d-miner): D-MINER.1 rollup honesty-regression KAT (sampler selftest mode) - #588

Merged
frstrtr merged 3 commits into
masterfrom
dashboard/d-miner1-rollup-selftest-kat
Jun 28, 2026
Merged

test(d-miner): D-MINER.1 rollup honesty-regression KAT (sampler selftest mode)#588
frstrtr merged 3 commits into
masterfrom
dashboard/d-miner1-rollup-selftest-kat

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What

Adds a selftest subcommand to scripts/miner_presence_sampler.py (D-MINER.1) that pins the rollup accounting with a rig-free, in-memory sqlite KAT.

The D-MINER.1 sampler/rollup feeds the notify engine (15 KATs) and the uptime page, but the rollup math itself had zero regression coverage. This locks it in.

Pinned behaviors (16/16 green)

  • presence rule: live hashrate >0 => online, ==0 => offline
  • hours_online = online_samples * interval
  • avg_hashrate averaged over online samples only (offline zeros excluded)
  • per-worker stale% = dead/(live+dead)
  • pool __pool__ row = shares delta (max-min), clamped, not absolute snapshot
  • rollup idempotent across restart (INSERT OR REPLACE, never double-counts)
  • per-UTC-day grouping
  • raw pruned >90d while daily summary kept forever

Safety

Pure additive: one new argparse choice + one new function. No change to sample / rollup / record_sample production logic. Run: python3 scripts/miner_presence_sampler.py selftest.

D-MINER.1 sampler/rollup had a 15-KAT notify engine downstream but zero
regression coverage on the rollup accounting itself. Add a SAFE-ADDITIVE
selftest subcommand (rig-free, in-memory sqlite) pinning the honesty-
critical math so a refactor cannot silently re-stub it:

  - presence rule: live hashrate>0 => online, ==0 => offline
  - hours_online = online_samples * interval
  - avg_hashrate averaged over ONLINE samples only (zeros excluded)
  - per-worker stale% = dead/(live+dead)
  - pool __pool__ row = shares DELTA (max-min), clamped, not absolute
  - rollup idempotent across restart (INSERT OR REPLACE, no double-count)
  - per-UTC-day grouping
  - raw pruned >90d while daily summary kept forever

Pure additive: new argparse choice + new function; no change to sample/
rollup/record_sample logic. 16/16 checks green.
@frstrtr
frstrtr force-pushed the dashboard/d-miner1-rollup-selftest-kat branch from e5da02b to b0c7f49 Compare June 28, 2026 01:02
Extends the rollup selftest KAT with two honesty-critical properties the
existing checks did not pin:

7) Per-worker isolation in the SAME UTC day: two workers with different
   online/stale profiles produce independent daily rows. One miner's
   downtime or stale work must never bleed into another's uptime report.

8) All-offline worker: a worker reporting only live==0 (even while still
   emitting dead_hashrate) yields hours_online=0 and avg_hashrate=0 (no
   phantom presence), is NOT dropped from the report, and reads stale=100
   when all its reported work was dead.

SAFE-ADDITIVE (test-only, rig-free, in-memory, fixed-epoch). 25/25 pass.
Stacks on the D-MINER.1 rollup KAT branch.
…ation-kat

test(d-miner): D-MINER.1 per-worker isolation + all-offline honesty KAT
@frstrtr
frstrtr merged commit e781a1d into master Jun 28, 2026
22 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.

1 participant