mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
31eb7dbdb27cec19104eb3665b23cbd1c2cce235
2741 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3fc0740c02 |
fix(tasks): re-register RQ workers whose registration expired (#5443)
After a host suspend longer than the worker TTL, the worker key lapses and the registry sweep drops the worker, or the next heartbeat recreates the key with only last_heartbeat. register_birth() only runs at startup, so the scan worker stayed invisible and every scan was refused with "No scan worker is listening" until a restart. RomMWorker.heartbeat() now checks the key still carries its queues and sits in the worker registries, and writes the registration back when it does not. Fixes #5327 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
183ee3b89f |
feat(platforms): enrich discovery cards and preserve AVIF animations (#5433)
Fetch original launch years and current platform logos during scans, retain curated platform icons, and show launch year and type on responsive discovery cards. Preserve animated AVIF frames during thumbnail and WebP conversion. Closes rommapp/romm#5432 Authored with Codex assistance, including implementation and tests. |
||
|
|
4393b70973 |
feat(media): JPEG XL library images and cover uploads (#5438)
* feat(media): serve JPEG XL library images inline Add .jxl to the image extensions the download endpoint serves inline, with an explicit image/jxl type since mimetypes doesn't know it, and to the frontend lists that pick artwork and folder screenshots out of rom.files. AVIF was already covered; the new test pins both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * feat(media): accept JPEG XL cover uploads through a Pillow plugin Pillow 13 reads AVIF but not JPEG XL. pillow-jxl-plugin registers a JXL codec with Pillow (imported once in utils/images, which the cover and WebP-conversion code already load). It ships musllinux wheels for the image's amd64 and arm64 builds. ROM and collection artwork uploads now accept image/jxl and store it re-encoded as PNG, since covers are served in their stored format and not every browser renders JPEG XL. Avatars, stored as uploaded, keep the PNG/JPEG/WebP/GIF allowlist. The plugin is GPL-3.0, which is compatible with RomM's AGPL-3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * test(roms): expect JPEG XL in the artwork rejection message Artwork uploads now also accept JPEG XL, so the rejection message lists it. The collection tests were updated with the change; this ROM one was missed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * fix(media): list library JPEG XL images only where the browser renders them Library files are served as stored, and Chrome and Firefox render no JPEG XL, so .jxl artwork and folder screenshots showed as broken tiles there. A one-time probe decodes a 22-byte JPEG XL image and the artwork and screenshot lists only include .jxl files once it succeeds (Safari), updating reactively when the answer arrives. Chromium 153 fails the probe, so the files stay hidden there as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * fix(media): size-check JPEG XL before decoding and keep it out of screenshot uploads pillow-jxl decodes every pixel in _open(), before Pillow's decompression-bomb check sees the size, so a small, highly compressed JXL declaring a huge canvas could exhaust memory. utils/jxl reads the width and height from the codestream SizeHeader (bare or inside a container) and runs Pillow's own bomb check on them first, then registers this guarded decoder in place of the plugin's. The decoder raises RuntimeError on a corrupt file, which escaped store_artwork as a 500. The guard turns it into SyntaxError, so Pillow reports UnidentifiedImageError and the upload takes the same path as a corrupt PNG. POST /api/screenshots validated against the library inline list, so it started accepting .jxl, but the asset endpoint serves those as attachments. Screenshot uploads now use their own list without JPEG XL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * style(media): one-sentence jxl docstring and a narrowed mock call in the JXL test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * style(media): one-sentence canRenderJxl doc comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1642a323c0 | fix(sort): strip only configured articles, and keep custom sort keys as typed (#5429) | ||
|
|
b62a81b968 | fix(scan): strip .p8 from PICO-8 cart titles so LaunchBox can match them (#5427) | ||
|
|
d05f5cc5e1 |
feat(ra): sync a player's achievements after they play an RA game (#5425)
* feat(ra): sync a player's achievements after they play an RA game RetroAchievements progress only synced nightly (and only when the scheduled task is enabled) or by hand from Settings, so achievements earned in a session didn't show in RomM until much later. When a play session is recorded for a ROM matched to RetroAchievements, queue an incremental progress sync for that user on the low-priority queue. Every play path (web player, streaming, device sync) records its sessions through ingest_play_sessions, so all of them trigger it. A fixed job id keeps one sync per user queued at a time. The per-user sync body moves out of the scheduled task so both share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT * fix(ra): queue the after-play sync under a valid id that a failure can't hold The job id used a colon, which RQ rejects, so every enqueue raised and was logged instead of queued. Use an underscore. With unique=True, RQ refuses any job whose id still exists, and a failed job is kept for failure_ttl (a year by default). One failed sync would have blocked that user's after-play syncs. The job now logs its own errors instead of failing, and failure_ttl is capped for a worker that dies mid-run. Add tests against the real queue: one job per user, and the id is free again after a sync succeeds or fails. Also drop the docstring's Raises block and narrow await_args before reading it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT * fix(ra): give the after-play sync the RetroAchievements task's timeout It used RQ's 180s default, which a first sync of a large account can exceed. Use the scheduled sync's configured timeout (TASK_TIMEOUT). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c5c6ef3119 |
fix(ra): count earned achievements that share a badge separately (#5423)
* fix(ra): count earned achievements that share a badge separately Earned achievements were stored and matched by badge name, which several achievements in one set can share. Those collapsed into one entry, so the game header undercounted (71/75 on a mastered set) and earning one of them marked them all as earned. Each earned entry now also carries the achievement's own ra_id, and the game details view matches on it. Progressions stored before this are read again on the next sync, and until then entries without an ra_id still match by badge. Fixes #5385 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT * test(ra): give the legacy-entry loop its own variable for mypy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT * feat(ra): mark the badge-name id of earned achievements deprecated Several achievements can share a badge, so ra_id is the field to match on. The OpenAPI schema now flags id as deprecated and points to ra_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d2f90ebba3 | fix(scan): hash game folders in sorted file order (#5421) | ||
|
|
d15cd9e7a1 |
fix: keep summary line breaks and strip provider HTML (#5413)
* fix(ui): keep line breaks in the game summary Normalize CRLF and bare CR to LF and render the summary with white-space: pre-line so multi-line summaries keep their structure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(metadata): turn HTML in provider summaries into plain text Add utils.html_text.html_to_text, a parser-based helper that drops known HTML tags, maps paragraphs, line breaks and list items to newlines, and unescapes entities. Unknown tags such as "<Start>" stay as literal text. Moby, ScreenScraper, Steam, Flashpoint and LaunchBox summaries go through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(metadata): separate table cells and keep bullets on their text Addresses Greptile review on #5413: adjacent td/th cells now get a space between them, and a list item wrapping its text in a paragraph keeps the bullet on the same line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3ae27a67a1 |
chore(seed): realistic, fast, debuggable seeded images (#5253)
* feat(seed): realistic, fast, debuggable seeded images generate_test_data.py can now seed a library whose images look like a real one, quickly, so gallery, sizing and image-conversion work can be tested without anyone's private cover art. The default (--image-fidelity 1) is unchanged: same seed, byte-identical files. - --image-fidelity 2: covers drawn at the real-world size mix (measured aggregates from one 8,396-cover library), the small cover made by RomM's own resize rule, and debug art on every image: the game's title, system and region; a box with rom id, size, kind and format; the original path; pure-colour corner pixels, named corners, percent ticks, crop boxes, a circle that shows stretching and a transparency ring. - --image-fidelity 3: the same over texture calibrated to real bytes per pixel, with 22% of big.png holding JPEG bytes as in real libraries. - --image-weighted-every N (default 10): at level 2, every Nth rom id is drawn at level 3, so one library serves layout and file-size work. - --image-media: also write ScreenScraper media (sizes provisional). - --image-workers / --image-limit: images are drawn in a process pool from a per-rom random stream (seed, rom id), identical to one process. 2,000 roms with images seed in about 18 s instead of about 10 minutes. - After a real run the seeder rotates the gallery's Redis cache, so a fresh seed never serves the previous library's lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(seed): keep rows independent of image flags; survive a cache failure - The screenshot count is drawn for every rom, whatever --images or --image-limit say, so those flags no longer shift the rows that follow (--no-images rows were already off in the previous seeder). With the defaults the draws are unchanged: level 1 output is still byte-identical. - A Redis error while rotating the gallery cache prints a warning instead of aborting after the rows are committed, so the report still prints. - Comments in seed_images.py trimmed to the repository's one-or-two-line rule. - tests/tools/test_generate_test_data.py runs the seeder with inserts recorded instead of written: rows match with --image-limit and --no-images, and a cache failure still reports the saved seed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(seed): document seeding a test library in DEVELOPER_SETUP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(seed): code-review fixes for seeded images pr-ready step 2 (code-review xhigh --fix): - level-3 noise is drawn per channel and retuned, so PNG output reaches the measured 0.9 / 1.5 / 2.0 bytes per pixel spread - --image-media is rejected at --image-fidelity 1, where it did nothing - paths come from rom_fs_resources_path, get_media_resources_path, CoverSize and MetadataMediaType instead of being rebuilt - drop the unused path_column parameter and a no-op ImageChops call - draw a batch's images while the next batch is built and inserted - the cache-failure test checks the rows of the failing run - drop a duplicate media-off test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(seed): simplify pass over seeded images pr-ready step 3 (simplify): - extract small_cover_size from resize_cover_to_small, so the seeder draws the small cover at RomM's size instead of writing, reopening and overwriting it - draw_rom_images returns nothing and follows plan_rom_images, and files_written is derived from the plan - _fitted_size measures from a proportional guess instead of stepping down one point at a time (about a quarter of level-2 draw time) - one draw path for the pool and inline cases - drop the ink parameter, the CORNER_RING alias, the _fade_ring wrapper and the RomImageJob caption default; tighten comments - trim media from the two slowest tests and use dataclasses.replace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(seed): humanizer pass over the seeding docs pr-ready step 5 (humanizer). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(seed): one image pipeline, dry runs write nothing, main owns its cleanup - level 1 mosaics go through plan_rom_images/draw_rom_images like the other levels, so they get media, workers and RomM's small-cover size - --dry-run plans image paths but writes no files - main() is a thin wrapper: it registers the UTC connect listener and removes it (disposing the pool) in a finally, and the image pool cancels queued draws on error; the test no longer patches SQLAlchemy - the recommendation feed cache is rotated with the gallery cache 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> |
||
|
|
638601f480 |
fix(webp): raise the cover WebP quality to 95 (#5410)
* fix(webp): raise the cover WebP quality to 95 Quality 90 left visible artifacts on box art with small text. On a sample of real covers, 95 adds about 3 dB of luma PSNR for about 25% more bytes (small covers go from 20% to 25% of the PNG size, big ones from 27% to 36%); 100 costs another third for little gain. Small animated covers now use the same quality instead of Pillow's default of 80, and the ignored optimize flag is dropped from the static WebP save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> |
||
|
|
209e791eb9 |
fix(ui/ux): make age rating and player count badges clickable (#5237)
* feat(ui/ux): make age rating and player count badges clickable Issue #4805 (item 1): on the game page's default tab the age rating and player count were rendered as static badges, even though both are already supported gallery search filters. Each badge now pivots into the global search scoped to that value, the same pattern InfoGrid already uses for genres/developers/publishers, so the pivot is a real `a[href]` and middle-click/open-in-new-tab keep working. - AgeRatingBadges carries the stored `metadatum.age_ratings` entry on the badge so the link matches the JSON_ARRAY filter, not the reconstructed "CATEGORY: RATING" display label. - PlayerCountBadge pivots on the provider's free-form player-count string, which is what the SCALAR_IN `player_counts` filter matches. * fix(age-ratings): focusable tooltips, typed fixtures, real provider coverage * fix(age-ratings): pr-ready code-review fixes Give each repeated rating its own category badge with a unique key, pass the untrimmed player count so the pivot matches the stored value, drop the custom focus rings in favour of the global one, and test both links against the real searchLocation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(age-ratings): pr-ready simplify pass Build each badge label once, group provider ratings without copying the queue on every insert, and share the mount helper across the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(player-count): pr-ready review-polish comment trim Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(age-ratings): pr-ready humanizer pass Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(metadata): trim ScreenScraper and gamelist player counts The player_counts filter is an exact match, so a padded value listed as its own option and missed the player-count badge's search link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(game-details): match badge hover to the info grid chips Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Yi-111-a <847203299+qQ1AJb@gmail.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b35eb4d07c |
fix(scan): clean up unreferenced rescan media, split scan_rom and move its parts into handler/scan (#5408)
* fix(scan): delete screenshots and media a rescan leaves unreferenced A complete rescan keeps the stored artwork, so two kinds of file stayed on disk with nothing pointing at them: - screenshots indexed past a shorter new list, since files are named by position and only the indexes in range were rewritten - media of a type removed from the preferences, since providers record no path for it and stale media was compared over the preferred types only get_rom_screenshots now deletes the indexes past the new list, and remove_stale_media compares every media type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): split scan_rom's merge into named steps scan_rom held seeding the row, following Demozoo links, splicing scene summaries, resetting rematched sources, the scene lock, rehash cleanup, priority merges for fields, tags and artwork, and the SteamGridDB pass in one body. Each step is now its own helper, the SteamGridDB lookup a _RomLookups method, and the providers' answers a dict keyed by source instead of fourteen locals. The Pouet and CSDb link follows share one helper. Behaviour is unchanged. McCabe complexity of scan_rom goes from 68 to 13, and the function from 664 to 215 lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): trim remove_stale_media's docstring per Greptile review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): move the scan vocabulary, lookups and merge into handler/scan scan_handler.py held the scan types and metadata sources, the per-source lookups, the merge of their answers and the orchestration in one 2,000-line module. It now builds on a handler/scan package: - sources.py: ScanType, MetadataSource, the tag constants, RESCAN_RULES, should_consult, stored_match_id and the priority ordering - lookups.py: RomLookups, the LaunchBox and Steam resolvers and get_main_platform_igdb_id - merge.py: the pure steps that merge the sources' answers into a rom's columns scan_handler.py keeps scan_platform, scan_rom, the asset scans and the media downloads. Importers point at the module that now defines each name, and the helpers that crossed a module boundary lost their leading underscore. clear_rehash_misses takes the attempted sources instead of the lookups, so merge does not depend on lookups. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ci): import ScanType from handler.scan.sources in the e2e seed script Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): harden leftover screenshot cleanup (pr-ready: code-review) List the screenshots folder once, use isdecimal() for the index test, and log rather than raise when a leftover can't be removed. Point three comments at handler/scan instead of scan_handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): tidy the merge helpers and patch paths (pr-ready: simplify) - fetch_sgdb_rom refetches by stored_id and builds the SGDB name list itself, so the name sources stay private to lookups. - follow_demozoo_link checks the source is enabled; scan_rom loops over Pouët and CSDb. - order_merge_sources holds the one ordering pass, and build_metadata_handlers adds the empty SGDB entry. - Leftover screenshots go through the quiet-delete helper, renamed _discard_file. - Tests patch rom lookups through handler.scan.lookups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): never leave a recorded media or screenshot path without its file - remove_stale_media only deletes a file whose owner or source changed when that new owner stores the type again in this pass. A file nothing records is still deleted. - Screenshots past a shorter list are pruned by remove_screenshots_past once the new paths are saved, in both download_rom_resources and update_rom, so a failed cover or manual leaves them in place. - The release-notes schema diff watches scan_handler.py beside scan/sources.py, for ranges that span the move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
63faff8883 |
fix(misc): Rename paths, rescan artwork, scan lookups and streaming teardown fixes (#5396)
* fix(roms): rewrite only the moved part of a renamed rom's file paths Renaming a rom rewrote each of its files with `str.replace(old fs_name, new fs_name)` on both the name and the path. On disk, rename_fs_rom moves only `fs_path/old` to `fs_path/new`, so: - a folder rom's inner file named after the folder (`Game (Disc 1).bin` in `Game/`) was renamed in the database but not on disk; - an fs_name that also appears in the platform path (a rom named `n64` under `n64/roms`) rewrote the platform path too. _moved_file_location mirrors the move instead: a single-file rom's name changes, a folder rom's files keep their names under the renamed folder, and anything else is left alone. _refetch_changed_matches now returns the ids it refetched, so the RetroAchievements badge download keys off that rather than repeating the comparison, and the shared-media rematch uses the same _match_changed check as the refetch loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): keep artwork a complete rescan has nothing to replace with A complete rescan deleted the rom's cover, manual, screenshots and every provider media folder before asking any provider, then reset the stored paths. A provider that was down, rate limited or no longer had the art left the rom with none. The wipe is gone, and scan_rom no longer resets the path columns on a complete rescan. The download step already replaces what changed: covers, manuals and screenshots refetch when their URL differs, and remove_stale_media drops provider media whose owner or URL changed. The URLs and locks are still cleared, so whatever answers now can replace a file; a file nothing replaces stays where it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): move scan_rom's provider lookups onto a _RomLookups class scan_rom defined 16 provider lookups as closures over its own locals (scan type, platform, rom, rom_attrs, enabled sources, the attempted and inconclusive sets), so none of them could be read or tested apart from the 1,000-line function around them. They are now methods of _RomLookups, a dataclass holding exactly what they used to capture, along with the helpers they share (consults, note_inconclusive, resolve_fetch and the cached match files). scan_rom builds one instance and keeps its local names for the shared sets, so its body is unchanged apart from the calls. SteamGridDB's lookup stays nested because it reads the other providers' results. scan_rom drops from 977 to 664 lines. Its own complexity is unchanged: that comes from the merge after the lookups, not the lookups themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(streaming): one teardown order for every way a session ends A session could be torn down three ways, each spelling out its steps: - teardown_released_session (owner release and single admin release) - teardown_abandoned_session (stale takeover and the reaper) - force_release_all's inline _teardown The first two ran the same stop/playtime/activity/state/saves sequence in two copies. The sweep differed in ways that mattered: it held no drain marker while it worked, recorded the termination after the stop (so a polling tab could miss it), marked the exit save pull pending only after the stop, and deleted the key unconditionally, even if a newer claim had replaced the one it read. _stop_and_collect now holds the shared sequence, and both lifecycle teardowns call it after their own opening (a drain marker for a release, a staleness-checked marker for an abandoned session). The sweep runs teardown_released_session for each session, like a single admin release. With no container config left, it still records the termination, then frees the key through the guarded release_own_session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: apply code-review findings (pr-ready step 2) Record playtime and clear the activity entry when force-release-all frees a session whose container config is gone, and let the PICO-8 cartridge fallback see a cover a complete rescan keeps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: apply simplify findings (pr-ready step 3) Let _RomLookups.attempts() record the attempt it gates, drop scan_rom's local aliases for the lookups' state, read the platform slug off the lookups in fetch_launchbox_rom, seed the kept artwork paths into rom_attrs for every rescan so the PICO-8 fallback reads them directly, return None from _moved_file_location when a file did not move, and share the playtime and activity steps through close_session_record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address Greptile review on #5396 Drop a cover's other formats once a new one is stored, so a kept upload in another extension can't shadow it, and move the rename path rule onto FSRomsHandler next to rename_fs_rom. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2d140e606a |
fix(scan): consult sources from one rule table and keep stored matches on refresh (#5394)
* refactor(scan): decide which sources a scan consults from one rule table Each of scan_rom's 16 provider fetchers opened with its own copy of the same gate: is the source enabled, does it cover the platform, and does this scan type (new, complete, update, unmatched, hashes) ask it about this rom. The copies differed in small ways (which platform field, whether a hash scan counts, whether an id alone counts as matched) that were only visible by reading all 16 side by side. RESCAN_RULES now holds one RescanRule per source, and should_consult applies them. Each fetcher's gate is a single consults() call. The fetchers' lookup logic is unchanged. A brute-force comparison of the old inline gates against should_consult, over 57,600 combinations of scan type, new rom, enabled source, id, metadata, platform id and platform slug, found no differences. The new test_scan_rescan_rules.py pins the rules per source without a database. The nested fetchers drop from a combined cyclomatic complexity of 215 to 87 (437 to 264 lines). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(scan): pin rescan rule columns independently, cover Hasheous' platform id Addresses Greptile's review: an explicit table of each rule's id and metadata columns, Hasheous in the platform-id test, and a one-sentence should_consult docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): keep stored matches on refresh and pick rescans from the rule table - Every fetcher refetches a stored id through stored_match_id(): an update, or an unmatched retry of missing metadata, keeps the id instead of trading it for a hash or filename match. IGDB now prefers it over Hasheous and Playmatch, MobyGames and ScreenScraper refetch it on an unmatched retry, and Demozoo refetches it at all. - Playmatch runs only when a source that reads its ids will be consulted. - should_scan_rom picks update and unmatched roms with should_consult, so the platform gates and the metadata check apply, and Playmatch alone picks nothing. - unmatched_supported takes the platform instead of reading rom.platform. - scan_rom's handler table and update_rom's refetch table take their columns from RESCAN_RULES; a test checks METADATA_SOURCE_COLUMNS agrees with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b5acfa4c44 |
refactor(streaming): type the session record as a StreamingSession TypedDict (#5395)
* refactor(streaming): type the session record as a StreamingSession TypedDict The streaming session lived in the cache as a JSON object and moved through the code as dict[str, Any], so its 18 keys were implied by the two claim literals and a handful of mutate_session calls spread across session_store, lifecycle, access, launch, memory_cards and the endpoint. A misspelt key read as None without a warning. StreamingSession (total=False, since drain markers and records from older releases carry only some fields) now names every key and its type, and every session and claim parameter, return and literal uses it. mypy checks each .get() and write against it. The scope helpers that also read a termination notice take a Mapping[str, object] instead. No behaviour changes: the record's JSON is the same. Tests that built sessions by hand now build StreamingSessions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(streaming): one-sentence StreamingSession docstring Addresses Greptile's review on the comment rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
81b617459b |
fix(db): bump client token and device last-used timestamps without a prior read (#5384)
* fix(db): bump client token and device last-used timestamps without a prior read update_last_used() and update_last_seen_debounced() read the row with session.get() and then updated it in the same transaction. When two requests with the same Client API Token ran concurrently and both passed the debounce check, the second UPDATE hit MariaDB error 1020 (Record has changed since last read), so a read-only GET returned HTTP 500. Make each a single conditional UPDATE that only touches the row when the debounce window has passed. Fixes #5379 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * test(db): code-review fixes for last-used race tests Reuse the executed_statements fixture, scope race listeners to sync_engine, add the device race test, drop an unused fixture, and apply trunk fmt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(db): simplify pass on last-used race fix Share the race hook as tests/db_race_stubs.run_before_first, look tokens up by id in tests, trim duplicated docstrings, and state the handler comment as current behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(db): humanizer pass on last-used handler comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(db): run MariaDB and MySQL sessions at READ COMMITTED MariaDB 11.6+ turns on innodb_snapshot_isolation, so at REPEATABLE READ any transaction that reads a row and then writes it fails with error 1020 ("Record has changed since last read") when another transaction committed to that row in between. READ COMMITTED, PostgreSQL's default, takes a fresh snapshot per statement and removes the whole class of failures. A server logging binlog_format=STATEMENT refuses InnoDB writes below REPEATABLE READ, so its sessions keep the default and log a warning once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(auth): skip last-used and last-active writes inside the debounce window Client-token auth bumped the token, the device and the user on every request, the user with an undebounced UPDATE plus a re-SELECT. The token's loaded last_used_at now gates the token and device bumps, and set_last_active checks the loaded last_active and bumps through a debounced conditional UPDATE, so a request inside the window writes nothing and takes no row lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
332643b5d2 |
Fix scan failure when ROM name is missing (#5377)
### Summary Prevent ROM scanning from failing when the `name` field is missing from `rom_attrs`. The identification log message now falls back to `fs_name` when `name` is unavailable. This avoids a `KeyError` during scanning while preserving the existing log output for ROMs that have a name. ### Motivation During a library scan, RomM raised a `KeyError: 'name'` in `scan_rom()` when attempting to log a successfully identified ROM. This caused the affected ROM's scan to fail. Using `fs_name` as a fallback allows the scan to continue even when the metadata name is missing. ### Testing - Reproduced the issue during a ROM library scan. - Verified that scanning completed successfully after applying the fallback. ### AI assistance AI assistance was used to help investigate the error. The fix was tested locally against the affected RomM installation. |
||
|
|
c6b5f0ae11 |
fix(platforms): count only the roms the caller can see in rom_count and fs_size_bytes (#5313)
* fix(platforms): count only the roms the caller can see in rom_count and fs_size_bytes Platform.rom_count and fs_size_bytes are column properties over every rom row on the platform, and the platform endpoints only filter hidden platforms. So the platform header's "In library" count and "On disk" size included roms hidden from the caller (directly, or by an age limit), while the gallery left them out. Server Stats was off the same way: its per-platform metadata coverage divides /api/stats' visibility-filtered match counts by the unfiltered rom_count, so a restricted user saw coverage too low and platform counts and sizes too high. For a restricted caller, the list, detail and update endpoints now subtract the totals of the roms RomVisibilityFilter hides (DBStatsHandler.get_hidden_rom_totals_by_platform, next to the other per-platform aggregates). Direct hides are matched by primary key, so a few hidden roms cost a few lookups rather than a pass over every rom on the platform. Admins and other unrestricted callers keep the model's values and skip the query. On a generated library of 50 platforms and 100k roms (MariaDB), the platform list takes ~44 ms; this adds ~4 ms with 100 roms hidden, ~44 ms with 5,000, and ~60 ms with an age limit (min_age isn't indexed, so that case scans the platforms' roms). Fixes #5312 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): read the hidden roms' totals in the platform query Addresses Greptile's review of #5313: - Counts can become negative: the hidden totals came from a second query, so a rom added between the two could be subtracted without having been counted. They now come from a grouped subquery outer-joined into the statement that computes the full totals, so both read one snapshot (on PostgreSQL's READ COMMITTED too, which a shared transaction wouldn't give). - Counting rules live in endpoints: the endpoint helper is gone. get_platform and get_platforms take the caller's RomVisibilityFilter (unrestricted by default) and return platforms with the visible totals; DBStatsHandler.get_hidden_rom_totals_by_platform is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review fixes for visible platform totals - Re-read rows with populate_existing so a shared session never subtracts twice - Narrow the hidden-totals subquery to the one platform get_platform reads - Re-read after update only for restricted callers, and 404 instead of leaking full totals - Test the update endpoint's restricted totals and the shared-session read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on visible platform totals Gate the row clause in one condition with a why comment, fold the MariaDB narrowing reason into the docstring, and drop restating comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): count only visible roms in /supported and RetroArch listings - Move the hidden-ROM predicate into RomVisibilityFilter.hidden_on_visible_platforms_clause, with the age rule spelled as ranges an index on min_age can serve - get_platforms reads hidden platforms from the visibility filter instead of a second hidden_platform_ids argument - /api/platforms/supported lists a hidden platform as unmatched and counts only the caller's ROMs on the rest - RetroArch WebDAV skips a platform whose ROMs are all hidden from the caller Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(roms): index platform_id, min_age, fs_size_bytes for age-limited totals On a 73k-ROM copy of a real library (MariaDB 13), GET /api/platforms for an age-limited user went from 208 ms to 55 ms: the hidden-totals aggregate is now an index-only scan instead of a full scan of the wide roms rows. 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> |
||
|
|
83b0615424 |
fix(streaming): give standalone PPSSPP the broker's working state slot (#5256)
* fix(streaming): give standalone PPSSPP the broker's working state slot A webstation container that maps psp to standalone PPSSPP fell through to NO_CAPABILITIES, so the player offered only Save & Exit, even though the broker saves and loads one working slot for it over the state hotkeys. Add a ppsspp entry next to retroarch and scummvm with the same slot shape. Closes #5230 * style(streaming): keep the PPSSPP comment and test docstring to the house length |
||
|
|
e2e39b9b72 |
fix(worker): close database pools before work horse exit (#5303)
* fix(worker): 🐛 close database pools before work horse exit * test(worker): ✅ annotate cleanup regression tests * fix(worker): keep the parent's pooled connections open in the work horse pr-ready step 2 (code-review xhigh --fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(worker): merge the duplicated pool cleanup tests pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(worker): clarify the engine fixture docstring pr-ready step 5 (humanizer). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
88e3c016f9 |
fix(sigil): classify routine extraction failures by type (#5304)
* fix(sigil): 🔇 classify routine extraction failures by type * fix(sigil): log sigil's error message and correct test error codes pr-ready step 2 (code-review): log the exception text instead of the bare numeric code, restore the comment on why these failures are routine, use NEEDS_KEY's real code (-6) in the fixture, and give parametrized cases ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(sigil): split routine and unexpected failures into separate except clauses pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sigil): keep sidecar files away from sigil Disc sheets, subchannel data and text files beside a ROM never hold a title id, and sigil fails short ones with the same IO error it raises for real read failures, so they kept logging at ERROR on every scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
60703be09c |
chore(platforms): split arcade aliases into per-emulator-family slugs (#5273)
* feat(platforms): split arcade aliases into per-emulator-family slugs Give MAME, AdvanceMAME, FBNeo, FBA, Daphne, Singe and the arcade boards that need their own emulator (NAOMI/NAOMI 2/NAOMI GD-ROM, Model 2/3, Hikaru, Triforce, Lindbergh, Namco System 246/3xx, Gaelco, ...) their own slugs with verified provider IDs. Providers without a dedicated entry fall back to their Arcade platform via arcade_fallbacks(). MAME-only boards (CPS1-3, System 16/32, Model 1, Namco 22) stay aliases of arcade. Refs #5272 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review pass on arcade slugs - Retry IGDB on unmatched scans for every platform IGDB resolves, not just slugs in IGDB_PLATFORM_LIST. - Resolve config binding/version values through the alias table, so a binding to a retired slug (cps2, model1, ...) still lands on a platform. - Alias the Batocera `typex` folder to type-x. - Build provider id->slug reverse maps before merging Arcade fallbacks. - Share one MAME title lookup between base_handler and libretro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on arcade slugs - Alias the three RomM-keyed IGDB versions inside IGDB_PLATFORM_VERSIONS, dropping IGDB_VERSION_SLUGS and _version_slug. - Derive EmulatorJS arcade entries from ARCADE_SET_PLATFORMS. - Remove the unused provider id->slug reverse maps, so the Arcade fallback merge no longer has an ordering constraint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(platforms): humanizer pass on arcade slug comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): settle arcade slug review decisions - Migration 0154 moves platforms still on a retired MAME-only board slug (cps1-3, model1, system16, system32, system-32) to arcade, so no row carries a slug the enum no longer has. - MAME shortname expansion keys off the RomM slug via MAME_SHORTNAME_PLATFORMS instead of per-provider arcade ids, so Daphne, Singe, Type X and Lindbergh sets are no longer read as MAME sets. Neo Geo now expands at ScreenScraper too, as it already did at IGDB and Moby. - fba offers fbneo before the FinalBurn Alpha CPS cores. - AdvanceMAME leaves the WebRcade feed; EmulatorJS and WebRcade share PLAYABLE_ARCADE_SET_PLATFORMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review pass (xhigh) on arcade slugs Verify arcade-board BIOS files against the known list's arcade entries, and make migration 0154 match retired slugs case-insensitively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on arcade slugs Apply IGDB family overrides once in get_platform instead of on each return path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(platforms): use a slug with no shipped icon singe now ships an icon, so the no-icon prefetch test needs a slug that never will. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(platforms): add a teknoparrot arcade slug TeknoParrot runs PC-based arcade boards outside the MAME/FinalBurn family, so its folder gets its own platform (RetroBat and ES-DE both use `teknoparrot`). Providers fall back to their Arcade entry, MAME shortname expansion skips it, and it gets a placeholder icon copied from `arcade`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(platforms): give each arcade-family icon its own marquee title Redraws the ARCADE marquee on the copied cabinet icons with each platform's name, in the Bungee typeface with the original inline and extrusion styling. Sega boards use Sega blue, Namco systems Namco red, and Type X Taito blue; the rest keep the original amber. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review pass (xhigh) on arcade slugs Neo Geo BIOS lives under arcade in the known BIOS list, so map neogeoaes and neogeomvs there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on arcade slug tests 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> |
||
|
|
6bf6554c97 |
perf(roms): cheaper grouped gallery window on PostgreSQL and MariaDB (#5267)
* feat(tools): time the two statements behind one gallery window Builds the page-ids and load-by-id statements the way GET /api/roms does, runs each under EXPLAIN (ANALYZE) in a read-only transaction, and prints the execution time with the plan nodes that spend the most of it. PostgreSQL only. Baseline on a 100,000-rom seed, grouping on, window 0+72, median of 3: page ids 1490.6 ms (hash join 441, roms_pkey scan 371, sort 302) load rows 892.3 ms (hash join 467, sort 318) total 2382.9 ms Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * perf(roms): load a window's rows by id without re-running the sibling grouping The ids a window loads were already picked by the grouped query, so the load re-ranked the whole library only to confirm them. It now builds its select from filter_roms with no filters (same loader options, file stats and hidden-roms check) and narrows it to the page's ids. Measured on a 100,000-rom seed, grouping on, window 0+72, median of 3: load rows by id 892.3 ms -> 1.3 ms both statements 2382.9 ms -> 1481.9 ms Page ids are unchanged at about 1.48 s. The new tests compile the SQL only and were not run here: they need the test database. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * perf(roms): rank pre-releases with one regex instead of six LIKEs The sibling-dedup window evaluated six leading-wildcard ILIKEs on every rom's filename. One case-insensitive regex over the same tags matches the same names and reads each name once. The pattern is built from PRERELEASE_FILENAME_TAGS so the tag list stays the only place a tag is named. Measured on a 100,000-rom seed, grouping on, window 0+72, page-ids statement: median 1480.6 ms -> 1243.5 ms hash join under the sort, own time 455 ms -> 182 ms The new tests check the pattern against the old rule on sample filenames and that both dialects compile to a single match; they were not run here (they need the test database). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * feat(tools): time searches and filters with --filters on the gallery timing tool Takes RomFilterParams as JSON, so a search term, a platform or any filter can be timed the way the plain gallery is. On a 100,000-rom seed a search costs 26 to 220 ms for a window's ids, and the broad filters (matched, verified, a status) cost 430 to 1,145 ms because the sibling ranking covers almost every rom. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(roms): keep the status filter when loading a window's rows by id A page picked with statuses=hidden was reloaded under the default that hides hidden roms, so its items came back empty while the total stayed non-zero. The row load now carries the request's statuses and statuses_logic, and nothing else. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(tools): time searches as the endpoint runs them and accept group_by_meta_id in --filters The timing tool now passes the search term to the query and defaults to the endpoint's empty sort, so a search is timed with its relevance ordering. The JSON filters merge over the grouped default (--ungrouped still wins), so a full RomFilterParams can be pasted without a duplicate keyword. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(roms): cut change rationale from the new docstrings and test headers Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * test(roms): type the hidden-status page test Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * test(roms): satisfy the CI mypy config in the hidden-status page test Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * refactor(roms): load a window's rows with loader options only The by-id row load reused filter_roms with a statuses-only RomFilterParams, which tied its correctness to knowing which predicates apply by default. Split the loader options out of filter_roms into _with_rom_loaders, and have get_page_rows_query apply only those plus the id list and the visibility clauses (the cached id index's key does not carry visibility). Keep the six ILIKEs for the pre-release rank on PostgreSQL, where they measured ~13% faster than the regex on whole-library windows (100k roms), and use the regex on MariaDB, where it measured ~25% faster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): apply code-review findings on the window row load pr-ready step 2 (code-review xhigh --fix): drop the dead loader flags from the ids query, align the timing tool's sort args and --repeat with the endpoint, tighten comments, and stop the hidden-status test inserting a RomUser twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(roms): drop filter_roms loader flags no caller sets pr-ready step 3 (simplify): the gallery card loaders moved to get_page_rows_query, so filter_roms no longer takes include_file_stats, include_siblings or include_notes. The page-rows test compiles through the shared compile_sql helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(roms): trim the pre-release pattern comment pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(roms): plainer docstring on the grouped-query yardstick test pr-ready step 5 (humanizer). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(roms): build every rom card loader from one list with_details, with_simple_details and filter_roms each kept their own copy of the SimpleRomSchema loads, and the copies had drifted: the filter_roms siblings skipped load_only. All three, and the gallery's page-row load, now build from _rom_card_loaders. Feeds still skip the track and doc metadata they never read. The real-row pre-release test pins the accent-sensitive match on both PostgreSQL and MariaDB. The timing tool now applies the user's rom visibility, times the eager loads the row query triggers, and keeps parallel plan nodes in wall-clock time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
a5b3054270 |
fix(streaming): let a container's broker_secret override STREAMING_BROKER_SECRET (#5259)
* fix(streaming): let a container's broker_secret override STREAMING_BROKER_SECRET STREAMING_BROKER_SECRET replaced every container's broker_secret, so a pool of containers with different BROKER_SECRETs could not authenticate: each broker after the first answered 403 "bad broker secret". A container's own broker_secret now wins, and the env var is the fallback for containers that set none. A blank broker_secret also falls back instead of becoming the literal secret "None". * test(streaming): cover a blank broker_secret with no env secret Addresses Greptile review on #5259: the fallback cases all set the env secret, so none pinned that YAML null no longer becomes the secret "None". * Update examples/config.example.yml --------- Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com> |
||
|
|
aae48728e5 |
fix(metadata): read names from {id, name} facet entries in recommendations and ROM responses (#5249)
* fix(recommendations): handle named metadata objects in facet tokens * fix(recommendations): pr-ready step 2 (code-review): skip non-list columns, base role fallback on usable names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(recommendations): pr-ready step 3 (simplify): type facet params as object, trim redundant test cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(recommendations): pr-ready step 4 (review-polish): keep the extract_tokens test prefix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): read names from metadata objects in filter values and ROM responses Share the facet name cleaner as utils.facets.facet_names, and run it in the filter-values reader, RomMetadataSchema, and over every list[str] key of the provider metadata blobs, so an {id, name} entry no longer fails /api/roms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): clean name lists in raw metadata edits, reject non-object JSON parse_raw_metadata now runs the provider blob's list-of-names keys through facet_names before storing it, so {id, name} objects stop landing in the database, and answers 422 when the JSON is not an object. Manual metadata keeps its strict adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d8f08a60f2 |
fix(scan): fall back to filename name when only libretro matches (#5241)
* fix(scan): fall back to filename name when only libretro matches Libretro matches by filename and supplies no name. On a complete scan or a newly added ROM that only libretro identifies, rom_attrs had no name, so the identified-as log raised KeyError and the scan result was discarded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(scan): keep a new rom's own name when libretro alone matches code-review (xhigh) pass. A physical game is created with the name the user typed, and the filename fallback would rebuild it from the sanitized fs_name ("Kingdom Hearts HD 2.5" -> "Kingdom Hearts HD 2"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): simplify the new-rom name fallback expression simplify pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(scan): clarify the name fallback comment humanizer pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
e304e08a88 |
perf(roms): let a list fetch leave the provider metadata off each item (#5228)
* perf(roms): let a list fetch leave the provider metadata off each item GET /api/roms takes with_provider_metadata, default true. When it is false, every *_metadata field but manual_metadata (the twelve provider blobs and merged_ra_metadata) comes back null. The fields stay in the schema, so the response shape is unchanged. metadatum and the flat fields read from the blobs (alternative_names, youtube_video_id, path_video) are serialized as before. The fields are nulled on a copy of the finished schema rather than on the Rom, because an assignment to the row inside the request's session would be flushed to the database. The set of fields is derived from the schema, and a test pins the names, so a new *_metadata field joins on purpose. Closes #5227 * refactor(roms): list the provider metadata columns in one place PROVIDER_METADATA_COLUMNS on the model now backs the scan snapshot, the unmatch reset and the list endpoint's opt-out, which each spelled out the thirteen columns. The opt-out test is cut down to one request per mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(roms): spell out the RetroAchievements field in the opt-out The response set is now the provider columns less ra_metadata, plus merged_ra_metadata, which the schema serves with absolute badge paths. The nulling reads as one conditional step before the return. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(roms): copy only the achievement dicts in merged_ra_metadata The deep copy cloned the whole RetroAchievements blob to rewrite two badge paths per achievement. Building new achievement dicts keeps the stored paths relative at a quarter of the cost: 24.2 ms to 6.3 ms over a 500-item page of a real library, with identical output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
89607cd22c |
chore: Library support for zelda classic games (#5214)
* feat(platforms): add Zelda Classic (zc210) engine support Recognise Batocera/REG-Linux zc210 quest folders as the zelda-classic platform so .qst libraries scan as a first-class engine platform, matching existing fantasy-console/engine precedents like TIC-80 and WASM-4. Co-authored-by: Cursor <cursoragent@cursor.com> * chore(platforms): drop placeholder Zelda Classic icons Use RomM's default platform icon until a properly licensed asset is available. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(setup): identify FS alias platforms in library wizard The setup UI matches on-disk folders by exact fs_slug against supported_platforms, so aliases like zc210 never matched zelda-classic. Merge resolved filesystem platforms into the setup response. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(platforms): also alias zc250 to Zelda Classic EmulatorJS documents both zc210 (2.10) and zc250 (2.50) cores for .qst quests; accept either folder name as Zelda Classic. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(setup): reuse listed folders when merging FS aliases get_filesystem_platforms was walking the library again outside the setup endpoint's error guard, so a folder-list failure could still 500 /api/setup/library. Pass the folders already read instead. Co-authored-by: Cursor <cursoragent@cursor.com> * revert(setup): drop setup-wizard FS alias merge from this PR Keep Zelda Classic platform aliases (zc210/zc250) without changing /api/setup/library behavior. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
3a79911b2f |
Revert "feat: classify ROMs by release type (homebrew, hack, translation, ...) (#5363)" (#5365)
This reverts commit
|
||
|
|
08acaa9ea9 | feat: classify ROMs by release type (homebrew, hack, translation, ...) (#5363) | ||
|
|
552ac3a393 |
fix(platforms): share provider entries across duplicate platform slugs (#5359)
* fix(platforms): share provider entries across duplicate slugs and rename system-32 Three consoles have two RomM slugs, each used by different providers, so a library folder only matched the providers that knew its spelling: vc-4000 / interton-vc-4000, apple-pippin / pippin and tandy-vis / vis. DUPLICATE_PLATFORM_SLUGS lists them once, and fill_duplicate_slugs gives each slug the other's entry in every provider table. pippin and interton-vc-4000 now get an IGDB platform id, and IGDB's family override also applies to a listed duplicate so both VC 4000 slugs stay in the Interton family. The system-32 slug mapped to Namco System 22 in ScreenScraper and LaunchBox, easy to confuse with Sega System 32 (system32). It is now namco-system-22. Folders and config bindings named system-32 still resolve to it, and migration 0154 renames existing platform rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * fix(platforms): resolve bindings to a renamed slug back to their folder resolve_platform_slug already maps a binding to system-32 onto namco-system-22, but resolve_fs_slug compared the raw binding with the new slug, so a moved folder bound to the old slug was never found. Both now go through the same renamed-slug lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * fix(platforms): drop the system-32 slug backfill migration Every scan resolves a platform's slug from its folder again, so the next scan renames system-32 rows through the renamed-slug alias without a migration, as the backend guide asks for normalizations the parser now handles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * chore(platforms): reword two comments so the product isn't the actor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * revert(platforms): leave system-32 to the arcade slug split rommapp/romm#5273 retires system-32 as an alias of arcade and resolves aliases in config bindings in both directions, which covers what the namco-system-22 rename and the renamed-slug lookup did here. This PR now only shares provider entries across duplicate slugs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ff9627ae70 |
fix(auth): require the current password to change your own username, password or email (#5351)
* feat(auth): require the current password to change your own password
PUT /api/users/{id} set a new password or email for the caller with
nothing more than a me.write credential, so a leaked client token or a
hijacked session could take the account over for good.
A self-edit that changes the password or the email now needs
current_password, checked with bcrypt off the event loop (400 when
missing, 403 when wrong). Admins editing another user and the
forgot/reset-password flow are unchanged. Accounts with no local
password (OIDC-provisioned placeholders) can set a first one only from a
sign-in session, not from a bearer or client token.
UserSchema gains has_password so the UI asks for the current password
only when the backend will: the change-password dialog, the profile
email field, and the edit-user dialog when editing yourself.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(user): shorten _verify_account_holder docstring
Addresses Greptile review on #5351.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(user): treat a case-only email edit as no change (code-review)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(user): simplify current-password checks and tests (simplify)
Hash the new password off the event loop, reuse errorMessage and the
viewer token fixture, and table-drive the needsCurrentPassword tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(user): require the current password to change your own username
Login is by username and a rename revokes every session, so a stolen
me.write token could lock the owner out without touching the password.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(user): lock the email of OIDC accounts to the identity provider
The provider overwrites a linked account's email at every sign-in, and
finds an unlinked password-less account by it, so a self-edit is either
lost or breaks SSO sign-in. Admins can still change it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(RTextField): give read-only fields a muted style
Dashed chrome, no fill and muted text, with no hover or pointer-focus
halo, so a locked value no longer looks editable. Keyboard and gamepad
focus keep their outline.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
||
|
|
26dff477d7 |
fix(auth): bound new client tokens by the caller's scopes and stop delegates removing admins (#5346)
* fix(auth): bound new client tokens by the caller's scopes and stop delegates removing admins - Creating a client token, approving a device, and regenerating or pairing an existing token now check against the scopes of the credential making the request rather than the whole account's. A narrow client token can no longer mint, or recover the secret of, a broader one. Session and basic auth carry the account's scopes, so they behave as before. - Deleting an admin requires the caller to be an admin, mirroring the existing rule for creating one, since users.write can be delegated. - Editing another user requires the users.write scope on top of the admin role, so an admin's me.write-only token can't change other accounts. - own_only is rejected (422) on grants and overrides for entities with no owner (platforms, roms, firmware, users, tasks, logs), where it silently meant "all". The catalog exposes the ownable entities and the permission matrices only offer "own" on those. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(permissions): keep owner-less own_only grants' access on save Addresses Greptile review on #5346: - An own_only delete grant on an entity with no owner allows nothing today (delete has no coarse scope and the fine check runs with owned=False), so it is now dropped from group grants, or turned into a revoke for overrides, instead of being saved as full delete access. The matrices show it the same way. - The group dialog no longer saves when the permission catalog failed to load, which would have stripped every own_only grant. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(auth): require users.write in the credential to act on another user (pr-ready: code-review) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(auth): share client token effective scopes and canOwn (pr-ready: simplify) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(permissions): tighten grantEffect docstring and matrix comment (pr-ready: review-polish) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(auth): make user, token and streaming admin rules consistent - Acting on another user (edit, delete, RA refresh) needs users.write in the credential, and only admins may target an admin or grant the admin role. One assert_admin_for_admin helper now backs add_user, invite links, update, delete and admin token revocation. - Re-issuing a client token's secret (regenerate, pair) needs every scope it stores; deleting one needs every scope it currently grants, so a narrow token can't remove a broader sibling. - Streaming admin overrides need users.read or users.write in the credential, not just the admin role. - Migration 0154 rewrites stored own_only grants and overrides on owner-less entities to the access they already gave, so the frontend normalisation and the catalog save gate are gone. - own_only is no longer rejected on revoke overrides. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
3bb255e468 |
chore(deps): update backend dependencies (#5347)
* chore(deps): update backend dependencies * fix(backend): update type ignores for mypy 2.4 and starlette 1.9 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
f522d3959b |
fix(logs): keep password reset links out of the log viewer buffer (#5343)
When SMTP is off or sending fails, the reset link is logged so an admin can read it from stdout and pass it on. LogStreamHandler copied that record into the Redis buffer behind GET /api/logs and the log socket, which any logs.read holder can see, and logs.read is not admin-only. Records logged with extra=STDOUT_ONLY now skip LogStreamHandler, and the reset link uses it. The invite flow already logs only the token id. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
88b3ebe49d |
refactor(streaming): let the backend pick the resume picker's states (#5210)
* refactor(streaming): let the backend pick the resume picker's states
The player decided which of a ROM's states the resume picker offers from
a core rule the config shipped, and so repeated the rules the claim
checks a pick against.
The player now asks `GET /api/streaming/states/{rom_id}` which states
load natively and which the broker can import, so the rules live only in
the backend. A native state whose filename carries no slot number is
offered only when the broker can import it, since it can't resume as is.
The player asks again only when the ROM's states, the emulator or the
import kinds change, keeps its last answer if a refresh fails, and holds
Play until the first answer for the ROM arrives, so a quick click can't
skip the state about to be preselected.
`StreamingContainerSchema.state_core` and `StateCoreSchema` are removed,
and the config no longer asks each broker for its core.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(streaming): address Greptile review on the state picks
Refetch the picks when a state is renamed, since the filename decides whether it resumes as it is, and fold the new docstrings to one sentence.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Zach Clendenen <zclendenen@yahoo.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
|
||
|
|
26d83db6ea |
fix(streaming): keep a stream capture Cloud Sync serves from its slot (#5209)
* fix(streaming): keep a stream capture Cloud Sync serves from its slot A stream capture filed in a core's folder is the state Cloud Sync serves for its slot while it is the newest there. Pruning the stream's state history past its limit would delete it, and a device holding it as that slot would lose the slot. The prune now skips a capture a slot serves, until a newer state takes that slot or the capture's file is gone from disk. History can go over the limit by at most one capture per slot. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * docs(streaming): fold the prune_state_history docstring to one sentence Greptile review on #5209. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Zach Clendenen <zclendenen@yahoo.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
5270c5d31e |
fix(sync): file a screenshot sent ahead of its state past a stream capture (#5208)
* fix(sync): file a screenshot sent ahead of its state past a stream capture A Cloud Sync client sends a slot's screenshot before the state it belongs to. With a stream capture serving the slot, the screenshot was filed under the capture's name and wrote over the capture's own thumbnail. The screenshot now goes to the state the slot's next upload writes to: the slot's newest non-capture state, or the canonical name when the upload will create one. A copy of the capture's own screenshot sent back is left alone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor(sync): address Greptile review on the stream capture checks Move the capture copy checks for a state and a screenshot upload out of the endpoint into the sync handler, and fold the core_library_name, prune_state_history and Stream.vue comments to two lines. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Zach Clendenen <zclendenen@yahoo.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
261178cb25 |
fix(streaming): share RetroArch stream saves and states with Cloud Sync (#5197)
A streamed RetroArch exit's save landed in "No slot", and the stream's states were filed under a different emulator than the one Cloud Sync and the other RetroArch clients use, so neither side could see the other's. A streamed exit's save is now stored as an `autosave` version, like the other clients' autosaves. Stream saves and states are filed under the core's RetroArch folder, which the broker reports as `library_name`; a broker that doesn't is filed under the core id. A stream resumes from any state in the booted core's folder, including other clients' states and ones filed under an alias of the folder, and the picker's core rule gains the folder's names so it offers them too. Cloud Sync shares the slot with stream captures but never writes over or deletes one: an upload goes to the slot's newest non-capture state or creates one, sending a capture's own bytes back is a no-op, and a delete removes the slot's other states and leaves captures in place. Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
1f6b4d11ca |
feat(permissions): gate emulator streaming and in-browser play behind group permissions (#5185)
* feat(permissions): gate emulator streaming behind a group permission Add a streaming permission entity. Read shows streaming and allows joining a session; write allows starting one. Users without read get a disabled streaming config, so every streaming surface hides. Migration 0152 grants read and write to every existing group, so nobody loses access on upgrade. Groups created afterwards start without it. Owner-scoped session controls (save, exit, release) stay ungated so a revoked user can still leave a running game without losing saves. * fix(streaming): pr-ready code-review fixes for the streaming grant Own-only read no longer joins other users' sessions, the config refetches on permissions:changed, the store skips the joinable request when streaming is off, and tests clean up the groups they create. * refactor(streaming): pr-ready simplify pass on the streaming grant Collapse the streaming permission helpers onto assert_can/can_access, return an empty joinable list instead of 403, skip the permission resolve when streaming is off, and add a stream.start action key so the UI hides Stream (but keeps Join) for users without the write grant. * docs(streaming): pr-ready review-polish pass on the streaming grant Trim the 0152 migration docstring to a single summary line, matching 0150 and 0151. * docs(streaming): pr-ready humanizer pass on the streaming grant Plainer wording for the stream.start action key comment and the Permission Groups paragraph, which now says an own-only read shows streaming without the join. * feat(permissions): gate in-browser emulation behind a group permission Adds an emulation entity next to streaming. Read plays in the browser (EmulatorJS, Ruffle, js-dos, PICO-8, EasyRPG) and joins netplay rooms, write hosts them. Migration 0152 now backfills both entities onto every existing group. * fix(streaming): address Greptile review on PR 5185 - Pin the claimed container in the stream player, so a permission refresh that turns streaming off mid-game keeps save, load and disc swap until the session ends. - Empty the Join list when a refreshed config turns streaming off, and discard any joinable request still in flight. - Update the installPermissionsHydration doc to name every layout that calls it. * fix(migrations): renumber play permissions migration to 0153 after master's 0152 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(permissions): drop redundant PermEntity comments Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(streaming): drop the live config refresh on permission changes 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> |
||
|
|
de62fa3815 |
fix(oidc): match any of the comma-separated groups in OIDC_ROLE_* (#5203)
* fix(oidc): match any of the comma-separated groups in OIDC_ROLE_* OIDC_ROLE_ADMIN/EDITOR/VIEWER were read as one raw string and checked for membership in the roles claim, so a value like "romm-admin,platform-admins" never matched and the login was rejected with 403. Parse each variable into a set of stripped, non-empty values and grant the role when it intersects the claim. A single-valued string claim is matched whole rather than by substring. Fixes #4302 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(oidc): reject a string role claim that only contains a mapped group Addresses Greptile's review on #5203: the string-claim case only covered a match, which the old substring check would also have passed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
92b6421e65 |
fix(saves): make a deduplicated slot upload the slot head (#5204)
* fix(saves): make a deduplicated slot upload the slot head A slotted upload whose bytes match an older version in the slot returned that version without touching its updated_at, so the slot's newest save stayed one the device had moved away from. A client re-downloading the slot head then restored the wrong save. Bump the matched version before pruning so it becomes the head and survives the cap. A retry of the current head is left alone so other devices don't see a spurious update. Fixes #5200 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(saves): promote a deduplicated save in the handler, past same-second heads Addresses Greptile review on #5204: the head promotion moves out of the endpoint into db_save_handler.promote_to_slot_head, and the promoted timestamp is at least a second past the current head's, so a head written in the same second can no longer win the id tiebreak. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
989bfb8553 |
fix(scan): reassociate a moved ROM by title id when its hashes changed (#5202)
Reassociation matched a moved file to its missing entry by CRC, MD5 and SHA1, and only consulted the binary title id when the hashes were absent. Moving a GameCube iso into its own folder next to a dumpinfo.txt makes it a folder ROM whose hash spans both files, so the hashes no longer matched, the title id was never tried, and the scan created a new entry that showed up under Recently added. Fall back to the title id when the hashes match no missing entry. Hashes still win when they match, and ambiguous hashes still return no match rather than letting the title id break the tie. Fixes #5046 Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
f89f6ef185 |
fix(security): check collection ownership in the ROM filters (#5201)
* fix(security): check collection ownership in the ROM filters The collection endpoints refuse a private collection to anyone but its owner, but the ROM listing endpoints accepted the same id as a collection_id or smart_collection_id filter without checking it. Any user (or a kiosk visitor) could list, randomly pick from and bulk download another user's private collections and Favourites, and re-share one through a public smart collection scoped to it. The membership filters now match only collections that are public or owned by the caller. A collection_id inside smart collection criteria is checked against the smart collection's owner, both when the criteria are saved and when they are evaluated. Reported by Takaya Sato (dagadjno). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(security): clear stale smart collection caches across owners Addresses Greptile's review on #5201. Smart collections cache their membership on the row, so one scoped to another user's private collection kept serving the members it cached before the ownership check. Migration 0152 empties those caches on upgrade, and sharing or unsharing a collection now refreshes the smart collections scoped to it. Also covers a second user listing a public smart collection scoped to its owner's private collection. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(collections): harden smart collection scope refreshes (code-review) Allow re-saving a smart collection whose stored scope was since lost, reject non-object criteria in from_stored_criteria, guard the scoped refresh, and refresh smart collections when a collection's ROMs are replaced or the collection is deleted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(collections): share the refresh wrapper and trim scope tests (simplify) Move the scoped smart collection refresh next to the existing wrapper, match the scope on the raw criteria before refreshing, batch the migration update, and fold the duplicate unshare test into helpers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(migrations): describe the cleared smart scopes by current behavior (review-polish) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(roms): state the collection filter comment plainly (humanizer) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
be6ad905b1 |
fix(sync): serve the newest on-disk RetroArch state in a slot (#5193)
* fix(sync): resolve RetroArch paths across emulators sharing a core folder Several RomM emulator ids map to one RetroArch folder (mednafen_psx_hw, beetle_psx_hw and the raw "Beetle PSX HW" all sync through saves/Beetle PSX HW/). The manifest built paths from whichever id an asset carried, but GET parsed the folder back to the canonical id and matched it exactly, so an asset filed under another alias was advertised and then 404'd. Uploads also started a second autosave history beside the alias's. The manifest now lists the newest asset per folder, and GET, PUT and DELETE resolve a path across every alias. Rewrites of an existing unslotted save or state stay under that row's own emulator. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): prefer on-disk alias saves and share newest-per-key grouping pr-ready step 2 (code-review --fix). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): one alias helper and a lineage computed once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): type the alias fixture's asset kind pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): isolate the asset dir per RetroArch sync test The alias tests write different bytes to the same asset paths, and user and ROM ids repeat across xdist worker databases, so parallel runs raced on those files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): serve the newest on-disk RetroArch state in a slot Missing states are dropped before slot grouping for the manifest and reads, so a newer missing state (or alias) no longer hides an older one still on disk. A PUT still matches the missing row and revives it in place. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): fall back past a RetroArch file that vanished unflagged Addresses Greptile's review on #5193: a state whose file was deleted before `missing_from_fs` was set still won its slot. The manifest now rebuilds when hashing flags an asset, and GET flags a missing file and resolves again, so an older asset at the path is listed and served. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
57ebac8efe |
perf(sync): resolve RetroArch core aliases in one query (#5192)
* fix(sync): resolve RetroArch paths across emulators sharing a core folder Several RomM emulator ids map to one RetroArch folder (mednafen_psx_hw, beetle_psx_hw and the raw "Beetle PSX HW" all sync through saves/Beetle PSX HW/). The manifest built paths from whichever id an asset carried, but GET parsed the folder back to the canonical id and matched it exactly, so an asset filed under another alias was advertised and then 404'd. Uploads also started a second autosave history beside the alias's. The manifest now lists the newest asset per folder, and GET, PUT and DELETE resolve a path across every alias. Rewrites of an existing unslotted save or state stay under that row's own emulator. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): prefer on-disk alias saves and share newest-per-key grouping pr-ready step 2 (code-review --fix). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): one alias helper and a lineage computed once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): type the alias fixture's asset kind pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): isolate the asset dir per RetroArch sync test The alias tests write different bytes to the same asset paths, and user and ROM ids repeat across xdist worker databases, so parallel runs raced on those files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * perf(sync): resolve RetroArch core aliases in one query The saves handler now filters on a collection of lineages and looks up a file name across several folders, so the RetroArch alias resolvers issue one query each instead of one per alias. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * perf(sync): filter a RetroArch delete to autosave and unslotted saves in SQL Addresses Greptile's review on #5192: saves_at_path loaded every slot of the matching lineages and dropped the named slots in Python. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
79d1feba6c |
fix(sync): resolve RetroArch paths across emulators sharing a core folder (#5191)
* fix(sync): resolve RetroArch paths across emulators sharing a core folder Several RomM emulator ids map to one RetroArch folder (mednafen_psx_hw, beetle_psx_hw and the raw "Beetle PSX HW" all sync through saves/Beetle PSX HW/). The manifest built paths from whichever id an asset carried, but GET parsed the folder back to the canonical id and matched it exactly, so an asset filed under another alias was advertised and then 404'd. Uploads also started a second autosave history beside the alias's. The manifest now lists the newest asset per folder, and GET, PUT and DELETE resolve a path across every alias. Rewrites of an existing unslotted save or state stay under that row's own emulator. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): prefer on-disk alias saves and share newest-per-key grouping pr-ready step 2 (code-review --fix). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): one alias helper and a lineage computed once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): type the alias fixture's asset kind pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): isolate the asset dir per RetroArch sync test The alias tests write different bytes to the same asset paths, and user and ROM ids repeat across xdist worker databases, so parallel runs raced on those files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): delete every aliased state in a slot and prefer one on disk Addresses Greptile review on #5191: a slot's state is picked live-first across aliases, so a newer missing alias no longer hides an older one on disk, and DELETE removes every state in the slot so an older alias can't resurface at the same path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
e232a52656 |
fix(docker): boot when the container runs as a non-default UID (#5189)
* fix(docker): boot when the container runs as a non-default UID Unraid runs the container as 99:100, which can't write to the image's /romm (owned by 1000, mode 755), only to the mounted subfolders. The PSP pending dir at /romm/cache/retroarch_sync was created at import time, so every gunicorn worker failed to boot. - Buffer pending PSP save files under the user's assets folder (assets/users/<user>/retroarch/psp_pending/), beside the other RetroArch Cloud Sync files and outside the client-reachable blob categories. - Move the zip and rom-converto download caches to /tmp/romm/cache, and point nginx's internal /cache/ alias there. - Put gunicorn's control socket in /tmp/gunicorn instead of $HOME/.gunicorn, since HOME is / for that UID. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(docker): honor ROMM_TMP_PATH for caches, explain an unwritable sync folder - The download caches live under $ROMM_TMP_PATH/cache when it's set, so installs with a small Docker disk (Unraid's docker.img) can point them at a share. The entrypoint exports the same path for nginx's /cache/ alias. - With ENABLE_SYNC_FOLDER_WATCHER on and /romm/sync not writable, /init warns and skips the watcher instead of dying on mkdir under errexit. - The compose example lists the /romm/sync mount the sync features need. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): cover reading back and clearing buffered PSP files Addresses Greptile's review on #5189. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): apply code-review findings to PSP pending buffer Remove the emptied psp_pending folder after a merge, define the sync folder path once in init, update the architecture doc's PSP and blob locations, and drop a stale .gitignore entry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): apply simplify findings to PSP pending cleanup Clear the buffered folder with remove_directory, let the startup check own creating the sync folder, and reword the test fixture docstring. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): cap buffered PSP files and drop them on delete Buffered files for an unresolved save folder now count against the bundle limits, so a folder can't fill the assets share and then fail every merge once it resolves. A DELETE also removes the buffered copy, so a deleted file isn't merged back when the folder resolves. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(docker): check the sync folder for push-pull sync too ENABLE_SYNC_PUSH_PULL keeps SSH keys and device saves under /romm/sync as well, so an unwritable folder now disables it with the watcher and warns at boot instead of failing when the task runs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(docker): strip whitespace from env vars like the backend does The backend strips every variable it reads, while the init script and nginx templates used raw values, so a padded ROMM_TMP_PATH sent nginx's /cache/ alias somewhere the backend never writes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(config): drop the CACHE_BASE_PATH comment Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(docker): say which backend config strips env whitespace Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * revert(docker): drop the entrypoint env whitespace trimming Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): apply pr-ready code-review findings Gate push-pull on its SSH keys path rather than a writable sync folder, accept the same truthy values as the backend, and clear only the merged PSP pending files so another worker's buffered file survives. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor: apply pr-ready simplify findings Share one truthy pattern across init's flag checks (the watcher gates now accept the same values as the backend), disable gunicorn's unused control socket instead of placing it, derive the converts redirect from its own cache path, and factor the unknown PSP folder in tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(docker): apply pr-ready humanizer pass to the sync mount note Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(fs): create handler base folders on first write, skip leftover temp files FSHandler no longer mkdirs its base path when constructed, so a module-level handler rooted at an unmounted or unwritable folder can't take down boot; every write path already creates its parent folders. Blob listings skip .romm_tmp_ files a crashed write left behind, so they are never merged into a PSP bundle or advertised in the sync manifest. The prefix now lives in one TEMP_FILE_PREFIX constant. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
ec10e5b930 |
fix(platforms): give platforms missing from IGDB a family (#5187)
* fix(platforms): give platforms missing from IGDB a family Platform families only came from the IGDB platform list, so platforms IGDB doesn't list (win9x, win3x, Sega arcade boards, TI computers, ...) landed in "Other" when grouping the platforms page by family. Platforms IGDB doesn't list now either share the family and category of an IGDB sibling (win9x -> Windows), or get an explicit family, which can override the sibling's (Sega Model 2 -> Sega, Arcade). 108 of the 242 unlisted platforms get a family; the rest are engines, generic groups, single-member makers or ambiguous. Fixes #5178 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(platforms): satisfy mypy when applying a platform family Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(platforms): check every unlisted platform mapping resolves a family Addresses Greptile review on #5187. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |