aeat.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 BucketEventHistoryRepository via emit_workflow_state_reset().

See also

WorkflowStateRepository

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

aeat.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.

BucketEventHistoryRepository

Append-only secure repository that stores the reset event.

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:
  • schema_version (int | None)

  • written_at (datetime | None)

  • byte_length (int | None)

  • reason_class (str)

  • recovered_bucket_id (str | None)

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

Bases: BaseModel

Typed payload for the workflow_state.reset bucket event.

Parameters:
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: