Files
romm/backend
Stu Anderson eff94b8766 chore(seeder): use realistic metadata (#5641)
* chore(seeder): fill IGDB and ScreenScraper metadata to real-world size

Seeded provider JSON was about half the size of a real library's, so
gallery benchmarks understated decode and payload cost. IGDB now carries
keywords, platforms, realistic alternative names and always ten similar
games; ScreenScraper carries every media url and path key a match stores.
List lengths follow percentiles measured on a 9,172-game library.

New values draw from a per-game stream, so every other column, every
fill rate and the library shape match the previous seed exactly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(seeder): wipe snapshots before the saves and states they hold

--wipe failed on any database with save-channel snapshots, because
snapshots reference saves and states with ON DELETE RESTRICT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(seeder): tighten comments to what the code shows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(seeder): draw distinct keywords and test the snapshot wipe order

A keyword list now samples without replacement from a pool larger than the
longest measured list (213), so long lists keep their distinct values.
A test pins that snapshots are wiped before the saves and states they hold.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(seeder): apply code-review fixes to realistic metadata

Insert ROMs 100 rows per statement, seed the metadata stream from
provider and drawn facts so it follows --seed, fill search_titles and
min_age on Core-inserted rows, sample real distinct IGDB platforms, and
derive SS media kinds from SSMetadataMedia.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(seeder): simplify realistic metadata builders

Share the alias and similar-games builders between providers, pass rom
rows straight to compute_search_titles and compute_min_age, and name the
SS media kinds that carry a path. Output is unchanged for a given seed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(seeder): humanizer pass on extra_rng comment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(seeder): fill every scan key, match similar-game slugs, pin the main stream

Seeded IGDB and ScreenScraper metadata now carry every required key of
IGDBMetadata and SSMetadata (publishers, developers, themes, player
perspectives, rating count, physical disc), so the facet columns that
read them are populated. Similar-game slugs follow their names without
shifting the main stream, and a test pins the main stream's position
after the builders so a draw moved onto it fails loudly.

compute_derived_columns in models/rom.py now derives search_titles and
min_age from a mapping, shared by the insert listener and the seeder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-20 08:15:08 -05:00
..
2024-02-10 12:43:39 -05:00