Jidoka.Review.Policy (Jidoka v0.9.0)

Copy Markdown View Source

Policy describing when a model-requested operation must pause for review.

A policy is definition data. Runtime approval still flows through Jidoka.Review.Interrupt, Jidoka.Review.Request, and Jidoka.Review.Response.

Summary

Functions

Normalizes an optional review policy, including boolean shorthand.

Builds a review policy from keyword or map attributes.

Builds a review policy and raises if the attributes are invalid.

Returns true when a policy requires human review.

Returns the Zoi schema for a review policy.

Projects a review policy into a stable map.

Types

mode()

@type mode() :: :pre_execution

t()

@type t() :: %Jidoka.Review.Policy{
  message: nil | nil | binary(),
  metadata: map(),
  mode: :pre_execution,
  predicate: nil | nil | any(),
  reason: any(),
  required: boolean(),
  ttl_ms: nil | nil | integer()
}

Functions

from_input(policy)

@spec from_input(t() | keyword() | map() | true | false | nil) ::
  {:ok, t() | nil} | {:error, term()}

Normalizes an optional review policy, including boolean shorthand.

new(attrs)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}

Builds a review policy from keyword or map attributes.

new!(attrs)

@spec new!(keyword() | map()) :: t()

Builds a review policy and raises if the attributes are invalid.

required?(policy)

@spec required?(t() | nil) :: boolean()

Returns true when a policy requires human review.

schema()

@spec schema() :: Zoi.schema()

Returns the Zoi schema for a review policy.

to_map(policy)

@spec to_map(t()) :: map()

Projects a review policy into a stable map.