@davoodmehraban89 / Aram / commits / 2eecd22
Fork 0

docs(control): define five-statement exact tie-outs and nonapproval semantics

davoodmehraban89 committed Oct 31, 2026 at 08:37 UTC 2eecd2293b0ff698a30ca2d016bfee3ffcbf5b14
1 file changed +68
docs/CROSS_STATEMENT_RECONCILIATION.md new
+68
@@ -0,0 +1,68 @@
1 +# ARAM — cross-statement reconciliation gate (NOT APPROVAL)
2 +
3 +## Purpose
4 +
5 +The five independent previews now need a single arithmetic gate before any combined analyst review packet can be considered:
6 +
7 +- Trial balance diagnostic
8 +- Balance sheet candidate
9 +- Income statement candidate
10 +- Statement of changes in equity candidate
11 +- Direct-method cash flow candidate
12 +
13 +`reconcile_cross_statements(...)` consumes the typed candidate objects produced by those modules. It does not rebuild or trust a report just because an individual module returned a positive eligibility flag.
14 +
15 +## Exact controls
16 +
17 +1. **Common source:** company code, fiscal year and source XLSX SHA-256 must be identical across all five candidates.
18 +2. **Trial balance:** recomputes opening, debit, credit, closing and net movement totals from the complete account trace; requires the debit-net opening and closing totals and debit/credit movement difference to be zero.
19 +3. **Balance sheet:** recomputes assets − liabilities − equity = 0 and compares the reported difference.
20 +4. **Equity:** balance-sheet equity total must exactly equal the statement-of-changes-in-equity closing total.
21 +5. **Profit:** income-statement net result must exactly equal the equity movement explicitly classified as `NET_PROFIT_LOSS`.
22 +6. **Cash:** caller must select the exact BS asset note/subnote keys that represent cash and cash equivalents, with a separate evidence reference for each. Their presentation total must exactly equal direct cash-flow closing cash.
23 +7. **Internal bridges:** recomputes the P&L bridge, equity opening + movement = closing, cash operating/investing/financing net flows and cash opening + net change = closing.
24 +8. **Cash account trace:** every cash account in the direct cash-flow candidate must exist in the trial-balance trace; opening, debit turnover, credit turnover, closing and source-row lineage must match exactly. The cash account list and opening/closing totals must also reconcile.
25 +
26 +All comparisons use exact Decimal values and zero tolerance. A missing note selection, duplicate BS note line, mismatched source hash, wrong scope, blocked upstream candidate or arithmetic mismatch makes the result ineligible.
27 +
28 +## Example invocation
29 +
30 +After the application has created all five typed candidates from the **same immutable workbook bytes**:
31 +
32 +```python
33 +from aram_backend.cross_statement_reconciliation import (
34 + CashBalanceNoteSelection,
35 + reconcile_cross_statements,
36 +)
37 +
38 +result = reconcile_cross_statements(
39 + balance_sheet=bs_candidate,
40 + income_statement=is_candidate,
41 + equity_changes=equity_candidate,
42 + cash_flow=cash_candidate,
43 + trial_balance=trial_balance_diagnostic,
44 + cash_balance_notes=[
45 + CashBalanceNoteSelection(
46 + statement_section="Current assets",
47 + note_number="C01",
48 + subnote_code="",
49 + evidence_ref="FINANCE-OWNER-CASH-NOTE-POLICY",
50 + ),
51 + ],
52 +)
53 +if not result.eligible_for_analyst_review:
54 + # Resolve every finding; never override or silently ignore it.
55 + print(result.findings)
56 +```
57 +
58 +The cash-note selection is an untrusted input. Its evidence reference is traceability, not authenticated approval. The caller must ensure that the selected BS notes include **all and only** cash and cash equivalents, including approved treatment of restricted cash and overdrafts.
59 +
60 +## Interpretation and limits
61 +
62 +`eligible_for_analyst_review=true` means the provided candidates, references and arithmetic tie out under their explicit user-supplied policies. It does **not** prove that the ledger, bank transactions, cash-account registry, mapping or note selection is complete or authentic.
63 +
64 +The result permanently marks `source_ledger_completeness_verified=false`, `accounting_policy_authorized=false`, `independently_reviewed=false`, `trusted_approvals=false`, `official_financial_statement=false`, `export_authorized=false`, `releasable=false`.
65 +
66 +No real accounting approval, statutory compliance, tax treatment, authenticated C1/C2/C3 review, database write, report export, GUI or installer is implemented by this gate. It is an engineering control only.
67 +
68 +Run `cd backend && pytest -q tests/test_cross_statement_reconciliation.py` and full Backend CI. Synthetic candidate objects are used in tests; never place real financial files or approvals in public GitHub.