open-standards/.github
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science ba523f293b jcp-gateway: test tree-metered calls against an oracle on real servers
tests/upstream_tree.rs relays tools/call through Gateway::relay to real
MCP-ish servers it spawns: awk answering each JSON-RPC line itself, and a
shell answering each with an awk worker it forks and reaps before it
replies. The oracle shares no code with the meter or the gateway: the
server's proc_pid_rusage into a raw buffer at the SDK's offsets (energy at
336, reaped-descendant time at 96 and 104), read before and after each
relay once the server is quiet by pti_numrunning at byte 88 of a raw
PROC_PIDTASKINFO buffer. A server blocked on its next request does not
move its count, so each call's figure must be the oracle's advance rounded
down to the µJ, and it was: 99 of 99 readings over 9 runs at load ~150.

A declared single-process server is sealed HwShunt and whole; the same
server undeclared is HwShunt/Partial with not-declared-self-contained; the
reaping shell is HwShunt/Partial with reaped-descendant even when
declared, its figure the shell's own advance; an upstream naming a pid
this process may not read (launchd) is metered machine-wide. Each call's
plaintext grade equals its sealed one, and each receipt log verifies.

The jcp-rs matrix entry runs on Linux, where no tree meter exists, so the
macos-energy-backend job gains a jcp-gateway step that fails unless the
test printed its `upstream tree:` line. libc is a dev-dependency for the
oracle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 10:49:24 -04:00
..
workflows jcp-gateway: test tree-metered calls against an oracle on real servers 2026-10-09 10:49:24 -04:00