ExGAM.Constitution (ExGAM v0.1.0)

Copy Markdown View Source

Canonical identity for the executable rules supplied to a Domain.

The rules remain a plain portable map: ExGAM does not invent a universal policy language. Their canonical reference is named by Genesis, which prevents a restart from silently substituting different duty or governance rules under the same Domain history.

Summary

Functions

Returns the exact plain value whose digest identifies these rules.

Returns the content reference that a matching Genesis must name.

Returns the content reference or raises for an invalid rule map.

Reads one field from host-authored Constitution configuration.

Validates a rule map without granting it authority.

Functions

canonical(rules)

@spec canonical(map()) :: map()

Returns the exact plain value whose digest identifies these rules.

ref(rules)

@spec ref(map()) :: {:ok, String.t()} | {:error, term()}

Returns the content reference that a matching Genesis must name.

ref!(rules)

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

Returns the content reference or raises for an invalid rule map.

rule_value(rule, key, default \\ nil)

@spec rule_value(map(), atom(), term()) :: term()

Reads one field from host-authored Constitution configuration.

Governed records are always structs after replay. Constitution rules remain intentionally portable user configuration, so this is the single boundary where atom and string keys are accepted. Core modules should not duplicate tolerant field lookup for durable records.

validate(rules)

@spec validate(term()) :: :ok | {:error, term()}

Validates a rule map without granting it authority.