Skip to main content

Module receipts

Module receipts 

Source
Expand description

POST /v1/receipts (receipts v2, C0 2.5 K2 M3): the Engine receipts of this machine’s Cloud vaults.

The tool path only notes a receipt: note_engine_receipt checks one marker file and, when uploads are on, turns the local v1 receipt into a closed leanctx.instance-receipt/v2 document and queues it in the durable outbox. No lease, network or config work happens in a tool call. The scheduler keeps the marker in step with what allows receipts — the release switch, [cloud] receipts_upload, the lease’s receipts.upload right (Enterprise), the workspace’s org_settings.receipts_upload and no upload_disabled answer under the current lease — and sends the queue in signed batches (leanctx.cloud.receipts/v2, instance key).

What leaves the engine (aggregates and opaque values only):

  • input and output digests as HMAC-SHA256 under an engine-local key (receipts.hmac-key, created here, never uploaded): Cloud cannot test a guess against them, the engine can re-derive them from its receipt;
  • the invocation and receipt ids as HMAC-derived hex, never the local id;
  • source references as a count; failure recovery references dropped;
  • the session the app names (LEAN_CTX_SESSION_ID, V9) only as an HMAC under the same key (session_ref), never the id; absent outside a session and while the enrolled Cloud does not announce session_ref (crate::session_ref);
  • measurements with a contract name and unit only;
  • no policy reference: the Cloud policy digest is not bound to a local invocation, so policy_digest is null.

The checkout path stays on this machine: it only selects the Cloud vault, and a receipt of a checkout Cloud does not know is dropped.

Enums§

ReceiptsRun
What a receipts run did.

Functions§

note_engine_receipt
Queue an Engine receipt for Cloud, if receipt uploads are on. Cheap and silent: a failure here never fails the Engine call that produced it.
run
Bring the marker in step with the gates and send what is queued.
status
Why receipts are not sent now, for cloud status (local only).