jouleclaw-energy: a ledger total carries its weakest grade; macOS meter code is linted in CI #259
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/meter-clippy-macos"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was wrong
jouleclaw-energy'sEnergyLedgeradded up microjoules without recording how good each figure was. Itscostsdefaults are fixed numbers, and their docs called one of them "measured". So a total built from estimates looked exactly like a total built from hardware readings, in the serializableLedgerSnapshotas well.The fix
recordandrecord_batchnow take the deposit'sProvenance, and the ledger keeps the weakest grade it has been given. That is a singlefetch_min, so the hot path stays lock-free.provenance(),LedgerSnapshot::provenanceandsummary()report the total's grade.resetclears it.span::weaker.Estimator, and the word "measured" is gone.const _: () = { assert!(..) }incosts. Before, they were a test of constants, which clippy flagged asassertions_on_constants.CI
The macOS energy job gains a last step that runs
cargo clippy --all-targets --no-deps -- -D warningson the eight crates whose meter code compiles only on macOS. Each crate gets the features its tests use:ioreport)No Linux job lints that code, which is how the lints fixed in #244 went unseen. All eight pass the gate today on the build host.
Checked
ioreportand withserde, including the two new ledger tests.a_total_is_graded_by_its_weakest_deposit;E0080);b"IOReportChannels\0"fails the new CI step.EnergyLedgerorcosts.🤖 Generated with Claude Code
EnergyLedger summed microjoules with no grade. Its `costs` defaults are fixed figures, and the docs called one "measured". So a total built from estimates looked the same as one built from readings, in the serializable snapshot too. Now: - `record` and `record_batch` take the deposit's `Provenance`. The ledger keeps the weakest grade it was given (one `fetch_min`, still lock-free). `provenance()`, `LedgerSnapshot::provenance` and the summary report that grade; an empty ledger has none, and `reset` clears it. The order of the grades is pinned to `span::weaker` by a test. - The `costs` docs say what the figures are: defaults carried over from another codebase's measurements, calibrated on no host that uses them, so a deposit computed from one is `Estimator`. "measured" is gone. - The orderings the defaults must keep are checked when the crate builds (`const _: () = { assert!(..) }`), not in a test of constants that clippy flagged as `assertions_on_constants`. CI: the macOS energy job now runs clippy, with `-D warnings`, on the eight crates whose meter code compiles only on macOS: jcp-energy, jcp-gateway, proof-cascade, proof-solvers, eoc-meter, jouleclaw-energy (ioreport), sandbox-meter and sandbox-proof. No Linux job lints that code, which is how the lints fixed in #244 went unseen. All eight pass today. Co-Authored-By: Claude Opus 5.5 <[email protected]>