cadrumo.core.ledger_sort module¶
Closed sort axes for the aeat app ledger list surface.
ledger list exposes a stable, operator-selectable sort. The two axes are
declared here in core/ — the innermost hexagonal ring — so the authored
command specification can project the accepted values from the enum directly,
production code routes on enum members, and tests assert against members rather
than raw strings.
LedgerSortField selects the projection axis and
LedgerSortOrder selects the direction. The CLI parser and the
ledger projection service both use these enum members rather than raw
string tokens, threading them through
cadrumo.entrypoints.cli._app_ledger_command_specs.LEDGER_COMMAND_SPECS,
cadrumo.entrypoints.cli._ledger_read_cli.ledger_list(),
cadrumo.entrypoints.cli._ledger_list.project_ledger_list(), and the stable
cadrumo.entrypoints.cli._ledger_list._sort_results helper.
This module deliberately declares tokens only. It does not project transactions, compare rows, page results, or decide missing-key ordering; those rules stay in the ledger-list projection helpers so the CLI and tests exercise one implementation.
- class LedgerSortField(*values)[source]¶
Bases:
StrEnumThe closed set of fields a
ledger listresult may be sorted by.dateis the effective value date (value_date or booked_date);value_dateis the raw value date;amountis the non-negative magnitude;description,lifecycle_state, andclassificationare the lexical / categorical axes;created_at/modified_atare the D6 persistence-record lifecycle timestamps;classified_atis the active-decision timestamp. A row missing the chosen key (aNonetimestamp on a row authored before the axis existed) sorts deterministically last under both orders, never crashing the sort.The value set is consumed by the command-spec runtime and by
cadrumo.application.ledger.list_query._sort_field_value(), so any new member must be added with a projection overTransactionand covered by the real repository sort tests.- Variables:
DATE – Effective value date, falling back to booked date.
VALUE_DATE – Raw value date from the imported/manual transaction.
AMOUNT – Non-negative transaction magnitude.
DESCRIPTION – Operator-facing transaction description.
CREATED_AT – Persistence-record creation timestamp.
MODIFIED_AT – Persistence-record modification timestamp.
CLASSIFIED_AT – Timestamp for the active classification decision.
LIFECYCLE_STATE – Transaction lifecycle state token.
CLASSIFICATION – Business classification token.
- DATE¶
- VALUE_DATE¶
- AMOUNT¶
- DESCRIPTION¶
- CREATED_AT¶
- MODIFIED_AT¶
- CLASSIFIED_AT¶
- LIFECYCLE_STATE¶
- CLASSIFICATION¶
- class LedgerSortOrder(*values)[source]¶
Bases:
StrEnumAscending or descending order for a
ledger listsort.LedgerSortOrdercontrols only the primary axis selected byLedgerSortField; the final content-addressedtransaction_idtie-break remains ascending incadrumo.entrypoints.cli._ledger_list._sort_results.- Variables:
ASC – Sort the primary axis ascending.
DESC – Sort the primary axis descending.
- ASC¶
- DESC¶