feat(drafts): a draft has a state and can be discarded (P4)
Accounting reason: an entry that is finished but waits on its receipt is
a different thing from one still being built, and a draft that will
never post must have a way out, or the period that holds it open can
never close (the Lean hypothesis hdrafts). JournalEntry gains
DraftState { Building, AwaitingEvidence { note } }; Ledger gains
set_draft_state (a note: no line, balance or report moves),
discard_draft (a draft only; a posted entry is never removed, B-8; ids
are never reused; what was recorded about the draft goes with it) and
posted_seq (the journal line that posted an entry, for the digest's
since_seq). Lean Step.discard with its preservation proof and three
theorems (a discard moves no figure, removes only its draft, and
unblocks a close), listed in Audit.lean.
Tests: discard_unblocks_close (ledger-core invariants).
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
75882c5e07
commit
be8bcf340e
8 files changed
+347
-1
No files matched your search
@@ -854,6 +854,12 @@ pub enum LedgerError {
|
||||
#[error("{0}")]
|
||||
InvalidVoid(String),
|
||||
|
||||
/// A draft's state or discard was refused: the message says why (a
|
||||
/// note or reason that breaks the books' text rule, no reason given).
|
||||
/// Plan P4, rules.md B-43.
|
||||
#[error("{0}")]
|
||||
InvalidDraft(String),
|
||||
|
||||
/// A void invoice can't be recorded as sent: it was never a document
|
||||
/// the customer should have received (plan P4b S5, B-38).
|
||||
#[error("invoice {0} is void: a void invoice was never sent")]
|
||||
|
||||
Reference in new issue
Block a user