feat(import,store): bank files mask, chart files refuse, the audit finds an old line

A bank file's description cell is not typed by a person and often carries
a nine-digit reference, so books.import_bank_csv no longer meets a refusal
for one: a number that reads as a tax id is kept masked to its last four
digits (•••-••-1234) and the answer says how many values and on which
lines (masked_count, masked, masked_note). A chart file is typed by a
person: a cell that looks like a tax id refuses the file, naming its row
and column, never the number. The store's own attachment, unlink, withdraw
and void texts meet the same check. books.audit gains tax_id_in_journal: a
journal line an earlier version took whose text field looks like a tax id
is named by line and field, never the number; the books open and replay
as they are and the journal is never rewritten (BS-entry-4).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 15:05:19 -07:00
1 parent 7327d04897
commit 98b1adb754
8 files changed
+337 -11

No files matched your search

+37
View File
@@ -362,6 +362,43 @@ fn integrity_detects_each_seeded_defect() {
drop(w);
Store::open(&dir).unwrap().integrity_findings()
}
"tax_id_in_journal" => {
// A line an earlier version took: its description holds an
// SSN's shape. The books open on it all the same, and the
// audit says where it is, never what.
let next = s.ledger().next_entry_id();
drop(s);
let mut w = JournalWriter::open(&dir.join(JOURNAL_FILE)).unwrap();
w.append(
"entry.created",
json!({"id": next, "date": "2026-03-01", "description": "paid 000-00-0000 in cash"}),
)
.unwrap();
drop(w);
let s = Store::open(&dir).expect("books holding such a line still open");
s.verify().expect("and still verify");
let found = s.integrity_findings();
let f = found
.iter()
.find(|f| f.code == "tax_id_in_journal")
.expect("found");
assert!(f.message.contains("`description`"), "{}", f.message);
assert!(
f.message.contains(&format!(
"journal line {}",
f.subject.describe().rsplit(' ').next().unwrap()
)),
"{}",
f.message
);
assert!(
!f.message.contains("0000"),
"never the number: {}",
f.message
);
assert!(f.message.contains("books.set_tin"), "{}", f.message);
found
}
"access_log_damaged" => {
std::fs::write(
dir.join("access.jsonl"),