energy tests: a 0.1 J burn floor, tick-driven fake RAPL trees, stale trees cleared #136

Merged
dcharlot merged 2 commits from energy/burn-floor-0-1-j into main 2026-10-04 14:04:32 -04:00
Owner

Two per-process energy tests required 0.2 J for 200 ms of one thread's CPU:

  • sandbox-meter's process_energy;
  • jouleclaw-energy's process_cpu.

On a busy host the burn took 1 s of wall time and read 0.171 J, and the test's own oracle around it read the same 0.171 J. The meter was right and the floor was wrong. What 200 ms of CPU costs depends on the core class that ran it; on an M5 Max it read 0.18–1.24 J. jcp-energy's and eoc-meter's equivalent tests already use 0.1 J.

Both floors are now 0.1 J. That is also the sleeping test's ceiling, so a counter that reads wall time at a fixed power still fails one of the two tests.

Verified: cargo test -p sandbox-meter --test process_energy (5 passed) and cargo test -p jouleclaw-energy --test process_cpu (1 passed), on macOS.

Fake RAPL trees: driven by the probe's tick, and cleared before use (515545ab)

sandbox-meter's the_public_package_counter_opens_only_over_live_packages failed once, in a full workspace run on a heavily loaded host just after a restart. It passed on its own. I built test binaries of the old and new forms and ran each 12 times under 24 CPU hogs; both passed every time. So the cause was not reproduced. Two inputs the tests didn't control could produce it, and this commit removes both:

  • Thread scheduling. sandbox's two liveness tests advanced the fake packages from a writer thread on a 2 ms timer, while the probe's tick slept 25 ms. A writer starved for a whole interval would make a live tree read as Frozen. The tick now advances the zones itself, then sleeps, so every interval sees exactly one advance. The 300 ms window rule still runs on the real clock. jcp-energy's and jouleclaw-energy's equivalent tests keep their writer thread, because they test the real probe with its own tick.
  • Leftover trees. sandbox's and jcp-energy's fake powercap roots are named by pid and a counter, and were built into whatever already sat at that path. A killed test process never drops its trees, so a later process reusing that pid could inherit stale zones. The root is now cleared first, as eoc-meter's and jouleclaw-energy's fakes already do.

Verified: cargo test -p sandbox-meter --lib (122 passed) and cargo test -p jcp-energy --lib (84 passed).

🤖 Generated with Claude Code

Two per-process energy tests required 0.2 J for 200 ms of one thread's CPU: - sandbox-meter's `process_energy`; - jouleclaw-energy's `process_cpu`. On a busy host the burn took 1 s of wall time and read **0.171 J**, and the test's own oracle around it read the same 0.171 J. The meter was right and the floor was wrong. What 200 ms of CPU costs depends on the core class that ran it; on an M5 Max it read 0.18–1.24 J. jcp-energy's and eoc-meter's equivalent tests already use 0.1 J. Both floors are now 0.1 J. That is also the sleeping test's ceiling, so a counter that reads wall time at a fixed power still fails one of the two tests. **Verified:** `cargo test -p sandbox-meter --test process_energy` (5 passed) and `cargo test -p jouleclaw-energy --test process_cpu` (1 passed), on macOS. ### Fake RAPL trees: driven by the probe's tick, and cleared before use (515545ab) sandbox-meter's `the_public_package_counter_opens_only_over_live_packages` failed once, in a full workspace run on a heavily loaded host just after a restart. It passed on its own. I built test binaries of the old and new forms and ran each 12 times under 24 CPU hogs; both passed every time. So the cause was **not reproduced**. Two inputs the tests didn't control could produce it, and this commit removes both: - **Thread scheduling.** sandbox's two liveness tests advanced the fake packages from a writer thread on a 2 ms timer, while the probe's tick slept 25 ms. A writer starved for a whole interval would make a live tree read as Frozen. The tick now advances the zones itself, then sleeps, so every interval sees exactly one advance. The 300 ms window rule still runs on the real clock. jcp-energy's and jouleclaw-energy's equivalent tests keep their writer thread, because they test the real probe with its own tick. - **Leftover trees.** sandbox's and jcp-energy's fake powercap roots are named by pid and a counter, and were built into whatever already sat at that path. A killed test process never drops its trees, so a later process reusing that pid could inherit stale zones. The root is now cleared first, as eoc-meter's and jouleclaw-energy's fakes already do. Verified: `cargo test -p sandbox-meter --lib` (122 passed) and `cargo test -p jcp-energy --lib` (84 passed). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
energy tests: a 200 ms burn's floor is 0.1 J in sandbox and jouleclaw
Some checks failed
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 1m1s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m54s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m25s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m17s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m13s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m39s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 13m6s
standards workspaces build + test / aac-rs (pull_request) Successful in 6m38s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 4m42s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 2m43s
standards workspaces build + test / map-rs (pull_request) Successful in 4m7s
standards workspaces build + test / mesh-rs (pull_request) Successful in 1m54s
standards workspaces build + test / openpay (pull_request) Successful in 15m57s
standards workspaces build + test / arl-rs (pull_request) Has been cancelled
standards workspaces build + test / joule-ui-rs (pull_request) Has been cancelled
standards workspaces build + test / jouledesk-rs (pull_request) Has been cancelled
standards workspaces build + test / joulehook-rs (pull_request) Has been cancelled
standards workspaces build + test / sense-rs (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Has been cancelled
0cfa3a6c7b
sandbox-meter's process_energy and jouleclaw-energy's process_cpu
required 0.2 J for 200 ms of one thread's CPU. On a busy host the burn
took 1 s of wall time and read 0.171 J, and the oracle around it read
the same 0.171 J. The meter was right and the floor was wrong. What
200 ms of CPU costs depends on the core class that ran it: on an M5 Max
it read 0.18-1.24 J. jcp-energy's and eoc-meter's equivalent tests
already use 0.1 J.

The floor is now 0.1 J in both. That is also the sleeping test's
ceiling, so a counter that reads wall time at a fixed power still fails
one of the two.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
energy tests: drive the fake RAPL trees from the probe's tick, and clear stale ones
Some checks failed
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 1m1s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m52s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m23s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m15s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m11s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m40s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 15m5s
standards workspaces build + test / aac-rs (pull_request) Successful in 4m33s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 4m9s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 2m0s
standards workspaces build + test / map-rs (pull_request) Successful in 3m1s
standards workspaces build + test / mesh-rs (pull_request) Successful in 1m43s
standards workspaces build + test / openpay (pull_request) Successful in 11m1s
standards workspaces build + test / arl-rs (pull_request) Has been cancelled
standards workspaces build + test / joule-ui-rs (pull_request) Has been cancelled
standards workspaces build + test / jouledesk-rs (pull_request) Has been cancelled
standards workspaces build + test / joulehook-rs (pull_request) Has been cancelled
standards workspaces build + test / sense-rs (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Has been cancelled
515545abcc
sandbox-meter's the_public_package_counter_opens_only_over_live_packages
failed once in a full workspace run on a heavily loaded host, just after
a restart. It passed on its own, and in 12 of 12 runs under 24 CPU hogs
in both its old and new forms. The cause was not reproduced. Two inputs
the tests did not control could produce it, and both are removed here.

- Thread scheduling: sandbox's two liveness tests advanced the fake
  packages from a writer thread on a 2 ms timer, while the probe's tick
  slept 25 ms. A writer starved for a whole interval reads a live tree
  as Frozen. The tick now advances the zones itself, then sleeps, so
  every interval sees exactly one advance. The 300 ms window rule still
  runs on the real clock. jcp-energy's and jouleclaw-energy's
  equivalents keep their writer thread, because they test the real
  probe with its own tick.
- Leftover trees: sandbox's and jcp-energy's fake powercap roots are
  named by pid and a counter, and were built into whatever already sat
  at that path. A killed test process never drops its trees, so a later
  process reusing that pid could inherit stale zones. The root is now
  cleared first, as eoc-meter's and jouleclaw-energy's fakes already do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcharlot changed title from energy tests: a 200 ms burn's floor is 0.1 J in sandbox and jouleclaw to energy tests: a 0.1 J burn floor, tick-driven fake RAPL trees, stale trees cleared 2026-10-01 18:40:16 -04:00
dcharlot force-pushed energy/burn-floor-0-1-j from 515545abcc
Some checks failed
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 1m1s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m52s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m23s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m15s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m11s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m40s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 15m5s
standards workspaces build + test / aac-rs (pull_request) Successful in 4m33s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 4m9s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 2m0s
standards workspaces build + test / map-rs (pull_request) Successful in 3m1s
standards workspaces build + test / mesh-rs (pull_request) Successful in 1m43s
standards workspaces build + test / openpay (pull_request) Successful in 11m1s
standards workspaces build + test / arl-rs (pull_request) Has been cancelled
standards workspaces build + test / joule-ui-rs (pull_request) Has been cancelled
standards workspaces build + test / jouledesk-rs (pull_request) Has been cancelled
standards workspaces build + test / joulehook-rs (pull_request) Has been cancelled
standards workspaces build + test / sense-rs (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Has been cancelled
to cc133929c1
All checks were successful
no-vanity-metrics / WAI public text names no company or product (pull_request) Successful in 3s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m53s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m26s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m13s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m10s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m39s
wai cross-architecture byte-equality / linux-x86_64 (pull_request) Successful in 26s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 3m17s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 13s
WAI conformance / independent verifiers · claims, JWP and key discovery (Python) (pull_request) Successful in 2m9s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 23s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 43s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 1m5s
wai formal verification (integer core) / kani (pull_request) Successful in 4m11s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 59s
WAI neural decoders end-to-end / synthetic fixtures → Rust decode → reference (±4) (pull_request) Successful in 1m6s
WAI neural sink gates / model-free refusals of the neural sink (pull_request) Successful in 45s
WAI section references / cited sections exist (pull_request) Successful in 10s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 3m43s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 1m31s
standards workspaces build + test / arl-rs (pull_request) Successful in 2m32s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 2m57s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 3m18s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 2m50s
standards workspaces build + test / sense-rs (pull_request) Successful in 3m6s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 4m22s
wai cross-architecture byte-equality / macos-arm64 (reference) (pull_request) Successful in 38s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 5m57s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 39s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 2m1s
2026-10-01 23:39:18 -04:00
Compare
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!136
No description provided.