* chore(deps): update backend dependencies
* fix: keep empty form values cleared under FastAPI 0.162
FastAPI 0.149 started parsing an empty form string as a missing field, so
the field's default (None) applied. Clients clear a user's email, a
collection's description or remote cover, and ROM fields by sending them
empty, and those updates were silently ignored. keep_empty_string restores
the submitted "" from the raw form.
The CSRF and session tampering tests set a cookie next to the one the
TestClient jar already held for the response domain; the client now sends
both and the original wins. Clear the jar first, as a browser would replace it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(deps): hold fastapi below 0.149
FastAPI 0.149 parses an empty value in a form model as a missing field, so
PUT /api/users/{id} with email="" kept the old address. Stay on 0.148 and
stop Renovate from proposing 0.149+ until the update endpoints can tell an
absent field from an empty one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(deps): hold fastapi at 0.146
FastAPI 0.147 started reading a missing bool field in a form model as
false, so PUT /api/users/{id} with only a role also disabled the account.
Keep the version master runs and cap Renovate below 0.147 until the update
endpoints tell absent, empty and false apart themselves.
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>
* fix(sync): match RetroArch saves named after a ROM's files
RetroArch names a save after the file it launched, so a disc or a
translation inside a multi-file game folder uploaded a save that matched
no ROM. When no ROM carries the name, saves now resolve to the ROM owning
a file with that stem. Those saves stay unslotted under their own name,
since a ROM's autosave lineage holds one save per core and the discs
would overwrite each other. States keep matching on the ROM name only,
because their slots are advertised under it.
Fixes#5364
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sync): write a case-variant reupload to the stored save's own file
Addresses Greptile review on #5445.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sync): match a stored save's name in any case on PostgreSQL
The RetroArch save lookup relied on MariaDB's case-insensitive collation, so
on PostgreSQL a reupload in another case created a second save instead of
replacing the stored one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(player): point RetroArch's system directory at PUAE Kickstarts
EmulatorJS's retroarch.cfg has no system_directory, so RetroArch falls
back to the content directory. WHDLoad games packed in a subfolder then
miss the Kickstarts RomM writes to the system directory, and PUAE boots
AROS instead.
When EJS_externalFiles targets the system directory (only PUAE today),
append system_directory to retroarch.cfg as soon as gameManager is
assigned, before the core boots. Other cores keep the content directory
fallback, since EJS_biosUrl and keepArcadeBiosWhole put their BIOS there.
Fixes#5247
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(player): reword the system directory comment per Greptile review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs(readme): add RomP, RommPS and GRID Launcher, drop Syncthing sync
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(readme): leave GRID Launcher out until it reaches 10 stars
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(trunk): Upgrade trunk
* fix(trunk): keep pinact on 4.1.1 until the plugin passes --format
Addresses Greptile's review: the pinned trunk-io/plugins wrapper runs
pinact with single-dash long flags, which pinact 5 rejects. The upstream
fix is trunk-io/plugins#1180.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[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>
/start checked that the caller could see the platform, but /complete wrote
into the platform folder using the fs_slug cached in the upload session. An
Editor who opened a session before an admin hid the platform could still
finish it during the 24h session TTL.
Completion now re-resolves the platform through the same helper /start
uses, so a hidden or deleted platform answers "Platform not found" and the
staged chunks are cleaned up. The session no longer caches the fs_slug; the
folder comes from the platform's current row. The ROM-folder branch already
rechecked ROM visibility at completion.
Claude-Session: https://claude.ai/code/session_011waFLHbQCsqHfeX1CKGZ7s
Co-authored-by: Claude <noreply@anthropic.com>
After a host suspend longer than the worker TTL, the worker key lapses and
the registry sweep drops the worker, or the next heartbeat recreates the key
with only last_heartbeat. register_birth() only runs at startup, so the scan
worker stayed invisible and every scan was refused with "No scan worker is
listening" until a restart.
RomMWorker.heartbeat() now checks the key still carries its queues and sits
in the worker registries, and writes the registration back when it does not.
Fixes#5327
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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>
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.
Closesrommapp/romm#5432
Authored with Codex assistance, including implementation and tests.
* fix(firmware): verify firmware by hash regardless of name or platform
A correct BIOS dump went unverified when renamed (even case-only) or
placed under a sibling platform folder, because verification only ran
after a name+platform lookup in the known BIOS list. Keep that lookup as
the fast path, then fall back to a cached (size, md5/sha1) index over the
whole fixture.
Fixes#5329
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): recheck stored firmware hashes on scans that skip rehashing
Addresses Greptile review on #5441.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Revert "fix(scan): recheck stored firmware hashes on scans that skip rehashing"
This reverts commit 04efbd7e91.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
EmulatorJS 4.2.3 unpacks the BIOS archive and writes its members loose at
the content root, so same_cdi (MAME-based) never finds cdimono1.zip or a
cdimono1/ folder on its rompath and reports cdi200.rom as missing. Route
the same_cdi core through keepArcadeBiosWhole so cdimono1.zip lands whole
at the root, which is the first rompath entry the core searches.
Fixes#5215
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
* fix(RMenu): return focus to the activator when the menu closes
Picking an item, pressing Escape or pad B unmounted the panel with focus
inside it, so focus fell to <body> and keyboard and gamepad users lost
their place in the toolbar. RMenu now moves focus back to its activator
whenever it closes with focus inside the panel, like a native menu
button. Focus an item handler already moved elsewhere is left alone.
The return happens before the open state flips, so a dialog opened from
an item records the activator (not the unmounting item) as the element
to restore on its own close. A sync watcher covers controlled menus the
parent closes without going through close().
focusFromInput keeps the ring modality-gated: visible after a key or pad
pick, none after a mouse click or tap.
Adds unit tests for item pick, Escape, mouse pick, a handler that moves
focus away, and a parent-closed controlled menu, plus a Storybook play()
that opens the menu from the keyboard, picks an item and asserts focus
is back on the activator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4f48oD21sx3k4u6NiD
* refactor(menu): trim the focus-return comment and a duplicated test
Shortens the focus-return comment to the repo's two-line limit and drops
the Escape unit test, whose interaction the KeyboardFocusReturn story's
play() already covers in the browser.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4f48oD21sx3k4u6NiD
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(switch): explain why encrypted dumps get no title id
RomM doesn't read prod.keys, so encrypted retail NSP/XCI dumps resolve no
title id, and nothing said so. A scan now logs one info line counting the
encrypted Switch files it skipped, a Switch game without a title id says
why on its metadata tab, and key files in the Firmware tab are marked as
not used by RomM.
Fixes#5330
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(switch): keep each scan's encrypted file count separate
Addresses Greptile's review on #5428: scans overlapping in one process
(DEV_MODE) shared the module-level set, so a second scan's begin_scan
cleared the first's count. The set now lives in a context var that each
scan's rom tasks inherit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(oidc): add OIDC_AUTH_PARAMS for extra authorization request parameters
Lets admins send provider options such as prompt=select_account on the
OIDC login redirect. Authlib's authorize_params override its generated
state, nonce and PKCE values, so the parameters RomM manages are
rejected at startup.
Closes#5406
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(oidc): trim parse_oidc_auth_params docstring
Addresses Greptile review on #5431.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
PostgreSQL jsonb rejects \u0000, so seeding ss_metadata with the
NUL-byte miximage path failed before the request ran. The seed only
needs the URLs; the request still sends every path under test.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The badge count had no view-level test, so going back to counting the
earned set (1/3 for a shared badge) would not fail. Cover achievements
that share a badge with both ID-based and badge-only earned entries.
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(ra): sync a player's achievements after they play an RA game
RetroAchievements progress only synced nightly (and only when the
scheduled task is enabled) or by hand from Settings, so achievements
earned in a session didn't show in RomM until much later.
When a play session is recorded for a ROM matched to RetroAchievements,
queue an incremental progress sync for that user on the low-priority
queue. Every play path (web player, streaming, device sync) records its
sessions through ingest_play_sessions, so all of them trigger it. A fixed
job id keeps one sync per user queued at a time.
The per-user sync body moves out of the scheduled task so both share it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
* fix(ra): queue the after-play sync under a valid id that a failure can't hold
The job id used a colon, which RQ rejects, so every enqueue raised and was
logged instead of queued. Use an underscore.
With unique=True, RQ refuses any job whose id still exists, and a failed
job is kept for failure_ttl (a year by default). One failed sync would
have blocked that user's after-play syncs. The job now logs its own
errors instead of failing, and failure_ttl is capped for a worker that
dies mid-run.
Add tests against the real queue: one job per user, and the id is free
again after a sync succeeds or fails. Also drop the docstring's Raises
block and narrow await_args before reading it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
* fix(ra): give the after-play sync the RetroAchievements task's timeout
It used RQ's 180s default, which a first sync of a large account can
exceed. Use the scheduled sync's configured timeout (TASK_TIMEOUT).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ra): count earned achievements that share a badge separately
Earned achievements were stored and matched by badge name, which several
achievements in one set can share. Those collapsed into one entry, so the
game header undercounted (71/75 on a mastered set) and earning one of them
marked them all as earned.
Each earned entry now also carries the achievement's own ra_id, and the
game details view matches on it. Progressions stored before this are read
again on the next sync, and until then entries without an ra_id still
match by badge.
Fixes#5385
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
* test(ra): give the legacy-entry loop its own variable for mypy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
* feat(ra): mark the badge-name id of earned achievements deprecated
Several achievements can share a badge, so ra_id is the field to match
on. The OpenAPI schema now flags id as deprecated and points to ra_id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iit2hMN1bb49UMpcT
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: confine provider media paths to the rom's own folders
Media paths in ScreenScraper and LaunchBox metadata sent through
PUT /api/roms/{id} are now kept only when they point at a PNG or video
file in the rom's own folder for that media type. Malformed provider
metadata is rejected with a 422.
nginx serves /assets/romm/resources/ with nosniff and a sandbox CSP,
except for PDFs, so the browser's PDF viewer still opens them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix: code-review pass on media path confinement
Reject non-string media URLs with a 422, limit stored media file names
to [A-Za-z0-9_-]{1,64}, build the LaunchBox path test from the fixture
rom's ids, and trim the new docstring and nginx comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: simplify pass on media path confinement
Raise the 422 directly instead of through a self-caught TypeError, pull
the path check into a predicate, and share the media I/O patches between
the new tests through a class fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: keep only stored media URLs from raw provider metadata
A media URL in client-supplied ScreenScraper or LaunchBox metadata is
kept only when the rom's stored metadata for that provider already holds
it. Otherwise the URL key, or the whole later-disc entry, is dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Setting OIDC_PROVIDER to Plex or Jellyfin now shows that provider's
logo on the login button. Also clarifies in env.template that the
value is the button label.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ui): hide the anniversaries widget on days without anniversaries
The card showed "No anniversaries today" on empty days. It now renders
nothing then, and comes back when the rollover finds a day with games.
A failed load still shows the card with its error copy. The unused
widget-anniversaries-empty string is removed from every locale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ui): collapse the widget rail when no card is visible
Addresses Greptile's review on #5414: with Anniversaries as the only
enabled widget on an empty day, the rail kept its padding as a blank
strip. The rail now hides itself when it holds no cards, staying in
the DOM so the widget keeps its midnight check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* 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>
* feat(seed): realistic, fast, debuggable seeded images
generate_test_data.py can now seed a library whose images look like a real
one, quickly, so gallery, sizing and image-conversion work can be tested
without anyone's private cover art. The default (--image-fidelity 1) is
unchanged: same seed, byte-identical files.
- --image-fidelity 2: covers drawn at the real-world size mix (measured
aggregates from one 8,396-cover library), the small cover made by RomM's
own resize rule, and debug art on every image: the game's title, system
and region; a box with rom id, size, kind and format; the original path;
pure-colour corner pixels, named corners, percent ticks, crop boxes, a
circle that shows stretching and a transparency ring.
- --image-fidelity 3: the same over texture calibrated to real bytes per
pixel, with 22% of big.png holding JPEG bytes as in real libraries.
- --image-weighted-every N (default 10): at level 2, every Nth rom id is
drawn at level 3, so one library serves layout and file-size work.
- --image-media: also write ScreenScraper media (sizes provisional).
- --image-workers / --image-limit: images are drawn in a process pool
from a per-rom random stream (seed, rom id), identical to one process.
2,000 roms with images seed in about 18 s instead of about 10 minutes.
- After a real run the seeder rotates the gallery's Redis cache, so a
fresh seed never serves the previous library's lists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(seed): keep rows independent of image flags; survive a cache failure
- The screenshot count is drawn for every rom, whatever --images or
--image-limit say, so those flags no longer shift the rows that follow
(--no-images rows were already off in the previous seeder). With the
defaults the draws are unchanged: level 1 output is still byte-identical.
- A Redis error while rotating the gallery cache prints a warning instead
of aborting after the rows are committed, so the report still prints.
- Comments in seed_images.py trimmed to the repository's one-or-two-line rule.
- tests/tools/test_generate_test_data.py runs the seeder with inserts
recorded instead of written: rows match with --image-limit and
--no-images, and a cache failure still reports the saved seed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(seed): document seeding a test library in DEVELOPER_SETUP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(seed): code-review fixes for seeded images
pr-ready step 2 (code-review xhigh --fix):
- level-3 noise is drawn per channel and retuned, so PNG output reaches
the measured 0.9 / 1.5 / 2.0 bytes per pixel spread
- --image-media is rejected at --image-fidelity 1, where it did nothing
- paths come from rom_fs_resources_path, get_media_resources_path,
CoverSize and MetadataMediaType instead of being rebuilt
- drop the unused path_column parameter and a no-op ImageChops call
- draw a batch's images while the next batch is built and inserted
- the cache-failure test checks the rows of the failing run
- drop a duplicate media-off test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(seed): simplify pass over seeded images
pr-ready step 3 (simplify):
- extract small_cover_size from resize_cover_to_small, so the seeder
draws the small cover at RomM's size instead of writing, reopening
and overwriting it
- draw_rom_images returns nothing and follows plan_rom_images, and
files_written is derived from the plan
- _fitted_size measures from a proportional guess instead of stepping
down one point at a time (about a quarter of level-2 draw time)
- one draw path for the pool and inline cases
- drop the ink parameter, the CORNER_RING alias, the _fade_ring wrapper
and the RomImageJob caption default; tighten comments
- trim media from the two slowest tests and use dataclasses.replace
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(seed): humanizer pass over the seeding docs
pr-ready step 5 (humanizer).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(seed): one image pipeline, dry runs write nothing, main owns its cleanup
- level 1 mosaics go through plan_rom_images/draw_rom_images like the
other levels, so they get media, workers and RomM's small-cover size
- --dry-run plans image paths but writes no files
- main() is a thin wrapper: it registers the UTC connect listener and
removes it (disposing the pool) in a finally, and the image pool
cancels queued draws on error; the test no longer patches SQLAlchemy
- the recommendation feed cache is rotated with the gallery cache
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* feat(api): include the parsed version tag in ROM responses
The filename parser stores a version tag such as `(v2.00)` or
`(version CN-07)` in `Rom.version` and keeps it out of `tags`, but the ROM
response schemas never exposed it, so a client had no way to read it.
Add `version` next to `revision` and regenerate the frontend types.
Closes#5243
* fix(frontend): give hand-built ROM objects the new version field
romFixture(), the list row fixture and RelatedGameCard build SimpleRom
objects by hand, so vue-tsc rejected them once version became a required
schema field.
* test(roms): fix mock parameter order in version tag test (code-review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(api): return null for a missing revision or version and clear version on unmatch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(frontend): show the parsed ROM version on the game overview
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>
* 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>
* feat(ui/ux): make age rating and player count badges clickable
Issue #4805 (item 1): on the game page's default tab the age rating and
player count were rendered as static badges, even though both are already
supported gallery search filters.
Each badge now pivots into the global search scoped to that value, the
same pattern InfoGrid already uses for genres/developers/publishers, so
the pivot is a real `a[href]` and middle-click/open-in-new-tab keep
working.
- AgeRatingBadges carries the stored `metadatum.age_ratings` entry on
the badge so the link matches the JSON_ARRAY filter, not the
reconstructed "CATEGORY: RATING" display label.
- PlayerCountBadge pivots on the provider's free-form player-count
string, which is what the SCALAR_IN `player_counts` filter matches.
* fix(age-ratings): focusable tooltips, typed fixtures, real provider coverage
* fix(age-ratings): pr-ready code-review fixes
Give each repeated rating its own category badge with a unique key, pass
the untrimmed player count so the pivot matches the stored value, drop the
custom focus rings in favour of the global one, and test both links
against the real searchLocation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(age-ratings): pr-ready simplify pass
Build each badge label once, group provider ratings without copying the
queue on every insert, and share the mount helper across the tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(player-count): pr-ready review-polish comment trim
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(age-ratings): pr-ready humanizer pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(metadata): trim ScreenScraper and gamelist player counts
The player_counts filter is an exact match, so a padded value listed as its
own option and missed the player-count badge's search link.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(game-details): match badge hover to the info grid chips
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Yi-111-a <847203299+qQ1AJb@gmail.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): delete screenshots and media a rescan leaves unreferenced
A complete rescan keeps the stored artwork, so two kinds of file stayed on
disk with nothing pointing at them:
- screenshots indexed past a shorter new list, since files are named by
position and only the indexes in range were rewritten
- media of a type removed from the preferences, since providers record no
path for it and stale media was compared over the preferred types only
get_rom_screenshots now deletes the indexes past the new list, and
remove_stale_media compares every media type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(scan): split scan_rom's merge into named steps
scan_rom held seeding the row, following Demozoo links, splicing scene
summaries, resetting rematched sources, the scene lock, rehash cleanup,
priority merges for fields, tags and artwork, and the SteamGridDB pass in one
body. Each step is now its own helper, the SteamGridDB lookup a _RomLookups
method, and the providers' answers a dict keyed by source instead of fourteen
locals. The Pouet and CSDb link follows share one helper. Behaviour is
unchanged.
McCabe complexity of scan_rom goes from 68 to 13, and the function from 664
to 215 lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): trim remove_stale_media's docstring per Greptile review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(scan): move the scan vocabulary, lookups and merge into handler/scan
scan_handler.py held the scan types and metadata sources, the per-source
lookups, the merge of their answers and the orchestration in one 2,000-line
module. It now builds on a handler/scan package:
- sources.py: ScanType, MetadataSource, the tag constants, RESCAN_RULES,
should_consult, stored_match_id and the priority ordering
- lookups.py: RomLookups, the LaunchBox and Steam resolvers and
get_main_platform_igdb_id
- merge.py: the pure steps that merge the sources' answers into a rom's
columns
scan_handler.py keeps scan_platform, scan_rom, the asset scans and the media
downloads. Importers point at the module that now defines each name, and the
helpers that crossed a module boundary lost their leading underscore.
clear_rehash_misses takes the attempted sources instead of the lookups, so
merge does not depend on lookups. Behaviour is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ci): import ScanType from handler.scan.sources in the e2e seed script
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): harden leftover screenshot cleanup (pr-ready: code-review)
List the screenshots folder once, use isdecimal() for the index test, and
log rather than raise when a leftover can't be removed. Point three
comments at handler/scan instead of scan_handler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(scan): tidy the merge helpers and patch paths (pr-ready: simplify)
- fetch_sgdb_rom refetches by stored_id and builds the SGDB name list
itself, so the name sources stay private to lookups.
- follow_demozoo_link checks the source is enabled; scan_rom loops over
Pouët and CSDb.
- order_merge_sources holds the one ordering pass, and
build_metadata_handlers adds the empty SGDB entry.
- Leftover screenshots go through the quiet-delete helper, renamed
_discard_file.
- Tests patch rom lookups through handler.scan.lookups.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): never leave a recorded media or screenshot path without its file
- remove_stale_media only deletes a file whose owner or source changed
when that new owner stores the type again in this pass. A file nothing
records is still deleted.
- Screenshots past a shorter list are pruned by remove_screenshots_past
once the new paths are saved, in both download_rom_resources and
update_rom, so a failed cover or manual leaves them in place.
- The release-notes schema diff watches scan_handler.py beside
scan/sources.py, for ranges that span the move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci(coverage): measure frontend coverage with v8 and backend branch coverage
The frontend had no coverage measurement, and the backend's line-only
report counts a one-sided `if` as covered when its body never runs.
- Add @vitest/coverage-v8 and `npm run test:coverage`. Its include lists
every source file, so a file no test imports reports 0% instead of
disappearing. Generated types, locales, tokens, test utilities,
stories, fixtures and play helpers are excluded.
- Frontend Checks runs tests with coverage and uploads the cobertura
report to GitHub code coverage as code-coverage/vitest, mirroring
pytest.yml: a separate job holds code-quality: write and fork PRs skip
the upload.
- Turn on branch coverage in backend/.coveragerc.
Baseline on master: 407 test files pass; frontend lines 63.3%, branches
55.3%. The app project alone (no stories) gives 61.4% lines, so stories
add about two points.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iK9WRvZqdTHiRc9gY
* ci(coverage): include JavaScript sources in the frontend coverage report
The two audio worklets (gmeAudioWorklet.js, pico8AudioWorklet.js) are
production code that the `{ts,vue}` glob left out of the report, so they
now show at 0% instead of being omitted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iK9WRvZqdTHiRc9gY
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(roms): rewrite only the moved part of a renamed rom's file paths
Renaming a rom rewrote each of its files with
`str.replace(old fs_name, new fs_name)` on both the name and the path. On
disk, rename_fs_rom moves only `fs_path/old` to `fs_path/new`, so:
- a folder rom's inner file named after the folder (`Game (Disc 1).bin`
in `Game/`) was renamed in the database but not on disk;
- an fs_name that also appears in the platform path (a rom named `n64`
under `n64/roms`) rewrote the platform path too.
_moved_file_location mirrors the move instead: a single-file rom's name
changes, a folder rom's files keep their names under the renamed folder,
and anything else is left alone.
_refetch_changed_matches now returns the ids it refetched, so the
RetroAchievements badge download keys off that rather than repeating the
comparison, and the shared-media rematch uses the same _match_changed
check as the refetch loop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): keep artwork a complete rescan has nothing to replace with
A complete rescan deleted the rom's cover, manual, screenshots and every
provider media folder before asking any provider, then reset the stored
paths. A provider that was down, rate limited or no longer had the art
left the rom with none.
The wipe is gone, and scan_rom no longer resets the path columns on a
complete rescan. The download step already replaces what changed:
covers, manuals and screenshots refetch when their URL differs, and
remove_stale_media drops provider media whose owner or URL changed. The
URLs and locks are still cleared, so whatever answers now can replace a
file; a file nothing replaces stays where it was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(scan): move scan_rom's provider lookups onto a _RomLookups class
scan_rom defined 16 provider lookups as closures over its own locals
(scan type, platform, rom, rom_attrs, enabled sources, the attempted and
inconclusive sets), so none of them could be read or tested apart from
the 1,000-line function around them.
They are now methods of _RomLookups, a dataclass holding exactly what
they used to capture, along with the helpers they share (consults,
note_inconclusive, resolve_fetch and the cached match files). scan_rom
builds one instance and keeps its local names for the shared sets, so its
body is unchanged apart from the calls. SteamGridDB's lookup stays nested
because it reads the other providers' results.
scan_rom drops from 977 to 664 lines. Its own complexity is unchanged:
that comes from the merge after the lookups, not the lookups themselves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(streaming): one teardown order for every way a session ends
A session could be torn down three ways, each spelling out its steps:
- teardown_released_session (owner release and single admin release)
- teardown_abandoned_session (stale takeover and the reaper)
- force_release_all's inline _teardown
The first two ran the same stop/playtime/activity/state/saves sequence
in two copies. The sweep differed in ways that mattered: it held no drain
marker while it worked, recorded the termination after the stop (so a
polling tab could miss it), marked the exit save pull pending only after
the stop, and deleted the key unconditionally, even if a newer claim had
replaced the one it read.
_stop_and_collect now holds the shared sequence, and both lifecycle
teardowns call it after their own opening (a drain marker for a release,
a staleness-checked marker for an abandoned session). The sweep runs
teardown_released_session for each session, like a single admin release.
With no container config left, it still records the termination, then
frees the key through the guarded release_own_session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: apply code-review findings (pr-ready step 2)
Record playtime and clear the activity entry when force-release-all frees
a session whose container config is gone, and let the PICO-8 cartridge
fallback see a cover a complete rescan keeps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: apply simplify findings (pr-ready step 3)
Let _RomLookups.attempts() record the attempt it gates, drop scan_rom's
local aliases for the lookups' state, read the platform slug off the
lookups in fetch_launchbox_rom, seed the kept artwork paths into
rom_attrs for every rescan so the PICO-8 fallback reads them directly,
return None from _moved_file_location when a file did not move, and
share the playtime and activity steps through close_session_record.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: address Greptile review on #5396
Drop a cover's other formats once a new one is stored, so a kept upload
in another extension can't shadow it, and move the rename path rule onto
FSRomsHandler next to rename_fs_rom.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(player): build the EmulatorJS globals in one pure function
EmulatorJSPlayer.vue configured EmulatorJS through about 90 lines of
`window.EJS_*` assignments mixed into its setup, reading props, the
config store, i18n and the DOM along the way, and declared the 60-line
global type block it relied on. None of it could be tested without
mounting the player.
buildEjsConfig() in views/Player/emulatorJSConfig.ts now takes those
inputs and returns every value, and applyEjsGlobals() writes them onto
window in one place. The Window declarations move with them. The
component builds the input from its props and stores and keeps
everything else (save sync, the default-options trap, the netplay audio
tap, the reload on unmount) as it was.
The values are unchanged, including two existing quirks kept on purpose:
the controls are still looked up by the requested core and the core
options by the resolved one, and the controls and cache limit are only
set when configured.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(player): build firmware fixtures from a typed factory
Addresses Greptile's review: firmwareFixture returns a complete
FirmwareSchema instead of a cast partial, used by the EmulatorJS config
and launch intent tests, and two config comments are trimmed to the
comment rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>