jouleclaw-energy: advance the scripted RAPL tree in step with the probe #228

Merged
dcharlot merged 1 commit from fix/rapl-probe-test-in-step into main 2026-10-13 01:02:51 -04:00
Owner

What

rapl::tests::the_production_probe_needs_every_package_to_keep_advancing failed on loaded hosts. It drove a fake two-socket tree from a writer thread on a 2 ms timer and expected the production probe to call the tree live inside one budget. When the host starves the writer, the samples stop changing and the probe correctly judges the scripted tree frozen. The test was failing on load, not on behaviour.

Change

  • liveness::probe_stepping: the production probe with a closure run at the start of every tick, ahead of the burn. probe calls it with an empty closure, so the shipped path is unchanged.
  • rapl::probe_packages_stepping: the same for the package probe.
  • The test advances the tree in that closure. Each interval the probe samples holds one advance however threads are scheduled, and there is no second thread.
  • The timing assertions now state only what a loaded host leaves certain: a live verdict comes no sooner than the rule's window and inside the probe's own cap; a frozen verdict takes at least one budget.

Verification

On the Linux x86_64 host, cargo test -p jouleclaw-energy --features rapl,nvml --lib:

  • idle: all lib tests pass;
  • under 40 busy loops: the RAPL tests pass on every one of 25 repeats.

The module is Linux-only and feature-gated, so a macOS run or a run without --features rapl compiles none of these tests.

🤖 Generated with Claude Code

## What `rapl::tests::the_production_probe_needs_every_package_to_keep_advancing` failed on loaded hosts. It drove a fake two-socket tree from a writer thread on a 2 ms timer and expected the production probe to call the tree live inside one budget. When the host starves the writer, the samples stop changing and the probe correctly judges the scripted tree frozen. The test was failing on load, not on behaviour. ## Change - `liveness::probe_stepping`: the production probe with a closure run at the start of every tick, ahead of the burn. `probe` calls it with an empty closure, so the shipped path is unchanged. - `rapl::probe_packages_stepping`: the same for the package probe. - The test advances the tree in that closure. Each interval the probe samples holds one advance however threads are scheduled, and there is no second thread. - The timing assertions now state only what a loaded host leaves certain: a live verdict comes no sooner than the rule's window and inside the probe's own cap; a frozen verdict takes at least one budget. ## Verification On the Linux x86_64 host, `cargo test -p jouleclaw-energy --features rapl,nvml --lib`: - idle: all lib tests pass; - under 40 busy loops: the RAPL tests pass on every one of 25 repeats. The module is Linux-only and feature-gated, so a macOS run or a run without `--features rapl` compiles none of these tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jouleclaw-energy: advance the scripted RAPL tree in step with the probe
All checks were successful
energy meters on real hardware / RAPL and NVML on jetson-hub (pull_request) Successful in 40s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 3m12s
standards workspaces build + test / aac-rs (pull_request) Successful in 2m57s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m23s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 55s
standards workspaces build + test / map-rs (pull_request) Successful in 56s
standards workspaces build + test / mesh-rs (pull_request) Successful in 53s
standards workspaces build + test / openpay (pull_request) Successful in 2m39s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 43s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 4m4s
jouleclaw public surface must stay documented / Public-surface audit (jouleclaw-rs) (pull_request) Successful in 1m8s
standards workspaces build + test / arl-rs (pull_request) Successful in 1m18s
standards workspaces build + test / eoc-rs (pull_request) Successful in 2m3s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m38s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 1m12s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 1m13s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m19s
standards workspaces build + test / sense-rs (pull_request) Successful in 1m19s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m25s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 4m3s
d944ff67b4
`the_production_probe_needs_every_package_to_keep_advancing` drove a fake
two-socket tree from a writer thread on a 2 ms timer and expected the
production probe to call it live inside one budget. On a loaded host the
writer is starved, the samples stop changing, and the probe rightly judges
the scripted tree frozen, so the test failed on load rather than on
behaviour.

The probe now has a `probe_stepping` form that runs a closure at the start
of every tick, ahead of the burn. The real probe passes nothing. The test
advances the tree there, so each interval the probe samples holds one
advance however threads are scheduled, and no second thread exists.

The timing claim is also restated as what a loaded host leaves certain: a
live verdict comes no sooner than the rule's window and inside the probe's
own cap, and a frozen verdict takes at least one budget.

Verified on the Linux x86_64 host with `--features rapl,nvml`: the lib
tests pass idle, and the RAPL tests pass on every one of 25 repeats under
40 busy loops.

Co-Authored-By: Claude Opus 5.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!228
No description provided.