mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
The saves handler carried two ROM filters that ANDed together, and the states handler had only the singular one, so the same "which ROMs" question had three answers across two sibling handlers. Collapse both onto rom_ids: a single-ROM lookup is just a one-element scope, which is what the three internal callers in the saves endpoint now pass. That leaves the routes to fold their own public rom_id param into the scope. Rather than write the fold twice, narrow_rom_id_scope joins utils/validation beside RomIdScope, keeping the documented "combined with rom_id" semantics: both filters still apply together, so the effective scope is their intersection. GET /api/states gains the rom_ids param GET /api/saves got in #4304, declared with the same shared RomIdScope, so a client syncing a known set of ROMs can discover states the same way it discovers saves, under the same cap and the same 422 on a bad scope. One behaviour shift falls out of the handler's old falsy check: rom_id=0 used to be ignored and return the whole library, and now scopes to nothing, which is what RomIdScope's positive-ID rule says a zero means. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>