cadrumo.application.operations.supervisor module

Application-owned baseline operation supervision.

class OperationSupervisor(*, registry, authority_operation, journal, event_stream, leases, operands, owner_id, lease_token_factory, clock, lease_duration, execution_timeout=None, cleanup_timeout=None, response_authority_issuer=None, response_token_factory=<function new_response_token>, financial_operand_custody=None)[source]

Bases: SupervisorExecutionMixin, SupervisorSettlementMixin, SupervisorReconciliationMixin, OperationSupervisorLeaseMixin

Coordinate durable execution, interactions, recovery, and settlement.

Parameters:
async shutdown()[source]

Wipe runtime-only secrets and stop supervising unsettled work.

Ephemeral secrets are wiped first, so no executor still holding one can read it. Each running task is then closed under its definition’s policy: a detachable operation is cancelled and left for owner recovery, any other is asked to cancel and given its cleanup window first. Each task settles its operand custody as it stops, before the operand broker is closed.

Return type:

None

async inspect(operation_id)[source]

Load the authoritative current snapshot for one operation.

Return type:

OperationPersistedSnapshot

Parameters:

operation_id (OperationId)

async observe(operation_id)[source]

Return the latest durable operation observation.

Return type:

OperationPersistedSnapshot

Parameters:

operation_id (OperationId)

async replay(operation_id, cursor, *, limit)[source]

Read one bounded authoritative event page after an exclusive cursor.

Return type:

OperationReplayPage

Parameters:
  • operation_id (OperationId)

  • cursor (OperationEventCursor)

  • limit (OperationReplayLimit)

async detach(operation_id)[source]

Release a frontend without mutating the durable operation.

Return type:

OperationPersistedSnapshot

Parameters:

operation_id (OperationId)

async reject(response)[source]

Consume a rejected REVIEW response through the shared response transition.

Return type:

OperationConsumedInteraction

Parameters:

response (OperationRejectResponse)