Syntropy.Receipts.Receipt (syntropy v0.3.0)

Copy Markdown

Builders for rc-* receipt records.

A receipt is the deterministic record of one executed (or deliberately skipped) project check inside a code-review run: which tool ran with which argv, against which diff (diff_sha), how it exited, and a digest of its full output. Receipts are plain maps with a fixed key set so they embed directly in run envelopes and survive JSON round-trips.

Status semantics:

  • "passed" — the check exited 0
  • "failed" — the check exited non-zero (the finding, not a fault)
  • "timeout" — the check exceeded its time budget and was killed
  • "error" — the check could not be executed or died on a signal
  • "skipped" — the check was not run (tool missing); the reason says why

Summary

Functions

Builds a receipt for an executed check from the execution outcome.

Builds a receipt for a check that was not executed.

Statuses a receipt can carry.

Types

t()

@type t() :: %{
  id: String.t(),
  tool: String.t(),
  tool_version: String.t() | nil,
  argv: [String.t()],
  kind: String.t(),
  diff_sha: String.t() | nil,
  status: String.t(),
  exit_code: integer() | nil,
  duration_ms: non_neg_integer() | nil,
  summary: String.t(),
  output_digest: String.t() | nil,
  output_tail: String.t() | nil,
  reason: String.t() | nil
}

Functions

executed(index, check, outcome)

@spec executed(non_neg_integer(), map(), map()) :: t()

Builds a receipt for an executed check from the execution outcome.

Derives status from the outcome (:timed_out, signal deaths as reported by exit codes above 128, otherwise the exit code) and a one-line summary.

skipped(index, check, reason)

@spec skipped(non_neg_integer(), map(), String.t()) :: t()

Builds a receipt for a check that was not executed.

statuses()

@spec statuses() :: [String.t()]

Statuses a receipt can carry.