feat(audit): books.audit, the attestation tools and the CPA gate (P8)

The whole re-audit through the tools: books.audit previews its checks, then
with the preview's digest runs them, files the workpaper and journals the
run; the same books, day and scope return the run that exists.
books.attest_receipt, books.review_entry and books.attest_period record a
named client's claim with its self-reported method; books.attestations
weighs each against policy.attestation_bar as it stands. Under
policy.cpa_package_requires_audit = refuse, books that declared audits
cannot export the CPA package without a counted audit for the handoff at the
current head unless a reason is given, which is journaled as a decision
(D-9). Needs attention asks for the month-end attestation, the annual audit
and the audit before the handoff. Rules B-45, the handbook section, the
interface, parity, receipt-store and testing records, and the As-built
block. Merge needs no go-ahead: the live books refuse the new writes until
the owner gives it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
swaitsandClaude Fable 5.1 committed 2026-10-29 15:54:26 -06:00
1 parent d45e842873
commit 45bcce679b
23 files changed
+2128 -22

No files matched your search

+22
View File
@@ -1146,6 +1146,28 @@ fn happy_path(name: &str) -> Mcp {
json!({"period_id": p, "confirmed": true}),
);
// P8: an audit of the month, its workpaper, and the claims that stand
// behind it.
let audit_run = m.ok(
"books.audit",
json!({"scope": "month", "through": "2026-01-31", "confirmed": true}),
)["run"]["id"]
.as_u64()
.unwrap();
m.ok("books.workpaper", json!({"id": audit_run}));
let audited = m.attach(Some(e1), b"audit receipt");
m.ok(
"books.attest_receipt",
json!({"attachment_id": audited, "entry_id": e1, "amount": "10000.00",
"date": "2026-01-02", "method": {"reasoning_effort": "high"}}),
);
m.ok(
"books.review_entry",
json!({"entry_id": e1, "method": {"reasoning_effort": "high"}}),
);
m.ok("books.attestations", json!({}));
m.ok("books.attest_period", json!({"period": "2026-01"}));
// How the books are kept: start, conventions, decisions, open items,
// a template and an approval, and the settings file moving in.
m.ok("books.start", json!({}));