jcp-gateway, joule-ui-serve: name the plaintext figure cost_uj #128

Merged
dcharlot merged 1 commit from energy/cost-keys-named-for-what-they-carry into main 2026-10-01 06:22:25 -04:00
Owner

Stacked on #121 (sandbox per-process energy, which itself sits on #114). Retarget to main once those merge.

Two plaintext keys named measured_uj carried a call's cost. That cost is the meter's estimate wherever no live counter read the span:

  • jcp-gateway's _meta["science.transaction/jcp"] on an allowed tools/call;
  • joule-ui-serve's POST /action response.

#114 put the grade beside each key, but the key name still said "measured". This PR renames them. Nothing outside these crates reads either key: no spec, conformance vector or site defines them.

  • jcp-gateway: _meta.cost_uj is the key its sealed receipt already uses for the same figure. It sits beside energy_provenance, and beside energy_coverage when partial. Relayed::Allowed { cost_uj, .. } is renamed to match.
  • joule-ui-serve: the response carries cost_uj and energy_provenance, and the page scripts in joule-ui-render and the serve binary read those.
  • Unchanged: the energy record's own measured_uj, which is present only for a hardware reading. That includes the signed joule-ui conformance vectors, sandbox-mcp's device rows and joule-code's in-toto predicate. Those keys mean what they say.

Verified: cargo test -p jcp-gateway (13) and cargo test --workspace in joule-ui-rs (72) pass. The tests now assert that measured_uj is absent from both plaintext shapes.

🤖 Generated with Claude Code

Stacked on #121 (sandbox per-process energy, which itself sits on #114). Retarget to `main` once those merge. Two plaintext keys named `measured_uj` carried a call's **cost**. That cost is the meter's estimate wherever no live counter read the span: - jcp-gateway's `_meta["science.transaction/jcp"]` on an allowed `tools/call`; - joule-ui-serve's `POST /action` response. #114 put the grade beside each key, but the key name still said "measured". This PR renames them. Nothing outside these crates reads either key: no spec, conformance vector or site defines them. - **jcp-gateway:** `_meta.cost_uj` is the key its sealed receipt already uses for the same figure. It sits beside `energy_provenance`, and beside `energy_coverage` when partial. `Relayed::Allowed { cost_uj, .. }` is renamed to match. - **joule-ui-serve:** the response carries `cost_uj` and `energy_provenance`, and the page scripts in `joule-ui-render` and the serve binary read those. - **Unchanged:** the energy record's own `measured_uj`, which is present only for a hardware reading. That includes the signed joule-ui conformance vectors, sandbox-mcp's device rows and joule-code's in-toto predicate. Those keys mean what they say. **Verified:** `cargo test -p jcp-gateway` (13) and `cargo test --workspace` in joule-ui-rs (72) pass. The tests now assert that `measured_uj` is absent from both plaintext shapes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jcp-gateway, joule-ui-serve: name the plaintext figure cost_uj
All checks were successful
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 1m53s
standards workspaces build + test / aac-rs (pull_request) Successful in 36s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 39s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 33s
standards workspaces build + test / map-rs (pull_request) Successful in 32s
standards workspaces build + test / mesh-rs (pull_request) Successful in 26s
standards workspaces build + test / openpay (pull_request) Successful in 1m29s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m48s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m18s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m12s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m11s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 2m37s
standards workspaces build + test / arl-rs (pull_request) Successful in 2m5s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 4m22s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 2m36s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 2m37s
standards workspaces build + test / sense-rs (pull_request) Successful in 2m34s
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Successful in 3m55s
4952e8ac34
Two plaintext keys called `measured_uj` carried the call's cost, which is
the meter's estimate wherever no live counter read the span:
- jcp-gateway's `_meta` block on an allowed tools/call;
- joule-ui-serve's /action response.
Their grade already rode beside them, but the name still said
"measured". Nothing outside these crates reads either key: no spec,
vector or site defines them.

- jcp-gateway: `_meta.cost_uj`, the key its sealed receipt already uses
  for the same figure, beside `energy_provenance` and, when partial,
  `energy_coverage`. `Relayed::Allowed { cost_uj }` follows.
- joule-ui-serve: `cost_uj` and `energy_provenance`, and the page
  scripts in joule-ui-render and the serve binary read those.

The energy record's own `measured_uj`, present only for a hardware
reading, is unchanged everywhere, signed vectors included. Tests assert
the old key is gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcharlot changed target branch from sandbox-meter/process-energy to main 2026-10-01 06:21:24 -04:00
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!128
No description provided.