test(cli,store): through the server a refusal writes nothing, a bank file is masked, a chart file refused; the store's own texts meet the check

The store's attestation notes and model names, attachment and document
texts and the unlink, withdraw and void reasons are checked before
anything is journaled, like the engine's. Two end-to-end tests changed
their words (not their data): spec_projects expects "tax id" where it
expected "TIN", documents expects "tax id" where it expected
"taxpayer", for the refusal the new check now gives first.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 15:38:14 -07:00
1 parent d2384dfe7c
commit 657daf43da
7 files changed
+298 -4

No files matched your search

+71
View File
@@ -301,6 +301,77 @@ fn stale_head_period_attestation_refused() {
s.verify().unwrap();
}
/// BS-partner-2 (WB-partner-15): the store's own texts (a file's name and
/// description, the reasons for unlinking, withdrawing and voiding, an
/// attestation's note, an entry's description) meet the one free-text check
/// before anything is journaled, whoever calls.
#[test]
fn the_store_refuses_text_that_looks_like_a_tax_id_and_journals_nothing() {
use ledger_core::LedgerError;
let dir = test_dir("tin-text");
let (mut s, fx) = books(&dir, None);
let tin = "000-00-0000";
let refused = |r: Result<(), StoreError>, what: &str| match r {
Err(StoreError::Ledger(LedgerError::FreeTextHoldsTin(why))) => {
assert!(!why.contains("0000"), "{what}: never the number: {why}");
}
other => panic!("{what}: expected a refusal for the tax id, got {other:?}"),
};
let (att, _, _) = s
.attach_receipt(Some(fx.entry), "r.txt", "text/plain", b"paper 40.00", None)
.unwrap();
let head = s.head();
refused(
s.attach_receipt(
None,
"s.txt",
"text/plain",
b"other",
Some(&format!("paid {tin}")),
)
.map(drop),
"a description",
);
refused(
s.attach_receipt(None, &format!("w9 {tin}.txt"), "text/plain", b"other", None)
.map(drop),
"a file name",
);
refused(
s.file_document(
"tax",
"t.txt",
"text/plain",
b"doc",
Some(&format!("ein {tin}")),
)
.map(drop),
"a document's description",
);
refused(
s.unlink_receipt(att, &format!("dup {tin}")).map(drop),
"an unlink reason",
);
refused(
s.withdraw_attachment(att, &format!("dup {tin}")),
"a withdraw reason",
);
refused(
s.create_entry(d(2, 1), &format!("x {tin}")).map(drop),
"an entry description",
);
refused(
s.reverse_entry(fx.entry, d(2, 1), &format!("x {tin}"))
.map(drop),
"a reversal",
);
let mut c = claim("high");
c.note = Some(format!("see {tin}"));
refused(s.review_entry(fx.entry, c).map(drop), "an attestation note");
assert_eq!(s.head(), head, "a refusal journals nothing");
s.verify().unwrap();
}
/// The integrity table: each code seeded alone.
#[test]
fn integrity_detects_each_seeded_defect() {