import: templates match the engine's control accounts; report specs
check / check (push) Canceled after 0s

- Starter charts put "Platform and Payment Processing Fees" at 6100, the
  code payroll posts wages to, so a template company that ran payroll
  would book its wages as processing fees; their own payroll accounts
  (7000, 7050, 2300) were never used. Now 6100 Salary & Wage Expense and
  6110 Payroll Tax Expense (the engine's control accounts, with tax
  categories), fees at 6060, and the unused accounts gone (the
  withholding payables 2110-2150 are created when payroll first runs).
  New tests: every template imports with categories valid for its
  return; no template puts another account at a control code; a
  partnership names every partner and its shares sum to 100%.
- format_amount printed a negative zero ("(0.00)" for -0.004); it rounds
  half away from zero first now, like amount_parts.
- Specs (GOAL/SOURCE/INVARIANTS) for statement finishing, P&L, balance
  sheet, cash flow, trial balance, members' equity (each must foot as
  printed), format_amount, and the templates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-13 21:01:51 -06:00
1 parent ea180d1d8e
commit e52b88433c
3 files changed
+225 -12

No files matched your search

+34 -9
View File
@@ -10,6 +10,24 @@
//! `books.import_chart_csv`), with tax categories already assigned, plus
//! the `wanderbooks.toml` settings that go with it (tax form, owners, and
//! where period closes go).
//!
//! ```text
//! GOAL: a chart a new business can import and run as is.
//! SOURCE: docs/spec/sources/irs-tax-lines.md (each category belongs on
//! the business's return); the engine's control accounts
//! (ledger_core: receivables, payables, revenue, retained earnings,
//! payroll), which it finds by code.
//! INVARIANTS:
//! 1. Every row imports: codes unique, parents before children, types
//! valid, and each tax category valid for the entity's return.
//! 2. An account at a control account's code MUST be that control
//! account (same type and name)
//! BECAUSE the engine posts by code: wages would land on whatever
//! sits at 6100 (found 2026-10-13: the templates put processing fees
//! there).
//! 3. A partnership gets a capital and a distributions account per
//! partner and shares that sum to 100%.
//! ```
use crate::chart_csv::ChartRow;
use rust_decimal::Decimal;
@@ -130,7 +148,6 @@ pub fn chart_template(entity: EntityType, owners: &[String]) -> Result<ChartTemp
acct("2000", "Accounts Payable", "liability", None),
acct("2100", "Credit Card", "liability", None),
acct("2200", "Sales Tax Payable", "liability", None),
acct("2300", "Payroll Liabilities", "liability", None),
acct("2400", "Deferred Revenue", "liability", None),
acct("2500", owed_to, "liability", None),
acct("2700", "Loans Payable", "liability", None),
@@ -213,11 +230,26 @@ pub fn chart_template(entity: EntityType, owners: &[String]) -> Result<ChartTemp
acct("6000", "Advertising", "expense", Some("advertising")),
acct("6050", "Bank Fees", "expense", Some("other_deductions")),
acct(
"6100",
"6060",
"Platform and Payment Processing Fees",
"expense",
Some("commissions_fees"),
),
// Payroll posts to the engine's control accounts by code (6100,
// 6110; the withholding payables 2110-2150 are created when payroll
// first runs), so the template's payroll accounts are those.
acct(
"6100",
"Salary & Wage Expense",
"expense",
Some("salaries_wages"),
),
acct(
"6110",
"Payroll Tax Expense",
"expense",
Some("taxes_licenses"),
),
acct("6150", "Contract Labor", "expense", Some("contract_labor")),
acct("6200", "Depreciation", "expense", Some("depreciation")),
acct(
@@ -275,13 +307,6 @@ pub fn chart_template(entity: EntityType, owners: &[String]) -> Result<ChartTemp
"expense",
Some("nondeductible"),
),
acct(
"7000",
"Salaries and Wages",
"expense",
Some("salaries_wages"),
),
acct("7050", "Payroll Taxes", "expense", Some("taxes_licenses")),
acct(
"7100",
"Employee Benefits",