fix(store): cash accounts found by name come in chart order

FINDING from V-D2's reconcilable tests: cash_accounts returned the asset
accounts whose names say cash in the order ChartOfAccounts::all yields
them (a HashMap: "order unspecified"), so books.digest's
unreconciled_accounts could list the same books' accounts in a different
order from one run to the next. card_accounts, the rule beside it,
already sorts by account id. The name-matched path now sorts the same
way; configured codes keep the order they were configured in. No figure,
membership or due date changes, only the order of the list.

The earlier ignored test (cash_accounts_come_in_chart_order) now runs.
This is a small fix kept in its own commit so it can be dropped without
touching the tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-09 03:08:03 -07:00
1 parent 7a1d4a51a8
commit 11314db1f7
2 files changed
+6 -4

No files matched your search

+5 -2
View File
@@ -45,7 +45,8 @@ pub fn cash_accounts(ledger: &Ledger, configured: &[String]) -> Vec<AccountId> {
.filter_map(|c| ledger.chart().find_by_code(c).map(|a| a.id))
.collect();
}
ledger
// In chart order, as `card_accounts` is: the chart iterates in no order.
let mut found: Vec<AccountId> = ledger
.chart()
.all()
.filter(|a| {
@@ -55,7 +56,9 @@ pub fn cash_accounts(ledger: &Ledger, configured: &[String]) -> Vec<AccountId> {
&& CASH_WORDS.iter().any(|w| n.contains(w))
})
.map(|a| a.id)
.collect()
.collect();
found.sort_unstable();
found
}
/// The card accounts (`ledger_core::parties::card_accounts`: the