cadrumo.application.state_projection_ports module

Application-owned read contracts for the operator state projection.

The projection producer needs a small, profile-scoped view of persistence. It does not need to know which catalogue repositories or storage-runtime inspection serve that view. This module owns the DTOs and the required port bundle that an outer composition root supplies for one profile session.

Core types: UserProfileRecord.

class StateProjectionWorkspaceRead(transactions, invoices, drafts, work_units, discarded_work_units, calculation_revisions, unreadable_rows)[source]

Bases: object

Counters and integrity facts read from one profile workspace.

Parameters:
  • transactions (int)

  • invoices (int)

  • drafts (int)

  • work_units (int)

  • discarded_work_units (int)

  • calculation_revisions (int)

  • unreadable_rows (int)

transactions: int
invoices: int
drafts: int
work_units: int
discarded_work_units: int
calculation_revisions: int
unreadable_rows: int
class StateProjectionProfileRead(bucket_id, record)[source]

Bases: object

The profile bucket and current record used by readiness evaluation.

Parameters:
bucket_id: str
record: UserProfileRecord
class StateProjectionWorkspaceReadPort(*args, **kwargs)[source]

Bases: Protocol

Read the workspace counters for an explicitly selected bucket.

read_workspace(*, bucket_id)[source]

Return translated workspace facts for bucket_id.

Return type:

StateProjectionWorkspaceRead

Parameters:

bucket_id (str)

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

Bases: Protocol

Read the current profile record for an active profile identifier.

read_profile(*, profile_id)[source]

Return the selected profile facts, or no pointer when absent.

Return type:

StateProjectionProfileRead | None

Parameters:

profile_id (str)

exception StateProjectionReadError(operation)[source]

Bases: CadrumoError

Stable application error raised when a projection read cannot complete.

Parameters:

operation (str)

Return type:

None

code
class StateProjectionReadPorts(workspace, profile, usage_ratio_profile_loader)[source]

Bases: object

Required persistence reads for one operator state projection.

Parameters:
workspace: StateProjectionWorkspaceReadPort
profile: StateProjectionProfileReadPort
usage_ratio_profile_loader: UsageRatioProfileLoader

The persisted usage-ratio read is carried alongside profile readiness because the ledger preflight is part of this same projection.