Commit Graph

832 Commits

Author SHA1 Message Date
MMagTech
fdd311bdf3 fix(ra): match NAOMI, Atomiswave and Gaelco games again (#5746)
RetroAchievements' Arcade has sets for games Flycast runs (Atomiswave,
NAOMI, NAOMI 2 and NAOMI GD-ROM) and for Gaelco games FinalBurn Neo runs.
Since #5273 those folders have slugs of their own with no RetroAchievements
console, so their games get no hash.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:41:09 -05:00
Georges-Antoine Assi
ece64f4ca4 feat(scan): list the ROMs a ScreenScraper breaker skipped in the scan summary (#5727)
* feat(scan): list the ROMs a ScreenScraper breaker skipped in the scan summary

A ROM whose ScreenScraper lookup was answered by the quota or credentials
breaker is now recorded, and the end-of-scan summary lists those ROMs beside
the rate-limited ones. A ROM whose name lookup still reached ScreenScraper
after a short-circuited hash lookup is not listed.

Closes #4358

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

* fix(ss): list quota-skipped roms by path

Addresses Greptile's review on #5727: same-named roms on different
platforms collapsed into one entry in the skipped list.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:22:56 -05:00
Georges-Antoine Assi
80eca562f7 fix(demozoo): send an API key with every Demozoo request (#5723)
* fix(demozoo): send an API key with every Demozoo request

Demozoo's API has required an API key since 2026-11-01. Add
DEMOZOO_API_KEY, sent as an Authorization: Api-Key header, and enable
Demozoo when it is set, like the other key-based providers. It replaces
DEMOZOO_API_ENABLED, since requests without a key are refused.

Fixes #5698

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

* pr-ready: code-review

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

* pr-ready: prose

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:21:00 -05:00
Georges-Antoine Assi
5cd01267c0 fix(search): keep NSFW SteamGridDB covers from age-restricted users (#5721)
The cover search asked SteamGridDB for every content variant, so a user
under an age limit could browse NSFW artwork through a client. The
server now asks for SFW grids only when the caller has an age rule.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:31:42 -05:00
Stu Anderson
e06e0e4010 chore(docs): better openapi descriptions (#5660)
* docs(api): describe the core endpoints and add a docs test

Give the parameters, operations and response fields of the core routers a
description in the OpenAPI document: roms, platforms, collections, users,
saves, states, screenshots, channels, snapshots, streaming, devices, client
tokens, play sessions, search, auth, music, memory cards, firmware, sync,
config, feeds, notifications and permissions.

Response models read attribute docstrings (`use_attribute_docstrings` on the
shared response `BaseModel`), so a string after a field is its description.
The update-rom form reads its descriptions from `RomUpdateForm`, so they
have one home. The paging parameters gain examples, such as 72 per page.

`tests/endpoints/test_openapi_docs.py` reads `app.openapi()` and fails when a
parameter or operation of a listed router has no description, or when a
schema with some described fields leaves others bare. Add a router to
`DOCUMENTED_ROUTERS` once its parameters and operations are described.

Descriptions only: no parameter, constraint or default changes. The frontend
types need regenerating (`npm run generate`).

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

* docs(api): describe the remaining routers and the roms list parameters

Cover the last routers (tasks, activity, heartbeat, audit events, stats, logs
and netplay) and add the routers to the docs test's allow-list, so every
router is now held to a description on each parameter and operation.

Describe the schemas that test found partly documented: the task status
responses and `TaskInfo` (as `Annotated[..., Field(...)]`, since a TypedDict
takes no attribute docstrings) and the audit page's `max_id`.

Rewrite the `GET /api/roms` parameters that did not say what they do:
`with_char_index`, `with_filter_values`, `with_rom_id_index`, `with_total`,
`with_provider_metadata`, `order_by`, `with_files`, `group_by_meta_id` and
`search_term`, each with an example or the values it accepts.

Replace a franchise name in an existing docstring example with a neutral one.

Descriptions only: no parameter, constraint or default changes.

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

* chore(api): regenerate the frontend types

Run `npm run generate` against the backend so the generated models carry the
descriptions added to the OpenAPI document. Only comments change: no type,
field or signature differs.

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

* docs(api): fix alternative_names and shorten docstrings per review

Address the review feedback:

- Describe `alternative_names` as the hand-set titles when there are any,
  otherwise the titles from IGDB, MobyGames and ScreenScraper, as
  `resolve_alternative_names` returns them. It said every matched provider.
- Check HEAD routes in the docs test. Both existing HEAD routes already pass.
- Keep docstrings to one paragraph, as the repository asks. The test module
  docstring is one sentence and its two rules are short comments. Nineteen
  operation docstrings added in this change drop their second paragraph.

Descriptions and a test only: no parameter, constraint or default changes.

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

* chore(api): regenerate the frontend types

Pick up the corrected `alternative_names` description. Only comments change.

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

* docs(api): correct descriptions that disagree with the code (pr-ready: code-review)

Fix 12 OpenAPI descriptions that contradicted handler behavior (empty
provider metadata, virtual collection types, streaming container lookup,
save device sync, user collections, search terms, file order, firmware
file name, audit max_id, play session offset, save target layouts).
Share the music filter descriptions through Annotated aliases and drop
comments that restated the new docstrings.

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

* refactor(api): share parameter aliases and check every router (pr-ready: simplify)

Move the rom id and sort direction aliases to utils/router.py and reuse
them, add per-router id path aliases in place of repeated inline params,
let LimitOffsetPage inherit the shared BaseModel config, and drop Args
blocks that restated parameter descriptions. The docs test now covers
every /api path instead of an allowlist. The OpenAPI spec is unchanged
apart from description strings.

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

* refactor(api): form model for rom updates, shared schema config and rom id alias

- Take RomUpdateForm as a FastAPI form model instead of 33 Form params
  and a duplicate field dict; only sent keys still count as provided.
- Document TypedDict responses with attribute docstrings through
  @with_config(API_SCHEMA_CONFIG) instead of per-field Annotated wrappers.
- Move request payload models onto the shared BaseModel and use
  attribute docstrings for their descriptions.
- Replace the 32 inline rom id path params with RomIdPath, which now
  carries ge=1 (adds minimum: 1 to the activity and streaming rom ids).

The update rom request body now references a RomUpdateForm schema; the
multipart fields are unchanged.

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

* docs(api): keep only the descriptions that explain something

Drop the field and parameter descriptions that restate the name, the
type, or what the schema already shows (enum and literal values,
defaults, bounds, nullability), along with the wrappers and aliases
that only carried them. Reword four that did not say what the field
is. The docs test now checks operations only, since requiring a
description on every parameter and field is what produced the filler.

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

* docs(api): plainer wording for three sync and rom descriptions

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

* docs(api): rewrite clipped descriptions as full sentences

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

* docs(api): document error statuses in responses instead of docstrings

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

* docs(api): document pairing code exchange errors

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

* docs(api): move error statuses from route docstrings into responses

Covers the routes whose docstrings stated an error in prose or in a
Raises: block, new in this PR or older.

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-20 14:11:13 -05:00
Stu Anderson
220226feba fix(hasheous): map Neo Geo MVS to the Hasheous Neo Geo platform (#5616)
* fix(hasheous): map Neo Geo MVS to the Hasheous Neo Geo platform

Without an entry, get_platform("neogeomvs") returned no Hasheous id and
scans never sent MVS hashes, leaving sets like mslug.zip unidentified.

Fixes #5614

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

* test(hasheous): drop arrange/act/assert comments to match the file

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:53:45 -05:00
Marcello Pichini
9bbfc41a7a fix(export): encode filenames in ROM content URLs (#5596)
* fix(export): encode filenames in ROM content URLs

* refactor(export): share one ROM content URL builder (pr-ready: code-review)

Move the quoted get_rom_content URL into utils.urls.rom_content_url and use it
from both exporters and the feeds. Match the test route to the real
{file_name} converter and drop an unused fixture.

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

* refactor(export): share the ROM file URL builder too (pr-ready: simplify)

Move feeds' romfile download URL into utils.urls next to rom_content_url,
with the same encoding. Resolve the test's URLs against the real app router
and drop the branching that re-checked local paths.

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

* test(urls): cover the ROM and ROM file content URL builders (pr-ready: review-polish)

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

* fix(export): match URL re-exports by ROM id and decode URL paths on import

A URL-mode gamelist or Pegasus export never matched its own earlier entries,
so each re-export appended every game again. Entries whose path is a RomM
content URL are now matched by the ROM id it carries, which also covers
unencoded URLs and other hostnames from older exports. The gamelist importer
decodes a URL path's last segment before matching it to a file name. Both
exports pass visibility=UNRESTRICTED explicitly, since they write the
library's shared metadata file.

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

* style: format romfile_content_url

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

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:17:05 -05:00
Georges-Antoine Assi
e813e4d666 chore(coherence): adopt Coherence with specs, invariants and a PR report (#5584)
* chore(coherence): adopt Coherence with specs, invariants and a PR report

Install @posthog/coherence as a frontend dev dependency and wire its
Claude Code hooks into the committed .claude/settings.json, so every
agent session in the repo gets the vocabulary, specs, journal and checks.
The hooks call the binary under frontend/ through $CLAUDE_PROJECT_DIR.

Declare 23 components and the entrances that carry outside trust, and
six invariants, each refuted with a deliberate break before it counted:

- every /api route requires auth and its scopes, except a named public
  list (new route sweep in tests/endpoints/test_route_guards.py)
- a hidden rom, platform or firmware answers every id route exactly as
  a missing id would (new sweep over every method of every id route)
- the unscoped save, state and screenshot fetches by id are reached only
  from their own routers (chokepoints)
- validate_path never resolves outside its base folder

The PR workflow runs in comment mode: one report comment, failing only
when Coherence itself breaks. Trunk skips Prettier and markdownlint on
*.spec.md and *.practice.md, since Prettier escapes their globs.

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

* test(routes): satisfy mypy in the route guard sweep

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

* chore(coherence): record the worktree test database enactment

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

* fix(roms): answer a hidden rom like a missing one on file routes; tighten route sweeps

Addresses Greptile's review on #5584.

The rom file delete and reading-progress routes answered "File not found"
for a hidden rom but "Rom with id N not found" for a missing one, so a
caller could tell them apart. They now raise the same not-found.

The route sweeps now reach the checks they claim to test: a protected
route with no scopes counts as public (its guard admits anyone), write
requests carry a body and upload name so validation can't answer first,
RomFile-keyed routes get a real file id, error bodies are compared with
the id normalized, and the rom routes are swept with the rom hidden
directly, through its platform, and by the unrated filter.

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

* fix(coherence): tighten route guard sweeps and isolate oracle test databases (code-review)

- Count a route as protected only when its endpoint is the scope-checking
  wrapper with non-empty scopes, not just when it declares the bearer scopes.
- Treat 401 and 403 like 422 as never reaching the visibility check, and
  sweep /api/streaming/states/{rom_id}.
- Run pytest oracles with a per-run ROMM_TEST_DB_TAG unless one is set.
- Use the shared setup-frontend action and ubuntu-24.04 in the workflow.

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

* refactor(tests): simplify route guard sweeps and path tests (simplify)

- Mark scope-guard wrappers with required_scopes so the auth sweep reads a
  public attribute instead of the private closure.
- Derive the entity regex from one segment list, ask each missing id once,
  and run the three hide scenarios through one sweep helper.
- Fold the new validate_path inputs into the existing valid, traversal and
  absolute path tests.

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

* chore(coherence): trim workflow comments (review-polish)

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

* test(filesystem): restore the validate_path property test the paths invariant cites

Filesystem.spec.md names test_validate_path_never_escapes_its_base as the
invariant's evidence, and Coherence selects it by name.

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

* chore(coherence): run hooks from the local binary instead of npx

Each hook calls frontend/node_modules/.bin/coherence directly and exits 0
when it isn't installed, so sessions without frontend deps (fresh
worktrees, backend-only setups, cloud setup still installing) don't report
a hook error on every tool call, and no hook pays npx's startup.

Also commits the journal and run records left by earlier sessions, which
.coherence/.gitignore keeps as durable records.

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

* refactor(tests): share the bearer, user token and hide helpers

Tests built the same Authorization headers and HiddenEntity rows in about
40 local copies, and two modules imported private helpers from other test
files. They now use bearer, user_headers and hide from tests/auth_helpers.py.

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

* refactor(endpoints): one 404 for a missing or hidden rom, platform or firmware

Each route wrote the missing-row 404 and the hidden-row 404 separately and
had to keep them identical by hand. visible_rom_or_404,
visible_platform_or_404 and visible_firmware_or_404 take the lookup result
and raise one answer for both, either the standard not-found or a bespoke
detail. Re-reads after a write keep a plain not-found check, so an edit that
hides the row doesn't turn into a 404 after it succeeded.

The RomFile-keyed routes (/roms/{file_id}/files, .../files/content/{name},
/roms/{file_id}/patch) name their path parameter file_id instead of id, so
the route sweep reads which id a route takes from its path and drops its
hand-kept list. URLs are unchanged.

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

* docs(setup): develop inside WSL on Windows

@posthog/coherence installs only on Linux and macOS, so npm install in
frontend/ fails on native Windows.

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

* chore(coherence): record the whole-repo chokepoint run

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

* chore(types): regenerate API types for the file_id patch route

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 10:53:46 -05:00
Henrique Reis Neves
f549a5d132 chore(platforms): add slugs for Luxor ABC 800 and PlayStation Mobile (#5571)
* feat(platforms): add slugs for Luxor ABC 800 and PlayStation Mobile

No-Intro has DATs for both, but RomM had no slug for either, so a library
folder holding them was never identified.

Add UniversalPlatformSlug.ABC_800 and PLAYSTATION_MOBILE and map them where a
provider lists them: Hasheous (Luxor ABC 800 id 278114, Sony PlayStation
Mobile id 314213) and HowLongToBeat (PlayStation Mobile). ScreenScraper,
LaunchBox, RetroAchievements, TheGamesDB and libretro list neither, MobyGames
documents the ABC 800 under its ABC 80 platform and has no PlayStation
Mobile, and IGDB could not be checked directly, so those stay unmapped.

Closes #5540

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

* test(platforms): drop the ABC 800/ABC 80 inequality mypy rejects

mypy's strict equality flags `UPS.ABC_800 != UPS.ABC_80` as a comparison
between two enum literals that can never be equal. The check above it,
`UPS.ABC_800.value == "abc-800"`, already shows ABC_800 is its own member
and not an alias of ABC_80, whose value is "abc-80".

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 21:34:38 -05:00
Tyler Vigario
3c5bab7a7f fix(hltb): send the search's platform in the form HowLongToBeat filters by (#5569)
* fix(hltb): send the search's platform in the form HowLongToBeat filters by

HowLongToBeat's search ignores a platform sent as a bare name, so every
search covered every platform: "gran turismo" for the PSP came back with
the PlayStation game first, and the retry on a subtitle alone could match
a game on any console. Its site sends the platform as
{"mode": "include", "values": [...]}, which the search does filter by, and
the payload now sends it that way. With no platform name the list is
empty, which searches every platform.

A name outside HowLongToBeat's platform list filters out every game. It
lists PlayStation VR games under PlayStation 4, so that is what a
PlayStation VR ROM searches, and it has no PlayStation Now, so that
platform no longer maps to HowLongToBeat.

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

* fix(hltb): key HowLongToBeat's VIC-20 on the VIC-20, not the Plus/4

The VIC-20 entry was keyed on the Plus/4, which made no difference while
HowLongToBeat ignored the platform. Now that the search filters by it, a
Plus/4 ROM would be searched among VIC-20 games. HowLongToBeat has no
Plus/4, so that platform no longer maps to it.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:07:29 -06:00
Georges-Antoine Assi
0183cae8ad fix(retroachievements): ride out rate limits during the progress sync (#5532)
* fix(retroachievements): ride out rate limits during the progress sync

The progress sync asks RetroAchievements for each changed game's
achievements, one request per game. A single 429 that outlasted the one
2s retry became a 503 that aborted the whole sync and discarded every
game already read, so a large first sync never completed.

- send_with_retries honours Retry-After (capped at 60s) and doubles its
  backoff on each 429; rate limits can get their own attempt budget so
  timeouts are not retried more often.
- RetroAchievements gets five attempts against a 429.
- get_user_progression stops asking for game details once RA refuses
  one, keeps the stored entry for the remaining changed games, and
  returns what it read so it is saved and the next sync resumes.

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

* fix(retroachievements): keep stored progress on full refreshes and read pages first

Addresses Greptile review on #5532:
- a full refresh now passes the stored progression with refresh_all, so
  a refusal keeps the games it could not read instead of dropping them
- every completion page is read before any detail request, so a
  throttled later page fails before details are fetched and discarded
- docstrings trimmed to the comment rules

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

* fix(retroachievements): apply code-review fixes

pr-ready step 2 (code-review xhigh --fix): drop the synced progression
when the RA username changes, keep the award kind current on refused
games, read HTTP-date Retry-After values, and honour an explicit zero
rate_limit_attempts.

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

* refactor(retroachievements): apply simplify cleanups

pr-ready step 3 (simplify): reuse to_utc for HTTP-date Retry-After,
fold the None checks into _retry_after_seconds, drop the result=None
seed and the award-kind compare in get_user_progression, and share the
refusal setup and call() asserts across the new tests.

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

* chore(retroachievements): review-polish comment trim

pr-ready step 4 (review-polish): drop a comment that restated the code.

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

* fix(retroachievements): run the sync as a job and tell rejects from outages

- A non-429 error status or unreadable reply for one game keeps that
  game's stored progress and the sync moves on; only a throttle or an
  outage defers the remaining games.
- The five-attempt 429 budget applies to the progress sync's two
  requests, not every RetroAchievements call.
- A 429 holds the shared RA rate limiter through its wait and halves its
  pace, which steps back up as requests go through.
- Timeouts and 429s each count against their own attempt budget, and
  the 429 backoff doubles per 429.
- /ra/refresh queues the sync as a background job and answers 202; the
  job reports its outcome over the ra:synced socket event, which the
  settings section uses to reload the user or show the failure.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 07:56:45 -05:00
danielcopper
fb6c5e8e14 fix(moby): drop the PICO-8 slug's mapping to MobyGames' PICO VR platform (#5525)
RomM's `pico` slug is PICO-8, but MOBYGAMES_PLATFORM_LIST mapped it to
MobyGames platform 316, the PICO VR headset line. A scanned PICO-8
platform therefore took moby_id 316, and every cart was searched among
PICO VR titles. Without the entry PICO-8 gets no MobyGames platform
rather than a wrong one.

Fixes #5524
2026-11-09 09:05:35 -05:00
danielcopper
3c395e9cf6 fix(platforms): give amiga-cd32 libretro's CD32 name (#5511) 2026-11-09 08:50:33 -05:00
danielcopper
6b73d36043 fix(platforms): file amigacdtv as the CDTV and give it libretro's name (#5513) 2026-11-09 08:39:13 -05:00
danielcopper
29c878abff fix(platforms): use libretro's names for Xbox and drop two it does not have (#5509)
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-09 08:22:57 -05:00
danielcopper
1afaba47e3 fix(platforms): give pc-8800-series libretro's PC-88 name (#5508) 2026-11-09 08:00:00 -05:00
danielcopper
b3673fb1a7 fix(platforms): point Apple II at LaunchBox platform 111 (#5507) 2026-11-09 07:42:49 -05:00
Sam Dornan
183ee3b89f feat(platforms): enrich discovery cards and preserve AVIF animations (#5433)
Fetch original launch years and current platform logos during scans, retain curated platform icons, and show launch year and type on responsive discovery cards. Preserve animated AVIF frames during thumbnail and WebP conversion.

Closes rommapp/romm#5432

Authored with Codex assistance, including implementation and tests.
2026-11-01 19:23:51 -06:00
Sam Dornan
1642a323c0 fix(sort): strip only configured articles, and keep custom sort keys as typed (#5429) 2026-10-31 19:17:00 -05:00
Sam Dornan
c5c6ef3119 fix(ra): count earned achievements that share a badge separately (#5423)
* fix(ra): count earned achievements that share a badge separately

Earned achievements were stored and matched by badge name, which several
achievements in one set can share. Those collapsed into one entry, so the
game header undercounted (71/75 on a mastered set) and earning one of them
marked them all as earned.

Each earned entry now also carries the achievement's own ra_id, and the
game details view matches on it. Progressions stored before this are read
again on the next sync, and until then entries without an ra_id still
match by badge.

Fixes #5385

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

* test(ra): give the legacy-entry loop its own variable for mypy

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

* feat(ra): mark the badge-name id of earned achievements deprecated

Several achievements can share a badge, so ra_id is the field to match
on. The OpenAPI schema now flags id as deprecated and points to ra_id.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:04:38 -05:00
Georges-Antoine Assi
d15cd9e7a1 fix: keep summary line breaks and strip provider HTML (#5413)
* fix(ui): keep line breaks in the game summary

Normalize CRLF and bare CR to LF and render the summary with
white-space: pre-line so multi-line summaries keep their structure.

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

* fix(metadata): turn HTML in provider summaries into plain text

Add utils.html_text.html_to_text, a parser-based helper that drops known
HTML tags, maps paragraphs, line breaks and list items to newlines, and
unescapes entities. Unknown tags such as "<Start>" stay as literal text.
Moby, ScreenScraper, Steam, Flashpoint and LaunchBox summaries go through it.

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

* fix(metadata): separate table cells and keep bullets on their text

Addresses Greptile review on #5413: adjacent td/th cells now get a space
between them, and a list item wrapping its text in a paragraph keeps the
bullet on the same line.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 10:49:17 -04:00
yi111
209e791eb9 fix(ui/ux): make age rating and player count badges clickable (#5237)
* feat(ui/ux): make age rating and player count badges clickable

Issue #4805 (item 1): on the game page's default tab the age rating and
player count were rendered as static badges, even though both are already
supported gallery search filters.

Each badge now pivots into the global search scoped to that value, the
same pattern InfoGrid already uses for genres/developers/publishers, so
the pivot is a real `a[href]` and middle-click/open-in-new-tab keep
working.

- AgeRatingBadges carries the stored `metadatum.age_ratings` entry on
  the badge so the link matches the JSON_ARRAY filter, not the
  reconstructed "CATEGORY: RATING" display label.
- PlayerCountBadge pivots on the provider's free-form player-count
  string, which is what the SCALAR_IN `player_counts` filter matches.

* fix(age-ratings): focusable tooltips, typed fixtures, real provider coverage

* fix(age-ratings): pr-ready code-review fixes

Give each repeated rating its own category badge with a unique key, pass
the untrimmed player count so the pivot matches the stored value, drop the
custom focus rings in favour of the global one, and test both links
against the real searchLocation.

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

* refactor(age-ratings): pr-ready simplify pass

Build each badge label once, group provider ratings without copying the
queue on every insert, and share the mount helper across the tests.

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

* chore(player-count): pr-ready review-polish comment trim

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

* chore(age-ratings): pr-ready humanizer pass

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

* fix(metadata): trim ScreenScraper and gamelist player counts

The player_counts filter is an exact match, so a padded value listed as its
own option and missed the player-count badge's search link.

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

* fix(game-details): match badge hover to the info grid chips

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

---------

Co-authored-by: Yi-111-a <847203299+qQ1AJb@gmail.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:30:12 -04:00
Georges-Antoine Assi
b35eb4d07c fix(scan): clean up unreferenced rescan media, split scan_rom and move its parts into handler/scan (#5408)
* fix(scan): delete screenshots and media a rescan leaves unreferenced

A complete rescan keeps the stored artwork, so two kinds of file stayed on
disk with nothing pointing at them:

- screenshots indexed past a shorter new list, since files are named by
  position and only the indexes in range were rewritten
- media of a type removed from the preferences, since providers record no
  path for it and stale media was compared over the preferred types only

get_rom_screenshots now deletes the indexes past the new list, and
remove_stale_media compares every media type.

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

* refactor(scan): split scan_rom's merge into named steps

scan_rom held seeding the row, following Demozoo links, splicing scene
summaries, resetting rematched sources, the scene lock, rehash cleanup,
priority merges for fields, tags and artwork, and the SteamGridDB pass in one
body. Each step is now its own helper, the SteamGridDB lookup a _RomLookups
method, and the providers' answers a dict keyed by source instead of fourteen
locals. The Pouet and CSDb link follows share one helper. Behaviour is
unchanged.

McCabe complexity of scan_rom goes from 68 to 13, and the function from 664
to 215 lines.

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

* fix(scan): trim remove_stale_media's docstring per Greptile review

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

* refactor(scan): move the scan vocabulary, lookups and merge into handler/scan

scan_handler.py held the scan types and metadata sources, the per-source
lookups, the merge of their answers and the orchestration in one 2,000-line
module. It now builds on a handler/scan package:

- sources.py: ScanType, MetadataSource, the tag constants, RESCAN_RULES,
  should_consult, stored_match_id and the priority ordering
- lookups.py: RomLookups, the LaunchBox and Steam resolvers and
  get_main_platform_igdb_id
- merge.py: the pure steps that merge the sources' answers into a rom's
  columns

scan_handler.py keeps scan_platform, scan_rom, the asset scans and the media
downloads. Importers point at the module that now defines each name, and the
helpers that crossed a module boundary lost their leading underscore.
clear_rehash_misses takes the attempted sources instead of the lookups, so
merge does not depend on lookups. Behaviour is unchanged.

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

* fix(ci): import ScanType from handler.scan.sources in the e2e seed script

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

* fix(scan): harden leftover screenshot cleanup (pr-ready: code-review)

List the screenshots folder once, use isdecimal() for the index test, and
log rather than raise when a leftover can't be removed. Point three
comments at handler/scan instead of scan_handler.

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

* refactor(scan): tidy the merge helpers and patch paths (pr-ready: simplify)

- fetch_sgdb_rom refetches by stored_id and builds the SGDB name list
  itself, so the name sources stay private to lookups.
- follow_demozoo_link checks the source is enabled; scan_rom loops over
  Pouët and CSDb.
- order_merge_sources holds the one ordering pass, and
  build_metadata_handlers adds the empty SGDB entry.
- Leftover screenshots go through the quiet-delete helper, renamed
  _discard_file.
- Tests patch rom lookups through handler.scan.lookups.

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

* fix(scan): never leave a recorded media or screenshot path without its file

- remove_stale_media only deletes a file whose owner or source changed
  when that new owner stores the type again in this pass. A file nothing
  records is still deleted.
- Screenshots past a shorter list are pruned by remove_screenshots_past
  once the new paths are saved, in both download_rom_resources and
  update_rom, so a failed cover or manual leaves them in place.
- The release-notes schema diff watches scan_handler.py beside
  scan/sources.py, for ranges that span the move.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 15:23:13 -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
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
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
Georges-Antoine Assi
ec10e5b930 fix(platforms): give platforms missing from IGDB a family (#5187)
* fix(platforms): give platforms missing from IGDB a family

Platform families only came from the IGDB platform list, so platforms
IGDB doesn't list (win9x, win3x, Sega arcade boards, TI computers, ...)
landed in "Other" when grouping the platforms page by family.

Platforms IGDB doesn't list now either share the family and category of
an IGDB sibling (win9x -> Windows), or get an explicit family, which can
override the sibling's (Sega Model 2 -> Sega, Arcade). 108 of the 242
unlisted platforms get a family; the rest are engines, generic groups,
single-member makers or ambiguous.

Fixes #5178

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

* fix(platforms): satisfy mypy when applying a platform family

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

* test(platforms): check every unlisted platform mapping resolves a family

Addresses Greptile review on #5187.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 09:36:33 -04:00
Sam Dornan
377405e514 fix(igdb): harden Twitch auth; test the IGDB client and handler (#5133) 2026-10-05 07:53:56 -04:00
Sam Dornan
7b1028bedd feat: search platforms by slug, abbreviation and alternative names (#5107) 2026-10-04 22:59:52 -04:00
Sam Dornan
6735a318e6 refactor(metadata): share heartbeats, filename id tags and the Moby rom builder (#5134) 2026-10-04 17:01:39 -04:00
Sam Dornan
97c6a29170 refactor(metadata): share provider request retries and error mapping (#5132) 2026-10-04 16:44:54 -04:00
Sam Dornan
b23bc79b46 feat(launchbox): scrape box front, back, spine and 3D box art (#5129) 2026-10-04 16:25:41 -04:00
Sam Dornan
858fd64f7f refactor(metadata): share the indexed filename lookup across IGDB, Moby and SS (#5130) 2026-10-04 16:01:25 -04:00
Sam Dornan
c1c3058499 fix(metadata): four provider fixes; test Hasheous, TGDB, CSDb, gamelist and libretro (#5128) 2026-10-04 15:39:48 -04:00
Sam Dornan
02663721c7 fix(metadata): five provider fixes; test UPC, LaunchBox media, Demozoo, ScreenScraper and HLTB (#5126) 2026-10-04 15:28:09 -04:00
Sam Dornan
b52d4a1c0e fix(metadata): five provider fixes; test RetroAchievements, SteamGridDB, MobyGames, Playmatch and Pouët (#5123) 2026-10-04 14:26:15 -04:00
Georges-Antoine Assi
f8b3173bea feat: searchable alternative titles for ROMs (#5111)
* feat: searchable alternative titles for ROMs

Add an editable "Alternative titles" field to manual metadata, folded
into the search titles alongside provider aliases. IGDB localization
titles now join the ROM's alternative names, and the canonical IGDB
name is kept as one when a regional title is displayed.

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

* fix: list hand-added titles in alternative_names, test the field

Address Greptile review on #5111: the response's alternative_names now
appends the hand-added titles to the first provider's, and the Alternative
titles field gets a component test.

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

* test: type the alternative titles field lookup

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

* fix: code-review pass on alternative titles

Validate title lists from client-written metadata in one helper, list
hand-added titles first so the search text cap never drops them, and
let the titles combobox keep commas inside a title.

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

* refactor: simplify pass on alternative titles

Dedupe IGDB titles once in build_igdb_rom, inline the manual title
source, and reword the combobox comma comment.

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

* docs: review-polish pass on alternative titles

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

* docs: humanizer pass on alternative titles

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

* fix: hand-set alternative titles override, providers join

A non-empty manual list replaces every provider's titles, in the list
and in search; otherwise every provider's titles are joined. IGDB and
Hasheous store every title they know, the canonical name and regional
localizations included, and the ROM's displayed name is left out only
when listing them.

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

* fix: validate manual metadata on ROM update

A malformed raw_manual_metadata is rejected with a 422 instead of being
stored and failing every later response for that ROM.

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

* fix: list each alternative title once however it is spaced

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-04 13:12:40 -04:00
Sam Dornan
9e4b080403 fix(metadata): one UTC helper for release dates, a lint rule against local-time parsing, and Flashpoint tests (#5114) 2026-10-04 11:47:54 -04:00
Claude
1e6dd1a2ac perf: keep task code out of the cron scheduler and idle RQ workers
The registry imported every task module to read each task's title,
schedule, queue and timeout, so `rq cron` and every RQ worker parent
loaded the whole app. Task metadata now lives in the registry as
`TaskSpec`s with a dotted path to the implementation, which `get_task`
imports only when a job runs. Cron, the tasks API, enqueueing and the
worker's failure reporting read specs only.

Every log line also imported handler.metadata.base_handler, and with
it every metadata provider, for the redaction regex. The sensitive keys
and their regex now live in logger.formatter.

A test pins that importing the cron config or the worker class loads
neither handler.database, the auth handlers nor fastapi.

Measured RSS at LOGLEVEL=INFO, master -> this branch:
- rq cron: 164 MB -> 72 MB
- idle RQ worker (x3): 133 MB -> 68 MB
- gunicorn web worker: 214 MB -> 206 MB

Each job's work horse now imports its task module itself, 0.1-0.5s
more per job on an x86 host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
2026-10-01 01:32:21 +00:00
Sam Dornan
6941de13db Remove unused code and deduplicate copied helpers (#4975) 2026-09-30 18:51:36 -04:00
Sam Dornan
7a8e9f32f0 Match RetroAchievements by RA hash only, never by Hasheous' game ID (#4962)
* Match RetroAchievements by RA hash only, never by Hasheous' game ID

Hasheous links an RA game to a whole Hasheous game record, so every dump
grouped under it (other revisions, regions, bad dumps) got that RA ID and
its achievements, even when RA doesn't list the dump's hash as compatible.
It also bypassed RomM's own RA hash lookup and reached the priority merge
when RA was deselected or ranked below Hasheous.

Stop reading the RetroAchievements ID from the Hasheous lookup, drop the
unused RA proxy fetch (its response was discarded), and have fetch_ra_rom
always go through RA's hash list. Existing wrong matches clear on a
Complete rescan.

Fixes #4959

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

* pr-ready step 2 (code-review): cover stale and deselected-RA matches, fix stale copy

Parametrize the Banjo-Kazooie regression test over RA selected and
deselected, starting from a stale Hasheous ra_id, so it pins both the
Complete-rescan clear and the priority-merge leak. Move the RA comment
onto the hash-lookup branch, drop a merge get_igdb_game already does,
and stop the Hasheous provider description claiming it supplies
RetroAchievements IDs.

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

* pr-ready step 3 (simplify): reuse scan stubs in the Hasheous RA test

Build the Banjo-Kazooie platform, ROM and top-level file with the shared
add_n64_platform/add_rom/_top_level_rom_file helpers, state the expected
RA lookup as a parameter instead of branching on it, and drop a comment
that described the removed Hasheous path.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 11:28:46 -05:00
Sam Dornan
4cbf43acab perf(gamelist): validate media tag paths once per directory (#4943)
* perf(gamelist): validate media tag paths once per directory

A full-platform gamelist parse ran validate_path on every media tag,
about a dozen lstat calls each, which added up to tens of seconds per
platform on NFS/SMB mounts.

FSHandler.cached_path_validator returns a validate_path equivalent that
runs the lexical checks per call but hits the disk once per distinct
parent directory. The leaf needs no syscall: validate_path accepts a
symlinked leaf, and a plain one resolves inside its checked directory.
The gamelist parse builds one per pass and threads it to the media tag
and directory-entry checks.

On a 1,500-entry gamelist with six media tags per entry, lstat calls
drop from 108,140 to 200.

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

* test(gamelist): pin one validate_path call per media folder

Condense cached_path_validator's docstring to one sentence, and assert
the exact per-folder call counts in the gamelist parse test, with the
media index stubbed so only the parse's own validation is counted.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 10:15:14 -05:00
Sam Dornan
7c8778cc77 perf(scan): read only the selected ROMs' gamelist entries (#4940)
* perf(scan): read only the selected ROMs' gamelist entries

A scan of hand-picked ROMs warmed the gamelist cache by parsing the
platform's whole gamelist.xml. Every media tag of every entry goes
through validate_path, which stats each path component, so a 1,500
entry gamelist costs ~160k lstat calls. On a network mount that stalled
a one-ROM rescan for ~45 seconds before hashing started.

populate_cache now takes the file names to limit the parse to, and the
cache records that scope so a lookup outside it (a ROM renamed mid-scan,
or an overlapping library scan) still parses the full file.

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

* perf(scan): widen a limited gamelist cache instead of reparsing it all

A selected ROM renamed mid-scan (Switch title-ID embedding) is looked up
under a name outside the cache's scope, which fell back to a full parse
and brought the stall back.

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

* perf(scan): widen a limited gamelist cache by the missing names only

Each widening re-resolved every name already cached, so a batch of
Switch ROMs renamed mid-scan cost quadratic media resolution. Only the
names the cache lacks are read now, merged into the cached entries.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 09:22:55 -05:00
Sam Dornan
d344662eac Keep ScreenScraper disc art for every disc of a multi-disc game (#4885)
* Keep ScreenScraper disc art for every disc of a multi-disc game

ScreenScraper tags each disc's support-2D art with a "support" number,
but the extractor kept only the first support-2D it met, so discs 2 and
up were never downloaded or shown.

The first disc still fills physical_url/physical_path, which the cover
art, disc-spin animation and exporters read. Every later disc goes to a
new ss_metadata.physical_extra_discs list, is downloaded next to it as
physical/physical_disc<N>.png, and gets its own entry on the v2 Artwork
subtab.

Existing ROMs pick up the extra discs on their next metadata refresh.

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

* Type the extra-disc test metadata so mypy can index it

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

* Label the first disc's art on multi-disc games

ss_metadata now records which disc physical_url shows, so the Artwork
subtab can label it "Physical media (disc N)" alongside the later discs.
It stays plain "Physical media" for single-disc games, gamelist art, or
when no later disc's art is on disk.

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

* pr-ready step 2 (code-review): harden disc numbers and rematch cleanup

- Read ScreenScraper's disc number with safe_int and clamp it to 1, so
  a zero, negative or non-string "support" value counts as the first disc.
- Remove the physical folder on an ss_id change when only later discs
  had art, so a rematch doesn't keep the old game's disc images.
- Collapse store_metadata_media's two result lists into one target list.

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

* pr-ready step 3 (simplify): one home for the media a provider dict records

- Add FSResourcesHandler.recorded_media, which lists every recorded file
  including a <type>_extra_discs list, so store_metadata_media and the
  update_rom cleanup share one rule and neither special-cases physical.
- Skip stripping a disc's URL once a better region already supplied it.
- Share the ScreenScraper disc tests' patch setup in an _extract helper
  and spell out each test's discs instead of slicing a fixture.

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

* Refetch media whose source changed and keep shared art on rematch

- A scan now deletes each stored media file whose recorded URL changed,
  or a later disc's file the new metadata dropped, before storing, so a
  physical.png saved from another disc's art is fetched again instead of
  showing under a "(disc 1)" label.
- A rematch deletes a later disc's own file instead of the whole physical
  folder, so gamelist art sharing that folder survives.

Addresses the Greptile review on this PR.

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

* Keep a shared media file a higher-priority provider still records

The stale-media check could delete a shared file such as physical.png
because a lower-priority provider's URL for it changed, even though the
file held a higher-priority provider's unchanged art. Each provider now
leaves alone the paths the providers before it still record.

Addresses the second Greptile review on this PR.

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

* Decide stale shared media by which provider owns the path

The previous rule kept any path a higher-priority provider recorded, so
when ScreenScraper newly claimed a physical.png that still held older
gamelist art, neither provider refetched it. A shared path's file now
belongs to the first provider, in priority order, that records it, and
the file is refetched when that owner or its URL differs between the
previous and current metadata. Every provider is compared in one pass,
including ones outside this scan's sources.

Addresses the third Greptile review on this PR.

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

* Name the fields of recorded media instead of using bare tuples

RecordedMedia was a four-item tuple alias that callers unpacked by
position, with a comment spelling out what each slot held. It is now a
NamedTuple with explicit fields and a path property, and the per-path
ownership claim in remove_stale_media gets the same treatment.

Addresses review feedback on this PR.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 13:59:07 -05:00
Claude
42e5b5d119 Remove the no-emdash Trunk linter after a one-time sweep
The linter ran over every Markdown file and Python comment, so full-repo
trunk runs on master kept failing on em-dashes that predate it. Replace
the existing ones once and drop the check. The AGENTS.md rule stays, the
v2 ESLint rule stays, and pr-ready's humanizer pass catches new ones in
prose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyamrxVw5BzEidVzm68LY7
2026-09-28 16:59:56 +00:00
Georges-Antoine Assi
350009855c fix(platforms): stop labeling C128 and Videopac+ G7400 with their sibling's name
ScreenScraper has no dedicated system for the Commodore 128 or the
Videopac+ G7400, so both reuse a sibling's system ID (C64 and G7000).
The mapping copied the sibling's name too, and since IGDB has neither
platform, that ScreenScraper name won the display-name fallback. The
setup wizard and platform picker then listed the c128 slug as
"Commodore 64" and videopac-g7400 as "Videopac G7000".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 10:38:02 -04:00
Georges-Antoine Assi
c868d15827 Merge pull request #4849 from rommapp/fix/win9x-screenscraper-id
fix(ss): map Win9x to ScreenScraper's generic Windows system
2026-09-27 20:47:52 -04:00
Georges-Antoine Assi
837da4c1a0 chore(ss): address Greptile review on the Win9x comment
Reword the mapping comment so the platform is the subject.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 20:12:50 -04:00
Georges-Antoine Assi
f40240d287 fix(ss): map Win9x to ScreenScraper's generic Windows system
ScreenScraper's dedicated "PC Win9X" system (137) holds very few games;
Win9x titles are filed under the generic "PC Windows" system (138), which
acts as a fall-through like MAME does for arcade. Searching 137 meant
Win9x games only matched when scraped by ID.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 14:45:50 -04:00
Sam Dornan
420ccbc38a fix(hasheous): match multi-file roms when one file is unknown (#4846)
* fix(hasheous): match multi-file roms when one file is unknown

Hasheous' /Lookup/ByHash returns 404 for a batch as soon as any one SHA-1
in it is unknown, even when the rest match. A multi-disc CHD set with an
.m3u, a readme or an off-set disc beside it therefore never matched, e.g.
Final Fantasy VII (USA), whose three MAMERedump CHD hashes match on their
own.

- Leave .m3u playlists out of the lookup.
- When a multi-file batch misses, retry each file on its own, largest
  first, and take the first match.
- Read the TheGamesDB id from "TheGamesDb", the spelling Hasheous returns,
  so tgdb_id is no longer always dropped.

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

* fix(hasheous): require per-file matches to agree on one game

The per-file retry took the first file Hasheous knew, so a folder holding
an unknown game next to a known file from another game (a demo disc, a
bonus CD) could take on that other game's ids. Every file is now asked
and the match stands only when all known files name the same game;
conflicting answers match nothing and leave the lookup inconclusive.

A failed per-file request still ends the lookup as inconclusive, since
agreement can't be vouched for without every answer. The largest-first
ordering is gone, as nothing depends on the order any more.

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

* test(hasheous): expect the per-file retry after a missed batch

test_lookup_rom_sends_all_top_level_file_hashes mocks a miss for two
files, which now also asks Hasheous about each file alone.

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

* test(hasheous): build lookup fixtures as real RomFiles

The lookup tests cast MagicMocks to RomFile, which would hand lookup_rom
attributes a real RomFile lacks. They now build RomFiles, so file_extension
and lookup_hashes come from the model itself.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 13:45:09 -05:00