Skip to main content

Module task_evidence

Module task_evidence 

Source
Expand description

Task evidence (trace per change, contract §36): when this engine’s agent submits or verifies a Cloud task, the engine pins what it can prove about the work, so LeanCTX Cloud can join a landed change to its goal, the context its agent saw, and the rule that allowed it.

The task receipt (docs/contracts/task-receipt-v1.md) of the task’s sessions is built here, on this machine, and stays here. Cloud receives leanctx.cloud.task-evidence/v1: the receipt’s sha256 digest, its chain_broken flag, per session a keyed session_ref with chain heads and counts, and the distinct policy digests of its deliveries. The digest is over the exact bytes lean-ctx task receipt <n> --json --session … prints, so a person recomputes it with lean-ctx task trace <n> --json.

The sessions of a task are those the local work trace names (the session that claimed it and the one that submitted it, as the app’s LEAN_CTX_SESSION_ID), and the session of the calling process. The brief the app started a session with is known only as its digest (lean-ctx tasks update <n> --brief-digest sha256:…, kept locally).

The receipts switches gate it: [cloud] receipts_upload, the lease’s receipts.upload right, the workspace rule “Share instance metrics” and the release switch (crate::receipts). Queued only while receipts are queued and the enrolled Cloud announces change_trace; sent in the receipts run. When any of that is off nothing is queued or sent, and Cloud shows the gap no_receipt. Nothing here ever fails a task call.

Structs§

EvidenceRun
What one send pass did.
LocalTrace
What this machine knows of task number of the checkout at root, for lean-ctx task trace (local only, nothing is sent).

Constants§

FEATURE_CHANGE_TRACE
The features entry of a Cloud that takes task evidence.

Functions§

brief_of
The brief digest recorded for task number of vault_id.
local_trace
LocalTrace of task number in the checkout at root.
note_task_closed
Note that task number of vault_id was submitted or verified by this engine’s agent: queue its evidence when receipts are queued and the enrolled Cloud takes it. Silent and best effort.
receipt_digest
sha256: and the hex digest of the receipt as printed: its text and the final newline (lean-ctx task receipt … --json | sha256sum).
receipt_text
The receipt text of task over sessions, from the installed builder.
record_brief
Record the digest of the brief the app started task number’s session with. Local only: it leaves with the task’s evidence.
record_brief_at
record_brief for task number of the vault of the checkout at root (lean-ctx tasks update <n> --brief-digest sha256:…).
sessions_of
The session ids of a task in order, once: the claiming session, the submitting session, then current (the calling process’s), each as the app names it. At most MAX_EVIDENCE_SESSIONS.
set_receipt_source
Install the receipt builder (the CLI crate owns it). Without one, no evidence is queued.

Type Aliases§

ReceiptSource
Builds the task.receipt document text of a task over its sessions, as lean-ctx task receipt <task> --json --session … prints it (without the final newline); None when no receipt can be built now.