Financial Automation Company H6.ai: Freezing Real Invoice Status with Database Branches, Multi-Model Judge Regression Testing for AI Pipelines
H6.ai engineers Benji Borg and Mauro Pirrone describe how they leverage Lakebase Postgres's copy-on-write branching to solve regression testing challenges on their AI-driven accounts payable automation platform. Because financial data changes continuously, the same invoice may yield different processing results at different times, making it difficult for traditional methods to distinguish between differences caused by code changes versus data shifts. Their approach retains frozen database snapshots for each customer; after performing schema migrations on a snapshot branch, they fork disposable run branches to execute candidate pipelines against real data, finally determining correctness through deterministic assertions and a cross-provider AI judge panel.
In AI-driven accounts payable automation, the most thorny testing problem is not the code logic itself, but the fact that the data is constantly moving. In a Databricks official blog post, two H6.ai engineers, Benji Borg and Mauro Pirrone, described this dilemma: an invoice at 10:00 AM might match a purchase order with remaining quantity, but by afternoon that order could be partially consumed, modified, or closed. The same invoice, processed with the same code, yields different results. When regression tests show discrepancies, the team cannot determine whether the difference was caused by a code change or natural changes in customer data.
Their solution is not synthetic data or static fixtures, but preserving the real state. H6.ai runs an independent Lakebase Postgres database for each customer, storing purchase orders, suppliers, charts of accounts, historical transactions, and custom policies synced from the ERP. When the team discovers an invoice has been processed incorrectly, they create a copy-on-write branch of that customer's database as a snapshot. The branch does not duplicate any data; it shares storage with the parent database and only records new changes made on the branch. In the snapshot, that purchase order remains open, with its remaining quantity and price unchanged, even if it has long since been closed in the ERP.