Bourse.Spec.Promotion (bourse v0.1.0)

Copy Markdown View Source

Builds and gates complete owned-spec candidates from pinned CCXT references.

Preparation copies mechanical transport and metadata bulk, but resets every interpretive slot and unified capability to an explicit candidate state. A successful gate returns a complete owned document; it does not add the venue to Bourse.Spec, the registry, or the compiled exchange set.

Summary

Types

A promotion failure with a stable code and actionable message.

Functions

Encodes a candidate or report with stable pretty-printed JSON bytes.

Builds a candidate and evidence report from a decoded pinned CCXT reference.

Reads a pinned reference file and builds its candidate and report.

Returns the promoted owned document or every promotion gap.

Returns a lowercase SHA-256 digest for binary content.

Types

gap()

@type gap() :: Bourse.Spec.Promotion.Gap.t()

A promotion failure with a stable code and actionable message.

Functions

encode!(document)

@spec encode!(map()) :: String.t()

Encodes a candidate or report with stable pretty-printed JSON bytes.

prepare(reference, provenance)

@spec prepare(map(), map()) :: {map(), map()}

Builds a candidate and evidence report from a decoded pinned CCXT reference.

prepare_file!(reference_path)

@spec prepare_file!(Path.t()) :: {map(), map()}

Reads a pinned reference file and builds its candidate and report.

promote(candidate, report, opts \\ [])

@spec promote(map(), map(), keyword()) :: {:ok, map()} | {:error, [gap()]}

Returns the promoted owned document or every promotion gap.

Re-reads the pinned CCXT reference (from opts[:reference] or report["reference"]["path"]), verifies its bytes against report["reference"]["sha256"], and re-derives the method inventory from that reference so candidate/report cannot silently drop methods together.

sha256(contents)

@spec sha256(binary()) :: String.t()

Returns a lowercase SHA-256 digest for binary content.