Syntropy.Receipts (syntropy v0.3.0)

Copy Markdown

The receipts runner: executes a repository's own checks against a review diff and records rc-* receipts in the run envelope.

This is the deterministic layer of a code review — the runtime runs the project's tools; no model is involved. Given a code_review request (repo_path, base, head, optional checks allowlist), the runner:

  1. resolves the refs and computes the diff_sha binding (Syntropy.Receipts.Git),
  2. detects the project's checks or loads .syntropy/review.toml (Syntropy.Receipts.Detect),
  3. executes available checks sequentially as supervised OS processes (Syntropy.Receipts.Execution) — deterministic order, no resource contention between suites, simple cancellation — and
  4. emits a receipt_recorded event per check and returns the receipts plus the resolved code_review block for the envelope.

Checks whose tools are missing produce skipped receipts rather than disappearing; a run whose per-check budgets are exhausted marks the remaining checks skipped. Cancellation goes through Syntropy.Receipts.Tracker — see abort/1.

Summary

Functions

Aborts the running checks of run_id (tombstone + kill; see the tracker). Safe to call for runs without receipts — it is a no-op then.

Clears cancellation state for run_id once its runner task is fully down.

Executes the receipts pipeline for run_id.

Functions

abort(run_id)

@spec abort(String.t()) :: :ok

Aborts the running checks of run_id (tombstone + kill; see the tracker). Safe to call for runs without receipts — it is a no-op then.

release(run_id)

@spec release(String.t()) :: :ok

Clears cancellation state for run_id once its runner task is fully down.

run(run_id, request, opts \\ [])

@spec run(String.t(), map(), keyword()) :: {:ok, map()} | {:error, map()}

Executes the receipts pipeline for run_id.

Returns {:ok, %{receipts, code_review, synthesis, structured_answer, output_quality}} — everything the runner clause needs for the result map — or {:error, reason_map} when the repository, refs, or review config are unusable.