feat(audit): audit runs and attestations are journaled (P8)
A claim that someone checked the books is evidence the CPA handoff rests on, so it is a journal fact and replays: audit.run (a programme run through a day at the books' figure head, with the hashes that make it reproducible and the two filed workpapers), receipt.attested, entry.reviewed and period.attested. Behind the journal feature audits, schema 20; no figure moves. The figure head is the last line that bears on a figure: filing a workpaper, a run or an attestation never makes an audit stale, an entry, document, close, settings or role change does, so a period is attested only on an audit that still describes the books. A receipt reading that differs from the entry is recorded as disagreeing and never counts; whether a claim counts is derived against the bar when asked, never stored. The store also reads what a ledger cannot: the chain, the database against a replay, stored and extracted files, the access log, duplicate files, and the backups' standing handed in by the server. Fixture old-books/p8_before was written by the version before this one and opens to its figures. period.attested was the tests' placeholder for an unknown event type; they use ledger.not_yet_written now. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
843bcc421f
commit
6b7dccd1ee
19 files changed
+2479
-18
No files matched your search
@@ -5,7 +5,7 @@
|
||||
//! is the current version.
|
||||
|
||||
/// Current schema version.
|
||||
pub const SCHEMA_VERSION: u32 = 19;
|
||||
pub const SCHEMA_VERSION: u32 = 20;
|
||||
|
||||
/// Migrations, in order. `MIGRATIONS[i]` migrates from version `i` to `i+1`.
|
||||
pub const MIGRATIONS: &[&str] = &[
|
||||
@@ -485,5 +485,41 @@ CREATE TABLE IF NOT EXISTS draft_states(
|
||||
state TEXT NOT NULL,
|
||||
note TEXT NULL
|
||||
);
|
||||
"#,
|
||||
r#"
|
||||
-- v20: audits and attestations (plan P8, feature `audits`). An audit run
|
||||
-- is a row per `audit.run`: the date it covers, the figure head it was
|
||||
-- made at, the hashes that make it reproducible and the filed workpaper.
|
||||
-- An attestation is a row per `receipt.attested`, `entry.reviewed` or
|
||||
-- `period.attested`; whether one counts is derived against
|
||||
-- `policy.attestation_bar` when asked and never stored. The method is the
|
||||
-- client's own claim, kept as canonical JSON. Amounts stay TEXT.
|
||||
CREATE TABLE IF NOT EXISTS audits(
|
||||
id INTEGER PRIMARY KEY,
|
||||
through TEXT NOT NULL,
|
||||
through_seq INTEGER NOT NULL,
|
||||
scope TEXT NOT NULL,
|
||||
program_version TEXT NOT NULL,
|
||||
tb_hash TEXT NOT NULL,
|
||||
findings_sha256 TEXT NOT NULL,
|
||||
workpaper_attachment INTEGER NULL,
|
||||
workpaper_pdf INTEGER NULL,
|
||||
seq INTEGER NOT NULL
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS attestations(
|
||||
seq INTEGER PRIMARY KEY,
|
||||
kind TEXT NOT NULL,
|
||||
attachment_id INTEGER NULL,
|
||||
entry_id INTEGER NULL,
|
||||
period_id INTEGER NULL,
|
||||
audit_run_id INTEGER NULL,
|
||||
by_who TEXT NOT NULL,
|
||||
at_ts TEXT NOT NULL,
|
||||
method TEXT NOT NULL,
|
||||
amount_checked TEXT NULL,
|
||||
date_checked TEXT NULL,
|
||||
disagrees INTEGER NULL,
|
||||
note TEXT NULL
|
||||
);
|
||||
"#,
|
||||
];
|
||||
Reference in new issue
Block a user