Commit Graph

73 Commits

Author SHA1 Message Date
Spinnich
bbc1e63d69 fix(retroachievements): don't match ROMs against games with no achievement set
The hash index was built with RA's f=0, so it mapped hashes of games that
exist on RetroAchievements but have no achievements. Those ROMs came out of
a scan with an ra_id set, which lit up every RA signal (achievements tab,
match chip, has_ra filter, smart collections) while answering the only
question those signals are asked: no, there is nothing to earn here.

Measured live against N64 (system 2), 45% of indexed hashes pointed at
set-less games; NES and PlayStation are above 60%.

Switch to f=1 and bump the cache filename, since the freshness check is an
mtime test and installs would otherwise keep the stale index for up to
REFRESH_RETROACHIEVEMENTS_CACHE_DAYS.

Fixes #4343

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 18:49:17 +00:00
Georges-Antoine Assi
eec574b49b fix(metadata): give UniversalPlatformSlug a leaf home
Both CI failures came from one import cycle. RQ could no longer resolve
`endpoints.sockets.scan.scan_platforms`, and the e2e seed script failed the
same way, because `sigil` imports the platform slug enum, importing anything
under `handler.metadata` runs its `__init__`, that reaches `gamelist_handler`
which imports `handler.filesystem`, and `roms_handler` there imports `sigil`
back while it is still half-initialised.

The cycle predates this branch. It stayed hidden because `scan.py` reached
the enum through `utils.switch`, imported late enough that
`handler.filesystem` was already loaded; naming the adapter directly moved
that import to the top of the module and the ordering luck ran out.

So the enum moves to `utils/platform_slugs.py`, which imports nothing but
`enum`. Naming a platform no longer drags in httpx, redis and the titledb
task, and the 29 call sites point at the module that owns it rather than
picking it up from a 1000-line metadata handler that happens to re-export
it. `import adapters.services.sigil` now also works on its own, which it
did not before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 14:28:49 -04:00
Georges-Antoine Assi
d62452b069 refactor: give the publisher/developer derivations one home
Follow-up cleanup on the company metadata split.

- Hasheous returns `involved_companies` keyed by id, not as the list IGDB
  itself returns, so iterating it yielded the dict's string keys and raised
  on `c.get("publisher")`. Read it through the same pydash accessor the
  sibling `companies` line uses, and cover both shapes with a test.
- ss/ra/flashpoint/gamelist bind the publisher and developer lists once and
  build `companies` from them, so the merged list cannot drift from the
  split it is meant to be the union of. Follows launchbox's existing shape.
- The exporters shared one copy of the "prefer the explicit field, fall back
  to the companies ordering" rule; it now lives on `RomMetadata` as
  `primary_developer` / `primary_publisher`.
- Migration 0112 gates its two backfills on a probe. No stored blob carries
  the new keys before a re-scan, so they otherwise scan the whole roms table
  twice, and rewrite every roms_facets row, to write nothing.
- Smart collections no longer claim a `selected_publisher` legacy key that
  never shipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 18:38:02 -04:00
Georges-Antoine Assi
42ebaaec49 feat: split company metadata into publishers and developers
Metadata providers (ScreenScraper, RetroAchievements, LaunchBox,
Flashpoint, gamelist, IGDB) distinguish the publisher from the developer
of a game, but RomM amalgamated both into a single `companies` list at
ingestion, so the distinction was unrecoverable. This adds `publishers`
and `developers` as new, refined fields end to end while keeping
`companies` (the merged union) working exactly as before.

Backend:
- Handlers now emit publishers/developers alongside the unchanged
  companies list; IGDB requests the involved_companies developer/
  publisher flags to split by role.
- Migration 0112 adds generated_publishers/generated_developers columns
  on roms, projects them through the roms_metadata view, mirrors them
  into roms_facets, and adds publisher/developer virtual-collection
  types (triggers/functions rebuilt for MariaDB/MySQL + PostgreSQL).
- Filters, facets, endpoints, smart collections and the gamelist/pegasus
  exporters all carry the new fields; exporters prefer the explicit
  split and fall back to the companies heuristic for un-rescanned ROMs.

Frontend (v2):
- Shared filter store + API service, gallery filter drawer, URL
  persistence, game detail display (Developers/Publishers with a
  Companies fallback), edit dialog, smart-collection criteria, and a
  publisher/developer "group virtual collections by" option.
- Also relabels the confusing "company"->"Developer" group-by option
  to "Company" now that a proper Developer option exists.

Fixes #3518

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-27 14:44:30 -04:00
Georges-Antoine Assi
88a9731a9d fix: map Neo Geo MVS/AES to the RetroAchievements Arcade console
RetroAchievements files Neo Geo cartridge games under Arcade (console 27),
so the neogeomvs and neogeoaes folders resolved to no RA platform, the scan
skipped RAHasher entirely, and no ROM ever matched.

Fixes #4279

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 20:09:04 -04:00
Georges-Antoine Assi
335dcf5710 Merge branch 'master' into fix/supergrafx-retroachievements-platform-id 2026-07-01 21:36:09 -04:00
Georges-Antoine Assi
f0a195fb1c Merge branch 'master' into fix/fds-retroachievements-platform-id 2026-07-01 21:29:17 -04:00
Georges-Antoine Assi
70206b142d cleanup 2026-07-01 19:13:42 -04:00
Spinnich
ef95f91aa0 fix(retroachievements): match SuperGrafx against RetroAchievements
SuperGrafx games never matched against RetroAchievements: the supergrafx
slug had no RA platform ID, so RA hashing was skipped during scans and
matching bailed out early.

RetroAchievements has no separate SuperGrafx console; its games share the
PC Engine/TurboGrafx-16 console, ID 8, same as tg16. Map supergrafx to
that console in both RA tables, mirroring the existing tg16 entries.

Fixes #3651.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 19:52:14 +00:00
Spinnich
6d8d273a81 fix(retroachievements): match Famicom Disk System against RetroAchievements
Famicom Disk System (FDS) games never matched against RetroAchievements:
the fds slug had no RA platform ID, so RA hashing was skipped during scans
and matching bailed out early.

RetroAchievements lists the FDS as its own console, ID 81, separate from
the NES/Famicom console (ID 7). Map fds to that console in both RA tables,
mirroring the existing platform entries.

Fixes #3646.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 17:33:22 +00:00
Spinnich
895337e9d8 fix(retroachievements): match MSX2 against RetroAchievements
MSX2 games never matched against RetroAchievements: the msx2 slug had no
RA platform ID, so RA hashing was skipped during scans and matching
bailed out early.

RetroAchievements has no separate MSX2 console; it groups MSX2 under the
MSX console, ID 29. Map msx2 to that console in both RA tables, mirroring
the existing msx entry.

Fixes #3644.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 16:40:50 +00:00
Georges-Antoine Assi
3db3dd4434 run fmt 2026-05-14 15:41:32 -04:00
copilot-swe-agent[bot]
2c3335e8cf refactor: version RA hash cache and switch to O(1) hash-index format
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/f7097cd9-6bf4-42df-a14d-ff23e423291f

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-05-13 18:01:20 +00:00
copilot-swe-agent[bot]
157f719297 fix: include games without achievements in ra_hashes.json
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/d113d268-38fd-4564-892d-959fd5fddc68

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-05-13 15:17:47 +00:00
Georges-Antoine Assi
f2df03361e fix: cast spread-dict back to RAUserGameProgression to preserve typing
Pylance infers dict[str, Unknown] from the {**old, "highest_award_kind": ...}
spread, which then fails to assign to list[RAUserGameProgression]. Wrap in
typing.cast so the TypedDict type survives the reassignment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:08:18 -04:00
zurdi
56bc8c58dd feat: update RAHasher to version 1.8.3 and add Wii platform support 2026-03-20 13:24:19 +00:00
Georges-Antoine Assi
72e884a83c run fmt 2026-03-12 19:02:24 -04:00
copilot-swe-agent[bot]
da30e4daf1 feat: auto-update game status from RetroAchievements award kind
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-03-11 02:27:38 +00:00
Georges-Antoine Assi
ee8b55e6ef last set of changes 2026-03-07 09:56:17 -05:00
Georges-Antoine Assi
7a5185fe22 complete rest of handler 2025-09-20 19:38:26 -04:00
Georges-Antoine Assi
8c33a95637 remove hartbeat from bh endpoint 2025-09-20 17:57:38 -04:00
Georges-Antoine Assi
3c4113f8a8 Merge branch 'master' into flashpoint-metadata-handler 2025-09-11 21:27:48 -04:00
Georges-Antoine Assi
d7e85ba633 [ROMM-1333] Use metadata tag in filename to match game 2025-09-07 14:12:30 -04:00
Georges-Antoine Assi
d1ecff395b [ROMM-2344] Ignore RA manuals on scan 2025-09-04 23:11:04 -04:00
Michael Manganiello
e4e3928d1b misc: Apply import sorting 2025-09-04 11:17:00 -03:00
Michael Manganiello
d216bad78b misc: Add MetadataHandler's is_enabled method
Convert `MetadataHandler` to an abstract base class and add an
`is_enabled` class method that allows every metadata handler to
independently report whether it is enabled based on its configuration.

This avoids the need for global variables in the config module, allowing
us to change the enabled state of a metadata handler at runtime if
needed.
2025-09-03 22:13:28 -03:00
Georges-Antoine Assi
ef2546ec08 fix base handler filename 2025-08-27 12:40:16 -04:00
Michael Manganiello
9cede7680f feat: Add incremental sync for RetroAchievements progression
This change makes the RetroAchievements progression sync endpoint to
optionally perform an incremental sync (when `incremental` is true),
by only fetching new achievements since the last sync.

This reduces the amount of data fetched and speeds up the sync
process for users who frequently sync their progression. It unblocks the
implementation of automatic periodic syncs in the future.

Frontend behavior:
- When the `Apply` button is clicked in the RetroAchievements settings,
  a full sync is performed (same as before). This is because a change to
  the RA username may have occurred.
- When the `Sync` button is clicked, an incremental sync is performed.
2025-08-27 10:41:51 -03:00
Michael Manganiello
f13d2198db fix: Make RetroAchievements hash matching case-insensitive
Fixes #2182.
2025-08-09 12:48:28 -03:00
Georges-Antoine Assi
1955da78f2 finish all the handlers 2025-07-24 17:05:39 -04:00
Georges-Antoine Assi
8a76528815 finish translating keys 2025-07-24 16:09:49 -04:00
Georges-Antoine Assi
b431aa4d7e manual fixes 2025-07-24 15:43:03 -04:00
Georges-Antoine Assi
39e6fd3579 use ups keys for all lists 2025-07-24 15:30:03 -04:00
Georges-Antoine Assi
973f42cd0b update watasra supervision 2025-07-23 22:20:18 -04:00
Georges-Antoine Assi
595c52bcab Unify singular slugs 2025-07-23 21:52:52 -04:00
Georges-Antoine Assi
51652d5084 make all path stuff async 2025-07-18 10:53:55 -04:00
Georges-Antoine Assi
4838bec0a6 fix rahasher days 2025-07-17 21:55:46 -04:00
Georges-Antoine Assi
0df4eb1985 fix some aggressive usage 2025-07-17 21:20:02 -04:00
Georges-Antoine Assi
0d95735351 finish updating endpoints 2025-07-17 14:44:13 -04:00
Georges-Antoine Assi
d351ad11b0 fix rahandler metadata generation 2025-07-15 16:06:44 -04:00
Georges-Antoine Assi
8049e47d82 change from code review 2025-07-14 11:22:56 -04:00
Georges-Antoine Assi
0224b0a124 fix url of cover art 2025-07-14 10:51:38 -04:00
Georges-Antoine Assi
5d6ae2c842 stop overwriting IDs on scan 2025-07-14 10:31:19 -04:00
Michael Manganiello
8647057e54 misc: Remove _request method from RAHandler
This logic was moved to the RetroAchievements service in #1951.
2025-06-20 12:41:29 -03:00
zurdi
e12114e9ef fix: update badge path handling and improve user progression refresh logic 2025-06-18 10:25:51 +00:00
Georges-Antoine Assi
da74354eed fix ra platform id 2025-06-17 18:50:25 -04:00
Georges-Antoine Assi
d39614e87a Merge pull request #1990 from rommapp/hasheous-matching
Hasheous matching
2025-06-17 16:24:58 -04:00
zurdi
b1aa232ed6 fix: RA metadata file from new platform 2025-06-17 09:40:20 +00:00
Georges-Antoine Assi
66cf16d386 use hasheous as a populator to igdb and ra 2025-06-16 22:29:30 -04:00
Georges-Antoine Assi
f91109da37 pass in ra_hash fully 2025-06-14 22:25:16 -04:00