PtcRunner.Kernel.SelectedCanonicalSource (PtcRunner v0.15.0)

Copy Markdown View Source

Exact canonical-file selection for one or a bounded set of PTC command run references.

Named capture resolves only these candidates, without listing a directory:

  • <traces>/<run-ref>.jsonl
  • <traces>/<run-ref>.private.jsonl
  • <inspection>/<run-ref>.ptcins

Filenames are routing hints. Embedded run and trace identities remain authoritative, and snapshot identity commits to the selector, trace source class, exact evidence digests, and correlated trace ID. Whole-directory snapshots stay a distinct source variant.

Summary

Types

selected_trace()

@type selected_trace() :: %{
  path: binary(),
  run_ref: binary(),
  source_kind: :sanitized | :private
}

trace_source()

@type trace_source() ::
  {:file, binary(), binary()} | {:private_authorized_file, binary(), binary()}

Functions

inspection_set_source_id(correlated_digest, commitments)

@spec inspection_set_source_id(binary(), [map()]) :: binary()

inspection_source_id(run_ref, evidence_digest, trace_id)

@spec inspection_source_id(binary(), binary(), binary()) :: binary()

max_selected_runs()

@spec max_selected_runs() :: pos_integer()

prove_trace_events(events, run_ref)

@spec prove_trace_events(term(), term()) :: {:ok, binary()} | {:error, atom()}

resolve_inspection(directory, run_ref)

@spec resolve_inspection(term(), term()) :: {:ok, binary()} | {:error, atom()}

resolve_inspections(directory, run_refs)

@spec resolve_inspections(term(), term()) ::
  {:ok, [%{path: binary(), run_ref: binary()}]} | {:error, atom()}

resolve_trace(directory, run_ref)

@spec resolve_trace(term(), term()) :: {:ok, trace_source()} | {:error, atom()}

resolve_traces(directory, run_refs)

@spec resolve_traces(term(), term()) :: {:ok, [selected_trace()]} | {:error, atom()}

trace_set_source_id(commitments)

@spec trace_set_source_id([map()]) :: binary()

trace_source_id(run_ref, source, source_kind, evidence_digest, trace_id)

@spec trace_source_id(binary(), atom(), atom(), binary(), binary()) :: binary()

valid_run_ref?(run_ref)

@spec valid_run_ref?(term()) :: boolean()

validate_run_refs(run_refs)

@spec validate_run_refs(term()) :: {:ok, [binary()]} | {:error, atom()}