Commit Graph

13893 Commits

Author SHA1 Message Date
Georges-Antoine Assi
2d140e606a fix(scan): consult sources from one rule table and keep stored matches on refresh (#5394)
* refactor(scan): decide which sources a scan consults from one rule table

Each of scan_rom's 16 provider fetchers opened with its own copy of the
same gate: is the source enabled, does it cover the platform, and does
this scan type (new, complete, update, unmatched, hashes) ask it about
this rom. The copies differed in small ways (which platform field,
whether a hash scan counts, whether an id alone counts as matched) that
were only visible by reading all 16 side by side.

RESCAN_RULES now holds one RescanRule per source, and should_consult
applies them. Each fetcher's gate is a single consults() call. The
fetchers' lookup logic is unchanged.

A brute-force comparison of the old inline gates against should_consult,
over 57,600 combinations of scan type, new rom, enabled source, id,
metadata, platform id and platform slug, found no differences. The new
test_scan_rescan_rules.py pins the rules per source without a database.

The nested fetchers drop from a combined cyclomatic complexity of 215 to
87 (437 to 264 lines).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(scan): pin rescan rule columns independently, cover Hasheous' platform id

Addresses Greptile's review: an explicit table of each rule's id and
metadata columns, Hasheous in the platform-id test, and a one-sentence
should_consult docstring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(scan): keep stored matches on refresh and pick rescans from the rule table

- Every fetcher refetches a stored id through stored_match_id(): an update,
  or an unmatched retry of missing metadata, keeps the id instead of trading
  it for a hash or filename match. IGDB now prefers it over Hasheous and
  Playmatch, MobyGames and ScreenScraper refetch it on an unmatched retry, and
  Demozoo refetches it at all.
- Playmatch runs only when a source that reads its ids will be consulted.
- should_scan_rom picks update and unmatched roms with should_consult, so the
  platform gates and the metadata check apply, and Playmatch alone picks nothing.
- unmatched_supported takes the platform instead of reading rom.platform.
- scan_rom's handler table and update_rom's refetch table take their columns
  from RESCAN_RULES; a test checks METADATA_SOURCE_COLUMNS agrees with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 15:03:01 -04:00
Georges-Antoine Assi
b5acfa4c44 refactor(streaming): type the session record as a StreamingSession TypedDict (#5395)
* refactor(streaming): type the session record as a StreamingSession TypedDict

The streaming session lived in the cache as a JSON object and moved
through the code as dict[str, Any], so its 18 keys were implied by the
two claim literals and a handful of mutate_session calls spread across
session_store, lifecycle, access, launch, memory_cards and the
endpoint. A misspelt key read as None without a warning.

StreamingSession (total=False, since drain markers and records from
older releases carry only some fields) now names every key and its type,
and every session and claim parameter, return and literal uses it. mypy
checks each .get() and write against it. The scope helpers that also
read a termination notice take a Mapping[str, object] instead.

No behaviour changes: the record's JSON is the same. Tests that built
sessions by hand now build StreamingSessions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(streaming): one-sentence StreamingSession docstring

Addresses Greptile's review on the comment rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 14:40:02 -04:00
Georges-Antoine Assi
04c0277533 refactor(roms): drive update_rom's provider refetches from one table (#5393)
update_rom spelled out each provider three times: 15 hand-written id
parses, 11 raw metadata parses, and 11 refetch blocks that differed only
in the handler call and a few quirks. Adding or fixing a provider meant
editing every copy.

The ids are now parsed in one loop over MATCH_ID_FIELDS, the raw metadata
in one loop over the form's raw_*_metadata fields, and the refetches run
through _MATCH_REFETCHES, an ordered table of (id field, fetch, on_miss).
LaunchBox's media paths and ScreenScraper's exhausted-quota fallback live
in their fetch functions, and RetroAchievements' hash_match reset is its
on_miss. Table order keeps the old precedence, so a later provider's
name, summary or cover still wins.

New parametrized tests pin, for every provider, that a changed id
refetches it, a cleared id drops its metadata, an unchanged id is left
alone and raw metadata survives a miss, plus the precedence between two
providers. They passed before the change and pass after it.

update_rom drops from cyclomatic complexity 157 to 64 and 541 to 336 lines.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 14:06:52 -04:00
Georges-Antoine Assi
fea45b7637 fix(streaming): release a desktop claim when activation is cancelled (#5392)
* fix(streaming): release a desktop claim when activation is cancelled

claim_desktop_session freed its claim only on an Exception from activate.
A cancelled request raises CancelledError, a BaseException, which skipped
abort_claim and left the container reserved until the claim's TTL lapsed.
Catch BaseException, as claim_session already does since #5024.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(streaming): assert the cancelled desktop activate actually ran

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 13:46:30 -04:00
Georges-Antoine Assi
d52673649f chore: add reverted-fix, reach and test checks to security-audit (#5390)
* chore: add reverted-fix, reach and test checks to security-audit

Flag deleted lines that arrived in a security fix, count the callers of a
changed symbol instead of guessing its reach, and treat untested sensitive
changes as needs-attention. Rank findings by reach and coverage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: address Greptile review on security-audit checks

Run git log -S against the range tip, exclude backend tests from the
caller grep and tell the reader to inspect matches rather than counting
lines, and limit the test diff to actual frontend test files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 13:08:55 -04:00
Georges-Antoine Assi
853892ac31 docs(readme): add CoreHost as a hosted deploy option (#5380)
* docs(readme): add CoreHost as a hosted deploy option

CoreHost runs managed RomM instances and shares revenue from them with
the project, so it gets a deploy badge next to Hostinger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(readme): use the CoreHost referral link

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(readme): show the hosted deploy badges side by side

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 12:46:19 -04:00
alexcastgonz
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>
2026-10-29 12:23:31 -04:00
cfranz-medsoto
332643b5d2 Fix scan failure when ROM name is missing (#5377)
### Summary

Prevent ROM scanning from failing when the `name` field is missing from `rom_attrs`.

The identification log message now falls back to `fs_name` when `name` is unavailable. This avoids a `KeyError` during scanning while preserving the existing log output for ROMs that have a name.

### Motivation

During a library scan, RomM raised a `KeyError: 'name'` in `scan_rom()` when attempting to log a successfully identified ROM. This caused the affected ROM's scan to fail.

Using `fs_name` as a fallback allows the scan to continue even when the metadata name is missing.

### Testing

- Reproduced the issue during a ROM library scan.
- Verified that scanning completed successfully after applying the fallback.

### AI assistance

AI assistance was used to help investigate the error. The fix was tested locally against the affected RomM installation.
2026-10-29 12:09:51 -04:00
Sam Dornan
7e5023be76 feat(frontend): switch similar games between RomM and IGDB sources (#5382)
* feat: add RomM and IGDB similar games source toggle

* Use native RSelect for similar games recommendation source

* Use RomM native sliding segmented control for recommendation source

* test(frontend): drive the similar games source picker through its component

The picker moved to RSliderBtnGroup, which shallowMount stubs, so the
tests could no longer find its buttons. They now emit update:modelValue
on the stubbed group and read its modelValue. Also groups the
similarGamesSource setting with the other game page settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* docs(frontend): describe both similar games sources in GameDetails

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* refactor(frontend): use RSegmentedControl for the similar games source picker

RSliderBtnGroup was renamed to RSegmentedControl in #5383.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* fix(frontend): make the x-small size shrink the tab variant of RSegmentedControl

size="x-small" only had rules for the segmented variant, so the similar
games source picker kept the full 34px tab height beside a 14px heading.
Tab x-small is now a 24px text pill; the explicit height overrides
RBtn's compact density, as the segmented x-small rule already does.
Adds a TabXSmall story.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* chore: add #5382 screenshots for the PR description

Removed again in the next commit; the PR body links them by this
commit's hash.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* chore: remove #5382 screenshots from the tree

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* refactor(frontend): drop !important from the x-small tab rule

#5386 removed !important from RSegmentedControl; the x-small tab rule
already out-specifies the base tab rule and RBtn's, so it needs none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

* docs(frontend): shorten the RSegmentedControl size prop comment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 11:06:32 -05:00
Sam Dornan
ee29b1e2a4 refactor(frontend): rename RImg to RImage (#5387)
Spells the primitive out like every other one in src/lib (RIcon,
RTextField, RSegmentedControl). Renames the component, its folder,
story, story stylesheet, and the r-img CSS classes. No behaviour change.


Claude-Session: https://claude.ai/code/session_01NH5s4h1gm17cCYTX1t7BQX

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 11:06:17 -05:00
Sam Dornan
d46dd6a29a refactor(frontend): drop !important from RSegmentedControl (#5386) 2026-10-29 10:32:42 -05:00
Luc_Ren
89f1acbbd7 translation correction (#5370) 2026-10-29 10:58:33 -04:00
Ryan Farthing
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>
2026-10-29 10:48:04 -04:00
Ryan Farthing
4229c45e0b fix(collections): drop hidden roms' covers from collection responses (#5311)
* fix(collections): drop hidden roms' covers from collection responses

_hide_collection_roms already strips roms hidden from the caller out of
rom_ids (and so rom_count), but left path_covers_small/path_covers_large
alone. The collection card builds its thumbnail from those, so a hidden
rom's cover art still showed on regular, smart and virtual collections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(collections): hide hidden roms in collection write responses (pr-ready: code-review)

Run the write endpoints' responses through _hide_collection_roms so a hidden
rom's id and cover don't come back from add/remove/update calls. Trim the
docstring and reuse the cover test helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(collections): match hidden covers by rom id (pr-ready: simplify)

Cover URLs under roms/{platform_id}/{rom_id}/ carry the rom id, so filter on it
instead of looking up each hidden rom's current cover path. This drops the extra
query and get_cover_paths, and also catches stale smart collection snapshots.
Add a single-schema _hide_collection_rom wrapper for the per-item endpoints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(collections): name the single-schema hide helper (pr-ready: review-polish)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(collections): keep hidden members on update and refuse hidden adds

PUT /collections/{id} replaced the member list with what the client sent, so a
restricted owner saving the filtered list silently dropped roms hidden from
them. Keep those members, and treat hidden roms like missing ones when adding
through PUT or POST /collections/{id}/roms.

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>
2026-10-29 08:49:07 -04:00
Sam Dornan
be50c8bfd1 refactor(frontend): rename RSliderBtnGroup to RSegmentedControl (#5383) 2026-10-29 07:39:22 -05:00
berce
83b0615424 fix(streaming): give standalone PPSSPP the broker's working state slot (#5256)
* fix(streaming): give standalone PPSSPP the broker's working state slot

A webstation container that maps psp to standalone PPSSPP fell through to
NO_CAPABILITIES, so the player offered only Save & Exit, even though the
broker saves and loads one working slot for it over the state hotkeys.
Add a ppsspp entry next to retroarch and scummvm with the same slot shape.

Closes #5230

* style(streaming): keep the PPSSPP comment and test docstring to the house length
2026-10-29 08:08:46 -04:00
Alessandro Digilio
061e43314e fix(player): preserve arcade BIOS archive bytes (#5305)
* fix(player): 🐛 preserve arcade BIOS archive bytes

* fix(player): write every 4.2.3 externalFiles download as bytes

code-review pass. EmulatorJS 4.2.3 hands each EJS_externalFiles download to
Emscripten FS.writeFile as an ArrayBuffer, which it rejects after creating an
empty file. That drops PUAE Kickstarts as well as the arcade BIOS, so the
conversion moves out of keepArcadeBiosWhole into writeExternalFilesAsBytes,
installed from the EJS_emulator trap for every listed URL. The trap test now
covers the BIOS bytes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(player): coerce 4.2.3 GameManager writes instead of downloads

simplify pass. The broken contract is GameManager.writeFile handing an ArrayBuffer to Emscripten's FS.writeFile, so patch that method once on the 4.2.3 global class rather than wrapping downloadFile and matching externalFiles URLs. This drops the URL filter, the response-shape guard and the extra emulator interface, and the nightly build (which never sets window.EJS_GameManager) is gated out without sniffing downloadGameFile. playerFirmware.ts goes back to master.

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>
2026-10-29 08:08:15 -04:00
Alessandro Digilio
e2e39b9b72 fix(worker): close database pools before work horse exit (#5303)
* fix(worker): 🐛 close database pools before work horse exit

* test(worker): ✅ annotate cleanup regression tests

* fix(worker): keep the parent's pooled connections open in the work horse

pr-ready step 2 (code-review xhigh --fix).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(worker): merge the duplicated pool cleanup tests

pr-ready step 3 (simplify).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(worker): clarify the engine fixture docstring

pr-ready step 5 (humanizer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 21:06:24 -04:00
Alessandro Digilio
88e3c016f9 fix(sigil): classify routine extraction failures by type (#5304)
* fix(sigil): 🔇 classify routine extraction failures by type

* fix(sigil): log sigil's error message and correct test error codes

pr-ready step 2 (code-review): log the exception text instead of the bare
numeric code, restore the comment on why these failures are routine, use
NEEDS_KEY's real code (-6) in the fixture, and give parametrized cases ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(sigil): split routine and unexpected failures into separate except clauses

pr-ready step 3 (simplify).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(sigil): keep sidecar files away from sigil

Disc sheets, subchannel data and text files beside a ROM never hold a title
id, and sigil fails short ones with the same IO error it raises for real
read failures, so they kept logging at ERROR on every scan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 20:44:55 -04:00
Spinnich
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>
2026-10-28 19:53:06 -04:00
Stu Anderson
6bf6554c97 perf(roms): cheaper grouped gallery window on PostgreSQL and MariaDB (#5267)
* feat(tools): time the two statements behind one gallery window

Builds the page-ids and load-by-id statements the way GET /api/roms does,
runs each under EXPLAIN (ANALYZE) in a read-only transaction, and prints the
execution time with the plan nodes that spend the most of it. PostgreSQL only.

Baseline on a 100,000-rom seed, grouping on, window 0+72, median of 3:
  page ids    1490.6 ms (hash join 441, roms_pkey scan 371, sort 302)
  load rows    892.3 ms (hash join 467, sort 318)
  total       2382.9 ms

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* perf(roms): load a window's rows by id without re-running the sibling grouping

The ids a window loads were already picked by the grouped query, so the load
re-ranked the whole library only to confirm them. It now builds its select from
filter_roms with no filters (same loader options, file stats and hidden-roms
check) and narrows it to the page's ids.

Measured on a 100,000-rom seed, grouping on, window 0+72, median of 3:
  load rows by id   892.3 ms -> 1.3 ms
  both statements  2382.9 ms -> 1481.9 ms

Page ids are unchanged at about 1.48 s. The new tests compile the SQL only and
were not run here: they need the test database.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* perf(roms): rank pre-releases with one regex instead of six LIKEs

The sibling-dedup window evaluated six leading-wildcard ILIKEs on every rom's
filename. One case-insensitive regex over the same tags matches the same names
and reads each name once. The pattern is built from PRERELEASE_FILENAME_TAGS so
the tag list stays the only place a tag is named.

Measured on a 100,000-rom seed, grouping on, window 0+72, page-ids statement:
  median 1480.6 ms -> 1243.5 ms
  hash join under the sort, own time 455 ms -> 182 ms

The new tests check the pattern against the old rule on sample filenames and
that both dialects compile to a single match; they were not run here (they need
the test database).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* feat(tools): time searches and filters with --filters on the gallery timing tool

Takes RomFilterParams as JSON, so a search term, a platform or any filter can be
timed the way the plain gallery is. On a 100,000-rom seed a search costs 26 to
220 ms for a window's ids, and the broad filters (matched, verified, a status)
cost 430 to 1,145 ms because the sibling ranking covers almost every rom.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(roms): keep the status filter when loading a window's rows by id

A page picked with statuses=hidden was reloaded under the default that hides
hidden roms, so its items came back empty while the total stayed non-zero.
The row load now carries the request's statuses and statuses_logic, and
nothing else.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(tools): time searches as the endpoint runs them and accept group_by_meta_id in --filters

The timing tool now passes the search term to the query and defaults to the
endpoint's empty sort, so a search is timed with its relevance ordering. The
JSON filters merge over the grouped default (--ungrouped still wins), so a full
RomFilterParams can be pasted without a duplicate keyword.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* docs(roms): cut change rationale from the new docstrings and test headers

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(roms): type the hidden-status page test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* test(roms): satisfy the CI mypy config in the hidden-status page test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* refactor(roms): load a window's rows with loader options only

The by-id row load reused filter_roms with a statuses-only RomFilterParams,
which tied its correctness to knowing which predicates apply by default.
Split the loader options out of filter_roms into _with_rom_loaders, and have
get_page_rows_query apply only those plus the id list and the visibility
clauses (the cached id index's key does not carry visibility).

Keep the six ILIKEs for the pre-release rank on PostgreSQL, where they
measured ~13% faster than the regex on whole-library windows (100k roms),
and use the regex on MariaDB, where it measured ~25% faster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(roms): apply code-review findings on the window row load

pr-ready step 2 (code-review xhigh --fix): drop the dead loader flags from
the ids query, align the timing tool's sort args and --repeat with the
endpoint, tighten comments, and stop the hidden-status test inserting a
RomUser twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(roms): drop filter_roms loader flags no caller sets

pr-ready step 3 (simplify): the gallery card loaders moved to
get_page_rows_query, so filter_roms no longer takes include_file_stats,
include_siblings or include_notes. The page-rows test compiles through
the shared compile_sql helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(roms): trim the pre-release pattern comment

pr-ready step 4 (review-polish).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(roms): plainer docstring on the grouped-query yardstick test

pr-ready step 5 (humanizer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(roms): build every rom card loader from one list

with_details, with_simple_details and filter_roms each kept their own
copy of the SimpleRomSchema loads, and the copies had drifted: the
filter_roms siblings skipped load_only. All three, and the gallery's
page-row load, now build from _rom_card_loaders. Feeds still skip the
track and doc metadata they never read.

The real-row pre-release test pins the accent-sensitive match on both
PostgreSQL and MariaDB.

The timing tool now applies the user's rom visibility, times the eager
loads the row query triggers, and keeps parallel plan nodes in
wall-clock time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-28 19:47:37 -04:00
Sam Dornan
983ee142fb refactor(docker): simplify the production Dockerfile (#5376)
- Drop the unused backend-dev-build, dev-slim and dev-full stages. No
  workflow or compose file targets them (the dev image is ./Dockerfile),
  and because dev-full was the last stage, build_local_image.sh (no
  --target) was building an image with the dev extras. full-image is now
  the default target.
- Fetch argosy-sigil, mod_zip and nginx with BuildKit's git ADD (which
  also pulls submodules) instead of git clone/checkout, as the gme stage
  already does, so those stages no longer install git. RALibretro keeps
  its clone: its Makefile builds RA_BuildVer.h from .git/HEAD and
  `git describe --tags`, which ADD strips.
- Hardcode /var/www/html in place of WEBSERVER_FOLDER: nothing sets the
  ARG, and the entrypoint and nginx template hardcode the path anyway.
- Stop copying the CPython headers into the runtime image; nothing
  compiles there.
- Remove a no-op chmod and a mislabelled comment.


Claude-Session: https://claude.ai/code/session_01NH5s4fzfhupfVnuw2VKdog

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 13:30:02 -05:00
berce
6557f19877 fix(migrations): add GAME to a romfilecategory enum made before 4.5.0 (#5269)
* fix(migrations): add GAME to a romfilecategory enum made before 4.5.0

0033 created the PostgreSQL enum without GAME until b082e1582 added it
to the migration itself, so databases migrated before 4.5.0 never got
it. 0062's create(checkfirst=True) is then a no-op and its NOT IN list
fails to parse on 'GAME'. Add the value first, outside a transaction
as 0118 does for CHEAT, ahead of DLC to match a fresh install.

Closes #5262

* style(migrations): keep release history out of the 0062 comment and test docstring

* fix(tests): annotate 0062 test results for mypy and reformat

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>
2026-10-28 12:55:20 -04:00
Zach Clendenen
a5b3054270 fix(streaming): let a container's broker_secret override STREAMING_BROKER_SECRET (#5259)
* fix(streaming): let a container's broker_secret override STREAMING_BROKER_SECRET

STREAMING_BROKER_SECRET replaced every container's broker_secret, so a pool
of containers with different BROKER_SECRETs could not authenticate: each
broker after the first answered 403 "bad broker secret". A container's own
broker_secret now wins, and the env var is the fallback for containers that
set none. A blank broker_secret also falls back instead of becoming the
literal secret "None".

* test(streaming): cover a blank broker_secret with no env secret

Addresses Greptile review on #5259: the fallback cases all set the env
secret, so none pinned that YAML null no longer becomes the secret "None".

* Update examples/config.example.yml

---------

Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
2026-10-28 12:16:30 -04:00
Jeremy
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>
2026-10-28 12:03:36 -04:00
Edward Salter
7f04b134a8 fix(docker): stop the init watchdog spawning duplicate gunicorns on slow starts (#5250)
Gunicorn writes /tmp/gunicorn.pid only once its arbiter starts. On a slow
cold start the watchdog found no pid file and started another gunicorn
every 5s without stopping the earlier ones, until the host ran out of
memory. Record $! at launch, as the RQ workers already do.

Cold starts were slow because the image ships no bytecode while setting
PYTHONDONTWRITEBYTECODE=1, so every process compiled every module from
source. Compile the venv during uv sync and /backend at build time.

Fixes #5246

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:16:22 -04:00
Stu Anderson
c28e0e53b4 fix(auth): point the OpenAPI token URL at /api/token (#5245)
The OAuth2 password flow in the OpenAPI schema declared its tokenUrl as
/token, but the token endpoint is served at /api/token; a POST to /token
is rejected with a 403 before any token code runs. Clients that read
tokenUrl from the schema, such as Postman's OpenAPI import, request
tokens from the wrong place.

The test compares the schema's tokenUrl with the token route's own path,
so a future prefix change can't drift them apart again.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:08:34 -04:00
Ellis Nieuwpoort
7941d352eb fix(v2): stop game videos from holding connections they no longer need (#5236)
* fix(v2): stop game videos from holding connections they no longer need

* fix(v2): keep hover previews from stopping a playing clip (pr-ready: code-review)

Hover previews get their own release slot so a cover hover no longer
stops a trailer the user started, the play() promise no longer marks a
released preview as playing, and MiniPlayer reuses releaseMedia.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(v2): share the cover release path, dedupe a test stub (pr-ready: simplify)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(v2): skip the hover clip release when it never played

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>
2026-10-28 11:00:22 -04:00
Nathan Krebs
d8f08a60f2 fix(scan): fall back to filename name when only libretro matches (#5241)
* fix(scan): fall back to filename name when only libretro matches

Libretro matches by filename and supplies no name. On a complete scan or a
newly added ROM that only libretro identifies, rom_attrs had no name, so the
identified-as log raised KeyError and the scan result was discarded.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(scan): keep a new rom's own name when libretro alone matches

code-review (xhigh) pass. A physical game is created with the name the
user typed, and the filename fallback would rebuild it from the
sanitized fs_name ("Kingdom Hearts HD 2.5" -> "Kingdom Hearts HD 2").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(scan): simplify the new-rom name fallback expression

simplify pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(scan): clarify the name fallback comment

humanizer pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-28 09:40:40 -04:00
Georges-Antoine Assi
5af2e231ec fix(i18n): placeholder parity check, one locale list, memory card plurals (#5375)
* fix(i18n): pluralize the memory card import message

Replace "save file(s)" with vue-i18n plural forms in en_US and en_GB.
The dialog already passes count, which selects the form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): check placeholder parity and fix es_ES placeholders

check_i18n_locales.py now fails when a translation's {placeholders}
differ from en_US. The check found 33 es_ES strings that dropped a
placeholder (usernames, error details, file paths) or used one the code
never passes, which renders empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(i18n): derive the language list from the locale folders

The language store kept its own list of locales next to the folders
that locales/index.ts already discovers, so a new locale had to be
registered in both. The store now lists availableLocales and keeps only
their display names, and a test fails when a folder has no name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): address Greptile review on #5375

Give memory-card-import-body plural forms in the locales whose
"(s)"-style text has a one/other split (de, es, fr, pt_BR, ro, sv, bg)
and in cs_CZ's four-form rule. Extract the placeholder comparison into a
function, cover it with stdlib unittest tests, and run them in i18n.yml.
The locale checker now skips __pycache__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): type the locale checker for mypy

mypy.yml runs strict mypy over frontend/src/locales, which rejected the
untyped helpers and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(i18n): humanizer pass on the i18n skill changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): handle two-form Czech plurals

The cs_CZ plural rule always returned a four-form index, so the 17
cs_CZ strings with only "one | other" forms showed the wrong form for
0 and 1 and threw "Unexpected return type in composer" for counts of
2 or more. Two-form strings now use the one/other split, which also
lets memory-card-import-body drop its duplicated segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:11:39 -04:00
Daniel Nylander
23a10bc6ca feat(i18n): add Swedish locale (#5231)
* feat(i18n): add Swedish locale

* fix(i18n): pr-ready code-review pass on Swedish locale

Revert the Setup.vue t() call change: vue-i18n already selects the
plural branch from named.count, and the rewrite failed Prettier on a
frozen v1 file. Align the setup i18n test with the component's call
shape, and list sv_SE (and the missing tr_TR) in the i18n skill and
frontend architecture doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(trunk): pr-ready review-polish pass, skip checkov on locale JSON

checkov's CKV_SECRET_6 entropy check flags the Swedish translation
"Klient-API-token" as a secret. Locale strings cannot carry secrets,
and trufflehog still scans them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Daniel Nylander <qt@danielnylander.se>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 08:38:47 -04:00
danielcopper
e304e08a88 perf(roms): let a list fetch leave the provider metadata off each item (#5228)
* perf(roms): let a list fetch leave the provider metadata off each item

GET /api/roms takes with_provider_metadata, default true. When it is
false, every *_metadata field but manual_metadata (the twelve provider
blobs and merged_ra_metadata) comes back null. The fields stay in the
schema, so the response shape is unchanged. metadatum and the flat
fields read from the blobs (alternative_names, youtube_video_id,
path_video) are serialized as before.

The fields are nulled on a copy of the finished schema rather than on
the Rom, because an assignment to the row inside the request's session
would be flushed to the database. The set of fields is derived from the
schema, and a test pins the names, so a new *_metadata field joins on
purpose.

Closes #5227

* refactor(roms): list the provider metadata columns in one place

PROVIDER_METADATA_COLUMNS on the model now backs the scan snapshot, the
unmatch reset and the list endpoint's opt-out, which each spelled out the
thirteen columns. The opt-out test is cut down to one request per mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(roms): spell out the RetroAchievements field in the opt-out

The response set is now the provider columns less ra_metadata, plus
merged_ra_metadata, which the schema serves with absolute badge paths.
The nulling reads as one conditional step before the return.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* perf(roms): copy only the achievement dicts in merged_ra_metadata

The deep copy cloned the whole RetroAchievements blob to rewrite two badge
paths per achievement. Building new achievement dicts keeps the stored
paths relative at a quarter of the cost: 24.2 ms to 6.3 ms over a 500-item
page of a real library, with identical output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 08:33:51 -04:00
Yukine
2662c36b70 chore(converto): bump rom-converto to v0.24.0 in both images (#5220)
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-27 21:32:22 -04:00
Ellis Nieuwpoort
9b705d9602 fix(notifications): start a pasted Apprise URL from defaults, not stale values (#5217)
* fix(notifications): drop stale fields from an earlier pasted URL

A URL read half-typed (ntfy://romm) sets mode=cloud. The full URL then
omits mode as the default, so the stale cloud mode stayed and Apprise
ignored the host. Remember what the last read filled in and drop it on
the next read unless it was changed by hand.

* refactor(notifications): apply code-review fixes to stale URL field handling

Reset the last-read memory with the form values instead of a clearPaste
flag, compare with lodash isEqual, and fix the test import order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(notifications): simplify the stale URL field tests

Fold the three drop cases into it.each, bind the paste label once, and
drive the URL debounce with fake timers instead of real sleeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(notifications): let a pasted URL replace every option it decides

The parse response now lists every key the URL decides, defaults included,
so the dialog drops a stale value (ntfy's mode: cloud) whether it came from
an earlier read or from the channel being edited. This replaces the
frontend's memory of the last read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(notifications): keep typed values only beside a service's own URL

An Apprise URL carries every option, so a pasted one starts from defaults
and a stale ntfy mode: cloud (from an earlier read or the channel being
edited) is dropped. Only an https URL, a service's own, keeps what was
typed beside it. This replaces the parse endpoint's decided list.

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>
2026-10-27 21:17:47 -04:00
Georges-Antoine Assi
2216f122c1 chore(security): verify dev toolchain downloads (#5218)
* chore(security): verify dev toolchain downloads and pin dev image digests

dev-setup.sh piped astral.sh's uv installer into sh and fetched Node and
the Trunk launcher without any checksum. uv now comes from its GitHub
release tarball checked against the published .sha256, Node against the
release's SHASUMS256.txt, and the Trunk launcher from its versioned URL
against a pinned sha256 (the launcher then verifies the CLI against the
pins in .trunk/trunk.yaml).

The dev Dockerfile pinned ubuntu:22.04 and the uv image by tag only; both
are now pinned by digest like docker/Dockerfile.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(dev-setup): pick musl uv builds and stage downloads outside ~/.local/bin

code-review pass: a partial Trunk download no longer leaves a
non-executable trunk that later runs skip, and download temp dirs are
removed on any exit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(dev-setup): simplify pass on the verified downloads

Drop the uv-only musl branch (Node and apt already rule out musl hosts),
fail fast when no published checksum matches, create ~/.local/bin once,
and remove a dead cleanup the EXIT trap already covers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-27 20:13:32 -04:00
renovate[bot]
47dccbc95d chore(deps): update dependency happy-dom to v21.0.4 [security] (#5372) 2026-10-27 19:10:31 -05:00
Ian Hunter
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>
2026-10-27 17:49:48 -04:00
Georges-Antoine Assi
3a79911b2f Revert "feat: classify ROMs by release type (homebrew, hack, translation, ...) (#5363)" (#5365)
This reverts commit 08acaa9ea.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 08:21:22 -04:00
Georges-Antoine Assi
8148d58ee9 Revert "feat(frontend): add an Open in Steam action for Steam-matched games (#5358)" (#5366)
This reverts commit aaf6a4e17.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 08:20:31 -04:00
Sam Dornan
08acaa9ea9 feat: classify ROMs by release type (homebrew, hack, translation, ...) (#5363) 2026-10-26 21:34:35 -05:00
Sam Dornan
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>
2026-10-26 14:28:30 -05:00
Sam Dornan
aaf6a4e17a feat(frontend): add an Open in Steam action for Steam-matched games (#5358)
* feat(frontend): add an Open in Steam action for Steam-matched games

Games with a Steam app ID now get an "Open in Steam" button and menu item
that hand steam://run/<appid> to the local Steam client, the same way the
Flashpoint action hands off flashpoint:// links. The anchor-click handoff
is shared between the two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGA3D2oZ1hq3QUdnubMNXh

* test(frontend): drop the em dash from the Open in Steam test title

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>
2026-10-26 10:25:02 -05:00
Georges-Antoine Assi
78214a9e77 docs(readme): add R-Shop, RomMMobile and KONSORU to community projects (#5361)
R-Shop is maintained again after a quiet spell, RomMMobile is past 30
days old, and KONSORU passes every criterion; it ships binaries only,
which was a deliberate call.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-26 11:13:13 -04:00
Georges-Antoine Assi
ff9627ae70 fix(auth): require the current password to change your own username, password or email (#5351)
* feat(auth): require the current password to change your own password

PUT /api/users/{id} set a new password or email for the caller with
nothing more than a me.write credential, so a leaked client token or a
hijacked session could take the account over for good.

A self-edit that changes the password or the email now needs
current_password, checked with bcrypt off the event loop (400 when
missing, 403 when wrong). Admins editing another user and the
forgot/reset-password flow are unchanged. Accounts with no local
password (OIDC-provisioned placeholders) can set a first one only from a
sign-in session, not from a bearer or client token.

UserSchema gains has_password so the UI asks for the current password
only when the backend will: the change-password dialog, the profile
email field, and the edit-user dialog when editing yourself.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(user): shorten _verify_account_holder docstring

Addresses Greptile review on #5351.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(user): treat a case-only email edit as no change (code-review)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(user): simplify current-password checks and tests (simplify)

Hash the new password off the event loop, reuse errorMessage and the
viewer token fixture, and table-drive the needsCurrentPassword tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(user): require the current password to change your own username

Login is by username and a rename revokes every session, so a stolen
me.write token could lock the owner out without touching the password.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(user): lock the email of OIDC accounts to the identity provider

The provider overwrites a linked account's email at every sign-in, and
finds an unlinked password-less account by it, so a self-edit is either
lost or breaks SSO sign-in. Admins can still change it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(RTextField): give read-only fields a muted style

Dashed chrome, no fill and muted text, with no hover or pointer-focus
halo, so a locked value no longer looks editable. Keyboard and gamepad
focus keep their outline.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-26 11:12:27 -04:00
Georges-Antoine Assi
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>
2026-10-26 09:35:17 -04:00
renovate[bot]
b2a253f31f chore(deps): update frontend dependencies (#5349)
* chore(deps): update frontend dependencies

* chore(deps): dedupe playwright onto 1.64.1

@playwright/test 1.64.1 nested its own playwright and playwright-core
while the root copy used by @vitest/browser-playwright stayed on 1.63.0.
CI installs browsers with a single `npx playwright install`, which only
fetches the revision for one copy, so the other runner could not find
its browser on a clean runner. Bump the root copy so both share one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EQK1bggdH3kndYUDfLfmCG

* fix(frontend): satisfy vue-tsc 3.3.13 and axe-core 4.14 checks

useReducedMotion returned its writable computed typed as read-only, which
vue-tsc now rejects at the v-model in Settings/UserInterface.

axe-core 4.14 runs label-content-name-mismatch by default. The RBtn story
label now includes its visible text. GameCard and LiveSessionCard are
composite cards named by their title/action, so the rule is off for their
stories rather than folding every badge and button into the name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sam Dornan <sam@dornan.family>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-26 08:00:25 -04:00
renovate[bot]
3bb255e468 chore(deps): update backend dependencies (#5347)
* chore(deps): update backend dependencies

* fix(backend): update type ignores for mypy 2.4 and starlette 1.9

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-26 07:53:33 -04:00
Georges-Antoine Assi
a7c9a2b060 fix(feeds): require authentication on the Tinfoil feed (#5344)
The Tinfoil feed was registered with no required scope, so anonymous
callers could list the Switch catalog with its download URLs. Gate it on
roms.read like every other feed, and leave it open only when
DISABLE_DOWNLOAD_ENDPOINT_AUTH is set.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-26 07:47:32 -04:00
github-actions[bot]
d572214250 chore(trunk): Upgrade trunk (#5360)
* chore(trunk): Upgrade trunk

* Apply suggestion from @greptile-apps[bot]

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-10-26 07:47:12 -04:00
Georges-Antoine Assi
f522d3959b fix(logs): keep password reset links out of the log viewer buffer (#5343)
When SMTP is off or sending fails, the reset link is logged so an admin
can read it from stdout and pass it on. LogStreamHandler copied that
record into the Redis buffer behind GET /api/logs and the log socket,
which any logs.read holder can see, and logs.read is not admin-only.

Records logged with extra=STDOUT_ONLY now skip LogStreamHandler, and the
reset link uses it. The invite flow already logs only the token id.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-26 07:43:53 -04:00