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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.