* perf(roms): stop MariaDB rescanning the library for smart collections
MariaDB plans the smart collection membership IN (subquery) as a semi-join that rescans every rom per page query. A NO_SEMIJOIN hint keeps it a plain subquery; other dialects don't emit the hint.
* perf(roms): parse each distinct filter value list once
The filter dropdown query decoded every JSON column of every row. The columns are now read as text, deduplicated, and each distinct list is parsed once. PostgreSQL decodes JSON in the driver, so its lists are merged as returned.
* test(roms): cover repeated filter value lists in pr-ready code review
* refactor(roms): pr-ready simplify pass
* style(roms): pr-ready polish
* fix(roms): address Greptile review
Fold filter value rows in batches of 5000 instead of materializing the whole result, keeping the parse-each-distinct-list-once dedup across batches, so /api/roms/filters no longer holds one row per ROM in memory (Greptile: filter requests retain every row). The repeated-lists test now runs with a batch size of 2 to cover the cross-batch path.
* fix(roms): pr-ready code review fixes
- Cast filter JSON columns to text in SQL, so PostgreSQL gets the
parse-once saving and a scalar JSONB value no longer crashes json.loads
- Stream filter rows with yield_per instead of only partitioning
- Name the JSON filter columns instead of hard-coding positions
- Add optimizer_hint_on_mysql next to force_index_on_mysql, with tests
- Make the repeated-lists test span batches regardless of row order
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(roms): pr-ready simplify pass
Collect each filter column's distinct JSON texts and parse them once at
the end, and key the JSON filter columns by their RomFiltersDict field so
the positional unpack and per-field return go away.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* style(roms): pr-ready polish
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>