jouleclaw-energy: Implausible says what it now means, and a lint CI could not see #353

Merged
dcharlot merged 1 commit from fix/jouleclaw-energy-doc-links into main 2026-10-20 08:29:32 -04:00
Owner

Three things in one crate, all found by reading cargo doc and clippy output that no CI step reads.

1. CounterLiveness::Implausible understated itself — my omission

#341 made the GPU plausibility bound two-sided, so the variant is now produced for a counter that accrues far less than its board's telemetry says it drew, as well as for one running faster than the board can draw. Its doc comment still described only the fast direction.

That is the defect family this crate keeps surfacing — documentation asserting something narrower than the code does — and here I introduced it. The doc now names both arms, and says which one matters at an energy ceiling: a counter reading low would otherwise be graded as hardware and then spend a budget it is not measuring, while a counter running fast fails safe.

2. A clippy error CI structurally could not see

cargo clippy -p jouleclaw-energy with no features fails -D warnings on vec_init_then_push at meter.rs:266.

CI's clippy step lints this crate as --features ioreport only. With any meter feature on, detect_meter has several pushes and the lint does not fire. With none, every hardware meter is cfg-ed out and the estimator's push is the only one left — so the default build is a different program, and a lint pass that never compiles it cannot speak for it.

The lint is right for that configuration and wrong as a rewrite: with features on, collapsing to vec![..] would be incorrect. So it is allowed at the function with the reason written down, rather than restructured to satisfy one cfg at the others' expense.

3. The blind spot itself

standards-build.yml now lints the default build of jouleclaw-energy beside the featured one, so this class cannot hide there again.

Same shape as check-tests-in-ci catching a test no job runs: a check that compiles one configuration says nothing about the others. Verified both ways — clippy exits 0 with and without ioreport, and 70 tests pass.

What is deliberately not touched

De-linking plausible_gpu_counter (a pub(crate) item, so not linkable from public docs) removes one of this crate's nine cargo doc warnings — the only one inside text this PR corrects.

The other eight stay. They link private or platform-gated items in process.rs, which is #[cfg(target_os = "macos")], and in rapl.rs — so which of them appear depends on the target. cargo doc is not part of this workspace's CI gate, and rewriting another author's docs across a cfg boundary from a host that sees only one side of it is how a fix becomes a regression on the other. They are reported here with the cause instead, so the next person gets the context rather than the surprise.

How the lint was actually found

Not by a sweep. I ran clippy without features while checking something else, and an echo in my own command masked the non-zero exit — so I nearly recorded it as clean. Worth writing down: cmd | grep ...; echo ok prints ok regardless, because the status belongs to the echo.

🤖 Generated with Claude Code

Three things in one crate, all found by reading `cargo doc` and `clippy` output that **no CI step reads**. ## 1. `CounterLiveness::Implausible` understated itself — my omission #341 made the GPU plausibility bound two-sided, so the variant is now produced for a counter that accrues far **less** than its board's telemetry says it drew, as well as for one running faster than the board can draw. Its doc comment still described only the fast direction. That is the defect family this crate keeps surfacing — documentation asserting something narrower than the code does — and here I introduced it. The doc now names both arms, and says which one matters at an energy ceiling: a counter reading low would otherwise be graded as hardware and then spend a budget it is not measuring, while a counter running fast fails safe. ## 2. A clippy error CI structurally could not see `cargo clippy -p jouleclaw-energy` with **no features** fails `-D warnings` on `vec_init_then_push` at `meter.rs:266`. CI's clippy step lints this crate as `--features ioreport` **only**. With any meter feature on, `detect_meter` has several pushes and the lint does not fire. With none, every hardware meter is `cfg`-ed out and the estimator's push is the only one left — so the default build is a *different program*, and a lint pass that never compiles it cannot speak for it. The lint is **right for that configuration and wrong as a rewrite**: with features on, collapsing to `vec![..]` would be incorrect. So it is allowed at the function with the reason written down, rather than restructured to satisfy one cfg at the others' expense. ## 3. The blind spot itself `standards-build.yml` now lints the **default** build of `jouleclaw-energy` beside the featured one, so this class cannot hide there again. Same shape as `check-tests-in-ci` catching a test no job runs: a check that compiles one configuration says nothing about the others. Verified both ways — clippy exits **0** with *and* without `ioreport`, and 70 tests pass. ## What is deliberately not touched De-linking `plausible_gpu_counter` (a `pub(crate)` item, so not linkable from public docs) removes one of this crate's **nine** `cargo doc` warnings — the only one inside text this PR corrects. The other eight stay. They link private or platform-gated items in `process.rs`, which is `#[cfg(target_os = "macos")]`, and in `rapl.rs` — so *which* of them appear depends on the target. `cargo doc` is not part of this workspace's CI gate, and rewriting another author's docs across a cfg boundary from a host that sees only one side of it is how a fix becomes a regression on the other. They are reported here with the cause instead, so the next person gets the context rather than the surprise. ## How the lint was actually found Not by a sweep. I ran `clippy` without features while checking something else, and an `echo` in my own command masked the non-zero exit — so I nearly recorded it as clean. Worth writing down: `cmd | grep ...; echo ok` prints `ok` regardless, because the status belongs to the `echo`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jouleclaw-energy: Implausible says what it now means, and a lint CI could not see
All checks were successful
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 1m14s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 7s
wai-quantum WebGPU member / does this change touch it (pull_request) Successful in 12s
wai-quantum WebGPU member / member · DX12 and Vulkan (cbio-windows) (pull_request) Successful in 12m16s
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Successful in 7m26s
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Successful in 20m10s
standards workspaces build + test / jouleclaw-rs (-nodebug, jouleclaw/jouleclaw-rs, -p jouleclaw-energy --features rapl,nvml, jouleclaw-rs, linux-arm64, -C target-feature=+fp16) (pull_request) Successful in 2m32s
standards workspaces build + test / joulecontract-rs (joulecontract/joulecontract-rs, joulecontract-rs, linux-arm64, true) (pull_request) Successful in 1m14s
standards workspaces build + test / aac-rs (aac-conformance, aac/aac-rs, aac-rs, linux-arm64) (pull_request) Successful in 3m35s
standards workspaces build + test / map-rs (map-conformance, map/map-rs, map-rs, linux-arm64) (pull_request) Successful in 1m5s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 3m14s
standards workspaces build + test / mesh-rs (mesh/mesh-rs, -p mesh-engine-gguf -p mesh-openai --features mesh-engine-gguf/gguf,mesh-openai/server, mesh-rs, linux-arm64) (pull_request) Successful in 57s
standards workspaces build + test / openpay (openpay, openpay, linux-arm64) (pull_request) Successful in 3m26s
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 1m0s
standards workspaces build + test / arl-rs (arl/arl-rs, arl-rs, linux) (pull_request) Successful in 1m18s
standards workspaces build + test / eoc-rs (eoc/eoc-rs, -p eoc-meter --features cuda, eoc-rs, linux) (pull_request) Successful in 2m10s
standards workspaces build + test / jcp-rs (jcp-conformance, jcp/jcp-rs, -p jcp-energy --features nvml, jcp-rs, linux) (pull_request) Successful in 1m44s
standards workspaces build + test / joule-ui-rs (joule-ui/joule-ui-rs, joule-ui-rs, linux) (pull_request) Successful in 1m15s
standards workspaces build + test / joulehook-rs (joulehook/joulehook-rs, joulehook-rs, linux) (pull_request) Successful in 1m15s
standards workspaces build + test / pool-rs (pool/pool-rs, pool-rs, linux) (pull_request) Successful in 1m8s
standards workspaces build + test / proof-rs (proof-conformance, proof/proof-rs, proof-rs, linux, true) (pull_request) Successful in 1m33s
standards workspaces build + test / sense-rs (sense/sense-rs, sense-rs, linux) (pull_request) Successful in 1m14s
standards workspaces build + test / sandbox-rs (sandbox-conformance, sandbox/sandbox-rs, sandbox-rs, linux) (pull_request) Successful in 2m33s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Successful in 3m30s
standards workspaces build + test / smart-byte-rs (smart-byte/smart-byte-rs, smart-byte-rs, linux) (pull_request) Successful in 4m16s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 2m6s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 7m17s
standards workspaces build + test / jouledesk-rs (jouledesk/jouledesk-rs, jouledesk-rs, macos) (pull_request) Successful in 2m43s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m23s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m34s
05f60d68dd
Three things, all in this crate, found by looking at `cargo doc` and clippy
output that no CI step reads.

**1. `CounterLiveness::Implausible` understated itself.** #341 made the GPU
plausibility bound two-sided, so the variant is produced for a counter that
accrues far *less* than its board's telemetry says it drew as well as for one
that runs faster than the board can draw. Its doc comment still described only
the fast direction — the enum's own documentation understating the variant,
which is the defect family this crate keeps surfacing, here introduced by my
own omission. The doc now names both arms and says which one matters at an
energy ceiling: a counter reading low would otherwise be graded as hardware and
then spend a budget it is not measuring, while a counter running fast fails
safe.

**2. A clippy error CI structurally could not see.** `cargo clippy -p
jouleclaw-energy` with **no features** fails `-D warnings` on
`vec_init_then_push` at `meter.rs:266`. CI's clippy step lints this crate as
`--features ioreport` only, and with any meter feature on there are several
pushes so the lint does not fire. The default build is a different program —
every hardware meter in `detect_meter` is behind a `cfg` — and a lint pass that
never compiles it cannot speak for it.

The lint is right for that configuration and wrong as a rewrite: with features
on, `vec![..]` would be wrong. So it is allowed at the function with the reason
written down, rather than restructured to satisfy one cfg at the others'
expense.

**3. The blind spot itself.** `standards-build.yml` now lints the default build
of `jouleclaw-energy` beside the featured one, so this class of error cannot
hide there again. This is the same shape as `check-tests-in-ci` catching a test
no job runs: a check that compiles one configuration says nothing about the
others.

Also de-links `plausible_gpu_counter` in the corrected comment, which is
`pub(crate)` and cannot be linked from a public item's docs — one of this
crate's nine `cargo doc` warnings, and the only one inside text being changed
here.

The remaining eight are **not** touched. They link private or platform-gated
items in `process.rs`, which is `#[cfg(target_os = "macos")]`, and in
`rapl.rs`, so which of them appear depends on the target. `cargo doc` is not in
this workspace's CI gate, and rewriting another author's docs across a cfg
boundary from a host that sees only one side is how a fix becomes a regression
on the other.

Verified: clippy clean with **and** without `ioreport`; 70 tests pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!353
No description provided.