test(store): golden file for draft states, discard and the evidence gate

One fixture serves both parity rows (draft states and discard; the one
evidence gate). A Store fixture, because the gate's receipt-on-file half
lives in the store. New fixture, built like books_for_drafts and extended.

Hand-computed in plan/golden-worksheets/draft-states-and-evidence-gate.md,
before serializing anything:
- Requirement (B-43 inv. 2, threshold strictly > 25.00): drafts of 40.00,
  60.00 and 100.00 are Required; 12.50 is Exempt (policy); the reversal
  (debits 100.00) is Exempt by origin (D-47, D-12); the closing entry
  (52.50) is Exempt by origin. Receipt counts are pinned beside them: the
  gate refuses the 40.00 and 60.00 drafts (no receipt) with the journal
  head unchanged, then lets the rest post; the reversal has no receipt.
- Trial balance 2026-01-31 before and after the discard of the 60.00
  draft: Cash 447.50 Dr, Equity 500.00 Cr, Software 52.50 Dr, totals
  500.00; identical after the discard, next entry id 7 both times.
- The close is refused while the draft is open (B-12), accepted after the
  discard: Dr Retained Earnings 52.50 / Cr Software 52.50 (a loss), id 7;
  trial balance then 447.50 Dr, 500.00 Cr, 52.50 Dr.
Code and hand values agreed on the first run. Strength: four scratch edits
of the golden (a balance, a decision, a discard reason, the next id) each
fail the test.

Adds serde::Serialize to evidence::Requirement (tagged, snake_case) so the
gate's result can be pinned.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-07 10:39:36 -07:00
1 parent 3ac3e8b1b4
commit 2593931c47
4 files changed
+670 -1

No files matched your search

@@ -0,0 +1,252 @@
{
"drafts_open": [
{
"entry_id": 2,
"date": "2026-01-10",
"description": "Figma annual plan",
"debits": "40.00",
"state": "awaiting_evidence",
"note": "invoice due from Figma",
"receipts": 0,
"requirement": {
"decision": "required",
"reason": "its debits 40.00 are strictly greater than the 25.00 threshold"
}
},
{
"entry_id": 3,
"date": "2026-01-11",
"description": "Duplicate hosting invoice",
"debits": "60.00",
"state": "building",
"note": null,
"receipts": 0,
"requirement": {
"decision": "required",
"reason": "its debits 60.00 are strictly greater than the 25.00 threshold"
}
},
{
"entry_id": 4,
"date": "2026-01-15",
"description": "Office supplies",
"debits": "12.50",
"state": "building",
"note": null,
"receipts": 0,
"requirement": {
"decision": "exempt",
"source": "the receipt policy (policy.evidence.*): under the threshold, or on exempt accounts"
}
},
{
"entry_id": 5,
"date": "2026-01-20",
"description": "Hosting",
"debits": "100.00",
"state": "building",
"note": null,
"receipts": 1,
"requirement": {
"decision": "required",
"reason": "its debits 100.00 are strictly greater than the 25.00 threshold"
}
}
],
"gate_refusals": [
{
"entry_id": 2,
"refused": "receipt_required",
"journal_head_unchanged": true
},
{
"entry_id": 3,
"refused": "receipt_required",
"journal_head_unchanged": true
}
],
"posted_entries": [
{
"entry_id": 1,
"description": "Seed",
"reversal_of": null,
"debits": "500.00",
"receipts": 1,
"requirement": {
"decision": "required",
"reason": "its debits 500.00 are strictly greater than the 25.00 threshold"
}
},
{
"entry_id": 2,
"description": "Figma annual plan",
"reversal_of": null,
"debits": "40.00",
"receipts": 1,
"requirement": {
"decision": "required",
"reason": "its debits 40.00 are strictly greater than the 25.00 threshold"
}
},
{
"entry_id": 4,
"description": "Office supplies",
"reversal_of": null,
"debits": "12.50",
"receipts": 0,
"requirement": {
"decision": "exempt",
"source": "the receipt policy (policy.evidence.*): under the threshold, or on exempt accounts"
}
},
{
"entry_id": 5,
"description": "Hosting",
"reversal_of": null,
"debits": "100.00",
"receipts": 1,
"requirement": {
"decision": "required",
"reason": "its debits 100.00 are strictly greater than the 25.00 threshold"
}
},
{
"entry_id": 6,
"description": "Reverse hosting (billed in error)",
"reversal_of": 5,
"debits": "100.00",
"receipts": 0,
"requirement": {
"decision": "exempt",
"source": "a reversal: its evidence is its original's (B-43, D-47, D-12)"
}
}
],
"close_refused_with_draft": {
"refused": "drafts_in_period",
"period_id": 1
},
"discard_of_posted_refused": {
"entry_id": 1,
"refused": true
},
"before_discard": {
"drafts": [
{
"entry_id": 3,
"date": "2026-01-11",
"description": "Duplicate hosting invoice",
"debits": "60.00",
"state": "building",
"note": null,
"receipts": 0,
"requirement": {
"decision": "required",
"reason": "its debits 60.00 are strictly greater than the 25.00 threshold"
}
}
],
"next_entry_id": 7,
"trial_balance": {
"lines": [
{
"code": "1000",
"name": "Cash",
"debit": "447.50",
"credit": "0"
},
{
"code": "3000",
"name": "Owner's Equity",
"debit": "0",
"credit": "500.00"
},
{
"code": "6100",
"name": "Software",
"debit": "52.50",
"credit": "0"
}
],
"total_debits": "500.00",
"total_credits": "500.00"
}
},
"draft_journal_lines": [
{
"type": "entry.draft_state_set",
"id": 2,
"state": "awaiting_evidence",
"note": "invoice due from Figma"
},
{
"type": "entry.draft_discarded",
"id": 3,
"reason": "entered twice"
}
],
"after_discard": {
"drafts": [],
"next_entry_id": 7,
"trial_balance": {
"lines": [
{
"code": "1000",
"name": "Cash",
"debit": "447.50",
"credit": "0"
},
{
"code": "3000",
"name": "Owner's Equity",
"debit": "0",
"credit": "500.00"
},
{
"code": "6100",
"name": "Software",
"debit": "52.50",
"credit": "0"
}
],
"total_debits": "500.00",
"total_credits": "500.00"
},
"trial_balance_equals_before": true
},
"close_after_discard": {
"closing_entry": 7,
"debits": "52.50",
"receipts": 0,
"requirement": {
"decision": "exempt",
"source": "a period's closing entry: derived from the books (B-43)"
}
},
"after_close": {
"trial_balance": {
"lines": [
{
"code": "1000",
"name": "Cash",
"debit": "447.50",
"credit": "0"
},
{
"code": "3000",
"name": "Owner's Equity",
"debit": "0",
"credit": "500.00"
},
{
"code": "3999",
"name": "Retained Earnings",
"debit": "52.50",
"credit": "0"
}
],
"total_debits": "500.00",
"total_credits": "500.00"
}
}
}