feat(bookspec): the specification text and an example for the ledger's own laws (P13 step 4)
bookspec/spec holds the first edition: the model and the five laws (00-model.md) and one file per area, each B-rule a section with its status, a MUST/MAY statement, sources pinned either to a vendored source with a verbatim quotation or to an exact external paragraph, its symbolic form, its examples and its applicability. B-39, B-40, B-43 and B-45 are reserved sections (allocated, not yet stated in rules.md); B-44 is stated in rules.md and now carries its bookspec id and CONVENTION status. Eight new examples show the laws that had none, each figure worked by hand: an unbalanced entry is refused (Pacioli ch. 36, Pub. 583), a negative or zero line is refused, a fraction of a cent is refused (ISO 4217), a child account takes its parent's type, the trial balance and the accounting equation on one small book (cash 6550.25 = loan 2000 + capital 5000 + (sales 750.50 - rent 1200.25)), a reversal leaves the original standing and a second reversal is refused, a close sweeps revenue and expenses into Retained Earnings (3999) and the closed quarter takes no late entry, and cents add exactly. The refusal vocabulary gains unbalanced, negative_amount, zero_amount, too_few_lines, finer_than_minor_unit, parent_type_mismatch, already_reversed and period_closed; a refused entry may carry a non-positive amount. The checker's spec.rs fails the build on a rule without its section, a statement without MUST/SHOULD/MAY, a pin that is not verbatim in its vendored source, examples that differ from the catalogue, or more than 60 pages. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
f034b0d45b
commit
790ec8c0e6
24 files changed
+1576
-35
No files matched your search
@@ -0,0 +1,108 @@
|
||||
id = "period-a-close-sweeps-the-year-into-capital"
|
||||
title = "A close zeroes revenue and expenses into equity, and the closed period takes no new postings"
|
||||
rule = "A close MUST zero every revenue and expense account through its last day and credit equity with exactly the net income; a period once closed MUST take no new postings."
|
||||
status = "AUTHORITY"
|
||||
sources = [
|
||||
"Pacioli, Summa (1494), ch. 34: \"you shall close this account into the capital account\" (docs/spec/sources/pacioli-1494.md)",
|
||||
"OpenStax, Principles of Accounting, Vol. 1, 5.1: temporary accounts are closed at the end of each period (docs/spec/rules.md B-11)",
|
||||
"CONVENTION (docs/spec/rules.md B-12): a closed period is locked, which follows from posted-is-forever",
|
||||
]
|
||||
tags = ["accrual", "book", "us", "period", "close"]
|
||||
|
||||
[setup]
|
||||
currency = "USD"
|
||||
fiscal_year_start = "01-01"
|
||||
basis = "accrual"
|
||||
rounding = "half-even"
|
||||
|
||||
[[setup.accounts]]
|
||||
code = "1000"
|
||||
name = "Cash"
|
||||
type = "asset"
|
||||
|
||||
[[setup.accounts]]
|
||||
code = "2000"
|
||||
name = "Loan"
|
||||
type = "liability"
|
||||
|
||||
[[setup.accounts]]
|
||||
code = "3000"
|
||||
name = "Capital"
|
||||
type = "equity"
|
||||
|
||||
[[setup.accounts]]
|
||||
code = "4000"
|
||||
name = "Sales"
|
||||
type = "revenue"
|
||||
tax_category = "gross_receipts"
|
||||
|
||||
[[setup.accounts]]
|
||||
code = "6000"
|
||||
name = "Rent"
|
||||
type = "expense"
|
||||
tax_category = "rent_property"
|
||||
|
||||
[[events]]
|
||||
date = "2026-01-02"
|
||||
description = "Members put in cash"
|
||||
lines = [
|
||||
{ account = "1000", side = "debit", amount = "5000.00" },
|
||||
{ account = "3000", side = "credit", amount = "5000.00" },
|
||||
]
|
||||
|
||||
[[events]]
|
||||
date = "2026-02-10"
|
||||
description = "A sale"
|
||||
lines = [
|
||||
{ account = "1000", side = "debit", amount = "900.00" },
|
||||
{ account = "4000", side = "credit", amount = "900.00" },
|
||||
]
|
||||
|
||||
[[events]]
|
||||
date = "2026-03-10"
|
||||
description = "Rent"
|
||||
lines = [
|
||||
{ account = "6000", side = "debit", amount = "350.00" },
|
||||
{ account = "1000", side = "credit", amount = "350.00" },
|
||||
]
|
||||
|
||||
# Close January 1 through March 31 into capital.
|
||||
[[events]]
|
||||
date = "2026-03-31"
|
||||
description = "Close the quarter"
|
||||
close = { start = "2026-01-01", to = "retained_earnings" }
|
||||
|
||||
# March 31 is closed: an entry dated inside the quarter is refused.
|
||||
[[events]]
|
||||
date = "2026-03-15"
|
||||
description = "A late sale"
|
||||
refused = "period_closed"
|
||||
lines = [
|
||||
{ account = "1000", side = "debit", amount = "50.00" },
|
||||
{ account = "4000", side = "credit", amount = "50.00" },
|
||||
]
|
||||
|
||||
# By hand: net income = 900.00 - 350.00 = 550.00. Revenue and expense are
|
||||
# zero; the 550.00 lands in Retained Earnings (3999, the account the books
|
||||
# create for the close), so equity is 5000.00 + 550.00 = 5550.00; cash is
|
||||
# 5000 + 900 - 350 = 5550.00, so assets equal equity.
|
||||
[[expect]]
|
||||
query = "balances"
|
||||
as_of = "2026-12-31"
|
||||
[expect.values]
|
||||
"1000" = "5550.00"
|
||||
"3000" = "5000.00"
|
||||
"3999" = "550.00"
|
||||
"4000" = "0.00"
|
||||
"6000" = "0.00"
|
||||
|
||||
# The statement for the quarter excludes the close: the year's income is
|
||||
# still reported.
|
||||
[[expect]]
|
||||
query = "profit_and_loss"
|
||||
from = "2026-01-01"
|
||||
to = "2026-03-31"
|
||||
[expect.values]
|
||||
"4000" = "900.00"
|
||||
"6000" = "350.00"
|
||||
net_income = "550.00"
|
||||
Reference in new issue
Block a user