mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
master
2808 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0b1e449b0f |
feat(saves): convert DS, Sega cartridge and Game Boy Advance saves through sigil (#5643)
* feat(saves): convert Nintendo DS saves through sigil Sigil now converts a DS save between melonDS's raw file and DeSmuME's .dsv, so a download with core= gets the file that emulator reads instead of the stored one as is. DS moves from the native list to the platforms sigil restores; like Saturn and Sega CD it carries no title id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): accept a single-file neutral unit as sigil names it, for DS and Game Boy Sigil names a cart's single-file unit after the content, `{stem}.srm`, and sets the unit format; the neutral check only took `save.raw` for DS and `save.sram` for Game Boy, so a client pushing sigil's own unit got a 422. A SINGLE unit's one file may now carry sigil's name on those platforms; multi-file units and every other platform keep their names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): name DS among the cartridges that take no companions Sigil refuses companions on every cartridge platform, DS included now that it converts DS saves, so the refusal says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(saves): convert Mega Drive, 32X, Master System and Game Gear saves through sigil genesis_plus_gx and picodrive keep these carts' save RAM at the same offsets but fill and size it differently. With sigil converting between them, the four platforms move from NATIVE_SAVE_PLATFORM_SLUGS to SIGIL_RESTORE_PLATFORM_SLUGS (sigil slugs genesis, 32x, sms, gamegear), so a download with core= gets the file that core keeps. The companion refusal message names the new cartridges. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): accept the Sega cartridges' single-file neutral unit as sigil names it Sigil names a Mega Drive, 32X, Master System or Game Gear unit after the content, `{stem}.srm`. A SINGLE unit's one file may now carry that name, as DS and Game Boy's may; RomM's `save.sram` still passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(saves): convert Game Boy Advance saves between emulators with sigil GBA moves from the native-save platforms to the ones sigil reads at scan time and restores for a core. The stored file doesn't load everywhere: VBA Next keeps an EEPROM save at 128 KiB into a 136 KiB file, gpSP pads every save to 128 KiB, and standalone mGBA appends the cart clock. The scan stores the cart's save chip and clock in sigil_features, which sigil uses to size a padded save. The tests that used GBA as their native example now use SNES. Needs a sigil pin with GBA collect and restore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): accept a single-file GBA neutral unit as sigil names it Sigil names a GBA cart's unit as it does a Game Boy's: the save alone as `{stem}.srm`, or a clock cart's zip of `save.sram` and `clock.rtc`. GBA now takes Game Boy's form, so the single file may carry sigil's name. The clock-only form had no other platform left and goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): pin sigil at the DS merge, and take only a plain file name as its single unit Both SIGIL_VERSION pins move to baa96b8 (rommapp/argosy-sigil#22), the first sigil commit with DS. _SIGIL_SINGLE is [^/]+\.srm, so a single unit named with a folder in it is refused; test_neutral.py checks it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at the GBA merge rommapp/argosy-sigil#24 is merged as 4980f69. Both SIGIL_VERSION pins (Dockerfile, docker/Dockerfile) move from baa96b8 to that commit on sigil's main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at the Mega Drive merge rommapp/argosy-sigil#23 is merged as be0809d. Both SIGIL_VERSION pins (Dockerfile, docker/Dockerfile) move from baa96b8 to that commit on sigil's main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at 650b265 Both SIGIL_VERSION pins (Dockerfile, docker/Dockerfile) move from be0809d to 650b265, sigil's main. It holds rommapp/argosy-sigil#23 (be0809d) and is the commit rommapp/romm#5758 pins, so the two pull requests set the same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at 650b265 Both SIGIL_VERSION pins (Dockerfile, docker/Dockerfile) move from baa96b8 to 650b265, sigil's main. It holds rommapp/argosy-sigil#22 (baa96b8) and is the commit rommapp/romm#5758 pins, so the two pull requests set the same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at 650b265 Both SIGIL_VERSION pins (Dockerfile, docker/Dockerfile) move from 4980f69 to 650b265, sigil's main. It holds rommapp/argosy-sigil#24 (4980f69) and is the commit rommapp/romm#5758 pins, so the two pull requests set the same value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): name no systems in the companion refusal The message listed the cartridges that take no companions, so each platform added to sigil's restores edited it, and the open save PRs (#5643 to #5647) each edited it differently. It now says what holds for every platform: companions go only on memory cards and volumes. All five carry the same line, so they merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): name no systems in the companion refusal The message listed the cartridges that take no companions, so each platform added to sigil's restores edited it, and the open save PRs (#5643 to #5647) each edited it differently. It now says what holds for every platform: companions go only on memory cards and volumes. All five carry the same line, so they merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): name no systems in the companion refusal The message listed the cartridges that take no companions, so each platform added to sigil's restores edited it, and the open save PRs (#5643 to #5647) each edited it differently. It now says what holds for every platform: companions go only on memory cards and volumes. All five carry the same line, so they merge in any order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(saves): restore Sega cart saves through RomM's platform map and binding From review: the Mega Drive, 32X, Master System and Game Gear tests mock the binding, so a slug sigil doesn't take would still pass. A ROM on each RomM platform now goes through stored_game and the real binding, and the restored file is checked in the form sigil's genesis.md gives the core: genesis_plus_gx without trailing 0xFF, picodrive's 32 KiB for Master System and Game Gear. rom_game is the same helper in #5643 to #5647. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(saves): restore a DS save through RomM's platform map and the binding From review: the DS tests mock the binding, so a slug sigil doesn't take for DS would still pass. A ROM on RomM's nds platform now goes through stored_game and the real binding, and the restored file is checked in the form sigil's nds.md gives each core: DeSmuME's .dsv ends in its 122-byte footer, melonDS's .sav is the save. rom_game is the same helper in #5643 to #5647. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(saves): restore a GBA save through RomM's platform map and the binding From review: the GBA tests mock the binding, so a slug sigil doesn't take for GBA would still pass. A ROM on RomM's gba platform now goes through stored_game and the real binding, and the restored file is checked at the size sigil's gba.md gives each core: gpSP 128 KiB padded with 0xFF, VBA Next 136 KiB, mGBA the chip. rom_game is the same helper in #5643 to #5647. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at ef9b51e Both SIGIL_VERSION pins move from 650b265 to ef9b51e, sigil's main since rommapp/argosy-sigil#30 merged, the commit rommapp/romm#5758 pins now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at ef9b51e Both SIGIL_VERSION pins move from 650b265 to ef9b51e, sigil's main since rommapp/argosy-sigil#30 merged, the commit rommapp/romm#5758 pins now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(deps): pin sigil at ef9b51e Both SIGIL_VERSION pins move from 650b265 to ef9b51e, sigil's main since rommapp/argosy-sigil#30 merged, the commit rommapp/romm#5758 pins now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: MMagTech <mmagtech@Mac.home> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
d8d9fa7884 |
fix(igdb): let region_mode decide the localized title (#5785)
* fix(igdb): let region_mode decide the localized title get_igdb_preferred_locale ignored scan.priority.region_mode, so a rom tagged (Japan) always got IGDB's ja-JP localized title, even with prefer_config and us first in scan.priority.region. Under prefer_config the configured regions now come first and the rom's own tags are the fallback, matching the ScreenScraper handler since #4413. The default prefer_rom_tags ordering is unchanged. Fixes #5784 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(igdb): fold the region_mode note into one docstring sentence Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Log a missing IGDB locale at debug: under prefer_config every ROM asks for the first config locale, so a missing one is routine, not a warning. Pin SCAN_REGION_MODE in the multi-region locale test instead of relying on MagicMock's auto attribute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Drop the IGDB-locale filter on the ROM's region codes; the final lookup loop already skips codes IGDB has no locale for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Spell out the USA region in the prefer_config test docstring so it does not read as the pronoun, untangle the fallback test docstring, and finish the clipped Returns line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(metadata): share one region order across IGDB, ScreenScraper and LaunchBox IGDB now tries every preferred locale in order, up to the first region that uses the default title, instead of only the first. Under prefer_config with [eu, jp], a (Japan) ROM whose game has no EU localization gets the Japanese title again rather than the default. preferred_region_codes in the filesystem base handler builds the region order once. ScreenScraper, IGDB and LaunchBox all read it, so LaunchBox artwork follows region_mode too, and uppercase config codes match the ROM's tags for every provider. European country codes map to IGDB's EU locale and ScreenScraper's ss to the default title, so a (France) ROM no longer falls through to the next configured region. An unquoted no (Norway, Norwegian) in scan.priority.region or scan.priority.language loads as false from YAML and crashed every IGDB match. The config loader now turns it back into "no" and drops other non-string entries with a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(igdb): drop _string_codes and spell out the EU region codes 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> |
||
|
|
13e1a612d8 |
fix(launchbox): read the YouTube id from watch URLs wherever v sits and without a fragment (#5764)
* fix(launchbox): read the YouTube id from watch URLs wherever v sits and without a fragment A video URL with v after another parameter yielded no id, and a #t= fragment was kept as part of it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(launchbox): ignore a trailer URL that cannot be parsed Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * pr-ready: code-review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(metadata): share one YouTube id parser across LaunchBox, Demozoo and Pouet LaunchBox now also reads ids from embed, shorts, live, /v/ and youtube-nocookie links, and Demozoo and Pouet now accept URLs without a scheme. Ids are checked against the 11-character format at parse 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> |
||
|
|
a420c7da31 |
fix(saves): stop Pokemon scratch RAM writes from flooding save sync (#5758)
* fix(play): show the automatic Save synced toast at most once every 5 minutes * fix(saves): let sigil decide when a Pokemon save is the same, ignoring scratch RAM * pr-ready: code-review * pr-ready: review-polish * pr-ready: prose * fix(play): hold SRAM changes in the browser and upload them once the game goes quiet * fix(play): upload a held save before a state replaces it, and report only new snapshots * pr-ready: code-review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose (code-review fixes) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(play): leave a save a running session holds out of other tabs' sync passes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * build(sigil): pin ef9b51e --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
695fd5a9f1 |
fix(users): delete a user who has play sessions on a device (#5757)
* fix(users): delete a user who has play sessions on a device On MariaDB, deleting a user whose play sessions name a device failed with error 1452 once play_sessions had been rebuilt, as restoring a dump does. The cascade clears device_id on rows of the user being deleted, and InnoDB rechecks their user through the index that also holds device_id. The user's devices are now deleted first, while the user still exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(users): force the play_sessions rebuild in the delete-user test OPTIMIZE TABLE can defragment instead of rebuilding when innodb_defragment is on (MariaDB 10.11), which would leave the index order unchanged. ALTER TABLE ... FORCE always rebuilds. Addresses Greptile review. 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> |
||
|
|
fdba47d362 |
feat(filters): exclude platforms in the search filter drawer (#5756)
* Let the platforms filter exclude as well as include
The search filter drawer gains an Any/None toggle next to the platforms
select. `GET /api/roms` takes a new `platforms_logic` parameter ("any" or
"none"); "all" is rejected because a rom has one platform.
An exclusion keeps the grouped single-platform cache from answering, is
carried into the filter-values scope, round-trips through the URL, and
is stored on smart collections as `platforms_logic: "none"`. A platform
route always includes its own platform.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4icN79J4F1bZ15pmZG
* Rename the filter drawer's "Tags" heading to "Attributes"
The section holds genre, franchise, company, region, status and more,
with "Tag" as just one of its rows, so the heading read as if every row
were a tag. The platforms select joins it as the first row, and the rows
share one column grid so the selects line up even though the platforms
toggle has no "all" button.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4icN79J4F1bZ15pmZG
* Fix three gaps in platform exclusion found in review
- A URL with platforms but no platformsLogic now includes them, so
following an inclusion link after an exclusion no longer keeps
excluding. Without platforms the logic is left alone, since it is
never written to the URL then.
- Smart collection criteria give the route's platform priority, as the
gallery request does, so a collection saved on a platform page never
excludes the games on screen.
- The drawer's Reset button resets the platforms toggle to Any.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4icN79J4F1bZ15pmZG
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
ea8aac7d5d |
fix(ra): hash an arcade set by its archive, not the CHD beside it (#5747)
* fix(ra): hash an arcade set by its archive, not the CHD beside it RetroAchievements identifies an arcade game by its set's name. A folder holding a set and its disc was hashed by the CHD, which is named after the disc (gdl-0018.chd beside azumanga.zip). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Pass the arcade set's archive to RAHasher directly. RAHasher on Linux does not expand a /* wildcard, so the arcade hash of <folder>/* is the MD5 of an empty name. Prefer the archive named after the folder so a larger BIOS or parent zip beside it does not win. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: plain-prose 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> |
||
|
|
fdd311bdf3 |
fix(ra): match NAOMI, Atomiswave and Gaelco games again (#5746)
RetroAchievements' Arcade has sets for games Flycast runs (Atomiswave, NAOMI, NAOMI 2 and NAOMI GD-ROM) and for Gaelco games FinalBurn Neo runs. Since #5273 those folders have slugs of their own with no RetroAchievements console, so their games get no hash. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1ab3a3625a |
feat(auth): use the OIDC picture claim as the user's avatar (#5730)
* feat(auth): use the OIDC picture claim as the user's avatar On each OIDC sign-in, a user with no avatar, or one synced from the provider earlier, gets the picture claim stored as their avatar. An uploaded avatar is never replaced. The download goes through the SSRF-guarded client (the configured provider's origin may reach a LAN address), is capped at 5 MB, must sniff as a supported image, and any failure is logged without blocking the sign-in. Closes #4297 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): address review on the OIDC avatar sync Addresses Greptile's review on #5730: - ask the UserInfo endpoint when the ID token has no picture claim - keep an avatar uploaded while the picture downloaded - allow only the OIDC provider's origins to reach private addresses - trim docstrings and narrow await_args in the callback test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(auth): type the OIDC avatar test helpers for mypy Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Bound the OIDC picture download with an overall deadline, trust the OIDC CA bundle, catch hostname encoding errors so sign-in never 500s, and set the synced avatar with a conditional update so a concurrent upload wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Type the pytest fixtures and helpers in the OIDC avatar tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): remove the synced OIDC avatar when the user uploads one Once avatar_path points at the uploaded avatar.<ext>, the sync never touches the user's avatar again, so the old oidc-avatar.<ext> file would otherwise stay on disk for good. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ece64f4ca4 |
feat(scan): list the ROMs a ScreenScraper breaker skipped in the scan summary (#5727)
* feat(scan): list the ROMs a ScreenScraper breaker skipped in the scan summary A ROM whose ScreenScraper lookup was answered by the quota or credentials breaker is now recorded, and the end-of-scan summary lists those ROMs beside the rate-limited ones. A ROM whose name lookup still reached ScreenScraper after a short-circuited hash lookup is not listed. Closes #4358 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ss): list quota-skipped roms by path Addresses Greptile's review on #5727: same-named roms on different platforms collapsed into one entry in the skipped list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
80eca562f7 |
fix(demozoo): send an API key with every Demozoo request (#5723)
* fix(demozoo): send an API key with every Demozoo request Demozoo's API has required an API key since 2026-11-01. Add DEMOZOO_API_KEY, sent as an Authorization: Api-Key header, and enable Demozoo when it is set, like the other key-based providers. It replaces DEMOZOO_API_ENABLED, since requests without a key are refused. Fixes #5698 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e427d8b093 |
fix(scan): fetch file rows per rom on quick scans (#5725)
* fix(scan): fetch file rows per rom on quick scans A quick scan loaded every file row of a 200-rom batch up front, so a platform with a few extracted multi-file games held hundreds of thousands of RomFile objects at once and the worker was OOM-killed. Each rom now fetches its own rows inside the scan semaphore, capping the rows held to SCAN_WORKERS roms. Refs #5706 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style(scan): shorten the batch lookup comment Addresses Greptile's review on #5725. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ee14785ad6 |
fix(streaming): restore only broker-pulled save archives natively (#5724)
* fix(streaming): restore only broker-pulled save archives natively A device client (Argosy with Eden or Azahar) can sync its own zip under the emulator name a streaming container uses. RomM treated any .zip from that emulator as a native broker archive and pushed it as-is, so the broker refused the restore with a 422 for members outside its save subtrees. Only archives RomM filed from a broker pull (*.saves.zip) restore natively now. A client zip is skipped by the default launch and, when picked, goes through the broker's import path where it accepts saves. Fixes #5268 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): keep a broker archive's suffix through a rename Addresses Greptile's review on #5724: renaming a broker-pulled save to another .zip dropped the .saves.zip marker, so the next launch stopped restoring it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5cd01267c0 |
fix(search): keep NSFW SteamGridDB covers from age-restricted users (#5721)
The cover search asked SteamGridDB for every content variant, so a user under an age limit could browse NSFW artwork through a client. The server now asks for SFW grids only when the caller has an age rule. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
23ea65e2fe |
fix(snapshots): record the pushing device on a snapshot's states (#5720)
A push stored its save with origin_device_id and its states with none. The web player counts a state with no origin_device_id as its own and prefers a state on a tie, so after a console pushed a save and states in the same snapshot, the web player booted the console's state instead of its save, though that state may be another core's or older than the save. A pushed state now carries the same origin_device_id as the save beside it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ac9f5ab505 |
fix(saves): hash bytes that only end like a zip as one file (#5719)
* fix(saves): hash bytes that only end like a zip as one file zipfile.is_zipfile is true for any file whose last 64 KB hold a zip's end record. An emulator state can: Power Stone's Flycast (Naomi) state holds the tail of the game's own TorrentZip archive. Reading such a file as a zip fails, so compute_content_hash returned None, and a snapshot push carrying the state was refused whole with "does not hash to the manifest's value". When the bytes cannot be read as a zip (BadZipFile), compute_content_hash, hash_save_content and the memory card hash now hash them as one file, as the web player's saveContentHash and the snapshot identity hash already do. A real zip they cannot read within the limits stays unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Hash bytes as one file when the copied central directory points an entry before the bytes start, as the tail of an archive longer than the state does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: plain-prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): decide what is a zip archive by one rule Bytes are a zip archive only when their entries start at the first byte. A state or save holding another archive, whole or only its tail, after data of its own is hashed, shaped, uploaded and unpacked as one raw file everywhere: the content hashers, the identity hash, save_shape_of, check_upload and unpack_save_unit. A real archive with a corrupt entry stays unknown to the content hashers, and the identity hash falls back to the bytes for one past the limits too. 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> |
||
|
|
e63677ede3 |
fix(snapshots): keep a row's updated_at when its sharing is synced (#5718)
Pruning a channel re-syncs the sharing of the save and state rows the deleted snapshots shared with snapshots that stay. That Core UPDATE of is_public also ran updated_at's onupdate, so each kept row took the prune's time though nothing in it changed. The web player resumes the newest save by updated_at, so after a push that pruned a snapshot more than ten back it booted an old save another snapshot still held, often another app's. sync_content_visibility now keeps updated_at, as touch=False does for the sharing routes: sharing is not a write. The same holds where a push into a public channel, a channel's sharing change and a snapshot's sharing change sync it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ca8efb7a11 |
test(api): check returned, forwarded and stale error statuses (#5715)
* test(api): check returned and forwarded error statuses too The route error check only saw HTTPException with a literal status. It now also counts error responses a route returns, statuses passed to a helper, status maps, IfExp and local variables. A status it still cannot read fails the check instead of passing silently. Routes left out of the schema are skipped, and 422 counts as documented only when FastAPI documents it. The API description now names the middleware errors no route lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): fail on documented statuses a route cannot raise Add a stale check, the reverse of the undocumented one. To keep its false positives near zero, the analyzer now follows functions run through asyncio.to_thread and similar offloads, and skips a try body whose handler swallows every error (keeping the responses it returns). A new `# route-errors: raises <codes>` marker declares what a line raises when the analyzer cannot follow or read it. Following offloads found an undocumented 502 on save-and-exit: a container with no broker address fails the card wipe. search_cover declares the SteamGridDB 401 it re-raises from a gather. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: plain-prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review (best-effort broker PUT never raises) put_binary_json looked up the broker URL outside its try, so a container with no broker address raised a 502 from a helper documented as never raising. Evacuation already fails first on that container, so the 502 documented on save-and-exit could not happen; drop it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: plain-prose (code-review additions) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish (build a real container in the broker test) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2d7b9e3c34 |
test(api): check that routes document the error statuses they raise (#5686)
* test(api): check that routes document the error statuses they raise protected_route now documents the scope guard's 401 and 403 on every route that declares scopes, appending to a route's own description when it has one. tools/route_errors.py follows each route's calls through imports, handler instances, custom exception classes and HTTPException subclasses to the statuses it can raise. test_raised_statuses_are_documented fails on a status the route's responses= leaves out, against a baseline of existing gaps that can only shrink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error responses for roms routes Describe every 4xx and 5xx the rom routes and their helpers raise in each decorator's responses=, so the OpenAPI schema lists them. A hidden rom, platform or file is described like a missing one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error responses for saves routes Describe every 4xx/5xx the saves, states, screenshots, snapshots, play-sessions and sync routes raise in their responses=, and rewrite the states identifiers docstring that carried Args/Returns blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error responses for devices routes Describe the 4xx/5xx statuses that the device, device auth, install, client token, notification, notification channel, sync channel and heartbeat routes raise, and fill the empty install route entries. Rewrite the setup and heartbeat docstrings that published Args and Returns blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error responses for streaming routes Describe the 4xx and 5xx statuses the streaming, memory card and netplay routes raise in their responses= declarations, and replace the Args: blocks in route docstrings that FastAPI published verbatim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error responses for admin routes Describe the 4xx and 5xx statuses the config, permissions, user, auth, tasks, logs, activity and export routes raise, and rewrite their Args/Returns docstrings as plain operation descriptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error responses for library routes Describe the 400/403/404/409/500 statuses the collection, feed, firmware, platform, music, playlist and search routes raise, and replace route docstrings that carried Args/Returns blocks with plain sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): answer like a missing resource for hidden play sessions and private collections DELETE /play-sessions/{id} deleted the caller's session even on a rom hidden from them, so 204 versus 404 showed the session existed. The handler now takes the caller's rom visibility. Another user's private collection, smart collection or playlist answered 403, which showed it existed. It now answers 404 on every route; a public one the caller does not own still answers 403 on write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): describe private collections and playlists as missing Matches #5686, where another user's private collection or playlist answers 404 and a play session on a hidden rom answers like a missing one. The read routes drop their 403, and the write 403 now covers only a public resource another user owns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(collections): use #5693's docstrings on the routes this PR touches Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): address Greptile review on route error docs Fold the nine multi-paragraph route docstrings into one line, and keep the device-scope 403 descriptions in utils/auth.py next to resolve_device, which raises them, instead of in both saves.py and states.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): follow route dependencies in the status analyzer Addresses Greptile's review: route_errors now follows the callable in Depends(...) and Security(...), whether it is a parameter default or inside an Annotated alias, and the module docstring is one line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): tighten wording of route error descriptions Give clipped responses descriptions and helper docstrings their missing subjects and verbs, use 'the caller lacks' and 'is not allowed to' consistently, and replace 'picked' with 'chosen'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(api): drop the route error baseline Every status left in the baseline was one a client cannot get: - The export routes' empty platform list check is dead, since FastAPI answers a missing required list query with 422. Removed. - get_save_layouts went through _restore_error, whose 500 fallback it cannot reach. It raises its 400 and 503 directly now. - The notification test and confirm routes only catch ChannelError, since the cooldown and email errors come from other actions. - The analyzer now skips asyncio.gather(..., return_exceptions=True), which covers search_rom. - A '# route-errors: ignore' marker, with its reason, skips code whose errors never reach the client: the metadata heartbeat probe, the force-release teardowns, and the legacy save adoption. The check now fails on any undocumented status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
20bff0830a |
fix(streaming): merge the webstation exit delta over the restored save archive (#5673)
* fix(streaming): merge the webstation exit delta over the restored save archive A webstation exit export holds only the files changed since launch, but RomM filed it as a standalone .saves.zip and the next launch restored only the newest zip. A session that exited without an in-game save therefore filed an archive with no save data, and the next Play booted without it. The launch now records which native archive it restored on the session record, and the exit pull lays the delta over that archive before filing it, so every stored archive is a full snapshot. Fixes #5544 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(streaming): type the stored exit archive as bytes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(streaming): skip the exit merge when the restored archive was replaced PUT /saves/{id} rewrites a save in place under the same id, so the exit merge could combine the session's delta with save data it never loaded. Record the restored archive's content hash at launch next to its id, and merge only while the base still has it; otherwise file the delta alone. Addresses Greptile's review on #5673, including folding the _over_restored_archive docstring into one sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(streaming): drop ensure_zipfile_writable from the archive overlay #5678 applies the zipfile_inflate64 fix where it is imported, and removed the helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: simplify Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: prose (code-review additions) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(streaming): keep imported states, folders and the entry cap in the exit merge A launch that imported a state left the base archive's states off the container, so the exit merge now leaves them out too. The merge keeps both archives' folders and refuses past the archive entry limit, so a merged archive always gets a content hash. The webstation hydrate now uploads the save its caller resolved instead of looking it up again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(db): query a platform id no sequence can reach Postgres keeps id sequences across tests, so a worker that has created about a thousand platforms hands id 999 to the fixture's own platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c925728cab |
fix(converto): move save channels to the converted files (#5681)
* fix(converto): move save channels to the converted files
Convert library pointed the game at its new file and refreshed its files,
but a channel names its file by SHA-1, name and size, and those still named
the original. Afterwards GET /api/channels?rom_file_id=<new file> found
nothing and a push into the channel with the new file was refused 422
("the ROM file does not match the channel's").
After the refresh, every user's channels on the game move: one on a
replaced file (an iso, a cue, its tracks, a rewritten m3u) to the file that
replaced it, and one on the game's sync file (channel_file_id) to its new
sync file, since name order picks that once no cue is left. The move keeps
updated_at, which orders a user's channels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(converto): move channels before deleting the originals
Convert library now refreshes a ROM's files while the originals are still
on disk, moves what keys to them onto the outputs in one transaction, and
only then deletes the originals. A failure before the deletion removes the
outputs, puts rewritten playlists back and keeps the channels on the
originals, so no failure leaves a channel on a file that is gone.
The sync-file redirect follows only to a file this run wrote, so a disc
that failed to convert no longer takes a converted disc's channels, and it
yields to the channel's own replacement when the user already has a channel
of that label on the new sync file.
The same transaction moves the ROM's snapshot hashes, so archival snapshots
still reattach after a rescan, and its states' capture disc, so a resume
mounts the right disc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(converto): skip the ROM-level hash in the early file refresh
The refresh that runs while a folder ROM's originals and outputs are both
on disk rereads every top-level file for the ROM-level hashes and RAHasher,
and the refresh after the originals go does it again. A new rom_hashes flag
on refresh_rom_files keeps the stored ROM-level hashes in the early
refresh, which then reads only the new and changed files, so the originals
are never reread and the ROM-level hashes are computed once.
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>
|
||
|
|
a2ac57959d |
fix(saves): keep a slot's channel when an added file moves the sync file (#5697)
A legacy upload to a slot files its save under the channel of that name, found on the game's sync file when no earlier upload links the slot. A snapshot client keys a game's channels to that file and its saves carry no slot, so once a file added to the game becomes the sync file (a cue beside a chd), the next upload to autosave made a second, empty default channel on the new file instead of joining the player's. When the sync file holds no channel of that name, the slot now takes the game's own channel of that name on another of its files still on disk, before making one on the sync file. The sync file's channel still comes first, and a channel on a file the game no longer holds, or on another game's copy of the file, is not taken. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f2986597d5 |
fix(scan): read title ids from zipped games (#5694)
A scan skipped every archive before asking sigil for a title id, but sigil reads a .zip in place: a Vita dump through its sce_sys/param.sfo, any other platform through the largest member. So a zipped game got no title id and no cart facts, which left its saves nothing to convert between emulators by. PS Vita is the common case, since a zip is the usual Vita dump. Let .zip through both checks and keep skipping every other archive, which sigil doesn't open. A hashed single-file archive also never queued its file for extraction, so that branch now does, as the others do. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2469839b66 |
fix(jsdos): play a .jsdos bundle that sits inside a game folder (#5672)
* fix(jsdos): play a .jsdos bundle that sits inside a game folder The play check read the ROM's own extension, which is empty for a folder, so a bundle moved into a folder (for example beside its manual) lost its Play button. The backend now exposes has_jsdos_bundle, true when the ROM is a bundle or has one at its folder's top level, and the js-dos player asks the content endpoint for that file instead of a zip of the folder. Fixes #5615 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(jsdos): assert the player downloads only the bundle file Addresses Greptile's review on #5672: covers the bundle file id in the player URL and drops a comment that restated the constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * pr-ready: code-review Pin has_jsdos_bundle's value for a plain single file and for a bundle missing from disk, on both the SQL and the with_files path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te * pr-ready: code-review Expose missing_from_fs on RomFileSchema so the js-dos player skips a bundle gone from disk, the same rule has_jsdos_bundle applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te * pr-ready: simplify Share the top-level file predicate and the present-file exists subquery between is_easyrpg_game and has_jsdos_bundle, compute the top-level files once in apply_file_stats, and fold the two marker flag tests into one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te * pr-ready: review-polish Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te * pr-ready: prose Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te * refactor(jsdos): rename isJsDosBundle to hasJsDosBundle It also matches a folder that holds a bundle, so the name now says what the backend flag it reads says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te * fix(scan): derive a scanned rom's file flags from the files it read A scan emits scan:scanning_rom before it writes the rom's file rows, so a new rom reached clients with every file flag false (has_simple_single_file, has_multiple_files, has_jsdos_bundle and the rest) until a reload. The emits now derive those flags from the files the scan just read whenever it rebuilt them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a936e661dd |
fix(resources): inflate gzip-encoded metadata media downloads (#5670)
store_media_file streamed the raw response body without decode_gzip, so media served with Content-Encoding: gzip (the LaunchBox image CDN does this whenever the client accepts gzip) was written to disk still compressed. Covers, screenshots and manuals already inflated it. Fixes #5669 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e06e0e4010 |
chore(docs): better openapi descriptions (#5660)
* docs(api): describe the core endpoints and add a docs test Give the parameters, operations and response fields of the core routers a description in the OpenAPI document: roms, platforms, collections, users, saves, states, screenshots, channels, snapshots, streaming, devices, client tokens, play sessions, search, auth, music, memory cards, firmware, sync, config, feeds, notifications and permissions. Response models read attribute docstrings (`use_attribute_docstrings` on the shared response `BaseModel`), so a string after a field is its description. The update-rom form reads its descriptions from `RomUpdateForm`, so they have one home. The paging parameters gain examples, such as 72 per page. `tests/endpoints/test_openapi_docs.py` reads `app.openapi()` and fails when a parameter or operation of a listed router has no description, or when a schema with some described fields leaves others bare. Add a router to `DOCUMENTED_ROUTERS` once its parameters and operations are described. Descriptions only: no parameter, constraint or default changes. The frontend types need regenerating (`npm run generate`). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(api): describe the remaining routers and the roms list parameters Cover the last routers (tasks, activity, heartbeat, audit events, stats, logs and netplay) and add the routers to the docs test's allow-list, so every router is now held to a description on each parameter and operation. Describe the schemas that test found partly documented: the task status responses and `TaskInfo` (as `Annotated[..., Field(...)]`, since a TypedDict takes no attribute docstrings) and the audit page's `max_id`. Rewrite the `GET /api/roms` parameters that did not say what they do: `with_char_index`, `with_filter_values`, `with_rom_id_index`, `with_total`, `with_provider_metadata`, `order_by`, `with_files`, `group_by_meta_id` and `search_term`, each with an example or the values it accepts. Replace a franchise name in an existing docstring example with a neutral one. Descriptions only: no parameter, constraint or default changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * chore(api): regenerate the frontend types Run `npm run generate` against the backend so the generated models carry the descriptions added to the OpenAPI document. Only comments change: no type, field or signature differs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(api): fix alternative_names and shorten docstrings per review Address the review feedback: - Describe `alternative_names` as the hand-set titles when there are any, otherwise the titles from IGDB, MobyGames and ScreenScraper, as `resolve_alternative_names` returns them. It said every matched provider. - Check HEAD routes in the docs test. Both existing HEAD routes already pass. - Keep docstrings to one paragraph, as the repository asks. The test module docstring is one sentence and its two rules are short comments. Nineteen operation docstrings added in this change drop their second paragraph. Descriptions and a test only: no parameter, constraint or default changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * chore(api): regenerate the frontend types Pick up the corrected `alternative_names` description. Only comments change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs(api): correct descriptions that disagree with the code (pr-ready: code-review) Fix 12 OpenAPI descriptions that contradicted handler behavior (empty provider metadata, virtual collection types, streaming container lookup, save device sync, user collections, search terms, file order, firmware file name, audit max_id, play session offset, save target layouts). Share the music filter descriptions through Annotated aliases and drop comments that restated the new docstrings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): share parameter aliases and check every router (pr-ready: simplify) Move the rom id and sort direction aliases to utils/router.py and reuse them, add per-router id path aliases in place of repeated inline params, let LimitOffsetPage inherit the shared BaseModel config, and drop Args blocks that restated parameter descriptions. The docs test now covers every /api path instead of an allowlist. The OpenAPI spec is unchanged apart from description strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(api): form model for rom updates, shared schema config and rom id alias - Take RomUpdateForm as a FastAPI form model instead of 33 Form params and a duplicate field dict; only sent keys still count as provided. - Document TypedDict responses with attribute docstrings through @with_config(API_SCHEMA_CONFIG) instead of per-field Annotated wrappers. - Move request payload models onto the shared BaseModel and use attribute docstrings for their descriptions. - Replace the 32 inline rom id path params with RomIdPath, which now carries ge=1 (adds minimum: 1 to the activity and streaming rom ids). The update rom request body now references a RomUpdateForm schema; the multipart fields are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): keep only the descriptions that explain something Drop the field and parameter descriptions that restate the name, the type, or what the schema already shows (enum and literal values, defaults, bounds, nullability), along with the wrappers and aliases that only carried them. Reword four that did not say what the field is. The docs test now checks operations only, since requiring a description on every parameter and field is what produced the filler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): plainer wording for three sync and rom descriptions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): rewrite clipped descriptions as full sentences Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document error statuses in responses instead of docstrings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): document pairing code exchange errors Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(api): move error statuses from route docstrings into responses Covers the routes whose docstrings stated an error in prose or in a Raises: block, new in this PR or older. 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> |
||
|
|
0941b3033e |
feat(roms): load roms by an array of ids (#5663)
* feat(roms): load roms by an array of ids GET /api/roms accepts up to 256 rom_ids and returns those roms in the order given. Ids the caller can't see, or that don't exist, are left out. Closes #5659 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(roms): code-review pass on rom_ids window Reuse RomIdScope (dedupe, shared 500 cap), skip sidecar and grouped page cache reads for a window by id, report offset 0 and the id count as limit, and rename the shadowed rom_ids local in _transform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(roms): simplify pass on rom_ids window Return early for rom_ids before building the filtered query, the sidecars or any cache key, through a shared _hydrate helper, so the paged path is back to its prior shape. Tests use the headers fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(roms): review-polish pass, cover a hidden platform in the rom_ids window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(collections): refuse malformed virtual collection ids, require page-row visibility A malformed virtual_collection_id raised an uncaught decode error (500) on the gallery, random and bulk download routes. It is now a 422 at the query boundary, and GET /collections/virtual/{id} answers 404. get_page_rows_query takes visibility as a required argument, since it is the access check on caller-supplied rom ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(gallery): load scroll windows by rom id Once the bootstrap holds the whole ordered id index, a window fetch sends that slice as rom_ids, so the backend skips the filtered, offset-paged query. Items are placed by id, since ids that went missing or hidden are dropped from the response. On a 100k-rom MariaDB library, a filtered grouped window went from 0.8-2.0 s to ~50 ms, and a deep ungrouped window from 106 to 50 ms. 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> |
||
|
|
38d0a671df |
fix(archives): fix zipfile writes where zipfile_inflate64 is imported (#5678)
zipfile_inflate64 replaces zipfile._get_compressor with a one-argument wrapper, while CPython 3.13+ passes compresslevel too, so every zip write raises TypeError once it is imported. Each writer had to call ensure_zipfile_writable() first, and a new writer that forgot it broke. Wrap the patched function right after the import in utils/archives.py, the only module that imports zipfile_inflate64, and drop the per-site calls and the helper. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2bc4b8d0e5 |
fix(sync): support safe RetroArch WebDAV backups (#5648)
* fix(sync): preserve RetroArch saves before WebDAV overwrites * fix(sync): lock RetroArch backups across workers and honor zero retention Address Greptile review on #5648: publish backups under an flock on the backup folder so workers cannot prune each other's copies, replace the os.link publish with an exists check and os.replace under that lock (no hardlink support needed), and skip pruning when MAX_SAVES_PER_SLOT is 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): harden RetroArch COPY backups (code-review) pr-ready step 2. Lock through a regular file so NFS grants the flock, answer 404 for PSP bundle paths so RetroArch still uploads, back up the state the upload overwrites rather than a served stream capture, compare the Destination authority without default ports, accept a lowercase Overwrite value, prune backups by age, and share the stamp regex. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(sync): simplify RetroArch COPY backups (simplify) pr-ready step 3. Check the source once before copying, publish backups with the served file mode, drop the redundant deleted/ segment from the backup storage path, and fold the two retention tests into one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): back up RetroArch deletes and share upload targets Back up the file a MOVE into deleted/ drops before dropping it, and read only the Destination tail so a reverse proxy may rewrite the host and prefix. COPY resolves its source first, answering 404 whenever an upload writes over nothing (versioned saves, PSP members), from the same upload target helpers PUT uses. Backups are hardlinked when the filesystem allows, and the stamp grammar and retention policy move to the sync handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(sync): list the RetroArch COPY route with the other WebDAV verbs COPY authenticates through _authorize like the rest of the WebDAV routes, so the route guard test lists it as handled in its module. 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> |
||
|
|
f9c8c8ab2a |
perf(roms): page grouped galleries from the cached id index (#5636)
* perf(roms): page grouped galleries from the cached id index With group_by_meta_id, every gallery page ran the sibling-dedup window over the whole library, because the frontend fetches pages with with_rom_id_index=false. Grouped pages for the whole library or a plain platform list now slice the versioned, cached id index instead, so only the first page after a change pays for the window. Filtered, searched and collection pages still run live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q367p1Ri2c1dKeYCpQgHeh * fix(roms): share one cached key for grouped platform sidecars (pr-ready: code-review) Grouped platform-only sets read their char index, id index and pages from one key, deleting a platform invalidates the cached lists, and the platform-only gate derives from has_scope(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(roms): simplify grouped sidecar caching (pr-ready: simplify) Add RomFilterParams.has_only_platform_scope, share one str key base between the sidecar key builders, collapse the total and index branches, and dedupe the platform-key tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(roms): cover has_only_platform_scope (pr-ready: review-polish) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(roms): page grouped galleries from a Redis list, bump on deletes - Store the cached id index as a Redis list. A grouped page reads its window with LRANGE/LLEN instead of decoding the whole list. - Page requests only read the cache; on a miss they run the live page query, so only the index request rebuilds the list. - Cache grouped platform sets only for a single platform, and never store an empty list, so client-chosen platform ids can't grow Redis. - delete_rom and delete_platform queue the after-commit version bump, replacing the hand-placed calls in the endpoints and cleanup task. 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> |
||
|
|
0c93c6db73 |
fix(sync): map melonDS DS aliases to the RetroArch folder (#5637)
* fix(sync): map melonDS DS aliases to the RetroArch folder * fix(sync): retain DS platform resolution for melonDS DS aliases * test(sync): file melonDS DS streams under the core id Now that Cloud Sync maps the "melonDS DS" folder to melondsds, a stream files its states and saves there too, like mGBA. Cover the verbatim folder path with an unmapped core instead, and format the sync tests. 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> |
||
|
|
0370b08efc |
fix(export): fold line breaks in Pegasus metadata values (#5635)
* fix(export): fold line breaks in Pegasus metadata values ROM names, developers, publishers, genres and other single-line values were written verbatim, so a line break in one of them started a new top-level field in metadata.pegasus.txt (for example a per-game launch command). Fold line breaks into spaces for every single-line field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(export): fold Pegasus asset paths and reject control characters in uploads Asset references are built from the ROM's file name, which the upload path accepted with embedded line breaks, so they could still start a new field in metadata.pegasus.txt. Fold assets.* values like every other single-line field, and refuse upload file and folder names that carry control characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
866d95640f |
fix(auth): check a dummy hash when the username is unknown (#5633)
* fix(auth): check a dummy hash when the username is unknown Password sign-in skipped bcrypt for usernames with no account, so a failed login answered far faster for an unknown name than for a real one. Verify against a throwaway hash in that case so both take the same time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): run the dummy bcrypt check for accounts without a usable hash OIDC-provisioned and empty-hash accounts skipped bcrypt, so a failed password sign-in for them answered faster than for an unknown username. verify_password now falls back to the dummy hash whenever the stored one is unusable, and the tests assert bcrypt ran on a valid hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
00e40bdeb1 |
fix(sync): bound PSP PARAM.SFO size and TITLE length before ROM search (#5631)
A PARAM.SFO up to the upload limit was parsed in full, and its TITLE, of any length, became the ROM search term. The search builds one SQL condition per word, so a title of millions of words exhausted the worker's memory before any query ran. Reject PARAM.SFO files over 64 KiB (real PSP saves are under 5 KiB) and ignore a TITLE longer than the 128-byte field the format defines. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
494b4b4291 |
fix(auth): issue a new session id when the session changes identity (#5630)
* fix(auth): issue a new session id when the session changes identity Logging in (password or OIDC) wrote the user into the session named by the request cookie, so a session id set in the browser beforehand kept working for whoever held it after the login. The session middleware now writes the session under a fresh id whenever its user changes, and deletes the previous record and closes its sockets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): leave the session cookie alone when a refresh finds it gone A request still in flight on a session that a concurrent login rotated away failed its refresh and answered with an expiring session cookie, which wiped the fresh cookie the login had just set. A failed refresh now sends no Set-Cookie at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
220226feba |
fix(hasheous): map Neo Geo MVS to the Hasheous Neo Geo platform (#5616)
* fix(hasheous): map Neo Geo MVS to the Hasheous Neo Geo platform
Without an entry, get_platform("neogeomvs") returned no Hasheous id and
scans never sent MVS hashes, leaving sets like mslug.zip unidentified.
Fixes #5614
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(hasheous): drop arrange/act/assert comments to match the file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
9bbfc41a7a |
fix(export): encode filenames in ROM content URLs (#5596)
* fix(export): encode filenames in ROM content URLs
* refactor(export): share one ROM content URL builder (pr-ready: code-review)
Move the quoted get_rom_content URL into utils.urls.rom_content_url and use it
from both exporters and the feeds. Match the test route to the real
{file_name} converter and drop an unused fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(export): share the ROM file URL builder too (pr-ready: simplify)
Move feeds' romfile download URL into utils.urls next to rom_content_url,
with the same encoding. Resolve the test's URLs against the real app router
and drop the branching that re-checked local paths.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(urls): cover the ROM and ROM file content URL builders (pr-ready: review-polish)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(export): match URL re-exports by ROM id and decode URL paths on import
A URL-mode gamelist or Pegasus export never matched its own earlier entries,
so each re-export appended every game again. Entries whose path is a RomM
content URL are now matched by the ROM id it carries, which also covers
unencoded URLs and other hostnames from older exports. The gamelist importer
decodes a URL path's last segment before matching it to a file name. Both
exports pass visibility=UNRESTRICTED explicitly, since they write the
library's shared metadata file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: format romfile_content_url
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>
|
||
|
|
631a1a3763 |
fix(roms): parse TOSEC compound region and language tags (#5582)
* fix(roms): parse TOSEC compound region and language tags * test(roms): use unrecognized compound tag components * fix(roms): limit TOSEC compounds to two-letter codes (pr-ready: code-review) Single-letter GoodTools codes made (SW-R) read as Sweden and Russia, and old-style [T-Br] translation tags read as Taiwan and Brazil. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(roms): drop prefix test the compound branch never reaches (pr-ready: simplify) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(roms): clarify _resolve_every docstring (pr-ready: humanizer) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): give exact-case codes precedence in compound tags Addresses Greptile: "Nl-No" read as Netherlands and Norway instead of Dutch and Norwegian. 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> |
||
|
|
e813e4d666 |
chore(coherence): adopt Coherence with specs, invariants and a PR report (#5584)
* chore(coherence): adopt Coherence with specs, invariants and a PR report Install @posthog/coherence as a frontend dev dependency and wire its Claude Code hooks into the committed .claude/settings.json, so every agent session in the repo gets the vocabulary, specs, journal and checks. The hooks call the binary under frontend/ through $CLAUDE_PROJECT_DIR. Declare 23 components and the entrances that carry outside trust, and six invariants, each refuted with a deliberate break before it counted: - every /api route requires auth and its scopes, except a named public list (new route sweep in tests/endpoints/test_route_guards.py) - a hidden rom, platform or firmware answers every id route exactly as a missing id would (new sweep over every method of every id route) - the unscoped save, state and screenshot fetches by id are reached only from their own routers (chokepoints) - validate_path never resolves outside its base folder The PR workflow runs in comment mode: one report comment, failing only when Coherence itself breaks. Trunk skips Prettier and markdownlint on *.spec.md and *.practice.md, since Prettier escapes their globs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(routes): satisfy mypy in the route guard sweep Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(coherence): record the worktree test database enactment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): answer a hidden rom like a missing one on file routes; tighten route sweeps Addresses Greptile's review on #5584. The rom file delete and reading-progress routes answered "File not found" for a hidden rom but "Rom with id N not found" for a missing one, so a caller could tell them apart. They now raise the same not-found. The route sweeps now reach the checks they claim to test: a protected route with no scopes counts as public (its guard admits anyone), write requests carry a body and upload name so validation can't answer first, RomFile-keyed routes get a real file id, error bodies are compared with the id normalized, and the rom routes are swept with the rom hidden directly, through its platform, and by the unrated filter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(coherence): tighten route guard sweeps and isolate oracle test databases (code-review) - Count a route as protected only when its endpoint is the scope-checking wrapper with non-empty scopes, not just when it declares the bearer scopes. - Treat 401 and 403 like 422 as never reaching the visibility check, and sweep /api/streaming/states/{rom_id}. - Run pytest oracles with a per-run ROMM_TEST_DB_TAG unless one is set. - Use the shared setup-frontend action and ubuntu-24.04 in the workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(tests): simplify route guard sweeps and path tests (simplify) - Mark scope-guard wrappers with required_scopes so the auth sweep reads a public attribute instead of the private closure. - Derive the entity regex from one segment list, ask each missing id once, and run the three hide scenarios through one sweep helper. - Fold the new validate_path inputs into the existing valid, traversal and absolute path tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(coherence): trim workflow comments (review-polish) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(filesystem): restore the validate_path property test the paths invariant cites Filesystem.spec.md names test_validate_path_never_escapes_its_base as the invariant's evidence, and Coherence selects it by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(coherence): run hooks from the local binary instead of npx Each hook calls frontend/node_modules/.bin/coherence directly and exits 0 when it isn't installed, so sessions without frontend deps (fresh worktrees, backend-only setups, cloud setup still installing) don't report a hook error on every tool call, and no hook pays npx's startup. Also commits the journal and run records left by earlier sessions, which .coherence/.gitignore keeps as durable records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(tests): share the bearer, user token and hide helpers Tests built the same Authorization headers and HiddenEntity rows in about 40 local copies, and two modules imported private helpers from other test files. They now use bearer, user_headers and hide from tests/auth_helpers.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(endpoints): one 404 for a missing or hidden rom, platform or firmware Each route wrote the missing-row 404 and the hidden-row 404 separately and had to keep them identical by hand. visible_rom_or_404, visible_platform_or_404 and visible_firmware_or_404 take the lookup result and raise one answer for both, either the standard not-found or a bespoke detail. Re-reads after a write keep a plain not-found check, so an edit that hides the row doesn't turn into a 404 after it succeeded. The RomFile-keyed routes (/roms/{file_id}/files, .../files/content/{name}, /roms/{file_id}/patch) name their path parameter file_id instead of id, so the route sweep reads which id a route takes from its path and drops its hand-kept list. URLs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(setup): develop inside WSL on Windows @posthog/coherence installs only on Linux and macOS, so npm install in frontend/ fails on native Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(coherence): record the whole-repo chokepoint run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(types): regenerate API types for the file_id patch route Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c56d27be7b |
fix(roms): read full country names in filenames as regions (#5578)
* fix(roms): read full country names in filenames as regions No-Intro writes full country names, e.g. (Poland) or (Czech Republic). parse_tags only resolved the names listed in REGIONS, so the regions added from the provider vocabulary were stored as other tags. Add those names to the filename region aliases, skipping any that a language vocabulary claims. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * chore(roms): shorten region alias comment per Greptile review Addresses Greptile's comment-length finding on #5578. 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> |
||
|
|
17d184f4b6 |
fix(config): warn about platform bindings to unknown slugs (#5580)
* feat(config): warn about platform bindings to unknown slugs A config.yml binding whose value is neither a platform slug nor a folder alias (a typo such as `snes-test: snse`) silently made a custom platform with no metadata. Nothing pointed at the binding: the scan only logged "Platform snse not identified", like any unknown folder. Startup and the platform scan now log a warning that names the system.platforms or system.versions key, the bound value and the closest known slugs. Unbound folders are not checked, so custom platforms stay quiet. Closes #5464 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(config): treat IGDB version slugs as known bindings (pr-ready: code-review) Bindings to IGDB platform-version slugs such as amiga-a-1200 are identified by the scan, so they no longer warn. Startup reuses the config that migrate_retired_filesystem_keys just loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(config): share the binding lookup with resolve_platform_slug (pr-ready: simplify) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(config): tighten binding warning docstrings and test typing (pr-ready: review-polish) 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> |
||
|
|
8a1e6280b1 |
feat(saves): add save channels and snapshots (#5198)
* feat(saves): add save channels and snapshots * feat(saves): close spec gaps in save channels and hash with sigil * feat(saves): play snapshots in the v2 player, which pushes snapshots * fix(saves): code review: authorization, retention losses, held-save sync, batched responses * refactor(saves): simplify pass * refactor(saves): review-polish pass * docs(saves): humanizer pass * feat(saves): run every EmulatorJS page on the v2 player * feat(saves): per-user snapshot pins * feat(sigil): store the identity a save restore needs and pin sigil 0f05f25 * fix(saves): meet type-aware lint in the v2 player * feat(sigil): store N64 header and playlist title ids, pin sigil 0847fda * feat(saves): convert saves for a core on download and list save layouts * feat(saves): prune unreachable archival snapshots and empty detached channels on delete * feat(saves): device sync from the token, held snapshots and shared-card pushes * feat(saves): arc restores past abandoned snapshots and color channels by age * fix(saves): code-review and security-audit fixes * refactor(saves): simplify pass * chore(saves): review-polish pass * docs(saves): humanizer pass * fix(sync): file RetroArch autosave versions as their channel's next snapshot * fix(saves): address review findings and trim docstrings * fix(saves): share-lock planned rows by id so PostgreSQL accepts the lock * test(saves): stub the detached-channels fetch in SaveDataTab stories * feat(saves): carry the full current snapshot in a 409, pin sigil 2071dff * chore(sigil): pin 5d4ddb4, which reads .cue and .gdi sheets * docs(saves): drop v2 wording now that one UI remains * chore(sigil): pin 0190443, which reads PS2 raw BIN images and cue sheets * fix(sigil): treat a file too short for its format as routine during scans * chore(migrations): renumber save channel migrations after upstream's 0154 * fix(snapshots): a hardcore switch on unchanged content makes a new current * fix(sync): decide a channel's slot from its history and the device's snapshot * chore(docker): pin sigil at 794d99f for PSP Store release save prefixes * refactor(db): squash the save channel migrations into 0161 Fold the slot linking (0162) and the rom_files sigil identity columns (0163) into 0161_save_channels, so the feature ships as one revision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): close visibility and input gaps found in review (pr-ready step 2) code-review --fix: - negotiate_sync drops channel slots on ROMs hidden from the caller - channel PATCH/attach/DELETE answer 404 when the channel's ROM is hidden - a push copying a save from a hidden ROM answers 404 - _own_device applies require_token_device to bound client tokens - adopting a legacy save syncs its sharing with the channel it joins security-audit follow-ups: - another user's detached public save or state is no longer downloadable - profile and option values must be a single path segment - companions are de-duplicated and capped at 8 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(saves): share channel and asset lookups, drop duplicates (pr-ready step 3) simplify: - readable_channel_or_404 and channels_on_files replace four copies of the channel 404 check and two copies of the file-fed channel listing - readable_rom_asset_or_404 serves both public save and state downloads - _own_device resolves through require_device; _clone_origin takes the source - reuse _unprocessable, DESCRIPTOR_EXTENSIONS, SAVE_SLOT_MAX_LENGTH, uniqueBy and uuidv7; neutral forms default their required pattern to the allowed one - RetroArch delete checks held rows in one query, a guarded upload lists the slot only without a channel head, and uploads are read off the event loop - snapshotSession builds push requests once; player comment cleanups Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(saves): trim two docstrings to two lines (pr-ready step 4) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): answer held RetroArch paths with 423, mirror slot labels - RetroArch Cloud Sync answers 423 Locked for a PUT over a held unslotted save and for a DELETE where only held rows sit at the path, instead of 409 and 404 - channelLabelForSlot returns null for blank and state_ slots, as the backend's channel_label does, so the player files them under no channel either - document that sharing a channel lets every user read and push into it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(docker): pin sigil at 85f88a8 for Switch .nup containers * fix(snapshots): a save pushed in another shape or format makes a new current * refactor(saves): drop the always-true SAVE_SYNC.SNAPSHOTS heartbeat flag Nothing reads it, and the SAVE_SYNC block's presence already tells a client the server speaks the snapshot API. Also trim the rom detail channel field comments to one line each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(frontend): use uuidv7 for every client-generated id Drop the randomToken wrapper and the notification inbox's Math.random tab id, so uuidv7 is the one helper that works outside a secure context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(saves): trim redundant snapshot API surface, dead code and duplicate logic API: - Drop PUT /snapshots/{id}/devices/{device_id}; GET /snapshots/{id}?hold=true holds. - GET /snapshots is history only (channel_id required); GET /channels serves currents. - A snapshot carries channel_id instead of an embedded channel. - POST /saves/{id}/content takes the same query parameters as the GET, plus container_path. Backend: - Remove the archival write path, clone.py, DBStatesHandler.get_state, the sigil identity-hash path, unused relationships and composite snapshot indexes. - One held/frozen lookup, one bulk-delete guard, SQLAlchemy dialect upserts, and the shared reserve_version_name in the writer. - The writer takes a visibility filter and checks the channel and parent itself. - The restore handler picks per-game or merge; fewer wrapper types and tables. Frontend: - Channel delete uses the shared typed confirm; DeleteChannelDialog is gone. - Held offline pushes go through a per-channel SnapshotSession. - Remove the slot-based pending upload path. - The timeline shares the fan's badge logic. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * refactor(saves): release archival backups through module functions The saves and states handlers each built a private DBSnapshotsHandler to call release_backup and refresh_backup_digests, since they can't import the shared instance. Both only ever ran inside the caller's session, so they are now module functions taking it, like channel_for_slot. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> * refactor(saves): share one deleted-assets handler instance The saves handler built its own DBDeletedAssetsHandler because it can't import the package's instance. The instance is now built in deleted_assets_handler.py and re-exported by the package, so both use it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f549a5d132 |
chore(platforms): add slugs for Luxor ABC 800 and PlayStation Mobile (#5571)
* feat(platforms): add slugs for Luxor ABC 800 and PlayStation Mobile No-Intro has DATs for both, but RomM had no slug for either, so a library folder holding them was never identified. Add UniversalPlatformSlug.ABC_800 and PLAYSTATION_MOBILE and map them where a provider lists them: Hasheous (Luxor ABC 800 id 278114, Sony PlayStation Mobile id 314213) and HowLongToBeat (PlayStation Mobile). ScreenScraper, LaunchBox, RetroAchievements, TheGamesDB and libretro list neither, MobyGames documents the ABC 800 under its ABC 80 platform and has no PlayStation Mobile, and IGDB could not be checked directly, so those stay unmapped. Closes #5540 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(platforms): drop the ABC 800/ABC 80 inequality mypy rejects mypy's strict equality flags `UPS.ABC_800 != UPS.ABC_80` as a comparison between two enum literals that can never be equal. The check above it, `UPS.ABC_800.value == "abc-800"`, already shows ABC_800 is its own member and not an alias of ABC_80, whose value is "abc-80". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3c5bab7a7f |
fix(hltb): send the search's platform in the form HowLongToBeat filters by (#5569)
* fix(hltb): send the search's platform in the form HowLongToBeat filters by
HowLongToBeat's search ignores a platform sent as a bare name, so every
search covered every platform: "gran turismo" for the PSP came back with
the PlayStation game first, and the retry on a subtitle alone could match
a game on any console. Its site sends the platform as
{"mode": "include", "values": [...]}, which the search does filter by, and
the payload now sends it that way. With no platform name the list is
empty, which searches every platform.
A name outside HowLongToBeat's platform list filters out every game. It
lists PlayStation VR games under PlayStation 4, so that is what a
PlayStation VR ROM searches, and it has no PlayStation Now, so that
platform no longer maps to HowLongToBeat.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsLtVzsT8WBDnc6ZSRyp2u
* fix(hltb): key HowLongToBeat's VIC-20 on the VIC-20, not the Plus/4
The VIC-20 entry was keyed on the Plus/4, which made no difference while
HowLongToBeat ignored the platform. Now that the search filters by it, a
Plus/4 ROM would be searched among VIC-20 games. HowLongToBeat has no
Plus/4, so that platform no longer maps to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsLtVzsT8WBDnc6ZSRyp2u
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
34117694ac |
fix(scan): read revision tags written without a separator (#5559)
GoodTools sets name a revision with no space or dash after "Rev", as in "Sonic The Hedgehog (W) (REV01) [!].gen". REVISION_TAG_REGEX required a separator, so "(REV01)" and "(Rev1)" left the revision empty and landed in the free-form tags instead. The regex now also takes "Rev" followed directly by a digit. A letter right after "Rev" still does not count, so tags such as "(Revenge)" and "(RevB)" stay plain tags. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d96ec82e05 |
fix(scan): name a game by metadata priority, whatever order the scans ran in (#5546)
* fix(scan): name a game by metadata priority, whatever order the scans ran in An unmatched scan asks only the sources a ROM has no match from yet, and merges just their answers. A stored name that looks like a placeholder was replaced by whatever name that subset gave, and a provider's name often looks like one: LaunchBox calls Super C (USA).nes "Super C". So an unmatched HowLongToBeat scan renamed it "Super Lucky's Tale", though LaunchBox ranks above HowLongToBeat in scan.priority.metadata, and once a name no longer looked like a placeholder no refresh could correct it. Every source now keeps the title it gave in its own blob, as hash sources keep their dump tags. On an unmatched, update or hashes scan the name goes to the highest-ranked source among this scan's answers and the stored titles of the sources the ROM is still matched to. A source matched before titles were kept outranks the rest unknown, so the stored name stays. A stored name equal to some source's title counts as derived, so a better-ranked source can replace it; any other name is the user's and stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TsLtVzsT8WBDnc6ZSRyp2u * fix(scan): count only a string as a source's kept title The raw metadata editor stores any JSON, so a blob's name can be a list or an object, which broke a refresh with an unhashable set element. kept_title now reads a stored title for both settle_name and keep_base_fields, and anything but a string counts as no title. settle_name's docstring is one sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TsLtVzsT8WBDnc6ZSRyp2u * fix(scan): settle names across Hasheous-filled IGDB columns and pre-existing rows code-review (xhigh) pass: stamp every blob a source fills, treat only ids the row already held as stored matches, count this scan's titles as derived, and drop non-string kept titles from responses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): share one priority ordering for the name settle simplify pass: order_merge_sources returns the full ordering so settle_name skips its own config read, kept_title moves next to NAME_CLAIM_KEY and backs the response filter, keep_base_fields' comments fold into one, and the name priority tests share constants and parametrize their near-duplicates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(scan): reword settle_name's unknown-title comment review-polish pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): settle slug and artwork by priority too, under a scan_claims key Each source's blob now keeps the name, slug, cover and screenshots it gave under one namespaced scan_claims key (a ScanClaims TypedDict) instead of a bare name key that shared the providers' own key space. settle_claims ranks every claimed field by its own priority list, so a partial scan no longer writes a lower-ranked source's cover over a better-ranked one. A matched source with no claims on record holds the stored value only when that value is set. The artwork orderings are computed once and shared with apply_artwork_priority, so no config read is added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): hide scan_claims from the API The claims stay in each source's blob, but the provider metadata types no longer declare them, so they're out of the OpenAPI schema and the generated frontend types. Responses strip the key, and a raw metadata edit keeps the stored claims while the source's match stands instead of taking the client's. 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> |
||
|
|
03636ec156 |
fix(player): boot the base game, not a patch or translation (#5538)
* fix(player): boot the base game, not a patch or translation Files in a game's translations/ or hacks/ folder were mixed in with the base game: a .ups or .bps there counted as a bootable translation, a tagged variant sorting first became the default, and "All discs" zipped every file so EmulatorJS booted a translation's playlist. Patch files are now recognised by extension wherever they sit, the default and the selector's order favour the top-level (base) files, and "All discs" requests only the base set through file_ids. The content endpoint generates its playlist when the served files carry none, rather than when the rom has one anywhere. Fixes #5462 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(player): apply code-review fixes Share the m3u check through has_playlist, memoise the boot file ids, and correct the playerDisc comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(player): simplify the base-set helpers One allDiscFiles helper backs offersAllDiscs, defaultDisc and bootFileIds, and isPatchFile alone owns the patch rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(player): keep variants and media out of playlists; classify patches on the backend The backend's disc rule now leaves out patches, media and cheats, and a playlist covers only the base game's discs, so whole-rom downloads, the native shell and the streaming disc swap stop listing translations, hacks or a selected manual. A selection with no disc gets no generated .m3u. The scanner files any patch format as a patch, and the file schema does the same for rows scanned before, so the frontend trusts the category. The heartbeat now carries the supported patch extensions, which replaces the frontend copy, and one fileExtension helper replaces three. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
903ed64d94 |
fix(scan): hash compressed ROMs by their content in every format (#5537)
* fix(scan): hash compressed ROMs by their content in every format Files inside a game folder and standalone single-stream files picked a reader from a hand-written extension/MIME chain that treated plain .gz as tar, missed .tgz/.txz/.xz and the application/gzip MIME spelling, and called max() on empty archives. One suffix-then-MIME lookup in utils/archives now picks the reader, plain gzip/bz2/xz streams are decompressed (or read as a tarball when they hold one), and an empty or unreadable archive falls back to hashing its raw bytes. Fixes #5328 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): don't read a zero-prefixed compressed stream as an empty tar Addresses Greptile review on #5537: tarfile.is_tarfile accepts a zero-filled opening, so a plain .iso.bz2 or .iso.gz starting with zeros fell back to its compressed bytes. A tarball now needs a first member. Also moves hash_largest_member's failure contract into Returns:. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): fall back to raw bytes on more unreadable archives (code-review) Catch ValueError from corrupt Deflate64 members and undecodable zip names, treat an archive with empty content as unreadable, route zips with methods zipfile can't decode through 7zz, and drop the zlib.error handlers no reader raises any more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(scan): route 7z and undecodable zips through one largest-member reader (simplify) Replace hash_largest_7z_member with a read_7z_file iterator built on the shared 7zz listing and streaming helpers, probe zips with _undecodable_zip_method instead of inspecting the exception cause, share one decompression error tuple, snapshot only the ROM-level accumulators, and reuse the archive-writing test helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): bound, single-pass and RAR-aware largest-member hashing - Every Python-side archive read (zip, tar, gzip, bz2, xz, and the composite zip/tar readers) now shares the SEVEN_ZIP_TIMEOUT budget the 7zz and bsdtar paths already had, so a decompression bomb falls back to the raw bytes instead of tying up a scan thread. - Compressed tarballs are read in one streaming pass: each member larger than every one before it is hashed into a copy of the hashers as it passes, instead of listing the whole archive and then decompressing it again to reach the largest member. - gzip is decompressed member by member and ignores trailing bytes the way gunzip does, instead of discarding the content when padding follows the last member. - RAR members inside game folders hash by their largest member through bsdtar. - ARCHIVE_FORMAT_BY_SUFFIX moves to utils.filesystem and is the single suffix list: COMPRESSED_FILE_EXTENSIONS, RAR_FILE_EXTENSIONS and the handler's ARCHIVE_READERS are built from it. - _calculate_rom_hashes detects the MIME type once per file and reads the embedded CHD hash in the same thread, so libmagic no longer runs twice per file or on the event loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0a643a3e8e |
fix(sync): resolve RetroArch save names to the core's platform (#5533)
* fix(sync): resolve RetroArch save names to the core's platform A RetroArch Cloud Sync path names a game by file name only, so a name shared across platforms (a PS1 and a Saturn "Road Rash (USA)") always resolved to the lowest-id ROM. Uploads landed on the wrong ROM and the manifest hid the other platform's saves. Map each RetroArch core folder to the platforms it runs and prefer a ROM on one of them, including one that only owns a file of that name. An unknown core, or none, keeps the previous id order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): build the RetroArch arcade core platforms from the arcade sets Addresses Greptile review on #5533: MAME and FBNeo left out the mame, mame-advmame, fbneo and fba platforms, so a same-named Neo Geo ROM could take over a MAME ROM's saves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): apply code-review fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(sync): apply simplify cleanups Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(sync): cover a manifest with one name under two cores (review-polish) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): one core map, per-disc state slots, PSP serials on PSP - Move the EmulatorJS platform-to-cores map to the backend and serve it on the heartbeat; RetroArch core platforms invert it plus a top-up for RetroArch-only cores. - Map fbneo to "FinalBurn Neo" and dosbox_pure to "DOSBox-pure", the library names the cores report to RetroArch. - Resolve states by file name like saves, with a slot per disc-named state, so a disc folder game's state follows its save. - Resolve PSP serial-map titles with PPSSPP's platforms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0183cae8ad |
fix(retroachievements): ride out rate limits during the progress sync (#5532)
* fix(retroachievements): ride out rate limits during the progress sync The progress sync asks RetroAchievements for each changed game's achievements, one request per game. A single 429 that outlasted the one 2s retry became a 503 that aborted the whole sync and discarded every game already read, so a large first sync never completed. - send_with_retries honours Retry-After (capped at 60s) and doubles its backoff on each 429; rate limits can get their own attempt budget so timeouts are not retried more often. - RetroAchievements gets five attempts against a 429. - get_user_progression stops asking for game details once RA refuses one, keeps the stored entry for the remaining changed games, and returns what it read so it is saved and the next sync resumes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(retroachievements): keep stored progress on full refreshes and read pages first Addresses Greptile review on #5532: - a full refresh now passes the stored progression with refresh_all, so a refusal keeps the games it could not read instead of dropping them - every completion page is read before any detail request, so a throttled later page fails before details are fetched and discarded - docstrings trimmed to the comment rules Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(retroachievements): apply code-review fixes pr-ready step 2 (code-review xhigh --fix): drop the synced progression when the RA username changes, keep the award kind current on refused games, read HTTP-date Retry-After values, and honour an explicit zero rate_limit_attempts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(retroachievements): apply simplify cleanups pr-ready step 3 (simplify): reuse to_utc for HTTP-date Retry-After, fold the None checks into _retry_after_seconds, drop the result=None seed and the award-kind compare in get_user_progression, and share the refusal setup and call() asserts across the new tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(retroachievements): review-polish comment trim pr-ready step 4 (review-polish): drop a comment that restated the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(retroachievements): run the sync as a job and tell rejects from outages - A non-429 error status or unreadable reply for one game keeps that game's stored progress and the sync moves on; only a throttle or an outage defers the remaining games. - The five-attempt 429 budget applies to the progress sync's two requests, not every RetroAchievements call. - A 429 holds the shared RA rate limiter through its wait and halves its pace, which steps back up as requests go through. - Timeouts and 429s each count against their own attempt budget, and the 429 backoff doubles per 429. - /ra/refresh queues the sync as a background job and answers 202; the job reports its outcome over the ra:synced socket event, which the settings section uses to reload the user or show the failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |