The Enforcement Dispatcher
Every financial transaction flows through a single mandatory choke point. The Enforcement Dispatcher resolves the transaction type to a flow configuration, gathers signals, executes the guard chain, computes the outcome, and creates an immutable decision record. No journal entry is created without a decision.
The Guard Chain
Guards are stateless, independent, and composable. Same inputs produce the same outputs. Each guard checks one specific invariant. The Flow Registry maps transaction types to guard sequences, so different transactions face different enforcement paths.
| Guard | Category | Enforces | Override |
|---|---|---|---|
| BalanceGuard | Invariant | Validates debits equal credits on every journal entry | No |
| ClosedPeriodGuard | Temporal | Blocks posting to closed fiscal years | Yes |
| FundSegregationGuard | Policy | Prevents cross-fund cash movement in non-transfer entries | Yes |
| TrustSegregationGuard | Trust | Prevents commingling of trust and operating funds (regulatory requirement) | No |
| SubledgerGuard | Invariant | Validates subledger references exist on journal entry lines | No |
| InvariantGuard | Invariant | Enforces transaction type invariants (correct account types, line counts) | No |
| FundEligibilityGuard | Eligibility | Reserve fund eligibility checks | Yes |
| BillPaymentGuard | Policy | Bill approval status and duplicate payment prevention | No |
| VendorRiskGuard | Compliance | Blocks payment to vendors with debarment, expired license, or expired insurance | Yes |
| DisbursementComplianceGuard | Compliance | State-specific disbursement rules: board approval thresholds, dual signature, reserve restrictions | Yes |
| ReversalGuard | Invariant | Validates reversal source entry exists and is valid | No |
| LoanCovenantGuard | Debt | Evaluates debt covenants (DSCR, reserve ratio, delinquency) at loan and HOA scope | Yes |
| PaymentSplitGuard | Debt | Validates principal + interest + fees split in schedule-locked and schedule-flex modes | No |
| InterestCalculationGuard | Debt | Recomputes accrual math against loan terms, day-count convention, and index rates | No |
Immutable Decision Records
Every journal entry has a corresponding EnforcementDecision record. The decision captures the full guard chain results, the policy_snapshot_hash (SHA-256 of the guard manifest for tamper detection), and the outcome: ALLOW, BLOCK, OVERRIDE, or ERROR. The record is immutable after creation via ImmutableModelMixin. Unique constraints prevent duplicate POST_PERSIST decisions per journal entry.
Ledger Integrity Verification
The Ledger Integrity Scan runs six automated checks against the general ledger. It produces an immutable IntegritySnapshot with a SHA-256 content hash. Findings are categorized by severity. The scan runs daily via Celery and is available on-demand from the Integrity Scan Viewer.
Override Governance
Overrides are scope-based, expiring, and tracked. An override is not a bypass. It is a documented, authorized, time-limited exception with complete audit telemetry. Five guards cannot be overridden at all.
| Override Scope | Target | Max Duration |
|---|---|---|
| CLOSED_PERIOD | Post to a closed period (requires fiscal year + date range) | 30 days |
| FUND_SEG | Cross-fund cash movement (requires specific fund) | 14 days |
| YEAR_CLOSE | Close with imbalance (requires fiscal year) | 90 days |
| INTEGRITY_GATE | Override integrity gate block | 24 hours |
| VENDOR_RISK | Override vendor risk block (requires documented reason) | 24 hours |
Override Structure
- Required expiration date on every override (no permanent overrides)
- Minimum 20-character reason (immutable after creation)
- Authorized-by user, timestamp, and IP address captured
- original_check_result preserves the bypassed check as JSON snapshot
- Scope-specific target constraints validated in .clean()
Usage Telemetry
- Every usage logged as an AuditOverrideUsage record
- Links to the journal entry that consumed the override
- times_used counter on the override record
- last_used_at timestamp for monitoring
- Full usage context captured as JSON
Fund Integrity & Non-Commingling
Operating funds, reserve funds, trust funds, and special funds are structurally separated. Two guards enforce the boundary: FundSegregationGuard prevents operating/reserve cross-posting, and TrustSegregationGuard prevents trust/operating commingling. The trust guard cannot be overridden.
Institutional Artifacts
The audit trail produces institutional-grade artifacts for external consumption. Every artifact is generated from live ledger data, hashed with SHA-256, version-chained, and stored in the Vault. Board members can attest to artifacts with content-hash binding at signing time.
| Packet | Name | Audience |
|---|---|---|
| CEP | Close Evidence Pack | Auditors. 12 evidence sections, 14 risk flags. Generated at period close and lock. |
| RC | Resale Certificate | Title companies, escrow officers. 10 compliance profiles across 7 states. |
| RSR | Reserve Funding Status Report | Boards, reserve study firms. 30-year projection, component register. |
| LDS | Loan Disclosure Statement | Lenders. Schedule hash, subledger/GL reconciliation, covenant status. |
| FADR | Funds Authorization & Disbursement Record | Boards. Payment evidence chain from approval to settlement. |
| GCA | Governance Controls Attestation | Boards. Controls effectiveness summary with scoring. |
| FSR | Fiduciary Shield Record | Boards, D&O insurers. Board fiduciary duty compliance evidence. |
| BP | Board Packet | Board meetings. Bundled financial statements for monthly review. |
| CARI | 4 Report Types (Lender, Insurer, Title, Buyer) | Third-party consumers. Consent-gated risk reports via authenticated API. |
CPA Audit Portal
External CPAs access HOA financial data through a token-gated, unauthenticated, read-only portal. No Django login required. Every page access creates an immutable AuditEngagementEvent with resource_type tracking. Engagement types: Review, Audit, Compilation, Tax Preparation, and Agreed-Upon Procedures.
Compliance Reporting
Enforcement Reports
- Decision Explorer: filter by outcome, flow_name, date range
- Detail view: full guard chain with PASS/FAIL/SKIP badges
- Override report: scope, reason, times_used, expiration
- Staff enforcement dashboard (platform-wide, per-HOA drill-down)
- policy_snapshot_hash tamper detection across decisions
Financial Verification
- Integrity scan history with fingerprint-based deduplication
- Fund reconciliation verification
- Control account reconciliation (AR, AP, Loans vs. GL, $0.02 tolerance)
- Bank statement import (BAI2, OFX/QFX, CSV with format auto-detection)
- Debt subledger/GL reconciliation via LoanReconciliationRun audit trail
Governance is not a workflow. It is a system property. The architecture ensures that money cannot move unless the guard chain has determined it is permissible. Every decision is preserved. Every signal is captured. Every artifact is hashed. Fiduciary duty is encoded in code, not delegated to manual controls.