From 6c26160e26e15917cead11ffcfec37c0dc7a9518 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Thu, 29 Oct 2026 05:25:22 -0600 Subject: [PATCH] test(bookspec): each write-off in an example files its own notice Under P6's dedup (one record per bytes) the adapter's constant letter made the example's second write-off of the same invoice reuse the first write-off's record, which a receipt's one-entry rule (B-38) refuses, and the write-off now refuses that before anything is journaled (the S7/P6 integration fix). The example's two write-offs have two notices, which is what it describes. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp --- crates/ledger-core/tests/bookspec.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/ledger-core/tests/bookspec.rs b/crates/ledger-core/tests/bookspec.rs index 643c24f..d49942a 100644 --- a/crates/ledger-core/tests/bookspec.rs +++ b/crates/ledger-core/tests/bookspec.rs @@ -1180,6 +1180,14 @@ impl<'a> Books<'a> { .outstanding } }; + // Each write-off's own notice: identical bytes would be one + // record (plan P6 step 4), and a receipt evidences one entry + // (B-38), so a second write-off with the first's letter is + // refused before anything is journaled. + let letter = format!( + "%PDF-1.4\nFinal demand for invoice {invoice}: {}\n%%EOF\n", + w.reason + ); self.store .write_off_invoice( invoice, @@ -1189,7 +1197,7 @@ impl<'a> Books<'a> { Some(ledger_store::WriteOffEvidence::File { file_name: "collection-letter.pdf", mime_type: "application/pdf", - bytes: b"%PDF-1.4\nFinal demand\n%%EOF\n", + bytes: letter.as_bytes(), description: Some("Evidence of worthlessness"), }), )