fix(mcp,store,core): four refusals are decided before the call's first line (P15 T1, D-88)
A refusal is decided before anything is written; a failed call on the record is for a call that failed part way. Four tools wrote a line and then refused, so under T1 each left a begun line, its lines and a failed closing line in the journal for a plain "no": - books.attach_receipt and books.file_document: bytes already filed are one file, so filing them again links the existing attachment; a link it already holds was refused after the earlier links were written. The store now asks first (Store::check_filing_links). - books.draft_entry and books.draft_from_template: a no_party_reason that names a full tax id was refused by the mark, after the draft was made. Ledger::check_no_party_reason is asked first. - books.dispose_asset: a receipt named twice was refused at its second link, after the disposal was posted. The ids are checked for repeats first. Each has a test that the journal is byte for byte as it was. No journal format or frame shape changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc55a10101
commit
38612ab553
11 files changed
+192
-2
No files matched your search
@@ -314,6 +314,38 @@ fn templates_draft_through_the_server() {
|
||||
assert_eq!(d["lines"][1]["account"], "1000");
|
||||
}
|
||||
|
||||
/// A reason that names a full tax id is refused (BS-partner-2) before the
|
||||
/// draft's first line is written: the journal is byte for byte what it was
|
||||
/// (D-88), and the error says nothing of the number.
|
||||
#[test]
|
||||
fn a_template_draft_with_a_tax_id_in_its_reason_is_refused_before_it_is_written() {
|
||||
let books = Books::new("kept-template-tin");
|
||||
let mut m = Mcp::spawn(&books);
|
||||
init(&mut m);
|
||||
chart(&mut m);
|
||||
m.call(
|
||||
"books.set_convention",
|
||||
json!({"id": "bank-expense", "kind": "posting_template",
|
||||
"title": "Expense paid from the bank", "body_md": "Dr the expense / Cr 1000.",
|
||||
"structured": {"lines": [
|
||||
{"account": "6000", "side": "debit", "share": "1"},
|
||||
{"account": "1000", "side": "credit", "share": "1"}]},
|
||||
"decided_by": "A"}),
|
||||
);
|
||||
let before = books.journal_raw();
|
||||
let e = m.call_err(
|
||||
"books.draft_from_template",
|
||||
json!({"template_id": "bank-expense", "date": "2026-10-02", "amount": "12.00",
|
||||
"no_party_reason": "own account, tax id 987-65-4321"}),
|
||||
);
|
||||
assert!(!e.contains("987-65-4321"), "{e}");
|
||||
assert_eq!(
|
||||
books.journal_raw(),
|
||||
before,
|
||||
"a refusal wrote to the journal"
|
||||
);
|
||||
}
|
||||
|
||||
/// books.start stays at most 8 KB whatever the books hold, and says what
|
||||
/// it left out.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user