check / check (push) Canceled after 0s
The owner (2026-10-23): "We should probably just delete the stdio path altogether. THere's no point in that. And it sitting there unused will just lead to bitrot. Nuke it?" Books are served only by the books server (`wanderbooks server`), reached by agents through the bridge (`wanderbooks mcp --book ID`), which stays. Removed: `wanderbooks dev-stdio`, the `ledger-mcp` binary, and `ledger_mcp::run` (stdio and `--http` over a bare data dir), with all that only that mode had: - files the books make coming back inline: `HandedFile.content_base64` is gone, and `download` and `expires_at` are always there; - books with no access log or backups: `books.access_log`, `books.backup` and `books.back_up_now` are always offered, by scope; - the settings file read and reloaded (`legacy_files`), the vault key named by a file or `--vault-key-file`, and the books dir's key-inside-the-books and git checks (with `paths.rs`); - `wire.rs` (the bridge frames an agent's lines itself); - `books.settings`' file fields and `books.start`'s `settings_source`. `BooksServer` is built one way, from `Served` (a book as the books server serves it), in production and in the unit tests. An unknown tool is now a protocol error (mcp-tools.md). Inline file input is unchanged. Then the owner's three decisions (2026-10-23, the question tool): (a) `books.import_settings` is removed entirely (118 tools): old books come in whole by `wanderbooks books adopt`, which reads their settings file once; ledger-config keeps its settings-file parsing only as far as adoption uses it (`load` and the path-reading `effective_receipt_policy` are gone), and `books.chart_template` gives its settings as `books.set_setting` changes. (b) The viewer's loose-books-folder mode is removed (`--data-dir`, `--books-toml`, `--vault-key-file`, the settings file and config.json followed): it opens only books of the data root, reading settings from the journal and the vault from the book's own `vault/` and `keys/`. (c) `wanderbooks dev-stdio` has no stub: it is an unknown command like any other word. Also: an upload's expiry past the calendar is an error, never an empty string. Tests: every suite that drove the stdio server moved to crates/ledger-cli/tests/ and drives a real `wanderbooks server` on a data root of its own (tests/common), handed files by their download; mcp_stdio.rs is mcp_journeys.rs. Tests of what is gone are deleted and listed in docs/testing.md. Docs: plan D-44 (D-18 superseded), STATUS, testing, rules, mcp-interface, the handbook, README; justfile recipes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T3gXMVt7XJPi6ens1or9Dj
148 lines
5.1 KiB
Rust
148 lines
5.1 KiB
Rust
//! P3's seams in the viewer: on the seam review's books (a year of a
|
|
//! two-member LLC, `ledger-package`'s `tests/seams/books.rs`), the
|
|
//! viewer's figures, read through its own [`Books`] from the books' folder
|
|
//! as it opens them (their settings journaled, as the books keep them:
|
|
//! D-44), are the engine's (the server's
|
|
//! tools make theirs with the same calls and settings): each member's
|
|
//! capital statement, party money, the cash flow statement, the fixed
|
|
//! asset register and the 1099 worksheet, on several dates.
|
|
|
|
#[path = "../../ledger-package/tests/seams/books.rs"]
|
|
mod books;
|
|
|
|
use books::{SETTINGS_TOML, books, d};
|
|
use chrono::NaiveDate;
|
|
use ledger_gui::books::Books as Viewer;
|
|
use ledger_gui::{Source, data};
|
|
|
|
const START: &str = "2026-01-01";
|
|
|
|
fn viewer(dir: &std::path::Path, today: NaiveDate) -> Viewer {
|
|
data::load_once(&Source {
|
|
data_dir: dir.join("books-data"),
|
|
today: Some(today),
|
|
})
|
|
.unwrap()
|
|
}
|
|
|
|
#[test]
|
|
fn the_viewers_figures_are_the_engines_on_every_date() {
|
|
let dir = tempfile::tempdir().unwrap();
|
|
let mut b = books(dir.path());
|
|
// The settings in the books, where the viewer reads them (it reads no
|
|
// file beside them).
|
|
let import =
|
|
ledger_config::codec::import(SETTINGS_TOML, None, b.store.ledger().settings(), "USD")
|
|
.unwrap();
|
|
b.store
|
|
.change_settings(
|
|
&import.changes,
|
|
&ledger_core::settings::Source {
|
|
decided_by: "the test".into(),
|
|
decided_on: d(START),
|
|
citation: None,
|
|
note: None,
|
|
},
|
|
)
|
|
.unwrap();
|
|
let l = b.store.ledger();
|
|
let cash: Vec<_> = b
|
|
.cash
|
|
.iter()
|
|
.map(|c| l.chart().find_by_code(c).unwrap().id)
|
|
.collect();
|
|
let financing: Vec<_> = b
|
|
.financing
|
|
.iter()
|
|
.map(|c| l.chart().find_by_code(c).unwrap().id)
|
|
.collect();
|
|
let settings = ledger_package::Settings {
|
|
company: &b.company,
|
|
cash_accounts: &b.cash,
|
|
financing_accounts: &b.financing,
|
|
investing_accounts: &[],
|
|
};
|
|
let capitals = ledger_package::member_capitals(l, &b.company.members).unwrap();
|
|
for end in ["2026-06-30", "2026-09-15", "2026-12-31"].map(d) {
|
|
let v = viewer(dir.path(), end);
|
|
let span = (d(START), end);
|
|
// The settings the viewer read are the books'.
|
|
assert_eq!(v.money_cash_accounts, cash);
|
|
assert_eq!(v.financing_accounts, financing);
|
|
// Each member's capital statement is the K-1 worksheet's row.
|
|
let k1 = ledger_core::k1::k1_worksheet(l, span.0, span.1, &capitals, &cash).unwrap();
|
|
for (i, party) in [b.ana, b.ben].into_iter().enumerate() {
|
|
let c = v.capital_statement(party, span).unwrap();
|
|
let k = &k1[i];
|
|
assert_eq!(
|
|
(
|
|
c.opening,
|
|
c.contributions_cash,
|
|
c.contributions_property,
|
|
c.income_share,
|
|
c.distributions_taken,
|
|
c.other,
|
|
c.closing
|
|
),
|
|
(
|
|
k.beginning,
|
|
k.contributions_cash,
|
|
k.contributions_property,
|
|
k.net_income,
|
|
k.distributions,
|
|
k.other,
|
|
k.ending
|
|
),
|
|
"{end}"
|
|
);
|
|
}
|
|
// Party money is the engine's for every party.
|
|
let money = ledger_core::parties::money_accounts(l, &cash, &financing);
|
|
let members = b.company.party_members(l);
|
|
for p in l.parties() {
|
|
assert_eq!(
|
|
v.activity(p.id, span),
|
|
ledger_core::parties::activity_with(l, p.id, span, &money, &members),
|
|
"{} {end}",
|
|
p.name
|
|
);
|
|
}
|
|
// The cash flow statement the viewer lays out is the tools'.
|
|
let tools = ledger_package::cash_flow_for(
|
|
l,
|
|
&settings,
|
|
Some(START),
|
|
Some(&end.to_string()),
|
|
&[],
|
|
&[],
|
|
&[],
|
|
end,
|
|
)
|
|
.unwrap();
|
|
let viewers = ledger_package::cash_flow_for(
|
|
&v.ledger,
|
|
&ledger_package::Settings {
|
|
company: &v.settings.company,
|
|
cash_accounts: &v.settings.cash_accounts,
|
|
financing_accounts: &v.settings.financing_accounts,
|
|
investing_accounts: &v.settings.investing_accounts,
|
|
},
|
|
Some(START),
|
|
Some(&end.to_string()),
|
|
&[],
|
|
&[],
|
|
&[],
|
|
v.today,
|
|
)
|
|
.unwrap();
|
|
assert_eq!(viewers, tools, "{end}");
|
|
// The register, and the 1099 worksheet as of the day.
|
|
assert_eq!(
|
|
v.asset_register(end).unwrap(),
|
|
ledger_core::fixed_asset_register(l, end).unwrap()
|
|
);
|
|
let year = ledger_package::vendor_1099_report(l, &settings, 2026, None, None).unwrap();
|
|
assert_eq!(v.vendor_1099(2026).unwrap(), year, "{end}");
|
|
}
|
|
}
|