- Migration v9 adds idx_applications_user_flat_started on
(user_id, flat_id, started_at DESC). Covers latest_applications_by_flat
inner GROUP BY and the outer JOIN without a table scan.
- Push the protokoll date range into SQL instead of pulling 5000 rows
into Python and filtering there: new audit_in_range / errors_in_range
helpers with a shared _range_filter_rows impl. Protokoll page limits
500, CSV export 5000.
- _row_to_profile collapses to `dict(profile_row)`. ProfileModel (Pydantic)
already validates and coerces types on the apply side, extras ignored.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>