Real-Time Double-Entry Ledger Watchdog
Continuously audits zero-sum debit/credit balance and clearing account staleness.
Database-enforced tenant isolation with zero cross-tenant leakage.
Every tenant-scoped table in OpenTeq enforces ENABLE ROW LEVEL SECURITY and FORCE ROW LEVEL SECURITY, paired with composite tenant foreign keys and transaction-scoped SET LOCAL app.current_tenant_id binding.
withTenantTransaction executes SELECT set_config('app.current_tenant_id', $1, true) inside BEGIN...COMMIT so connection poolers never leak tenant state across requests.
Cross-table references use composite keys like FOREIGN KEY (tenant_id, invoice_id) so even system jobs cannot accidentally link records across tenants.
All Redis/KV keys follow tenant:{tenantId}:{domain}:{key}, and background workers re-verify tenant ownership before mutating state.
Continuously audits zero-sum debit/credit balance and clearing account staleness.
Compares legacy vs. target ERP AR balances and scans script conflicts pre-cutover.
Bundles immutable ledger lineage, webhook signatures, and RLS proofs for auditors.
Start with a single Wave 1 agent or equip a complete role blueprint. Every tenant runs on forced PostgreSQL RLS and zero-sum double-entry accounting.