efficiency/1: a partial energy figure is sealed as partial and never headlines as a task total #369
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/efficiency-keeps-coverage"
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?
What was open
An
efficiency/1receipt sealedenergy_ujandprovenance, and no coverage. A GPU-only reading, a hardware counter that sees the accelerator but not the CPU work driving it, reached a verifier as the whole unit's energy. The receipt also sealed auj_per_accepted_tokenover that reading, which presented it as what the work cost per token.jcp SPEC §5.2 already said a
Partialfigure MUST NOT be presented as a task total, and named the receipts that carry coverage. efficiency/1 was not among them.aggregate()summed energy across receipts with no coverage and no provenance, so the per-unit figure it produced looked as clean as one built from whole figures. §5.3 says aggregation takes the floor of both, and that aggregating must never improve a grade.What this changes
Coverage is sealed.
energy_coverage: "Partial"for a partial figure and omits it for a whole one.A partial receipt has no headline.
uj_per_accepted_token.The reader refuses non-conformant receipts.
read_payloadis split out ofverifyso that its rules can be replayed without a signature. It refuses:energy_coveragevalue other than"Partial", including"Whole"(an absent field means Whole);Totals take the floor.
Totalscarriesprovenance_floorandcoverage.SPEC §5.2 lists efficiency/1 with these rules.
Conformance pack.
conformance/v1/efficiency.json, emitted bygen_efficiency_vectors, holds:tests/efficiency_pack.rsreplays the pack from disk, as the energy-trace pack test does.Who sees it
uj_per_accepted_tokenoruj_per_completed_unitnow getsNonefor partial figures. The types are unchanged.Verification (build host)
Tests.
cargo test -p jcp-efficiencypasses: 57 lib tests (3 new) and the 4 pack replays.Mutations. All 9 mutations of the new rules are killed:
"Whole"accepted;The pack replay alone also catches the headline, coverage-floor and provenance-floor mutations.
Wider checks. The full jcp-rs workspace, the jcp conformance suite and the jouledesk workspace pass. jcp-efficiency is clippy-clean.
Repo checks. tests-in-ci, spec-refs, orphan-sources, vanity-metrics and comparative-prose pass.
Not in this PR
Sweep item #3's other half, a declared uncertainty on
jcp-schemaenergy figures (WAI's on-chip-counter versus calibrated-instrument split), is a schema change of its own.🤖 Generated with Claude Code
`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]>