cadrumo.application.ledger.readiness_query module

Readiness issues joined to the ledger facts that explain them.

A preflight issue names a transaction and a reason. On its own that tells an operator a row is not ready without telling them why, so the facts a reader needs to act – the classification and the four tax fields a deductible row must carry – are joined on here. Choosing WHICH facts accompany an issue is a diagnostic decision, not formatting, and it had been made inside the CLI status verb where no second surface could reach it.

The join can miss. A preflight report and the catalogue are two reads, so an issue can name a transaction the catalogue no longer holds. The adapter dropped those silently, which makes the issues an operator sees fewer than the count reported beside them with nothing saying so. Here the issue survives with transaction_present false and its facts absent, because a readiness problem whose row has vanished is a stronger signal than one whose row is merely incomplete – not a reason to say nothing.

class LedgerReadinessIssueV1(**data)[source]

Bases: BaseModel

One readiness issue with the ledger facts that explain it.

Every fact is optional because it is optional on the row: a deductible transaction missing its category is exactly the case this reports, so an absent value is the finding rather than a gap in the read.

Parameters:

data (Any)

transaction_id: str
reason: str
detail: str
transaction_present: bool
business_classification: str | None
category_id: str | None
taxable_base: Decimal | None
iva_rate: Decimal | None
iva_amount: Decimal | None
read_ledger_readiness(*, bucket_id, period, transaction_repository, usage_ratio_profile_loader, operation)[source]

Report this period’s readiness issues with their explaining facts.

Parameters:
Return type:

tuple[LedgerReadinessIssueV1, ...]

Returns:

Every issue the preflight raised, in report order, each carrying the row’s facts when the row is still present.