mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
fix/consistent-sibling-groups
822 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e46fcd7c51 |
pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4c5a088d6b |
Merge remote-tracking branch 'origin/master' into fix/consistent-sibling-groups
# Conflicts: # backend/handler/database/roms_handler.py # backend/handler/recommendation/serving.py |
||
|
|
b1d7d2b57a |
feat(emulatorjs): expose download cache enable setting (#5737)
* feat(emulatorjs): expose download cache enable setting * 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> * feat(config): move cache_limit under emulatorjs.cache and read config.yml strictly emulatorjs.cache.limit replaces emulatorjs.cache_limit, which is still read with a deprecation warning and is rewritten to the new key on the next save. Every config.yml read now goes through one reader that exits with code 3 when a parent block is not a dictionary (e.g. `netplay: true`), where get_nested silently fell back to the default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(emulatorjs): clear every EmulatorJS cache and keep nightly's cache size The clear-cache dialog now also deletes EmulatorJS-bios (4.2.3) and EmulatorJS-Cache (nightly), which kept serving downloaded files. Nightly turns EJS_CacheLimit, a per-file byte cap in 4.2.3, into its total cache size in MB, so a limit under 1 MiB gave a 0 MB cache. Passing cacheMaxSizeMB explicitly keeps nightly at its own 4096 MB default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(utils): drop get_nested The config loader reads config.yml through its own strict reader now, so get_nested has no callers left. 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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
38543d9bde |
fix(streaming): offer disc sheets, not their tracks, as stream discs (#5710)
* fix(streaming): offer disc sheets, not their tracks, as stream discs The start-disc picker and disc-swap dialog only treated .cue as a disc sheet, so .gdi, .ccd and .mds sets listed their raw tracks, which the backend rejects. Pick discs the way utils/m3u.disc_files does. Fixes #5709 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(streaming): keep patches and variants out of the disc lists The start-disc list now drops patch files by extension, as disc_files does, and the swap dialog lists only the base game's discs, as playlist_files does, so neither offers a file the backend rejects. 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> * fix(streaming): order stream discs by disc number The backend's disc_files sorts by the disc tag, so a set of ten or more discs listed Disc 10 before Disc 2 in the start and swap pickers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(streaming): offer no disc pick before the first heartbeat Patches are recognised by the heartbeat's supported extensions, which are empty until a heartbeat lands, so a root-level patch showed up as a disc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(streaming): decide the disc swap from the disc sent with the claim 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> |
||
|
|
084a6404e2 |
fix(auth): return no public base URL when ROMM_BASE_URL is malformed (#5700)
get_public_base_url promises the URL only when it is shareable, else None, but yarl.URL raised ValueError on a value such as "http://[invalid", so invite and notification rendering failed instead of omitting the link. Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
4159710e79 |
docs(api): document the error responses routes raise (#5693)
* 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> * 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(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> * docs(api): plain-prose pass on route error descriptions Spell out clipped error descriptions, replace internal slang (picked, taken, live, moved past), name the parameter an ID comes from, and split the long save conversion 400s into sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
28b67e305d |
fix(auth): treat localhost with a trailing dot as unshareable (#5699)
is_shareable_host only rejected the literal "localhost", so a base URL of http://localhost.:8080 (the same loopback name, per RFC 6761) was used to build invite and notification links. Co-authored-by: Claude Sonnet 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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
87c38eebf6 |
fix(patcher): cap the output size a patch can declare (#5632)
* fix(patcher): cap the output size a patch can declare RomPatcher.js allocates the patched ROM from the size written in the patch header, so a few-byte UPS/BPS/APS/BDF/RUP patch could make the Node patcher allocate and write gigabytes. patcher.js now wraps the BinFile constructor and refuses any allocation above a cap passed by the backend: twice the source ROM, or the ROM plus 64 MiB when that is larger, never above ROM_PATCHER_MAX_FILE_SIZE_BYTES. An oversized output is reported with exit code 3 and surfaces as a 400. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(patcher): run the output size guard through the real patcher.js The CI pytest job now installs Node and RomPatcher.js so the patcher tests can exercise patcher.js itself: a UPS patch declaring a 2 GiB output is rejected, and one growing the ROM within the cap applies. The tests skip when node or RomPatcher.js is missing locally. 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>
|
||
|
|
ff31cf9428 |
fix(validation): reject email addresses ending in a newline (#5593)
* fix(validation): reject email addresses ending in a newline * fix(validation): reject usernames ending in a newline The username pattern had the same trailing-newline gap as the email one. Both patterns now rely on fullmatch, so their anchors are dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(user): use the renamed bearer helper 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> |
||
|
|
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>
|
||
|
|
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> |
||
|
|
c0a67d674d |
fix(player): record the device that wrote a state and skip other devices' states at start (#5531)
* fix(player): boot another device's save over a state from the same quit States record no device, so the start screen could not tell a state written by another client's core (Argosy) from one this browser wrote. When the newest save names a device other than this browser and the newest state was written within a few seconds of it, default to the save. This browser's own Save and Quit still resumes from its state. Fixes #5199 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(player): keep the newer-save warning beside a same-quit state Addresses Greptile review on #5531: skipping a state from the picked save's quit returned no warning even when a newer save existed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(states): record the device that wrote a state States now carry origin_device_id like saves. POST /states and PUT /states/{id} take an optional device_id, and new content takes the writer's device (or none when the client names none). The web player sends this browser's device id with every state, including held ones. The start screen no longer defaults to a state tagged with another device. The same-quit timing rule stays only for untagged states, which covers states stored before this change and clients that send no device. device resolution moves from endpoints/saves.py to utils/auth.py so both asset endpoints share it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(player): drop the same-quit timing rule for untagged states The start screen and the newer-progress warning now go by the state's recorded device alone: an untagged state counts as this browser's, and a state tagged with another device is neither the default nor a reason to warn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(player): cover untagged states beside another device's save (code-review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(player): simplify the resume fallback and repair a mis-collated state column (simplify) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(states): trim the origin device column comment (review-polish) 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> |
||
|
|
fa3654dd79 |
fix(platforms): stop filing sgb folders as Game Boy Color (#5530)
* fix(platforms): stop filing sgb folders as Game Boy Color ES-DE and Batocera name their Super Game Boy system sgb (Game Boy games on the SNES adapter). Mapping sgb and sgb-msu1 to gbc gave those folders Game Boy Color provider ids and limited IGDB searches to the wrong platform. RomM has no Super Game Boy slug and IGDB, TheGamesDB, RetroAchievements and LaunchBox list none, so leave the folders unidentified; a config binding can still map them. Fixes #5506 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(scan): keep a missing platform folder unless its alias exists Addresses Greptile review on #5530: with the sgb aliases gone, gbc2players became the reverse folder for gbc, and a rescan with the gbc folder missing saved that nonexistent folder on the platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6b73d36043 | fix(platforms): file amigacdtv as the CDTV and give it libretro's name (#5513) | ||
|
|
54fecf2500 |
fix(setup): resolve folder aliases when identifying platforms in the setup wizard (#5473)
* fix(setup): resolve folder aliases when identifying platforms in the setup wizard The setup library endpoint returned raw folder names, so folders such as gamecube or a config-bound nintendo-snes showed as Unidentified and their platform stayed in the supported list. Report the resolved platform slug next to each folder and match on it in the wizard. Fixes #5465 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * fix(setup): match supported platforms on resolved slug, one detected row per folder pr-ready step 2 (code-review xhigh --fix): compare supported platforms by slug so a DB row with an alias fs_slug still matches, keep each folder's own name and rom count, read config once per request, black-format the new test, and add a SetupStepPlatforms unit test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(setup): fold detected-row branches, drop redundant selection guards pr-ready step 3 (simplify): build identified and unidentified rows from one object, drop the detected checks in togglePlatform and newSlugsInGroup (every caller already lists only supportedAvailable), and merge the duplicated chip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(setup): assert the resolved slug in every setup/library entry pr-ready step 4 (review-polish): compare whole existing_platforms entries in the older setup/library tests so they cover slug too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(setup): tighten detected-row comment pr-ready step 5 (humanizer). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(settings): resolve built-in folder aliases in folder mappings Folder Mappings matched folders to platforms on the client by exact slug, so alias folders like gamecube or megadrive showed as unmapped even though the scan resolves them. The heartbeat now returns FS_PLATFORM_SLUGS, each folder's slug from its name or built-in alias, and the table reads it for auto-detected rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: drop response schema field comments 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> |
||
|
|
37e4ca304d |
fix: permission, validation and resource-limit hardening (#5496)
* fix(sync): cap play sessions on sync completion and require roms.user.write The completion endpoint fed an unbounded play_sessions list to the same ingest as POST /api/play-sessions, which allows 100 per batch and requires roms.user.write. Apply both rules before the session is completed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(config): reject empty platform binding and version values config.yml exits on load when a platforms or versions value is empty, so the API must not write one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(collections): require smart collection criteria to be a JSON object Any other JSON value was stored, then failed the response schema and broke the smart collection list for every user who could see the collection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(stats): require roms.read on /api/stats Anonymous callers were served counts over the whole library, including platforms and ROMs hidden from users. The UI only calls it after login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(permissions): apply ROM visibility to filters, saves, play sessions and collection removal /api/roms/filters aggregated facet values over the whole library, GET /api/saves/{id} and GET /api/play-sessions returned the caller's own rows on hidden ROMs, and removing ROMs from a collection could drop members hidden from its owner. The facet visibility clauses move onto RomVisibilityFilter so stats and filters share them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(webhooks): keep non-admin webhooks off the admin's internal metadata origins The SSRF exception for a self-hosted Playmatch or Hasheous applied to every request, so a user's webhook could reach any path on that private origin. Non-admin webhooks now validate and connect with an empty allowlist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(saves): bound total decompressed size when hashing zip archives Zip content hashing capped each entry but not the archive, so many entries each under the cap could still decompress and hash far more than any real save or memory card holds. Budget the decompressed bytes across the whole archive and cap the entry count; callers keep treating an over-budget archive as an unknown hash. The chunked, budgeted entry reader is shared with the memory card archive check, and the RetroArch store path now hashes off the event loop like its siblings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(psp): clamp LZ4 literal and match copies to the ZISO block size The ZISO block decoder appended literals and copied matches for their full encoded length before checking the output size, and an LZ4 length can be extended without bound by 0xFF bytes. A small crafted block could therefore expand far past the block size before being truncated. Clamp each copy to the room left in the block, stop once it is full, end the block on a truncated match offset, and copy matches with slices instead of a per-byte loop (overlapping matches repeat their pattern). Output for valid blocks is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(auth): revoke OAuth tokens when a user's credentials change A password change, admin reset, reset-link reset or rename cleared the account's web sessions, but its OAuth access tokens kept working until they expired and its refresh tokens could still be exchanged at /api/token. Revoking a user's credentials now also records a per-username revocation time in Redis, kept for the longest token lifetime. Bearer validation and refresh consumption reject any token whose iat is at or before it. OAuth tokens now carry a sub-second iat, so a login right after the change still works; a token without iat counts as older than any revocation. The revocation is keyed by the token's sub, the same username sessions are keyed by, so a rename revokes tokens issued under the old name even if another account later takes it. Client (API) tokens are left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(api): reject local file URLs for user-supplied covers and manuals file:// and launchbox-file:// URLs are meant for covers and manuals that a scan records from gamelist.xml or LaunchBox metadata. The collection create/update endpoints and the ROM update endpoint passed a user-supplied url_cover (and url_manual) straight to the resource handler, which copied whatever library file it named into the entity's resources. That let any user with collections.write or roms.write pull files they cannot otherwise read, including those of hidden platforms and ROMs. These endpoints now answer 400 for a local file URL, unless it is the value already stored, which the edit forms echo back on every save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(resources): bound cover downloads and decodes Remote covers, screenshots, manuals, badges and media files were streamed to disk with no size limit, and a gzip-encoded body was read whole and inflated in memory. Downloads now go through one helper that counts bytes against MAX_ASSET_UPLOAD_SIZE_BYTES, inflates gzip incrementally under the same cap, and aborts past it, so the partial file is removed and any earlier copy kept. Covers are also bounded once on disk: a still image whose header declares more than MAX_COVER_PIXELS is discarded before it is decoded (and an uploaded one is refused with a 400), and a DecompressionBombError while deriving the small cover now discards the download instead of failing the request and leaving the file behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: fix mypy errors in the new tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: address Greptile review on permission and input hardening - Date OAuth tokens to before the credential check, so a password change that lands during the check revokes the tokens it issues. - Apply ROM visibility to play sessions in SQL, before the page slice. - Reject truncated gzip bodies and inflate every gzip member. - Shorten the zip budget comment; stream real httpx2 responses in tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: apply code-review findings on permission hardening Revoke OAuth tokens and sessions on user deletion, apply ROM visibility to GET /states/{id}, validate update_collection rom_ids, run get_rom_filters off the event loop, and reuse the shared httpx client factory for webhooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: apply simplify pass on permission hardening Read the OAuth revocation stamp through the async cache, share the play-session batch-size check, raise a plain OSError for oversized downloads, and drop a dead slice in the LZ4 decoder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: apply review-polish pass on permission hardening Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(play-sessions): filter rom_id and device_id on PlaySession after the visibility join Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1bc9a402b7 |
chore(deps): update node.js to v26 (#5469)
* chore(deps): update node.js to v26 * chore(deps): move the Node runtime pins to 26.13 Addresses Greptile's review: the engines and @types/node bump needs frontend/.nvmrc and both Dockerfiles on Node 26 too, or npm ci fails with EBADENGINE under engine-strict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f66950551a |
fix(sync): bind device tokens to their device; dial only known push-pull hosts (#5460)
* fix(sync): bind device tokens to their device; dial only known push-pull hosts A client token paired to one device could read, reconfigure, delete, sync saves for and record play sessions as any other device of the same user. Device CRUD, sync negotiate/complete, push-pull trigger, the save device resolver and play-session ingest now treat another device as not found for a bound token, through a shared require_token_device helper. GET /api/devices lists only the bound device. Push-pull let any user with devices.write point ssh_host at any host and port, and the connection error surfaced through the sync session, so the worker could be used to probe the internal network. The SSH handler now refuses a host with no trusted key or CA in the admin's known_hosts before dialling it, which keeps LAN handhelds working while nothing else is reached. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(device): revoke a deleted device's tokens; scope registration matches Addresses Greptile review on #5460. Deleting a device now deletes the client tokens paired to it, since the foreign key's SET NULL turned them into unbound tokens that reach every device. Registration with a bound token only matches its own device by fingerprint, so it can no longer reset syncs or overwrite capabilities on another device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): bind heartbeat, sync session and online reads; pin push-pull ports pr-ready step 2 (code-review xhigh --fix). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(device): one require_device helper; parse known_hosts once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(sync): narrow await_args before reading known_hosts pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(sync): plainer comments on the push-pull allowlist and token revoke pr-ready step 5 (humanizer). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(device): keep bound tokens off other tokens; cascade tokens with their device A device-bound token can no longer create tokens, or regenerate, pair or revoke a token of another device or an unbound one. The save session_id counter only counts a session of the caller's bound device. client_tokens.device_id now cascades on device delete (0159), so no path can leave an unbound token behind, and deleting a device records a client_token.revoke audit event for each token it takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(env): drop the push-pull allowlist note from env.template Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
257025ccd7 |
fix(downloads): keep converted copies' ETag stable so downloads resume (#5442)
Serving a cached conversion touched the copy's mtime to record demand for TTL cleanup, and nginx builds its default ETag from mtime and size, so the ETag changed on every request and Range/If-Range resumes always got a full 200. Record serves on a `.served` marker in the key dir instead; cleanup already takes the newest mtime among the dir's files, so it reads the marker and falls back to the copy's own mtime, and removes the marker with the dir. Fixes #5239 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
183ee3b89f |
feat(platforms): enrich discovery cards and preserve AVIF animations (#5433)
Fetch original launch years and current platform logos during scans, retain curated platform icons, and show launch year and type on responsive discovery cards. Preserve animated AVIF frames during thumbnail and WebP conversion. Closes rommapp/romm#5432 Authored with Codex assistance, including implementation and tests. |
||
|
|
4393b70973 |
feat(media): JPEG XL library images and cover uploads (#5438)
* feat(media): serve JPEG XL library images inline Add .jxl to the image extensions the download endpoint serves inline, with an explicit image/jxl type since mimetypes doesn't know it, and to the frontend lists that pick artwork and folder screenshots out of rom.files. AVIF was already covered; the new test pins both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * feat(media): accept JPEG XL cover uploads through a Pillow plugin Pillow 13 reads AVIF but not JPEG XL. pillow-jxl-plugin registers a JXL codec with Pillow (imported once in utils/images, which the cover and WebP-conversion code already load). It ships musllinux wheels for the image's amd64 and arm64 builds. ROM and collection artwork uploads now accept image/jxl and store it re-encoded as PNG, since covers are served in their stored format and not every browser renders JPEG XL. Avatars, stored as uploaded, keep the PNG/JPEG/WebP/GIF allowlist. The plugin is GPL-3.0, which is compatible with RomM's AGPL-3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * test(roms): expect JPEG XL in the artwork rejection message Artwork uploads now also accept JPEG XL, so the rejection message lists it. The collection tests were updated with the change; this ROM one was missed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * fix(media): list library JPEG XL images only where the browser renders them Library files are served as stored, and Chrome and Firefox render no JPEG XL, so .jxl artwork and folder screenshots showed as broken tiles there. A one-time probe decodes a 22-byte JPEG XL image and the artwork and screenshot lists only include .jxl files once it succeeds (Safari), updating reactively when the answer arrives. Chromium 153 fails the probe, so the files stay hidden there as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * fix(media): size-check JPEG XL before decoding and keep it out of screenshot uploads pillow-jxl decodes every pixel in _open(), before Pillow's decompression-bomb check sees the size, so a small, highly compressed JXL declaring a huge canvas could exhaust memory. utils/jxl reads the width and height from the codestream SizeHeader (bare or inside a container) and runs Pillow's own bomb check on them first, then registers this guarded decoder in place of the plugin's. The decoder raises RuntimeError on a corrupt file, which escaped store_artwork as a 500. The guard turns it into SyntaxError, so Pillow reports UnidentifiedImageError and the upload takes the same path as a corrupt PNG. POST /api/screenshots validated against the library inline list, so it started accepting .jxl, but the asset endpoint serves those as attachments. Screenshot uploads now use their own list without JPEG XL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * style(media): one-sentence jxl docstring and a narrowed mock call in the JXL test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs * style(media): one-sentence canRenderJxl doc comment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NH5s4hx1GtQiHd7vsLCpBs --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2f2f6cd144 | Merge remote-tracking branch 'origin/master' into fix/consistent-sibling-groups | ||
|
|
1642a323c0 | fix(sort): strip only configured articles, and keep custom sort keys as typed (#5429) | ||
|
|
ff412aa09c |
fix(siblings): group versions by connected component everywhere
The game page's siblings matched on any shared provider id, while the gallery's group_by_meta_id window partitioned on the first non-null id in a fixed provider order. A version matched by IGDB and ScreenScraper and one matched by ScreenScraper alone were siblings on the game page but two gallery cards. The recommendation surfaces didn't group at all: the cold-start row ranks by rating, which every version shares, so one game filled it. rom_sibling_groups now stores each ROM's connected component over rom_identity_keys, kept in step by add_rom/update_rom/delete_rom and rebuilt after a scan. The sibling_roms view, the gallery window and the recommendations all read it: the feed and similar games collapse each game to one entry, exclude the other versions of a played game, and show the version the grouped gallery shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0f75e6aaf4 |
fix(client-tokens): let a client token revoke itself without me.write (#5419)
* fix(client-tokens): let a client token revoke itself without me.write
A device that signs out or re-pairs had no way to revoke its own token
unless it held me.write, which also lets it mint tokens and approve
pairings. DELETE /api/client-tokens/{id} now skips the me.write check
when the id is the token authenticating the request.
Fixes #5274
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(client-tokens): code-review pass on self-revoke
Annotate raise_auth_error as NoReturn, trim the delete_token docstring, and
cover a me.write token revoking a sibling, the revoked token failing to
authenticate, and socket closure on self-revoke.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(client-tokens): revoke the calling token through DELETE /current
Self-revoke moves to an id-less route so a device never needs to know its
token id, and DELETE /{token_id} keeps me.write in its decorator and in
OpenAPI. The device-authorization token response now also returns token_id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(client-tokens): simplify pass, reuse raise_auth_error for /current
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* revert(client-tokens): drop DELETE /current and the device-flow token_id
Self-revoke stays on DELETE /{token_id} with the in-handler check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(device-auth): return the issued token's id from the device token poll
A device paired through the device-authorization flow can now revoke its
own token with DELETE /api/client-tokens/{id}, as tokens from /exchange can.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Update docs/BACKEND_ARCHITECTURE.md
* docs: format client tokens table
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
d15cd9e7a1 |
fix: keep summary line breaks and strip provider HTML (#5413)
* fix(ui): keep line breaks in the game summary Normalize CRLF and bare CR to LF and render the summary with white-space: pre-line so multi-line summaries keep their structure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(metadata): turn HTML in provider summaries into plain text Add utils.html_text.html_to_text, a parser-based helper that drops known HTML tags, maps paragraphs, line breaks and list items to newlines, and unescapes entities. Unknown tags such as "<Start>" stay as literal text. Moby, ScreenScraper, Steam, Flashpoint and LaunchBox summaries go through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(metadata): separate table cells and keep bullets on their text Addresses Greptile review on #5413: adjacent td/th cells now get a space between them, and a list item wrapping its text in a paragraph keeps the bullet on the same line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
638601f480 |
fix(webp): raise the cover WebP quality to 95 (#5410)
* fix(webp): raise the cover WebP quality to 95 Quality 90 left visible artifacts on box art with small text. On a sample of real covers, 95 adds about 3 dB of luma PSNR for about 25% more bytes (small covers go from 20% to 25% of the PNG size, big ones from 27% to 36%); 100 costs another third for little gain. Small animated covers now use the same quality instead of Pillow's default of 80, and the ignored optimize flag is dropped from the static WebP save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> |
||
|
|
81b617459b |
fix(db): bump client token and device last-used timestamps without a prior read (#5384)
* fix(db): bump client token and device last-used timestamps without a prior read update_last_used() and update_last_seen_debounced() read the row with session.get() and then updated it in the same transaction. When two requests with the same Client API Token ran concurrently and both passed the debounce check, the second UPDATE hit MariaDB error 1020 (Record has changed since last read), so a read-only GET returned HTTP 500. Make each a single conditional UPDATE that only touches the row when the debounce window has passed. Fixes #5379 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * test(db): code-review fixes for last-used race tests Reuse the executed_statements fixture, scope race listeners to sync_engine, add the device race test, drop an unused fixture, and apply trunk fmt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(db): simplify pass on last-used race fix Share the race hook as tests/db_race_stubs.run_before_first, look tokens up by id in tests, trim duplicated docstrings, and state the handler comment as current behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(db): humanizer pass on last-used handler comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(db): run MariaDB and MySQL sessions at READ COMMITTED MariaDB 11.6+ turns on innodb_snapshot_isolation, so at REPEATABLE READ any transaction that reads a row and then writes it fails with error 1020 ("Record has changed since last read") when another transaction committed to that row in between. READ COMMITTED, PostgreSQL's default, takes a fresh snapshot per statement and removes the whole class of failures. A server logging binlog_format=STATEMENT refuses InnoDB writes below REPEATABLE READ, so its sessions keep the default and log a warning once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(auth): skip last-used and last-active writes inside the debounce window Client-token auth bumped the token, the device and the user on every request, the user with an undebounced UPDATE plus a re-SELECT. The token's loaded last_used_at now gates the token and device bumps, and set_last_active checks the loaded last_active and bumps through a debounced conditional UPDATE, so a request inside the window writes nothing and takes no row lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
c6b5f0ae11 |
fix(platforms): count only the roms the caller can see in rom_count and fs_size_bytes (#5313)
* fix(platforms): count only the roms the caller can see in rom_count and fs_size_bytes Platform.rom_count and fs_size_bytes are column properties over every rom row on the platform, and the platform endpoints only filter hidden platforms. So the platform header's "In library" count and "On disk" size included roms hidden from the caller (directly, or by an age limit), while the gallery left them out. Server Stats was off the same way: its per-platform metadata coverage divides /api/stats' visibility-filtered match counts by the unfiltered rom_count, so a restricted user saw coverage too low and platform counts and sizes too high. For a restricted caller, the list, detail and update endpoints now subtract the totals of the roms RomVisibilityFilter hides (DBStatsHandler.get_hidden_rom_totals_by_platform, next to the other per-platform aggregates). Direct hides are matched by primary key, so a few hidden roms cost a few lookups rather than a pass over every rom on the platform. Admins and other unrestricted callers keep the model's values and skip the query. On a generated library of 50 platforms and 100k roms (MariaDB), the platform list takes ~44 ms; this adds ~4 ms with 100 roms hidden, ~44 ms with 5,000, and ~60 ms with an age limit (min_age isn't indexed, so that case scans the platforms' roms). Fixes #5312 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): read the hidden roms' totals in the platform query Addresses Greptile's review of #5313: - Counts can become negative: the hidden totals came from a second query, so a rom added between the two could be subtracted without having been counted. They now come from a grouped subquery outer-joined into the statement that computes the full totals, so both read one snapshot (on PostgreSQL's READ COMMITTED too, which a shared transaction wouldn't give). - Counting rules live in endpoints: the endpoint helper is gone. get_platform and get_platforms take the caller's RomVisibilityFilter (unrestricted by default) and return platforms with the visible totals; DBStatsHandler.get_hidden_rom_totals_by_platform is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review fixes for visible platform totals - Re-read rows with populate_existing so a shared session never subtracts twice - Narrow the hidden-totals subquery to the one platform get_platform reads - Re-read after update only for restricted callers, and 404 instead of leaking full totals - Test the update endpoint's restricted totals and the shared-session read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on visible platform totals Gate the row clause in one condition with a why comment, fold the MariaDB narrowing reason into the docstring, and drop restating comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): count only visible roms in /supported and RetroArch listings - Move the hidden-ROM predicate into RomVisibilityFilter.hidden_on_visible_platforms_clause, with the age rule spelled as ranges an index on min_age can serve - get_platforms reads hidden platforms from the visibility filter instead of a second hidden_platform_ids argument - /api/platforms/supported lists a hidden platform as unmatched and counts only the caller's ROMs on the rest - RetroArch WebDAV skips a platform whose ROMs are all hidden from the caller Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf(roms): index platform_id, min_age, fs_size_bytes for age-limited totals On a 73k-ROM copy of a real library (MariaDB 13), GET /api/platforms for an age-limited user went from 208 ms to 55 ms: the hidden-totals aggregate is now an index-only scan instead of a full scan of the wide roms rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
60703be09c |
chore(platforms): split arcade aliases into per-emulator-family slugs (#5273)
* feat(platforms): split arcade aliases into per-emulator-family slugs Give MAME, AdvanceMAME, FBNeo, FBA, Daphne, Singe and the arcade boards that need their own emulator (NAOMI/NAOMI 2/NAOMI GD-ROM, Model 2/3, Hikaru, Triforce, Lindbergh, Namco System 246/3xx, Gaelco, ...) their own slugs with verified provider IDs. Providers without a dedicated entry fall back to their Arcade platform via arcade_fallbacks(). MAME-only boards (CPS1-3, System 16/32, Model 1, Namco 22) stay aliases of arcade. Refs #5272 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review pass on arcade slugs - Retry IGDB on unmatched scans for every platform IGDB resolves, not just slugs in IGDB_PLATFORM_LIST. - Resolve config binding/version values through the alias table, so a binding to a retired slug (cps2, model1, ...) still lands on a platform. - Alias the Batocera `typex` folder to type-x. - Build provider id->slug reverse maps before merging Arcade fallbacks. - Share one MAME title lookup between base_handler and libretro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on arcade slugs - Alias the three RomM-keyed IGDB versions inside IGDB_PLATFORM_VERSIONS, dropping IGDB_VERSION_SLUGS and _version_slug. - Derive EmulatorJS arcade entries from ARCADE_SET_PLATFORMS. - Remove the unused provider id->slug reverse maps, so the Arcade fallback merge no longer has an ordering constraint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(platforms): humanizer pass on arcade slug comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): settle arcade slug review decisions - Migration 0154 moves platforms still on a retired MAME-only board slug (cps1-3, model1, system16, system32, system-32) to arcade, so no row carries a slug the enum no longer has. - MAME shortname expansion keys off the RomM slug via MAME_SHORTNAME_PLATFORMS instead of per-provider arcade ids, so Daphne, Singe, Type X and Lindbergh sets are no longer read as MAME sets. Neo Geo now expands at ScreenScraper too, as it already did at IGDB and Moby. - fba offers fbneo before the FinalBurn Alpha CPS cores. - AdvanceMAME leaves the WebRcade feed; EmulatorJS and WebRcade share PLAYABLE_ARCADE_SET_PLATFORMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review pass (xhigh) on arcade slugs Verify arcade-board BIOS files against the known list's arcade entries, and make migration 0154 match retired slugs case-insensitively. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on arcade slugs Apply IGDB family overrides once in get_platform instead of on each return path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(platforms): use a slug with no shipped icon singe now ships an icon, so the no-icon prefetch test needs a slug that never will. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(platforms): add a teknoparrot arcade slug TeknoParrot runs PC-based arcade boards outside the MAME/FinalBurn family, so its folder gets its own platform (RetroBat and ES-DE both use `teknoparrot`). Providers fall back to their Arcade entry, MAME shortname expansion skips it, and it gets a placeholder icon copied from `arcade`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(platforms): give each arcade-family icon its own marquee title Redraws the ARCADE marquee on the copied cabinet icons with each platform's name, in the Bungee typeface with the original inline and extrusion styling. Sega boards use Sega blue, Namco systems Namco red, and Type X Taito blue; the rest keep the original amber. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(platforms): code-review pass (xhigh) on arcade slugs Neo Geo BIOS lives under arcade in the known BIOS list, so map neogeoaes and neogeomvs there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(platforms): simplify pass on arcade slug tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> |
||
|
|
aae48728e5 |
fix(metadata): read names from {id, name} facet entries in recommendations and ROM responses (#5249)
* fix(recommendations): handle named metadata objects in facet tokens * fix(recommendations): pr-ready step 2 (code-review): skip non-list columns, base role fallback on usable names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(recommendations): pr-ready step 3 (simplify): type facet params as object, trim redundant test cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(recommendations): pr-ready step 4 (review-polish): keep the extract_tokens test prefix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): read names from metadata objects in filter values and ROM responses Share the facet name cleaner as utils.facets.facet_names, and run it in the filter-values reader, RomMetadataSchema, and over every list[str] key of the provider metadata blobs, so an {id, name} entry no longer fails /api/roms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(roms): clean name lists in raw metadata edits, reject non-object JSON parse_raw_metadata now runs the provider blob's list-of-names keys through facet_names before storing it, so {id, name} objects stop landing in the database, and answers 422 when the JSON is not an object. Manual metadata keeps its strict adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
89607cd22c |
chore: Library support for zelda classic games (#5214)
* feat(platforms): add Zelda Classic (zc210) engine support Recognise Batocera/REG-Linux zc210 quest folders as the zelda-classic platform so .qst libraries scan as a first-class engine platform, matching existing fantasy-console/engine precedents like TIC-80 and WASM-4. Co-authored-by: Cursor <cursoragent@cursor.com> * chore(platforms): drop placeholder Zelda Classic icons Use RomM's default platform icon until a properly licensed asset is available. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(setup): identify FS alias platforms in library wizard The setup UI matches on-disk folders by exact fs_slug against supported_platforms, so aliases like zc210 never matched zelda-classic. Merge resolved filesystem platforms into the setup response. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(platforms): also alias zc250 to Zelda Classic EmulatorJS documents both zc210 (2.10) and zc250 (2.50) cores for .qst quests; accept either folder name as Zelda Classic. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(setup): reuse listed folders when merging FS aliases get_filesystem_platforms was walking the library again outside the setup endpoint's error guard, so a folder-list failure could still 500 /api/setup/library. Pass the folders already read instead. Co-authored-by: Cursor <cursoragent@cursor.com> * revert(setup): drop setup-wizard FS alias merge from this PR Keep Zelda Classic platform aliases (zc210/zc250) without changing /api/setup/library behavior. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
3a79911b2f |
Revert "feat: classify ROMs by release type (homebrew, hack, translation, ...) (#5363)" (#5365)
This reverts commit
|
||
|
|
08acaa9ea9 | feat: classify ROMs by release type (homebrew, hack, translation, ...) (#5363) | ||
|
|
552ac3a393 |
fix(platforms): share provider entries across duplicate platform slugs (#5359)
* fix(platforms): share provider entries across duplicate slugs and rename system-32 Three consoles have two RomM slugs, each used by different providers, so a library folder only matched the providers that knew its spelling: vc-4000 / interton-vc-4000, apple-pippin / pippin and tandy-vis / vis. DUPLICATE_PLATFORM_SLUGS lists them once, and fill_duplicate_slugs gives each slug the other's entry in every provider table. pippin and interton-vc-4000 now get an IGDB platform id, and IGDB's family override also applies to a listed duplicate so both VC 4000 slugs stay in the Interton family. The system-32 slug mapped to Namco System 22 in ScreenScraper and LaunchBox, easy to confuse with Sega System 32 (system32). It is now namco-system-22. Folders and config bindings named system-32 still resolve to it, and migration 0154 renames existing platform rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * fix(platforms): resolve bindings to a renamed slug back to their folder resolve_platform_slug already maps a binding to system-32 onto namco-system-22, but resolve_fs_slug compared the raw binding with the new slug, so a moved folder bound to the old slug was never found. Both now go through the same renamed-slug lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * fix(platforms): drop the system-32 slug backfill migration Every scan resolves a platform's slug from its folder again, so the next scan renames system-32 rows through the renamed-slug alias without a migration, as the backend guide asks for normalizations the parser now handles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * chore(platforms): reword two comments so the product isn't the actor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh * revert(platforms): leave system-32 to the arcade slug split rommapp/romm#5273 retires system-32 as an alias of arcade and resolves aliases in config bindings in both directions, which covers what the namco-system-22 rename and the renamed-slug lookup did here. This PR now only shares provider entries across duplicate slugs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
26dff477d7 |
fix(auth): bound new client tokens by the caller's scopes and stop delegates removing admins (#5346)
* fix(auth): bound new client tokens by the caller's scopes and stop delegates removing admins - Creating a client token, approving a device, and regenerating or pairing an existing token now check against the scopes of the credential making the request rather than the whole account's. A narrow client token can no longer mint, or recover the secret of, a broader one. Session and basic auth carry the account's scopes, so they behave as before. - Deleting an admin requires the caller to be an admin, mirroring the existing rule for creating one, since users.write can be delegated. - Editing another user requires the users.write scope on top of the admin role, so an admin's me.write-only token can't change other accounts. - own_only is rejected (422) on grants and overrides for entities with no owner (platforms, roms, firmware, users, tasks, logs), where it silently meant "all". The catalog exposes the ownable entities and the permission matrices only offer "own" on those. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(permissions): keep owner-less own_only grants' access on save Addresses Greptile review on #5346: - An own_only delete grant on an entity with no owner allows nothing today (delete has no coarse scope and the fine check runs with owned=False), so it is now dropped from group grants, or turned into a revoke for overrides, instead of being saved as full delete access. The matrices show it the same way. - The group dialog no longer saves when the permission catalog failed to load, which would have stripped every own_only grant. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(auth): require users.write in the credential to act on another user (pr-ready: code-review) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(auth): share client token effective scopes and canOwn (pr-ready: simplify) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(permissions): tighten grantEffect docstring and matrix comment (pr-ready: review-polish) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(auth): make user, token and streaming admin rules consistent - Acting on another user (edit, delete, RA refresh) needs users.write in the credential, and only admins may target an admin or grant the admin role. One assert_admin_for_admin helper now backs add_user, invite links, update, delete and admin token revocation. - Re-issuing a client token's secret (regenerate, pair) needs every scope it stores; deleting one needs every scope it currently grants, so a narrow token can't remove a broader sibling. - Streaming admin overrides need users.read or users.write in the credential, not just the admin role. - Migration 0154 rewrites stored own_only grants and overrides on owner-less entities to the access they already gave, so the frontend normalisation and the catalog save gate are gone. - own_only is no longer rejected on revoke overrides. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |