config, mcp, gui: specs from sources, spec-blind suites, and the bugs they found
check / check (push) Canceled after 0s

ledger-config: parse gets a sourced spec. A fiscal year starts on the
first of a month (IRS Pub. 538); tax_classification is read by whole
words (Treas. Reg. 301.7701-3, Schedule C instructions; "business corp"
no longer reads as an S corp, "corporation or S corporation" is refused);
duplicate or blank members and shared capital accounts are refused; a
negative or non-grammatical receipt threshold is refused; codes trimmed.
tests/spec_config.rs (65 spec-blind tests, 14 properties), fuzz target
fuzz_config_parse (weekly). Mutation: 55 of 55 viable caught (from 25/38).

The receipt policy moves to ledger-config, with one loader
(effective_receipt_policy) and one decimal grammar, so the server and
the viewer enforce and show the same rule (the viewer had its own: only
expense-like debits, a silent $25 default, and no config.json).

ledger-mcp: a module spec (MCP 2025-06-18 tools, JSON-RPC 2.0, the
operating contract). Amounts in are exactly -?digits[.digits]; a number
that is one account's code and another's id (vendors, classes alike) is
refused, not guessed; the threshold is validated at startup. Fixed:
add_line with a bad class journaled the line before refusing;
profit_and_loss_by_class ignored `class`; aging buckets said "0". A wire
in front of rmcp answers malformed JSON with -32700 and invalid requests
with -32600 and their id (rmcp dropped the first, omitted the id).
tests/spec_mcp.rs (26 spec-blind tests: every tool's result against its
own outputSchema, a random-call state machine checking the journal is
untouched by every refusal, amount grammar, previews, the receipt policy).

ledger-gui: money, accounting, and dollars never round (they rounded to
cents, banker's style); export file names avoid Windows device names,
trailing dots and spaces, empty names, and 255-byte overflow; specs on
attention, history, fuzzy search, and axis ticks.

ledger-core: the lifetime profit_and_loss is renamed unclosed_earnings
(docs/testing.md #3).

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-14 10:13:05 -06:00
1 parent 5b8910a1cd
commit 3f20df9700
42 files changed
+4636 -363

No files matched your search

+47 -5
View File
@@ -1413,6 +1413,17 @@ dependencies = [
"smallvec",
]
[[package]]
name = "ledger-config"
version = "0.1.0"
dependencies = [
"chrono",
"ledger-core",
"rust_decimal",
"serde",
"toml 1.1.8+spec-1.1.0",
]
[[package]]
name = "ledger-core"
version = "0.1.0"
@@ -1430,6 +1441,7 @@ version = "0.0.0"
dependencies = [
"arbitrary",
"chrono",
"ledger-config",
"ledger-core",
"ledger-import",
"ledger-store",
@@ -2337,6 +2349,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
@@ -2656,11 +2677,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
dependencies = [
"serde",
"serde_spanned",
"serde_spanned 0.6.9",
"toml_datetime 0.6.11",
"toml_edit 0.22.27",
]
[[package]]
name = "toml"
version = "1.1.8+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"
dependencies = [
"indexmap",
"serde_core",
"serde_spanned 1.1.2",
"toml_datetime 1.1.2+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.4",
]
[[package]]
name = "toml_datetime"
version = "0.6.11"
@@ -2687,7 +2723,7 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"serde_spanned 0.6.9",
"toml_datetime 0.6.11",
"toml_write",
"winnow 0.7.15",
@@ -2720,6 +2756,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]]
name = "toml_writer"
version = "1.1.3+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"
[[package]]
name = "ttf-parser"
version = "0.25.1"
@@ -2807,7 +2849,7 @@ dependencies = [
"indexmap",
"rustc-hash",
"stacker",
"toml",
"toml 0.8.23",
"typst-library",
"typst-macros",
"typst-syntax",
@@ -2923,7 +2965,7 @@ dependencies = [
"smallvec",
"syntect",
"time",
"toml",
"toml 0.8.23",
"ttf-parser",
"two-face",
"typed-arena",
@@ -3038,7 +3080,7 @@ dependencies = [
"ecow",
"rustc-hash",
"serde",
"toml",
"toml 0.8.23",
"typst-timing",
"typst-utils",
"unicode-ident",
+10
View File
@@ -24,6 +24,9 @@ path = "../crates/ledger-store"
[dependencies.ledger-import]
path = "../crates/ledger-import"
[dependencies.ledger-config]
path = "../crates/ledger-config"
[[bin]]
name = "fuzz_journal_line"
path = "fuzz_targets/fuzz_journal_line.rs"
@@ -74,3 +77,10 @@ path = "fuzz_targets/fuzz_import_csv.rs"
test = false
doc = false
bench = false
[[bin]]
name = "fuzz_config_parse"
path = "fuzz_targets/fuzz_config_parse.rs"
test = false
doc = false
bench = false
+33
View File
@@ -0,0 +1,33 @@
// Fuzz target: `wanderbooks.toml` is written by people and agents, so its
// text is untrusted input. Parsing must return settings or an error, never
// panic or hang, and what it accepts must honor parse's invariants: the
// fiscal year starts on the first of a month, and members' shares (each in
// (0, 1]) sum to exactly 1.
#![no_main]
use libfuzzer_sys::fuzz_target;
use rust_decimal::Decimal;
fuzz_target!(|data: &[u8]| {
let Ok(text) = std::str::from_utf8(data) else {
return;
};
if let Ok(s) = ledger_config::parse(text) {
let (m, d) = s.company.fiscal_year_start;
assert!(
(1..=12).contains(&m) && d == 1,
"{:?}",
s.company.fiscal_year_start
);
if !s.company.members.is_empty() {
let total: Decimal = s.company.members.iter().map(|m| m.share).sum();
assert_eq!(total, Decimal::ONE, "{:?}", s.company.members);
for mem in &s.company.members {
assert!(
mem.share > Decimal::ZERO && mem.share <= Decimal::ONE,
"{mem:?}"
);
}
}
}
});
+17
View File
@@ -0,0 +1,17 @@
[company]
name = "Juniper Studio LLC"
entity_type = "LLC, single-member"
tax_classification = "disregarded entity" # Schedule C
fiscal_year_start = "01-01"
formation_state = "OR"
formed = "2025-06-02"
ein = "00-0000000"
address = "1200 NW Everett St, Portland, OR 97209"
owner = "Alex Rivera"
[books]
accounting_basis = "accrual"
receipt_threshold = "25.00"
close_into = "3000"
close_sweep = ["3100"]
cash_accounts = ["1000", "1010"]
View File
Whitespace-only changes.
+25
View File
@@ -0,0 +1,25 @@
[company]
name = "Three Partners LLC"
tax_form = "1065"
fiscal_year_start = "07-01"
[[company.members]]
name = "A"
share = "0.5"
capital_account = "3000"
distribution_account = "3100"
[[company.members]]
name = "B"
share = "25%"
capital_account = "3001"
[[company.members]]
name = "C"
share = " 0.25"
capital_account = " 3002 "
[books]
accounting_basis = "cash"
receipt_threshold = "75"
investing_accounts = ["1500"]
+6
View File
@@ -0,0 +1,6 @@
[company]
tax_classification = "We are an S corp, formerly a sole proprietorship"
fiscal_year_start = "02-29"
[books]
close_into = " "
close_sweep = ["3100", ""]
+28
View File
@@ -0,0 +1,28 @@
[company]
name = "Wanderland Labs LLC"
entity_type = "LLC, multi-member, member-managed"
tax_classification = "partnership" # Form 1065; a Schedule K-1 per member
base_currency = "USD"
fiscal_year_start = "01-01" # the year ends the day before: Dec 31
formation_state = "UT"
formed = "2026-10-04"
[[company.members]]
name = "Stephen Waits"
share = "50%"
capital_account = "3000"
[[company.members]]
name = "Katherine Pendergast"
share = "50%"
capital_account = "3001"
[books]
data_dir = "books-data"
accounting_basis = "accrual"
receipt_threshold = "0.00"
cash_accounts = ["1000"]
financing_accounts = ["2100"]
[viewer]
open_at_start = "ask"