Two bugs introduced in the db.DB leak-fix commits:
1. RowError ordering (both RowsErr tests):
sqlmock.RowError must be called BEFORE AddRow — the error is
attached to the next row returned by Next(). Calling it after AddRow
attaches to a future row that never arrives, so rows.Err() returns
nil. This broke the RowsErr contract (handler collects partial results
before seeing the error) and caused empty results instead of 1.
2. Deleted NullsOmitted test:
TestListDelegationsFromLedger_NullsOmitted was accidentally removed.
Restored with the prevDB+t.Cleanup pattern and correct
sql.NullString{}/nil time.Time values for SQL NULL simulation.
3. ScanError tests (corrected test description):
Go's rows.Scan panics on wrong column count (not error-return). The
handler has no recover() in listDelegationsFromLedger, so the scan
panic exits the loop immediately. Updated test comments to reflect
reality: bad rows before good rows → panic → empty result. The mock
expectations still register and ExpectationsWereMet passes.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>