A proof document summarizes evidence snapshots and the claims they support.
Use proof_document/2 to work with the JSON-ready map,
to_json_iodata/2 to encode it, and render_json/1 or render_human/1 to
print it from a command-line task.
Summary
Types
A proof category string: direct_fact, posture_snapshot, or unsupported_claim.
A proof status string: proven, inferred_posture, or unsupported.
An evidence row supplied to a proof projection.
A row formatted for the evidence viewer.
A JSON-ready proof document with guaranteed keys format_version, generated_at, proof_type, subject, mode, filters, summary, claim_assessment, and records; new JSON keys may be added.
A filter accepted by a proof read.
A supported proof read mode.
An option accepted by proof document reads.
A keyword list selecting the evidence included in a proof document.
A key accepted in a proof request. Unrecognized keys are ignored.
Functions
Builds a JSON-ready proof document from matching evidence snapshots and their claim assessment.
Prints a JSON-ready proof document in human-readable form through the Mix shell and returns :ok.
Prints a JSON-ready proof document to standard output and returns :ok.
Encodes matching evidence snapshots and their claim assessment as {:ok, iodata}.
Types
@type claim_kind() :: String.t()
A proof category string: direct_fact, posture_snapshot, or unsupported_claim.
@type claim_status() :: String.t()
A proof status string: proven, inferred_posture, or unsupported.
@type evidence_record_input() :: Threadline.Governance.EvidenceRecord.t() | Threadline.json_map()
An evidence row supplied to a proof projection.
@type presented_record() :: %{ subject: Threadline.json_value(), subject_ref: Threadline.json_value(), summary_status: Threadline.json_value(), recorded_at: String.t() | nil, verdict_status: claim_status(), verdict_kind: claim_kind(), verdict_reason: Threadline.json_value() }
A row formatted for the evidence viewer.
@type proof_document() :: Threadline.json_map()
A JSON-ready proof document with guaranteed keys format_version, generated_at, proof_type, subject, mode, filters, summary, claim_assessment, and records; new JSON keys may be added.
@type proof_filter() :: {:from, DateTime.t()} | {:to, DateTime.t()} | {:limit, pos_integer()}
A filter accepted by a proof read.
@type proof_mode() :: :latest | :history
A supported proof read mode.
@type proof_opt() :: Threadline.repo_opt() | {:generated_at, DateTime.t()}
An option accepted by proof document reads.
@type proof_request() :: [proof_request_opt()]
A keyword list selecting the evidence included in a proof document.
@type proof_request_opt() :: {:subject, Threadline.Evidence.Subject.subject_descriptor() | nil} | {:subject_ref, Threadline.Evidence.subject_ref() | nil} | {:mode, :latest | :history} | {:from, DateTime.t()} | {:to, DateTime.t()} | {:limit, pos_integer()}
A key accepted in a proof request. Unrecognized keys are ignored.
Functions
@spec proof_document(proof_request(), [proof_opt()]) :: proof_document()
Builds a JSON-ready proof document from matching evidence snapshots and their claim assessment.
Use to_json_iodata/2 when the encoded JSON is the desired output. The
request selects an overview or one subject, a latest or history read, and
optional date bounds and limit. Unrecognized request keys are ignored.
Request
:subject— supported subject name or descriptor. Optional; omission selects the overview.:subject_ref— subject reference map. Optional.:mode—:latestor:history. Optional; defaults to:latest.:from—DateTime. Optional; inclusive lower bound on the record time.:to—DateTime. Optional; inclusive upper bound on the record time.:limit— positive integer. Optional; caps the matching records.
Options
:repo— Ecto repository module. Required.:generated_at—DateTime. Optional; defaults to the current UTC time.
Returns
Returns a string-keyed JSON map containing the format version, generation
time, selected subject and mode, filters, record counts, claim assessment,
and matching records. Raises KeyError when :repo is omitted and
ArgumentError for an unsupported subject, invalid subject reference, or
invalid Evidence filter.
@spec render_human(proof_document()) :: :ok
Prints a JSON-ready proof document in human-readable form through the Mix shell and returns :ok.
@spec render_json(proof_document()) :: :ok
Prints a JSON-ready proof document to standard output and returns :ok.
@spec to_json_iodata(proof_request(), [proof_opt()]) :: {:ok, iodata()}
Encodes matching evidence snapshots and their claim assessment as {:ok, iodata}.
Use proof_document/2 when the JSON-ready map is needed instead of encoded
output. The request and options have the same meaning as that function;
unrecognized request keys are ignored.
Request
:subject— supported subject name or descriptor. Optional; omission selects the overview.:subject_ref— subject reference map. Optional.:mode—:latestor:history. Optional; defaults to:latest.:from—DateTime. Optional; inclusive lower bound on the record time.:to—DateTime. Optional; inclusive upper bound on the record time.:limit— positive integer. Optional; caps the matching records.
Options
:repo— Ecto repository module. Required.:generated_at—DateTime. Optional; defaults to the current UTC time.
Returns
Returns {:ok, iodata()} containing the encoded proof document. Raises
KeyError when :repo is omitted and ArgumentError for an unsupported
subject, invalid subject reference, or invalid Evidence filter.