aeat.application._workflow_review_models module¶
Shared leaf models for the workflow and review packages.
workflow and review need each
other’s pydantic models at runtime: WorkflowEvent is instantiated by
review actions and embedded as a field type on
InvoiceReviewRecord and
LedgerReviewRecord; those two review records
are in turn embedded as field types on
WorkflowState. Neither side can import the
other’s public facade without re-entering a partially-initialised package
during Python’s import machinery (the facade __init__ for either package
pulls in the other), and pydantic’s eager field-type resolution makes the
dependency runtime-bound rather than annotation-only, so neither side of the
former direct cross-import was TYPE_CHECKING-deferrable.
This module is the structural fix: it is a leaf with no dependency on either
workflow or review, so both packages import
these four names from here instead of from each other. workflow
re-exports WorkflowEvent and utc_now() from its facade;
review re-exports InvoiceReviewRecord and
LedgerReviewRecord from
its facade. Consumers outside these two packages are unaffected — they already
import through the public facades, which keep re-exporting the same names.
This module is private application-layer plumbing consumed only by
workflow and review; it is not
part of the application public surface and carries no __all__.
See also
WorkflowStateWorkflow aggregate that embeds review records from this leaf module.
InvoiceReviewRecordPublic review facade export for invoice annotations.
LedgerReviewRecordPublic review facade export for ledger transaction annotations.
BucketIdBucket identifier type carried by workflow events.
- class WorkflowEvent(**data)[source]¶
Bases:
BaseModelOne operator-visible event emitted by a mutating workflow verb.
Events are appended to
bucket_eventsso the operator can audit which actions ran, when, and against which object.actionnames the verb (e.g."profile.created");reasoncarries a free-form human-readable annotation;bucket_idandobject_idare optional pointers to the affected resource.- Parameters:
- action: str¶
- reason: str¶
- bucket_id: BucketId | None¶
- object_id: str | None¶
- at: datetime¶
- class LedgerReviewRecord(**data)[source]¶
Bases:
BaseModelWorkflow attention annotation for one persisted transaction.
Durable transaction facts are not stored here. Classification, category, business percentage, tax fields, evidence references, skip/final-disposition state, and corrections live on the bucket-scoped transaction catalogue.
- Parameters:
transaction_id (str)
history (tuple[WorkflowEvent, ...])
updated_at (datetime)
- transaction_id: str¶
- history: tuple[WorkflowEvent, ...]¶
- updated_at: datetime¶