docs: free text meets a tax id's shapes, bank files mask, chart files refuse (WB-partner-15)

The claim on BS-partner-2 gains a marked CHOICE (the owner, 2026-11-21:
shapes on free text, strict on party fields, masking on bank imports) and
the product rule WB-partner-15 with the downsides accepted; the tool
interface, the handbook sections an assistant reads (parties and TINs,
files in and out, attestations and audit) and the two import tools'
descriptions say what is refused, what is masked and what the audit
names.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 15:14:02 -07:00
1 parent 0c6b6586fc
commit d2384dfe7c
12 files changed
+129 -17

No files matched your search

+1 -1
View File
@@ -722,7 +722,7 @@ pub fn decimal(s: &str) -> Option<Decimal> {
/// looks like a tax id and nothing else.
/// SOURCE: BS-partner-2 (no full TIN in the books); wanderbooks' CHOICE on
/// it (the owner, 2026-11-21: shapes on free text, strict on party
/// fields, masking on bank imports), docs/spec/claims/partner.md.
/// fields, masking on bank imports), WB-partner-15.
/// INVARIANTS:
/// 1. Nine digits standing alone, an SSN's 3-2-4 and an EIN's 2-7 are
/// found, with any dash, dot or space (Unicode forms too) between
+4 -1
View File
@@ -564,7 +564,10 @@ mod engine {
let r =
f.l.replay_reverse_entry(e, day(2), &format!("undo {TIN}"))
.unwrap();
assert_eq!(f.l.get_entry(r).unwrap().description(), format!("undo {TIN}"));
assert_eq!(
f.l.get_entry(r).unwrap().description(),
format!("undo {TIN}")
);
let ann = ledger_core::Annotation {
attachment_id: 1,
fields: ledger_core::AnnotationFields {
+1 -1
View File
@@ -117,7 +117,7 @@ pub struct MaskedBankImport {
///
/// ```text
/// GOAL: a bank file is journaled whole, and no full tax id is.
/// SOURCE: BS-partner-2; docs/spec/claims/partner.md (the CHOICE: masking
/// SOURCE: BS-partner-2; WB-partner-15 (the CHOICE: masking
/// on bank imports).
/// INVARIANTS:
/// 1. No kept description holds a number the detector finds.
+1 -3
View File
@@ -225,9 +225,7 @@ mod tests {
// A blank line counts as a line of the file.
assert!(why("1000,Cash,asset,\n\n1010,Bad 000000000,asset,\n").contains("row 4"));
// What is no tax id goes through.
let ok = parse_chart_csv(&format!(
"{header}1234567890,Loan 2026,liability,\n"
));
let ok = parse_chart_csv(&format!("{header}1234567890,Loan 2026,liability,\n"));
assert_eq!(ok.unwrap().len(), 1);
}
@@ -8,7 +8,7 @@ The receipt rule in force: {evidence_rule}
- books.audit { through, scope } without confirmed lists the checks and changes nothing; show it to the human. Then call it again with confirmed: true and the preview. It files the workpaper (JSON and PDF, category workpaper) and journals the run. books.workpaper { id } gives it back: the JSON, and the PDF handed over (run its download command to save it).
- scope: month (a month-end), annual (a fiscal year), cpa_handoff (the year, for the CPA package), full (everything from the start of the books).
- It checks the trial balance, the accounting equation, the profit and loss against equity, the cash flow's footing, the A/R and A/P control accounts, closes, schedules and depreciation, the asset register, every posted entry against the receipt rule, open drafts, tax categories, 1099 decisions and the settings; then the journal's chain, the stored files, the access log and the backups. A finding is a failure (the books are wrong or cannot be shown right), a warning (unfinished or a rule not met) or a note (listed so the workpaper is whole: a reversal rests on its original's receipt).
- It checks the trial balance, the accounting equation, the profit and loss against equity, the cash flow's footing, the A/R and A/P control accounts, closes, schedules and depreciation, the asset register, every posted entry against the receipt rule, open drafts, tax categories, 1099 decisions and the settings; then the journal's chain, the stored files, the access log, a journal line whose text field looks like a tax id (a warning naming the line and the field, never the number; the journal is never rewritten, so correct it with a reversal and keep the tax id in the vault) and the backups. A finding is a failure (the books are wrong or cannot be shown right), a warning (unfinished or a rule not met) or a note (listed so the workpaper is whole: a reversal rests on its original's receipt).
- Fix findings with journaled corrections (a reversal, a receipt attached, a decision recorded), never by editing: posted entries stay as they are. Then audit again.
- The same books, day and scope give the run that exists: asking again files nothing. The books are "the same" while no entry, document, close, settings or role change has been made; filing a receipt, an audit or an attestation does not change them.
- Books that have not declared audits refuse a confirmed audit and every attestation with format_upgrade_pending until the owner's upgrade (books.start says so). Nothing else about them changes.
+1 -1
View File
@@ -8,7 +8,7 @@
## Importing a bank CSV (books.import_bank_csv)
A QuickBooks-style bank or credit-card CSV: 3 columns Date, Description, Amount (payments negative), or 4 columns Date, Description, money out, money in (Intuit heads them Credit, Debit). Slash dates must settle month-first or day-first from the file itself or from date_order ("month_first" for mm/dd, "day_first" for dd/mm); ask the human when the tool says the dates read either way. It creates one DRAFT entry per transaction, all or none: the bank account on one side, a categorized offset on the other (the longest matching rule pattern, else default_offset_code). Give the CSV as upload_id: upload it with books.begin_upload purpose import and `wanderbooks upload` (a file never passes through you). Review with books.digest, then post. File the export too (books.file_document category import_source) and pass source_attachment_id: it is linked to the bank account, so the import traces to its source (never to the drafts: a bank export is not a receipt).
A QuickBooks-style bank or credit-card CSV: 3 columns Date, Description, Amount (payments negative), or 4 columns Date, Description, money out, money in (Intuit heads them Credit, Debit). Slash dates must settle month-first or day-first from the file itself or from date_order ("month_first" for mm/dd, "day_first" for dd/mm); ask the human when the tool says the dates read either way. It creates one DRAFT entry per transaction, all or none: the bank account on one side, a categorized offset on the other (the longest matching rule pattern, else default_offset_code). Give the CSV as upload_id: upload it with books.begin_upload purpose import and `wanderbooks upload` (a file never passes through you). Review with books.digest, then post. File the export too (books.file_document category import_source) and pass source_attachment_id: it is linked to the bank account, so the import traces to its source (never to the drafts: a bank export is not a receipt). A bank's description often carries a nine-digit reference, so the file is not refused for one: a number in it that reads as a tax id is kept masked to its last four digits, and the answer says how many values were masked and on which lines (masked_count, masked, masked_note); tell the human, who can check the bank's own statement. A chart CSV (books.import_chart_csv) is refused whole if a cell looks like a tax id; the refusal names its row and column.
## Exporting a report (books.export)
@@ -11,7 +11,7 @@
- Every post_entry preview says where the entry stands (party_policy, party_missing, party_suggestions): under the `[books] parties` setting "suggest" (the default), when party_missing, name the likely party to the human and tag it (or add it) before confirming; under "require", posting is refused (party_required) until the entry names a party or is marked as having none (books.set_entry_party with party null and no_party_reason, or draft_entry no_party_reason: only for an entry with truly no counterparty, like a transfer between the company's own accounts); under "off", don't raise it.
- Record W-9 facts (books.set_w9) for contractors and landlords before paying them, and W-4 facts (books.set_w4) for employees before their first payroll; name the employee party on every books.run_payroll line.
- Never put a full TIN or SSN anywhere in the books, only the last four digits: the engine refuses any nine-digit number in a party field. The full TIN goes only to the encrypted TIN vault, and every member's and every 1099 payee's belongs there: books.set_tin (party, tin, tin_type: ssn, ein, itin; any role, so each member's SSN for their K-1) and books.set_w9 with tin and tin_type for a payee's W-9, and the signed form with w9_upload_id (books.begin_upload purpose w9; never books.file_document or books.attach_receipt: the form shows the TIN).
- A full TIN lives in the vault: keep it out of descriptions, notes, file names and version-history messages. books.get_w9 hands the signed form over (run its download command to save it for the human); books.purge_tin (preview, then confirmed, with a reason) deletes a TIN no longer needed.
- A full TIN lives in the vault: keep it out of descriptions, notes, file names and version-history messages. Every tool refuses a string that looks like a tax id (nine digits standing alone, or an SSN's 3-2-4 or an EIN's 2-7 grouping), whichever field it is in, before anything is written, and says which field; a party's own fields refuse any run of nine digits. An invoice number, a phone number or a reference of ten digits or more is no tax id. If a bank or vendor reference is nine digits, write its last four. books.get_w9 hands the signed form over (run its download command to save it for the human); books.purge_tin (preview, then confirmed, with a reason) deletes a TIN no longer needed.
- books.parties lists the directory (each party's TIN last four from its TIN or W-9 facts), books.party shows one party with the year's totals, and books.show party opens it in the viewer. Archive (books.update_party archived) parties no longer dealt with; never delete history.
## Tagging an entry with several parties (books.set_entry_party)
+1 -1
View File
@@ -11,7 +11,7 @@
//! SOURCE: BS-partner-2; WB-format-10 (a refused call writes nothing);
//! wanderbooks' CHOICE on BS-partner-2 (the owner, 2026-11-21:
//! shapes on free text, strict on party fields, masking on bank
//! imports), docs/spec/claims/partner.md.
//! imports), WB-partner-15.
//! INVARIANTS:
//! 1. Every string a write tool's schema has (a field, an array's
//! items, a map's values and keys, any untyped value) is in TABLE
+1 -1
View File
@@ -371,7 +371,7 @@ impl BooksServer {
#[tool(
name = "books.import_chart_csv",
title = "Import a chart of accounts",
description = "Import a chart of accounts from CSV (header: code,name,type,parent_code,tax_category; the last is optional), as upload_id: upload it with books.begin_upload purpose import and `wanderbooks upload` (a file never passes through you). Types: asset, liability, equity, revenue, expense. Parents must come before children. Fails on the first bad row; nothing is half-imported. A revenue or expense row without a tax_category is listed in warnings, or, under policy.require_tax_category = refuse, refuses the file.",
description = "Import a chart of accounts from CSV (header: code,name,type,parent_code,tax_category; the last is optional), as upload_id: upload it with books.begin_upload purpose import and `wanderbooks upload` (a file never passes through you). Types: asset, liability, equity, revenue, expense. Parents must come before children. Fails on the first bad row, a cell that looks like a tax id included (it names the row and column); nothing is half-imported. A revenue or expense row without a tax_category is listed in warnings, or, under policy.require_tax_category = refuse, refuses the file.",
annotations(
read_only_hint = false,
destructive_hint = false,
+1 -1
View File
@@ -709,7 +709,7 @@ impl BooksServer {
#[tool(
name = "books.import_bank_csv",
title = "Import a bank CSV as drafts",
description = "Import a bank or card CSV (Date, Description, Amount; or Date, Description, money out, money in) as one DRAFT entry per transaction, all or none: the bank account on one side, a categorized offset on the other. Give the CSV as upload_id (books.begin_upload purpose import; a file never passes through you). Ambiguous slash dates need date_order. Review with books.digest, then post. Also file the export (books.file_document category import_source) and pass source_attachment_id. Details in books.handbook section files-in-out.",
description = "Import a bank or card CSV (Date, Description, Amount; or Date, Description, money out, money in) as one DRAFT entry per transaction, all or none: the bank account on one side, a categorized offset on the other. Give the CSV as upload_id (books.begin_upload purpose import; a file never passes through you). Ambiguous slash dates need date_order. A description holding a number that reads as a tax id is kept masked to its last four digits (masked_count, masked). Review with books.digest, then post. Also file the export (books.file_document category import_source) and pass source_attachment_id. Details in books.handbook section files-in-out.",
annotations(
read_only_hint = false,
destructive_hint = false,