1.05 Chart of Accounts and the Account Model: Exit Evidence
Evidence · Step: 1.05 Chart of Accounts and the Account Model
| Step | 1.05 Chart of Accounts and the Account Model |
| Date | 2026-11-11 |
| Result | Passed. The accountant’s review of the accounts themselves is still pending from step 1.01. |
Deliverables
Section titled “Deliverables”| Deliverable | File | Contents |
|---|---|---|
| Account types and normal sides | crates/core/src/chart.rs |
AccountType (five types) with normal_side(); Side (debit, credit), also used for journal lines in step 1.06 |
| Chart model | crates/core/src/chart.rs |
Chart, AccountTemplate, AccountCode, AccountKind (control or system), ChartStatus (active or reserved). Parses and validates TOML text; reading the file is the caller’s job, so core stays free of I/O. Chart::resolve turns "2010:cust-abebe" into its template. |
| Account and lifecycle | crates/core/src/account.rs |
Account opened only from a chart reference, so its type and negative-balance rule always come from the chart. AccountStatus (open, frozen, closed) with explicit transitions. balance(normal_side, debits_total, credits_total). |
| Chart data file | charts/wallet-provider.toml |
The 15 accounts of chart of accounts v0: 10 active, 5 reserved |
Chart validation rules: codes 1000–5999 or 9000–9999, in steps of 10, unique; the type matches the code range (9xxx may be any type); control accounts have a unique prefix of 2–8 lowercase letters, system accounts have none; names are not empty; the currency is known.
Reference rules: a system account is referenced by its code (4010); a
control account only through a sub-account (2010:cust-abebe), whose name
starts with the account’s prefix and a dash. Reserved accounts cannot be
referenced or opened yet.
Status rules:
| From → to | Open | Frozen | Closed |
|---|---|---|---|
| Open | refused (unchanged) | allowed | only at zero balance |
| Frozen | allowed | refused (unchanged) | only at zero balance |
| Closed | refused | refused | refused (unchanged) |
Only open accounts accept postings (INV-24).
Testing requirements
Section titled “Testing requirements”| Requirement | Test | Result |
|---|---|---|
| Unit tests for every status transition, allowed and rejected | every_status_transition (all 9 pairs, with zero and non-zero balance), accounts_close_only_at_zero, closed_is_final (property) |
Pass |
| The balance function agrees with the hand-written normal-balance table for all account types | balance_agrees_with_the_normal_balance_table (property, table copied from the accounting model), posting_on_the_normal_side_increases_the_balance |
Pass |
| The chart file loads, codes are unique, and every system account in the accounting model exists in it | chart_file_loads, chart_file_matches_the_documentation |
Pass: the file and chart-of-accounts.md have the same 15 codes, names, kinds, normal sides and statuses |
In total: 51 tests in mezgeb-core (48 unit and property, 3 integration).
Coverage of non-test code in account.rs and chart.rs: 100% of lines,
functions and regions.
Acceptance criteria
Section titled “Acceptance criteria”The worked entries only reference accounts in the chart.
every_worked_entry_line_uses_a_chart_account reads every entry table in
docs/accounting/entries/ (the opening position and E01–E18), resolves each
line’s account against the chart file, and checks that the type written in
the entry matches the chart. Every active account is used by at least one
entry, and no reserved account is used. Pass.
Exit gate
Section titled “Exit gate”Gate: the chart of accounts has been reviewed against the step 1.01 examples.
The review is automated, so it cannot go stale: the integration test above fails if the chart file, the chart documentation and the worked entries ever disagree. All three agree today. Result: passed.
The accountant’s review (step 1.01) still covers whether the accounts themselves are right. If it changes an account, the test forces the data file and the documentation to change with it.