cadrumo.application.workflow.events module

Bucket-event emission for workflow-state lifecycle transitions.

Currently owns the workflow_state.reset emission path used by the aeat config repair reset-progress recovery route. The fingerprint payload mirrors the row-level metadata of the discarded envelope plus the actor/source/timestamp captured by the boundary; the plaintext envelope content is never recorded. Events are appended to the composed bucket-event history port via emit_workflow_state_reset().

See also

WorkflowStateRepository

Computes WorkflowStateResetFingerprint records and calls this module before deleting the workflow-state envelope.

cadrumo.application.workflow.persistence.reset_workflow_state()

Public helper used by the config repair reset-progress command to execute the emit-before-delete recovery route.

BucketEvent

Immutable audit event emitted for workflow_state.reset.

default_profile_bucket_event_history_repository()

Composed append-only repository port that stores the reset event.

WORKFLOW_REASON_CLASS_MAX_LENGTH

Longest a workflow reason class may be, stated once.

class WorkflowStateResetFingerprint(**data)[source]

Bases: BaseModel

Row-level fingerprint of a discarded workflow-state envelope.

Captured before the row is deleted so the operator-visible audit trail records what was discarded without retaining any plaintext payload. reason_class classifies the discarded envelope: "readable" when it decrypts and validates cleanly, "unreadable" when the row exists but cannot be decoded, and "absent" when no envelope row is present.

Parameters:

data (Any)

schema_version: int | None
written_at: datetime | None
byte_length: int | None
reason_class: WorkflowReasonClass
recovered_bucket_id: BucketId | None
class WorkflowStateResetEvent(**data)[source]

Bases: BaseModel

Typed payload for the workflow_state.reset bucket event.

Parameters:

data (Any)

fingerprint: WorkflowStateResetFingerprint
actor: str
source: str
timestamp: datetime
emit_workflow_state_reset(*, fingerprint, actor, source)[source]

Append workflow_state.reset to history and return the BucketEvent.

The event is recorded against the recovered bucket id when one survives on the fingerprint, or against the system bucket otherwise.

Return type:

BucketEvent

Parameters: