Action authoring and approval requirements¶
Action is an authoring facade. It compiles to ActionDefinition; the runtime
continues to accept definitions only.
action ¶
Thin authoring facade that compiles to the public action definition.
Action ¶
Action(*, authority_evaluator: AuthorityEvaluatorPort, commitment_provider: CommitmentProvider, protection_codec: ProtectionCodec)
Bases: ABC, Generic[CommandT, PrivateSnapshotT, PreviewT, ResultT]
Author an action as one typed object without creating a second runtime path.
Deployment services remain constructor-injected. Immutable action metadata
stays visible on the subclass. to_definition is the only bridge to the
runtime.
verification_lease_duration
class-attribute
¶
semantic_idempotency_strategy
class-attribute
¶
to_definition ¶
to_definition() -> ActionDefinition[CommandT, PrivateSnapshotT, PreviewT, ResultT]
Compile this authoring facade to the runtime's public plumbing.
prepare
abstractmethod
async
¶
prepare(command: CommandT, *, context: PreparationContext) -> PreparedAction[PrivateSnapshotT, PreviewT]
can_prepare
abstractmethod
async
¶
can_prepare(command: CommandT, *, context: PreparationContext) -> AuthorizationResult
can_decide
abstractmethod
async
¶
can_decide(evidence: AuthorityEvidence, *, context: DecisionContext) -> AuthorizationResult
can_execute
abstractmethod
async
¶
can_execute(snapshot: PrivateSnapshotT, *, context: ExecutionContext) -> AuthorizationResult
resolve
abstractmethod
async
¶
resolve(snapshot: PrivateSnapshotT, *, context: ExecutionContext) -> ResolvedState[PrivateSnapshotT, PreviewT]
execute
abstractmethod
async
¶
execute(snapshot: PrivateSnapshotT, *, context: ExecutionContext, execution_precondition: str) -> ExecutionResult[ResultT]
authorize_erasure
async
¶
authorize_erasure(proposal_reference: str, *, context: ReadContext) -> bool
ActionConfigurationError ¶
Bases: TypeError
Raised when an Action subclass cannot compile to ActionDefinition.
Approval requirements evaluate evidence after the host has authenticated and authorized each decision. They are not authorization policies.
approvals ¶
Evidence-only approval requirements.
These helpers evaluate already authenticated and host-authorized authority evidence. They never decide whether an authority is currently permitted to act.
SingleApproval
dataclass
¶
SingleApproval(authority: ConfirmingAuthority)
Require one specific authority after the host authorizes the decision.
evaluate
async
¶
evaluate(*, binding: AuthorityBinding, evidence: tuple[AuthorityEvidence, ...]) -> AuthorityEvaluation
AnyApproval
dataclass
¶
AnyApproval(authorities: tuple[ConfirmingAuthority, ...])
Require one distinct authority from a declared set.
evaluate
async
¶
evaluate(*, binding: AuthorityBinding, evidence: tuple[AuthorityEvidence, ...]) -> AuthorityEvaluation
MOfNApprovals
dataclass
¶
MOfNApprovals(required: int, authorities: tuple[ConfirmingAuthority, ...])
Require approvals from a distinct M-of-N set of authorities.
evaluate
async
¶
evaluate(*, binding: AuthorityBinding, evidence: tuple[AuthorityEvidence, ...]) -> AuthorityEvaluation