open-standards/jcp/conformance/v1/efficiency.json
Transaction Science 9b57b96816
All checks were successful
repository checks / lockfiles, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 55s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 17s
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 1m12s
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 3m18s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 4m14s
standards workspaces build + test / jcp-rs (jcp-conformance, jcp/jcp-rs, -p jcp-energy --features nvml, jcp-rs, linux) (pull_request) Successful in 1m37s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 7m41s
standards workspaces build + test / joulehook-rs (joulehook/joulehook-rs, joulehook-rs, linux) (pull_request) Successful in 1m10s
standards workspaces build + test / jouledesk-rs (jouledesk/jouledesk-rs, jouledesk-rs, macos) (pull_request) Successful in 2m50s
standards workspaces build + test / sandbox-rs (sandbox-conformance, sandbox/sandbox-rs, sandbox-rs, linux) (pull_request) Successful in 2m16s
standards workspaces build + test / joule-ui-rs (joule-ui/joule-ui-rs, joule-ui-rs, linux) (pull_request) Successful in 8m12s
efficiency/1: a partial energy figure is sealed as partial and never headlines as a task total
`Efficiency::wire()` sealed `energy_uj` and `provenance` and nothing about
coverage. So a GPU-only reading (a hardware counter that reads the
accelerator and not the CPU work that drove it) reached a verifier as the
whole unit's energy. The receipt also sealed a `uj_per_accepted_token` over
that reading, which presented it as what the work cost per token. jcp SPEC
§5.2 already said a `Partial` figure MUST NOT be presented as a task total,
and listed the receipts that carry coverage. efficiency/1 was not among them.

`aggregate()` then summed energy across receipts with no coverage and no
provenance, and its per-unit figure came out as clean as a whole one. §5.3
says aggregation takes the floor of both and is never a step at which a
grade improves.

Now:
- The receipt carries `energy_coverage: "Partial"` when the figure is
  partial, and omits it when the figure is whole. A whole receipt, and every
  receipt sealed before the field existed, keeps its bytes.
- A partial receipt seals no `uj_per_accepted_token`. A partial figure
  divided by tokens is not what the work cost per token, nor a bound on it,
  since a partial figure can fall short of the work or exceed it.
- `read_payload`, split out of `verify` so the payload rules can be replayed
  without a signature, refuses:
  - a partial receipt carrying the headline;
  - any `energy_coverage` but "Partial" ("Whole" included; absence is Whole);
  - a provenance label that is not one of the three.
- `Totals` carries `provenance_floor` and `coverage`. A total over any partial
  receipt is partial, gives no per-unit energy, and reports value per joule
  as its worst value (0.0).

SPEC §5.2 now lists efficiency/1 with these rules. A published pack,
`conformance/v1/efficiency.json` (from `gen_efficiency_vectors`), carries the
readings and refusals and the totals sets must sum to. `tests/efficiency_pack.rs`
replays it from disk.

Tests: 3 new unit tests and 4 pack replays. All 9 mutations of the new rules
are killed. The pack alone catches the headline, coverage-floor and
provenance-floor mutations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 13:58:36 -04:00

228 lines
7.3 KiB
JSON

{
"aggregate": {
"cases": [
{
"expected": {
"completed_uj": 1600000,
"coverage": "Partial",
"provenance_floor": "Estimator",
"tokens_per_completed_unit": 3000,
"uj_per_completed_unit": null,
"wasted_uj": 400000
},
"input": [
{
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_uj": 1000000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "whole",
"tokens_in": 2000,
"tokens_out": 500,
"uj_per_accepted_token": 2000,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
{
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_coverage": "Partial",
"energy_uj": 600000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "gpu-only",
"tokens_in": 2000,
"tokens_out": 500,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
{
"completed": 0,
"efficiency_receipt": "efficiency/1",
"energy_uj": 400000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "Estimator",
"seq": 0,
"steward": "did:example:steward",
"task": "estimated",
"tokens_in": 800,
"tokens_out": 200,
"uj_per_accepted_token": 2000,
"verdict": "gate-failed",
"wall_ns": 1000000000
}
],
"note": "a total over a partial figure is partial and gives no per-unit energy; its provenance is the floor"
},
{
"expected": {
"completed_uj": 1000000,
"coverage": "Whole",
"provenance_floor": "Estimator",
"tokens_per_completed_unit": 3500,
"uj_per_completed_unit": 1400000,
"wasted_uj": 400000
},
"input": [
{
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_uj": 1000000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "whole",
"tokens_in": 2000,
"tokens_out": 500,
"uj_per_accepted_token": 2000,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
{
"completed": 0,
"efficiency_receipt": "efficiency/1",
"energy_uj": 400000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "Estimator",
"seq": 0,
"steward": "did:example:steward",
"task": "estimated",
"tokens_in": 800,
"tokens_out": 200,
"uj_per_accepted_token": 2000,
"verdict": "gate-failed",
"wall_ns": 1000000000
}
],
"note": "a total over whole figures gives its per-unit energy, at the weakest provenance"
}
]
},
"payload": {
"negative": [
{
"expected": {
"refused": "presented as a task total"
},
"input": {
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_coverage": "Partial",
"energy_uj": 600000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "gpu-only",
"tokens_in": 2000,
"tokens_out": 500,
"uj_per_accepted_token": 1200,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
"note": "a GPU-only figure presented as a task total, with a per-token headline"
},
{
"expected": {
"refused": "energy_coverage"
},
"input": {
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_coverage": "Whole",
"energy_uj": 1000000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "whole",
"tokens_in": 2000,
"tokens_out": 500,
"uj_per_accepted_token": 2000,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
"note": "an absent coverage is Whole; \"Whole\" on the wire is refused"
},
{
"expected": {
"refused": "not a provenance label"
},
"input": {
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_uj": 1000000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "Measured",
"seq": 0,
"steward": "did:example:steward",
"task": "whole",
"tokens_in": 2000,
"tokens_out": 500,
"uj_per_accepted_token": 2000,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
"note": "a provenance that is not one of the three labels"
}
],
"positive": [
{
"expected": {
"energy_coverage": "Whole",
"energy_uj": 1000000,
"provenance": "HwShunt",
"uj_per_accepted_token": 2000
},
"input": {
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_uj": 1000000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "whole",
"tokens_in": 2000,
"tokens_out": 500,
"uj_per_accepted_token": 2000,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
"note": "a whole figure seals its per-token headline and no coverage field"
},
{
"expected": {
"energy_coverage": "Partial",
"energy_uj": 600000,
"provenance": "HwShunt",
"uj_per_accepted_token": null
},
"input": {
"completed": 1,
"efficiency_receipt": "efficiency/1",
"energy_coverage": "Partial",
"energy_uj": 600000,
"prev": "0000000000000000000000000000000000000000000000000000000000000000",
"provenance": "HwShunt",
"seq": 0,
"steward": "did:example:steward",
"task": "gpu-only",
"tokens_in": 2000,
"tokens_out": 500,
"verdict": "tests-pass",
"wall_ns": 1000000000
},
"note": "a GPU-only figure seals its coverage and no per-token headline: it is no task total"
}
]
},
"profile": "efficiency/1",
"spec": "jcp/SPEC.md §5.2-5.3"
}