test(d-miner): D-MINER.1 rollup honesty-regression KAT (sampler selftest mode) - #588
Merged
Merged
Conversation
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
force-pushed
the
dashboard/d-miner1-rollup-selftest-kat
branch
from
June 28, 2026 01:02
e5da02b to
b0c7f49
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
selftestsubcommand toscripts/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)
hours_online = online_samples * intervalavg_hashrateaveraged over online samples only (offline zeros excluded)stale% = dead/(live+dead)__pool__row = shares delta (max-min), clamped, not absolute snapshotSafety
Pure additive: one new argparse choice + one new function. No change to
sample/rollup/record_sampleproduction logic. Run:python3 scripts/miner_presence_sampler.py selftest.