cadrumo.application.ledger.evidence_ports module

Application-owned capabilities for purchase-invoice evidence.

The evidence service coordinates a bucket catalogue, secure attachment custody, and bucket-event history. The concrete encrypted repositories and attachment manifest service are composed by an executable root and translated into these narrow application contracts before they reach the service.

class PurchaseInvoiceEvidenceRepositoryProtocol(*args, **kwargs)[source]

Bases: Protocol

Bucket-scoped evidence catalogue capability.

load(*, bucket_id)[source]

Return the evidence records persisted for bucket_id.

Return type:

tuple[PurchaseInvoiceEvidence, ...]

Parameters:

bucket_id (str)

save(*, bucket_id, records)[source]

Persist the complete evidence record set for bucket_id.

Return type:

None

Parameters:
class EvidenceAttachmentIngestRequest(bucket_id, source_path, media_kind, mime_type, captured_at, actor)[source]

Bases: object

Application facts needed to place one evidence file in secure custody.

Parameters:
bucket_id: str
source_path: Path
media_kind: str
mime_type: str
captured_at: datetime
actor: str
class EvidenceAttachmentIngestorProtocol(*args, **kwargs)[source]

Bases: Protocol

Capability that stores evidence bytes and returns their content address.

ingest(request)[source]

Store the admitted file and return its content-addressed identifier.

Return type:

TypeAliasType

Parameters:

request (EvidenceAttachmentIngestRequest)

class LedgerEvidencePorts(evidence_repository, attachment_ingestor, bucket_event_repository)[source]

Bases: object

Required authorities for one purchase-invoice evidence invocation.

Parameters:
evidence_repository: PurchaseInvoiceEvidenceRepositoryProtocol
attachment_ingestor: EvidenceAttachmentIngestorProtocol
bucket_event_repository: BucketEventHistoryRepositoryProtocol
class LedgerEvidencePortsFactory(*args, **kwargs)[source]

Bases: Protocol

Construct the complete evidence bundle for one profile bucket.