mesh: say what the energy figure covers — the served span, not the request #385
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mesh-energy-span-scope"
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?
Mesh::serveroutes at step 1, authorises at step 2, and opens the meter session at step 3 — immediately beforeengine.serve. So a receipt's energy is the served span, and excludes routing and authorisation.Nothing said so.
grep -niE "routing (is|energy)|excludes? rout|before routing"overmesh/SPEC.mdandmesh-corefound nothing, and the field was documented only as "the honest, provenance-tagged energy span" — which span was never stated.Why the omission matters in this particular direction
The grant is debited this figure and admits further work on the strength of it. So a shortfall under-charges the ceiling — and under-reporting is the unsafe direction at a ceiling, the rule written into
jouleclaw/SPEC.md§1.3 and propagated across the meters in #354.For a table-driven router the gap is negligible. For a router that itself runs a model — a classifier or an LLM choosing the route — it is not, and a reader taking a mesh receipt's energy as the energy of handling the request would be wrong by exactly that inference.
What this changes
MeshReceipt::energyand the step-3 comment inmesh-coresay the same where someone reading the code will meet it.What it does not change — stated plainly
This states the limit; it does not remove it. Metering the routing span means moving the session boundary, which changes every receipt's figure and has conformance consequences. That is a scope decision rather than a doc fix, and the sweep item it comes from (2026-10-19 #17) carries it as a wedge, not a defect.
No test pins the ordering, and the spec now says so. The meter is snapshot-driven and routing takes no samples, so the boundary is an ordering invariant in the serving path rather than an observable property of a receipt.
Meshholdsrouter: Routerconcretely whilemeteris already&dyn Meter— putting the router behind a trait, as the engine already is, is what would let a test pin it. I would rather name that than imply coverage I did not add.A citation trap worth recording
mesh/SPEC.mdhas its own §5 ("The serving engine") and no §1.3. So a bare "JCP SPEC §5" would read as mesh's §5, and "jouleclaw SPEC §1.3" would dangle — andcheck-spec-refsscans only.rsfiles, so neither would have been caught. Both cross-standard references name their file instead. (This is the same trap that failed one of my earlier PRs when it was in a.rsfile, where the guard does look.)Verification
cargo check --workspace --all-targets --locked(mesh-rs) — 0 errorscargo test --workspace --locked— 22 test binaries green, 0 failurescargo clippy -p mesh-core -p mesh-receipt --all-targets --no-deps --locked -- -D warnings— exits 0, with 0 findings in a mesh file (the 44 it prints are all injouleclaw-backend-apple, a macOS-only Metal path dep that--no-depsdoes not suppress across workspaces; mesh is not in CI's clippy list at all)cargo doc --no-deps -p mesh-receipt— cleancheck-spec-refs— 1693 citations across 16 standards, all resolve;check-comparative-proseclean🤖 Generated with Claude Code