# Synthetic machine commitments: local conformance supplement

This executable supplement tests a small machine-service commitment: an agent
reserves synthetic accounting units and one supplier slot, the supplier runs a
real local SHA-256 job, and a signed receipt settles that commitment once.
It is separate from frozen Meridian REB v0c. No frozen source, criterion, test,
result or hash is modified or rerun.

Both controllers match the listed expected outcomes. The ordinary central
reservation reference is deliberately strong: it checks authentication,
delegation, budgets, holds, idempotency, revocation, expiry and local admission in
one synchronous transaction. No safety, economic, revocation, latency or
performance advantage over that baseline is demonstrated.

## Run locally

Use Node.js 20 or later, with built-in modules only. From the existing site root:

```sh
node research/meridian/demos/machine-commitments/run.mjs
node --test research/meridian/demos/machine-commitments/conformance.test.mjs
node research/meridian/demos/machine-commitments/run.mjs --json
```

These commands make no network requests, invoke no external models or paid APIs,
install no dependencies and perform no deployment. The runner prints to stdout
and does not write files. `results.json` is a saved successful run. Its semantic
hash excludes wall-clock time because no wall-clock value is recorded. Running
the same fixtures should reproduce that hash. Test execution and negative
controls run additional local computations; their jobs are not included in the
successful-fixture job count. The four controls verify three additional actual
jobs, for seventeen verified computations in one complete runner invocation.
The focused test suite has fifteen tests and runs its own additional local jobs.

## What is exercised

The nine categories contain sixteen deterministic variants:

| Category | Acceptance checks |
| --- | --- |
| Delivery | A real worker digest is checked independently; a false receipt is refused. |
| Authority | Signed identities, holder, resource, action, per-call bounds, safe integers, strict delegation and root ownership. |
| Joint budget | Both 60-first and 50-first orders respect a shared budget of 100. |
| Joint capacity | Three individually valid holds cannot jointly occupy two slots. |
| Idempotency | The whole semantic request is bound to actor and key; retry causes one reserve, start and settle. |
| Release/settle | Both terminal orderings are safe; released work cannot start or settle. |
| Revocation | Immediate and delayed external delivery; descendants revoke together; accepted holds remain payable. |
| Expiry | Grant and hold deadlines differ; exact-boundary starts refuse; running liability persists. |
| Local refusal | Supplier quota can refuse valid remote holds; reductions cannot preempt running work. |

There are fourteen actual worker computations across successful fixtures. There
is one shared service plane, whose independently verified receipts are supplied
to both reducers on identical signed events. This is fourteen actual jobs total,
not fourteen executions per controller. Two real worker threads are used; the
demo does not measure physical overlap, occupancy, throughput or duration.

Four isolated fault controls must fail independently recomputed invariants:
skipped aggregate budget checks (60 + 50 > 100), duplicate settlement accounting,
expiry that drops a running liability, and starting work beyond local quota.
The budget fault bypasses accounting checks; it is not an implemented or measured
concurrent stale-read race. All controls use the same signed event fixtures as
the unchanged central reference. Fault switches exist only on the demonstration
reducer and are never enabled in successful fixtures.

## Policy and trust boundary

Fixtures initialize a trusted root grant with budget 100, per-call ceiling 60,
global capacity two and local quota two. Accounting units are synthetic: no money
is transferred, provider purchase is made, customer demand is demonstrated or
service integration is claimed. All identities use explicitly public,
deterministic Ed25519 test keys. They are not credentials.

`apply(event)` is synchronous and includes validation, admission and state change
in one serial in-memory authority. The scheduler supplies nondecreasing logical
ticks. Signing a tick does not establish a secure clock. There are no crashes,
partitions, persistence, external replay stores, hostile issuers, hardware
attestation or distributed consensus in this model. Initial root grants are
trusted fixture configuration, not a production issuer-chain implementation.

A reserve immediately holds both budget and capacity. Budget usage is settled
units plus all HELD and RUNNING units. Capacity usage is HELD plus RUNNING slots.
Every ancestor grant constrains descendant commitments. Delegation must strictly
narrow at least one action, amount or validity bound and widen none.

Owner withdrawal issuance and authority observation are separate events. The
external delivery schedule is identical for both controllers. An ordinary
central authority can observe a delivered withdrawal immediately; the immediate
variant demonstrates that new holds are blocked at once. Delayed observation is
an input assumption, not an inherent limitation of central control. Existing
holds survive observed revocation, so completing them later is expected liability
settlement. Neither controller promises withdrawal cancels already accepted work.

Grant expiry stops new reservations; a surviving hold can start later if its own
`startBy` deadline permits. Unstarted hold expiry releases its units and slot.
Running work remains liable after hold expiry until settlement. Release is
permitted only while HELD. The supplier's local quota is checked in the ledger
and again immediately before actual worker dispatch. Lowering it beneath current
RUNNING commitments is refused. This is local admission control, not an emergency
stop or preemption demonstration.

Signatures authenticate actor and request bytes. They do not prove physical
execution. The harness observes actual local worker computations and independently
checks their SHA-256 bytes; the supplier and execution host remain trusted. A
precomputed correct digest without RUNNING state is included as a refused test
input. Official x402 or other protocol conformance is not claimed.

## Implementation and reproducibility

`reference-ledger.mjs` was implemented independently without opening the
demonstration reducer. `mandate-ledger.mjs` implements the other policy reducer.
They share only generic cryptographic helpers, fixture configuration and the
event/snapshot contract; neither reducer calls the other. The saved results
include hashes of these source files and fixtures, plus the actual signed failing
step and both controllers' before/after snapshots for each negative control.

`authority.mjs` signs canonical requests and verifies public fixture keys.
Idempotency hashes exclude only signature, logical tick and trace event ID;
actor, operation, limits, payload, reservation identity and other semantic fields
remain bound. Signature and safe clock/key validation precede replay lookup.
Matching signed denied retries preserve their original refusal. A replayed
STARTED response cannot dispatch a worker again.

`service-worker.mjs` supplies the real local jobs. Lanes remain committed until
settlement even when computation finishes earlier. `checks.mjs` independently
reconstructs snapshot accounting, bounds, ancestry and legal lifecycle changes.
`run.mjs` compares result codes, replay markers and every snapshot, then records
signed events, receipt evidence and deterministic hashes. `conformance.test.mjs`
adds tampering, swapped receipt, unsafe clock, denied-retry, worker veto and
reproducibility checks.

Matching outcomes apply to the explicitly listed signed traces and extra tested
probes. They are not a proof of equivalence for every possible input sequence.
Out-of-fixture malformed requests can have different refusal-code precedence
without affecting the tested invariant results. No new REB research campaign or
field validation is implied.
