Commit Graph

227 Commits

Author SHA1 Message Date
Spinnich 2ecefa3d3f Fix race condition in collection and favorite rom membership updates
Replace full rom_ids list replacement with atomic POST/DELETE endpoints
that add or remove individual ROMs from a collection. This prevents
concurrent rapid clicks from overwriting each other (last-write-wins).

Also fix missing session.flush() in add_rom_user() and add collection
endpoint tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 15:08:53 -04:00
Georges-Antoine Assi abc69c790f fix scanning 2026-04-12 09:35:34 -04:00
Georges-Antoine Assi 85f9444b57 fix: restore get_roms_by_fs_name after stripped @with_details
Commit 3991e1b6e removed `@with_details` from `get_roms_by_fs_name` but
left the body using the `query` parameter that decorator was supposed
to inject, so every scan hit `'NoneType' object has no attribute
'filter'` and crashed the platform identification task.

Make the function self-contained: build `select(Rom)` directly and
eager-load only `Rom.platform`, the one relationship the scan loop
actually needs (via `rom.platform_slug` / `rom.platform.fs_slug`).
Keeps the prior commit's intent of avoiding the heavy `with_details`
eager-load on every batch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 09:10:27 -04:00
Georges-Antoine Assi de9efb3da8 refactor: simplify mark_missing_roms with a single flips dict
Collapse the two parallel id lists and their mirrored chunked-update
loops into a `flips: dict[bool, list[int]]` keyed by desired state, and
drop unused rom assignments in the related tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 23:13:33 -04:00
Georges-Antoine Assi 3991e1b6ed fix: scan stalls on platforms with 10k+ already-scanned ROMs
The scan was spending excessive time on large platforms even when all ROMs
were already scanned. Root causes: per-ROM UPDATE queries for skipped ROMs
(10k individual writes), missing composite index on (platform_id, fs_name)
causing full table scans, NOT IN clauses with 10k+ values in
mark_missing_roms(), and redundant filesystem reads.

Changes:
- Add bulk_mark_present() for batch-updating skipped ROMs in one query
- Move skip detection from _identify_rom to the batch loop so skipped ROMs
  never enter the async scan pipeline, and report progress for them
- Add composite index idx_roms_platform_id_fs_name via migration 0077
- Rewrite mark_missing_roms() with flip-based approach: mark all missing,
  then un-mark present ones in chunks of 1000
- Cache filesystem reads in scan_platforms() to avoid double directory
  traversal (precounting + scanning)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 19:20:40 -04:00
Georges-Antoine Assi 8664f6203f bad removal 2026-04-05 19:19:06 -04:00
Georges-Antoine Assi e0214f100d more bot cleanup 2026-04-05 19:15:33 -04:00
Georges-Antoine Assi 7c41fb5bac revert fs_name sibling roms 2026-04-05 17:57:48 -04:00
Georges-Antoine Assi 997e2c44aa start pre-4.8 cleanup 2026-03-12 23:02:12 -04:00
Bergbok 99e41cecc2 refactor: create list for playable platforms that don't use EJS 2026-03-11 17:18:13 +02:00
Bergbok ed61158aee fix: include DOS, Game Boy Color and Sega 32X games in playable filter 2026-03-11 16:40:39 +02:00
Bergbok cad510a0b0 refactor: remove duplicate C64 entry from EJS_SUPPORTED_PLATFORMS 2026-03-11 16:37:49 +02:00
Bergbok 8517fb9aca fix: include browser games in playable filter 2026-03-11 16:11:08 +02:00
Georges-Antoine Assi e3d9bfe9fa fix migration 2026-03-08 20:14:14 -04:00
copilot-swe-agent[bot] ae73da7c27 Fix 500 error from empty fs_name_no_tags causing mass sibling matching and incorrect ROM grouping
- Add migration 0071 to fix sibling_roms view: add guard against empty string matching for fs_name_no_tags
- Fix group_by_meta_id in filter_roms: use func.nullif to treat empty fs_name_no_tags as NULL in grouping key
- Add group_by_meta_id support to get_roms_scalar
- Add tests for sibling matching behavior with empty/non-empty fs_name_no_tags

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-03-08 23:17:51 +00:00
Georges-Antoine Assi 2905328c9e update comments 2026-03-08 11:39:41 -04:00
Georges-Antoine Assi 29a5b8edf2 fix on mariadb 2026-03-08 10:15:08 -04:00
Georges-Antoine Assi 72d04b1ec7 fixes 2026-03-08 10:08:50 -04:00
Georges-Antoine Assi 708105aabd Hack for natural sorting of roms 2026-03-08 09:51:51 -04:00
Georges-Antoine Assi fe5b831afc Add Rom.ra_hash and RomFile.ra_hash fields to API 2026-02-13 11:11:02 -05:00
Georges-Antoine Assi 66ee72431e fix bot comment 2026-02-08 21:23:42 -05:00
Georges-Antoine Assi 16cac7cf64 [ROMM-2972] Fix /props returning stale data 2026-02-08 21:10:12 -05:00
Georges-Antoine Assi 5596999a3b one last regression 2026-02-07 22:46:09 -05:00
Georges-Antoine Assi cb85d70b83 extract filter into own block 2026-02-07 22:27:44 -05:00
Georges-Antoine Assi 3e86e55994 changes from bot review 2026-02-07 22:02:15 -05:00
Georges-Antoine Assi 2d678ef19f [ROMM-2976] Fix no games displayed for status filter 2026-02-07 21:27:24 -05:00
Georges-Antoine Assi 4733a86302 [ROMM-2983] Fix negative filter by verified 2026-02-07 15:44:03 -05:00
Georges-Antoine Assi 37436fddb7 changes from self review 2026-02-06 10:31:08 -05:00
Georges-Antoine Assi e36d7650e7 [ROMM-2989] Split search term by | 2026-02-06 10:20:14 -05:00
Spencer McIntyre 624f4ce14d Update the romm view to group by fs no tag 2026-02-03 20:22:59 -05:00
Georges-Antoine Assi 67efe62935 Merge branch 'master' into only-ids-param 2026-01-28 14:47:10 -05:00
Georges-Antoine Assi b49522e3e8 changes from bot review 2026-01-22 15:27:18 -05:00
Georges-Antoine Assi 7f5130c9b8 Add NONE support for filter logic operators 2026-01-22 13:47:55 -05:00
Georges-Antoine Assi e9b6fa202b tweak some db code 2026-01-19 09:47:55 -05:00
Georges-Antoine Assi 6eb888416f final manual clenaup 2026-01-18 22:51:43 -05:00
Georges-Antoine Assi 3ccc14d4a2 add endpoints for identifiers 2026-01-18 22:17:37 -05:00
Georges-Antoine Assi 54bfb3fec5 DB functions accept list of params 2026-01-18 21:26:48 -05:00
Georges-Antoine Assi b34117591a Merge pull request #2904 from rommapp/roms-filter-endpoint
ROMs filter endpoint + refactor
2026-01-16 19:14:37 -05:00
Georges-Antoine Assi bc564fd1c1 Merge pull request #2898 from BrandonKowalski/feature/updated-after-query-param
[ROMM-2874] Feature/updated-after-query-param
2026-01-16 17:24:11 -05:00
Georges-Antoine Assi c1bd666641 add comments to backend code 2026-01-16 13:28:46 -05:00
Georges-Antoine Assi 5240bb2f71 more changes from bot review 2026-01-15 13:15:29 -05:00
Georges-Antoine Assi 2c0325cae1 changes form bot review 2026-01-15 12:53:01 -05:00
Georges-Antoine Assi 354922cf41 correct set platforms in roms fetch 2026-01-15 12:43:35 -05:00
Georges-Antoine Assi b0cf2e9338 set filter platforms on platforms fetch 2026-01-15 12:10:13 -05:00
Georges-Antoine Assi 81b9eff8c7 Add filter values to roms query 2026-01-15 11:51:59 -05:00
Georges-Antoine Assi 96240a86e9 Add endpoint to fetch rom filters independent of query 2026-01-15 11:18:51 -05:00
Georges-Antoine Assi 2d8444d60b [HOTFIX] Rename selected_statuses to statuses 2026-01-14 10:07:57 -05:00
Brandon T. Kowalski 5b5dc68f58 Added updated_after query parameter for platform and rom endpoints. 2026-01-12 19:37:36 -05:00
DevOldSchool bdc6fc5235 Trunk format fixes. 2026-01-05 13:05:13 +10:00
DevOldSchool 86a6804447 Added player count metadata from SS. Displays on game detail screen and added a filter under search for player counts. 2026-01-05 11:57:30 +10:00