feat(core): the engine refuses free text that looks like a tax id

Entry and reversal descriptions, write-off and void reasons, document
memos, references, duplicate reasons and line descriptions, asset
descriptions, serials and tags, period names, account codes, schedule and
recurring descriptions and payroll employee names now meet the one
free-text detector in the Ledger command itself (FreeTextHoldsTin), so a
caller other than the MCP layer cannot journal a tax id (BS-partner-2).
Replay never refuses (BS-entry-4). Draft notes, discard reasons, no-party
reasons and send references and notes move from the strict nine-digit
reading to the shapes (parties::check_note), as the owner chose on
2026-11-21; party fields, names and recipients keep the strict reading.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 14:51:47 -07:00
1 parent ff58b055ce
commit 548901ce7d
9 files changed
+136 -18

No files matched your search

+4 -4
View File
@@ -474,10 +474,10 @@ impl BooksServer {
"due_date, or terms, or the customer's default terms, or invoicing.default_terms",
)?;
if let Some(r) = &p.customer_ref {
ledger_core::parties::check_text("the customer reference", r)?;
ledger_core::parties::check_note("the customer reference", r)?;
}
if let Some(m) = &p.memo {
ledger_core::parties::check_text("the memo", m)?;
ledger_core::parties::check_note("the memo", m)?;
}
let settings = self.settings();
let fields = arap::InvoiceFields {
@@ -616,10 +616,10 @@ impl BooksServer {
);
}
if let Some(m) = &p.memo {
ledger_core::parties::check_text("the memo", m)?;
ledger_core::parties::check_note("the memo", m)?;
}
if let Some(r) = &p.duplicate_reason {
ledger_core::parties::check_text("the duplicate reason", r)?;
ledger_core::parties::check_note("the duplicate reason", r)?;
}
// The file is taken before anything is written: an upload is used
// up only by the call that files it (files.rs INVARIANT 1).
+1 -1
View File
@@ -1550,7 +1550,7 @@ impl BooksServer {
if r.trim().is_empty() {
return Err("say why the entry has no counterparty".into());
}
ledger_core::parties::check_text("reason", r)?;
ledger_core::parties::check_note("the reason", r)?;
store
.set_entry_party(p.entry_id, None)
.map_err(|e| e.to_string())?;