Verifies the bank_rec_bootstrap migration step (a) creates precedents from existing partial.reconcile rows, (b) is idempotent on re-run, and (c) refreshes the MV without erroring. Three TransactionCase tests: - test_bootstrap_creates_precedents_from_existing_reconciles seeds two reconciles via the engine, wipes the auto-recorded precedents, then asserts the bootstrap produces source='backfill' precedents. - test_bootstrap_step_idempotent runs the bootstrap twice and asserts the second pass creates zero new precedents. - test_bootstrap_refreshes_mv_without_error runs the bootstrap on a clean partner and asserts no exception is raised and the result dict reports MV + pattern refresh outcomes. Implementation fixes uncovered by these tests: - precedent_backfill.backfill_precedents now pre-filters account.partial.reconcile to rows that touch a bank statement line on either side. Previously it walked every partial in the DB; on the westin-v19 dev DB that's 16k rows and the default limit=10000 missed the newest test fixtures (highest IDs). - backfill skips the periodic env.cr.commit() when running under a TestCursor, since committing inside a test breaks the rollback. Test count: 139 -> 142. Made-with: Cursor
4.5 KiB
4.5 KiB