Action authoring and approval requirements¶
For new integrations that pin an exact patch and own equivalence tests plus
migration review, the namespaced gradual-reveal API keeps immutable semantics
separate from operation-scoped host dependencies and compiles to the same
ActionDefinition and ActionRuntime used by the expert path. Other
integrations should start with the supported Action facade or construct an
ActionDefinition directly. See the versioning boundary.
experimental ¶
Experimental gradual-reveal authoring API.
This namespace may change independently while it is evaluated. The expert root API remains the stable runtime contract.
ActionApplication ¶
Bases: Generic[DepsT]
Minimal registration catalog for experimental action declarations.
register ¶
register(specification: ActionSpec[CommandT, PrivateSnapshotT, PreviewT, ResultT], recipe: ActionRecipe[DepsT, CommandT, PrivateSnapshotT, PreviewT, ResultT]) -> RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT]
inspect ¶
inspect(action: RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT]) -> ActionInspection
bind ¶
bind(action: RegisteredAction[CommandT, PrivateSnapshotT, PreviewT, ResultT], *, dependencies: DepsT) -> Iterator[BoundAction[CommandT, PrivateSnapshotT, PreviewT, ResultT]]
ActionApplicationError ¶
ActionApplicationError(code: ActionIssueCode)
Bases: RuntimeError
A content-safe experimental application failure.
ActionComponents
dataclass
¶
ActionComponents(preparation: PreparationPort[CommandT, PrivateSnapshotT, PreviewT], authorization: AuthorizationPort[CommandT, PrivateSnapshotT], authority_evaluator: AuthorityEvaluatorPort, state_resolver: StateResolverPort[PrivateSnapshotT, PreviewT], executor: GovernedExecutorPort[PrivateSnapshotT, ResultT], verifier: VerifierPort[ResultT], commitment_provider: CommitmentProviderPort, protection_codec: ProtectionCodecPort, retention: RetentionPort, store: ActionStore, retention_store: RetentionStore | None = None, clock: Clock | None = None, identifiers: IdentifierProvider | None = None, event_sink: EventSink | None = None, runtime_revision: str | None = None, recovery_authorization: RecoveryAuthorizationPort | None = None)
Bases: Generic[CommandT, PrivateSnapshotT, PreviewT, ResultT]
Operation-scoped ports and runtime services produced by a host recipe.
recovery_authorization
class-attribute
instance-attribute
¶
recovery_authorization: RecoveryAuthorizationPort | None = None
ActionIssueCode ¶
Bases: StrEnum
Content-safe issue vocabulary for the experimental authoring layer.
DEFINITION_NONCONFORMING is reserved for compatibility with the initial
experimental contract. ActionApplication.bind() does not emit it because
trusted definition-construction failures retain their original diagnostics.
ActionRecipe
dataclass
¶
ActionRecipe(bind: Callable[[DepsT], ActionComponents[CommandT, PrivateSnapshotT, PreviewT, ResultT]])
Bases: Generic[DepsT, CommandT, PrivateSnapshotT, PreviewT, ResultT]
Trusted host code that maps fresh dependencies to operation components.
bind
instance-attribute
¶
bind: Callable[[DepsT], ActionComponents[CommandT, PrivateSnapshotT, PreviewT, ResultT]]
ActionSpec ¶
Bases: BaseModel, Generic[CommandT, PrivateSnapshotT, PreviewT, ResultT]
Immutable action semantics that are safe to retain application-wide.
model_config
class-attribute
instance-attribute
¶
verification_delay
class-attribute
instance-attribute
¶
max_verification_attempts
class-attribute
instance-attribute
¶
allow_resend_after_final_absence
class-attribute
instance-attribute
¶
verification_lease_duration
class-attribute
instance-attribute
¶
semantic_idempotency_strategy
class-attribute
instance-attribute
¶
translate_validation_failure
classmethod
¶
BoundAction
dataclass
¶
Bases: Generic[CommandT, PrivateSnapshotT, PreviewT, ResultT]
Operation facade whose borrowed internals exist only inside bind.
prepare
async
¶
prepare(*, tenant_reference: str, command: CommandT, requesting_principal: RequestingPrincipal, proposing_agent: ProposingAgent | None = None, proposal_reference: str | None = None) -> ActionOperationResult
record_authority
async
¶
record_authority(*, evidence: AuthorityEvidence, authenticated_authority: ConfirmingAuthority, proposal_reference: str | None = None) -> ActionOperationResult
expire_due
async
¶
expire_due(*, tenant_reference: str, proposal_reference: str) -> ActionOperationResult
reconcile
async
¶
reconcile(*, tenant_reference: str, proposal_reference: str) -> ActionOperationResult
resume_verification
async
¶
resume_verification(*, tenant_reference: str, proposal_reference: str, expected_revision: int, operator: RecoveryOperator, intervention_reference: str) -> ActionOperationResult
Resume verification after a trusted host operator intervention.
read_recovery
async
¶
read_recovery(*, proposal_reference: str, context: ReadContext) -> ActionRecoveryView
Describe safe recovery options through the bound action.
export_evidence
async
¶
export_evidence(*, proposal_reference: str, context: ReadContext) -> ActionEvidenceBundle
Export one authorized, minimized proposal revision.
observation_context
async
¶
observation_context(*, proposal_reference: str, context: ReadContext) -> ExecutionContext
Authorize a read-only target observation for a custom adapter.
RegisteredAction
dataclass
¶
RegisteredAction(action_type: ActionType, _registration_id: int, _application_token: object)
Bases: Generic[CommandT, PrivateSnapshotT, PreviewT, ResultT]
Typed static handle returned by explicit registration.
Action remains the supported authoring facade for a host object that already
implements every port. 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: CommitmentProviderPort, protection_codec: ProtectionCodecPort)
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
can_recover
async
¶
can_recover(proposal_reference: str, *, context: RecoveryContext) -> AuthorizationResult
Deny operator recovery until an action explicitly authorizes it.
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