jcp-gateway, joule-ui-serve: name the plaintext figure cost_uj #128
Loading…
Reference in a new issue
No description provided.
Delete branch "energy/cost-keys-named-for-what-they-carry"
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?
Stacked on #121 (sandbox per-process energy, which itself sits on #114). Retarget to
mainonce those merge.Two plaintext keys named
measured_ujcarried a call's cost. That cost is the meter's estimate wherever no live counter read the span:_meta["science.transaction/jcp"]on an allowedtools/call;POST /actionresponse.#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.
_meta.cost_ujis the key its sealed receipt already uses for the same figure. It sits besideenergy_provenance, and besideenergy_coveragewhen partial.Relayed::Allowed { cost_uj, .. }is renamed to match.cost_ujandenergy_provenance, and the page scripts injoule-ui-renderand the serve binary read those.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) andcargo test --workspacein joule-ui-rs (72) pass. The tests now assert thatmeasured_ujis absent from both plaintext shapes.🤖 Generated with Claude Code
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]>