open-standards/eoc/eoc-rs/crates/eoc-meter/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
David Charlot 12986a5db7 eoc: a broken draw reading condemned the counter it was meant to judge
The third and last crate carrying the defect #185 fixed in jcp-energy.
`gpu_plausibility::plausible` returned a bool and folded two unlike things
into the one `false`:

  if rate_mw > cap || draws_mw.iter().any(|&d| u128::from(d) > cap)

The left is the counter running faster than the board can draw — a finding
about the counter. The right is the *board's own telemetry* reading past the
board's own limit, which says the yardstick is broken, not the counter. Its
test named the case too: `"a 590 W draw reading"` asserted `false`, and 590 W
is what an RTX 4050 Laptop GPU reports for a second after it wakes.

So the reading is dropped, and only that reading. Only when nothing usable is
left is there no yardstick, and then the verdict is `BoardTelemetryUnusable`
mapping to a new `CounterStatus::Unjudgeable`, kept apart from `Implausible`
whose doc asserts "It is not counting the board's energy" — a conclusion this
case does not support. `admits_vendor_counter` compares against `Live`, so the
new variant is inadmissible without a change there.

`GpuPlausibility` carries the rate, the bound and which bound it was, where
the bool discarded the magnitude. A test pins the mean-draw bound at twice
the usable 10 W reading plus 5 W, which it could not be if the 590 W spike
were still in the mean — the old mean summed every reading, so a bad reading
made that bound *more* permissive, and only the short-circuit hid it.

Five tests enumerate the declined statuses by hand rather than matching
exhaustively, so each now lists `Unjudgeable`; without that it would be the
one status whose declining nothing checked. Two of them only compile under
`--features cuda`.

Checked for aarch64-unknown-linux-gnu with and without `--features cuda`;
75 tests pass in the crate and the workspace is clean.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-10-09 08:37:44 -04:00
..
lib.rs eoc: a broken draw reading condemned the counter it was meant to judge 2026-10-09 08:37:44 -04:00