From e801908a880fd0e41f082dac1a10f17dc9797107 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 27 Oct 2026 12:15:51 -0600 Subject: [PATCH] test(mcp): exercise the write-off in the happy path (P4b S7) spec_mcp's inv1 walks every tool once and fails on any the books never answered: the happy path now creates an invoice that will not be paid, uploads the collection letter, and writes it off with the evidence in the same call, so books.write_off_invoice's output schema is checked like every other tool's. --- crates/ledger-cli/tests/spec_mcp.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/ledger-cli/tests/spec_mcp.rs b/crates/ledger-cli/tests/spec_mcp.rs index ede855a..4a3bc23 100644 --- a/crates/ledger-cli/tests/spec_mcp.rs +++ b/crates/ledger-cli/tests/spec_mcp.rs @@ -896,6 +896,20 @@ fn happy_path(name: &str) -> Mcp { json!({"kind": "invoices", "status": "all"}), ); m.ok("books.document", json!({"ref": format!("invoice:{inv}")})); + // P4b S7: a bad debt, its evidence uploaded and filed with it. + let bad = m.ok( + "books.create_invoice", + json!({"party_id": customer, "date": "2026-02-03", "due_date": "2026-03-03", + "lines": [{"description": "Consulting, never paid", "amount": "400.00"}]}), + )["id"] + .as_u64() + .unwrap(); + let letter = m.upload(b"Final demand", "letter.txt", "text/plain", "document"); + m.ok( + "books.write_off_invoice", + json!({"invoice": bad, "date": "2026-03-01", "reason": "collection exhausted", + "upload_id": letter, "confirmed": true}), + ); // Fixed assets. let registered = m.ok(