pub fn aggregate(records: &[LedgerRecord]) -> StatsSummaryExpand description
The one shared aggregation path: pure, total-order-independent, takes only ledger-shaped
records. scope/window/project are generic defaults here — callers (the CLI’s
stats/gain/session entry points) overwrite those framing fields on the returned
StatsSummary to suit each command’s emphasis; the underlying counts never change.