The sigil import-time debug line never printed at the default INFO level,
and the binding's absence already reaches the UI through
SigilService.is_enabled() on /heartbeat.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The engine carried its tuning history in its comments: measurement logs for
PIVOT_B, the weight a facet held before the company split, the shape of the
cold-start feed before the Bayesian average. None of that describes what the
code does now, and it belongs in the history rather than beside the values.
Also folds serving's ROM loader into feed's, which differed only by the
visibility filter applied afterwards.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Backend, wasted work:
- `_score_one` computed `content_similarity` twice per candidate on the
trim path and built `shared_reasons` for every candidate clearing the
score floor, discarding almost all of them. Compute content once and
build reasons only for the edges actually stored.
- `get_feature_rows` outer-joined `RomMetadata`, a view over the wide
`roms` table, defeating the point of reading the narrow facet mirror.
Read the generated columns off the `Rom` join already present.
- Feed cache invalidation ran a keyspace SCAN on every `rom_user` write.
Put graph and per-user version counters in the key so it is one INCR,
matching `invalidate_filter_values_cache`.
Backend, reuse:
- Route the five name comprehensions beside `_expanded_names` through it.
- `_recency_factor` reimplemented `to_utc`.
- `replace_similarity_edges` hand-rolled `itertools.batched`.
- Derive `TASTE_FACETS` from `FACET_WEIGHTS` instead of restating its keys.
Backend, dead code:
- `ScoredNeighbour`, `BuildStats.to_dict`, `delete_all_similarity_edges`,
the unread `difficulty`/`completion`/`backlogged` affinity fields,
`FACET_ORDER` and `RomInfo.rom_id`, and a no-op `column_type` ternary.
Frontend:
- Extract `RecommendationReason` from the two byte-identical copies in
`Home.vue` and `SimilarGamesGrid.vue`, dropping the repeated
`primaryReason` calls and their non-null assertions.
- Cap the caption with `--r-card-art-w` rather than a `158px` literal that
does not track the per-breakpoint card width.
- Key the similar-games fetch on the ROM id: `watchEffect` refetched on
every optimistic mutation of `currentRom`.
- One home for the similar-games limit.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolve conflicts in the v2 Home view and its test: keep both the
recommendations row from this branch and the live multiplayer sessions
row from master.
Master added migrations 0119 through 0121 that forked the Alembic chain
against this branch's 0119 through 0122. Renumber this branch's
migrations to 0122 through 0125 so they chain after 0121_state_disc_file.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D9EiQ8VWDJfzhEViDdj84d
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>
The Tinfoil feed was left behind when `_switch_productid_format` changed
from taking a `re.Match` to taking a `str`, so `/feeds/tinfoil` raised a
TypeError for any Switch rom carrying a product id in its filename but no
titledb id. It went unnoticed because `feeds.py` sits outside the changed
files mypy sees.
That call site was reachable only because "prefer the id the scan read over
the one scraped from the filename" lived in a second helper above the lookup,
leaving each caller to remember it. The resolution now happens inside
`_switch_productid_format`, so the three providers and the feed all get it
without repeating a preamble.
Also:
- Move `SWITCH_PLATFORM_SLUGS` to the sigil adapter so `utils/switch.py`
stops importing the metadata base handler. The cycle that import created
was papered over with a function-local import, and `normalize_identity`
now takes the fact it needs rather than the whole slug set.
- Merge a partial identity update onto the stored identity before
normalizing it. Normalizing rewrites the whole triple, so a client sending
only a title id was getting the derived base id next to its old save
target.
- Add `RomIdentity.from_rom` so the triple has one home on the read side
too, and drop `asdict` from `as_rom_attrs`.
- Hold the `SigilExtractionResult` on `TitleIdEmbedCandidate` instead of
copying two of its fields.
- Drop a guard in `_rom_level_identity` that could not fire, derive once in
`normalize_identity`, and return only the parse from `_rebuild_rom_files`,
which already owns `fs_rom["fs_name"]`.
- Read the parsed config in the heartbeat rather than forcing a YAML
re-parse per request, and make `SigilService.is_enabled` a classmethod
like every other one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The optional binding used to no-op in silence: an absent sigil was
indistinguishable from a file with no title id. `SigilService.is_enabled`
plus `FILESYSTEM.TITLE_ID_EXTRACTION_ENABLED` on the heartbeat put the
feature on the same footing as every other optional capability, and give
a client of `PUT /roms/{id}/identity` a way to ask whether the server
reads binaries at all.
The extracted id also reaches the layer that already matches on Switch
product ids. Until now that layer could only scrape one out of the
filename, which made `embed_switch_title_ids` the de facto transport:
users had to let RomM rewrite their filenames for matching to improve.
`switch_product_id` prefers the id read from the binary, so extraction
helps everyone with the binding and the rename stays cosmetic.
MobyGames' `get_rom` takes the rom, like its IGDB and ScreenScraper
siblings, and the product-id lookup now happens only on Switch.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
IGDB's involved_companies carries one entry per involvement rather than
per company, so a studio credited twice in a role was listed twice. On a
14,952-game library that repeated a name in 235 developer lists and 131
publisher lists, which the game-details display renders verbatim.
Master's #3898 landed the publisher/developer split, which this branch had
built its own narrower version of. Drop ours and rebuild on top of theirs:
- Delete 0113_company_role_columns; 0112_publisher_developer_split supersedes
it and derives the roles from all seven providers rather than two.
- Renumber 0110/0111/0112 to 0113/0114/0115 behind master's new head.
- Carry generated_publishers/generated_developers through the view and facet
trigger rebuilds in 0114/0115, which would otherwise drop them.
- Order 0115's view projections as 0114 leaves them: PostgreSQL rejects a
CREATE OR REPLACE VIEW that renames an existing column.
- Take master's IGDB role extraction; extract_tokens already dedupes.
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>
IGDB sends the main franchise both on its own (`franchise`) and inside
`franchises`, and the two were concatenated with `pydash.compact`, which
drops falsy values but not duplicates. The repeat is stored and rendered,
so the details page shows "Happy Feet, Happy Feet".
Measured on a 14,952-game library: 1,080 of 8,788 games carrying a
franchise carried it twice (12.3%).
`pydash.uniq` keeps first-seen order, so `franchises[0]` -- which the
gamelist exporter writes out as <family> -- is unchanged.
Existing libraries keep the repeat until the affected games are rescanned.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`involved_companies` carries one entry per involvement, so a studio
credited twice in the same role landed in `developers` twice. The two
role lists legitimately overlap where a studio both made and shipped a
game; neither may repeat internally.
The equivalent fix for the merged `companies` list and for `franchises`
is upstream in rommapp/romm#4175, since those exist on master.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`companies` flattens every IGDB involvement role into one list, so the studio
that made a game is indistinguishable from the label that shipped it or the
regional distributor that boxed it. Those carry very different weight: a
studio's games genuinely resemble each other, while a publisher spans
everything it ever released.
It is not a marginal distinction. On a 12.7k-game library the second most
common "company" is Tec Toy, Sega's Brazilian distributor, on 768 games, with
Playtronic (Nintendo's) on 350 -- dense enough that IDF does not suppress
them, so matches were coming out as "same distributor". Super Metroid's
cross-franchise suggestions were all justified by Playtronic.
IGDB returns developer/publisher booleans on involved_companies and the
scanner never requested them. Requesting them turns that noise into signal:
Super Metroid now matches on Nintendo R&D1, the studio behind it, Super Mario
Land and Wario Land. Gunstar Heroes returns Alien Soldier and Dynamite Headdy
-- the rest of Treasure's catalogue.
Developer keeps the 0.7 the merged facet already carried, so splitting the
roles redistributes that weight rather than adding new influence, and
publisher drops to 0.25. Sweeping developer from 1.0 to 0.4 barely moved
anything: a tight studio's games also share genre and theme, so the developer
token is not what carries them. The one place it shows is a wide-ranging
studio -- Tony Hawk's Pro Skater now surfaces Neversoft's unrelated titles
where it used to find other skateboarding games through a keyword.
`companies` is untouched for display, and the scorer falls back to it when a
game was matched by a provider that reports no roles, so emitting both never
double-counts one studio. Coverage is 72% developers and 78% publishers,
ahead of every facet already in use.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`average_rating` averages whatever providers happened to rate a game, so a
lone ScreenScraper 10/10 is indistinguishable from a broad consensus. The
cold-start feed ordered by that rating alone.
On a real 12.7k library exactly fourteen games scored a perfect 100, every one
of them a single ScreenScraper score with IGDB unrated. The feed returns
fifteen results, so it was reduced to listing those fourteen alphabetically:
"The Adventures of Batman & Robin", "Adventures of Lolo", "American Bass
Challenge", "Aussie Rules Footy". This is the first thing a new install shows
anyone, since nobody has play history on day one.
Storing IGDB's vote count lets the feed use a Bayesian average, shrinking a
rating toward the library mean in proportion to how little evidence backs it.
The same library now opens with A Link to the Past (1,710 votes), Uncharted 2
(2,216), Ocarina of Time (2,138) and GTA: San Andreas (4,012).
Games with no vote count -- most of them, since only IGDB reports one -- land
at the library mean rather than dropping out, which a test pins.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
IGDB carries three descriptors the scanner never requested: community
keywords ("metroidvania", "shmup"), curated themes (Horror, Survival, Open
world) and player perspectives (Side view, First person). They describe how a
game plays, which genre and franchise cannot: on a 12.7k library only these
three connect Castlevania to Symphony of the Night rather than to the
platformers, Ocarina of Time to Super Mario 64 via Open world, EarthBound to
Chrono Trigger via Fantasy, and GoldenEye to Perfect Dark via Stealth plus
First person.
Coverage beats the existing facets: 66% of matched games carry keywords
against 59% for franchises.
They reach the index the same way every other facet does -- a STORED
generated column, the roms_metadata view, then the trigger-maintained
roms_facets -- so the builder still never reads the wide roms table.
Weight a facet by the values it holds. A game's franchise weight is now split
across however many franchises it carries, so one counts for more than one of
six. Compilations and crossovers previously matched strongly on every
franchise they touched: the SNES Mario compilation pulled in Mario Tennis and
Mario Party ahead of the 2D platformers, and Project X Zone surfaced against
Resident Evil at 0.305 rather than 0.197. Splitting by sqrt rather than the
count keeps three genres worth more in total than one.
Rank keywords last when explaining a match. They are the rarest tokens and so
carry the highest IDF, which had them explaining a Castlevania pairing with
"frankenstein's monster" instead of the shared series.
Existing libraries carry none of this until it is fetched, so
tools/backfill_igdb_tags.py asks IGDB for only the three missing fields in
batches of 500 -- 12,118 games in 36 seconds, against the twelve thousand
requests a rescan would make.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Series titles like "Metal Gear Solid: Portable Ops Plus" and the Pokemon
Ranger games were resolved to the same IGDB (and, downstream, SteamGridDB)
entry as their base game, so distinct ROMs became siblings.
The first `_search_rom` pass filters by game_type, which excludes types like
EXPANSION, so a more specific variant is often absent from its candidates.
Jaro-Winkler scores the base title against the searched variant at ~0.99
(well above the 0.75 threshold), so the base was accepted and returned before
the broader search passes ran.
Only trust a first-pass hit outright when it is an exact match or not a
prefix/superset near-miss of the search term. Otherwise widen the search:
re-query without the game_type filter (the reliable recovery for excluded
types) alongside the existing expanded search, then re-rank across the union
so an exact variant outranks the base near-miss. The base stays in the pool,
so it remains the fallback when no better match exists.
Fixes#3805
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pattern.search() takes pos as its second argument, not flags, so passing
re.IGNORECASE (value 2) started the serial scan at index 2. Filenames
that begin with the serial itself (e.g. SCUS-94163.bin) never matched,
and the PS1/PS2/PSP serial index resolution was silently skipped in the
IGDB, MobyGames, and ScreenScraper handlers.
The regex already matches both cases via [a-zA-Z], and the serial is
uppercased before the Redis lookup (#3621), so the intended flag added
nothing. Drop the stray argument so serials are found anywhere in the
filename, including at the start.
Co-Authored-By: Claude <noreply@anthropic.com>
IGDB catalogues a console and its regional twin as two separate
platforms (SNES/Super Famicom, NES/Famicom). RomM locked each IGDB
search to a single platform id, so a region-exclusive title catalogued
under only the twin — e.g. the Japan-only Super Famicom game
"Rudra no Hihou" (platform 58) scanned from an `snes` folder
(platform 19) — was filtered out before name matching ran and never
matched.
Include a platform's regional twin in the IGDB platform filter so both
are searched. A non-twin platform keeps the exact existing query
(`platforms=[19]`); a twin produces an OR group
(`(platforms=[19] | platforms=[58])`), leaving all other platforms and
recorded cassettes unchanged.
Written primarily by Claude Code.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
IGDB scans dropped games whose filename uses a localized (non-English)
title even when that title exists in IGDB's alternative_names. The
alternative_name wildcard search surfaced the correct game, but
_search_rom() rebuilt its name->game candidate dict using only the
primary English name, so the Jaro-Winkler re-check scored the localized
term below threshold and discarded the match (issue #3435).
Add _index_games_by_searchable_name(), which indexes each game by its
primary name plus alternative_names and game_localizations titles, and
use it for both candidate-building passes in _search_rom(). Primary
names keep precedence (lowest-igdb-id tiebreak); alternative/
localization titles fill in only names not already claimed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add `STANDALONE_EXPANSION` game type to the `with_game_type` filter in
`_search_rom` so games like "Ecco: The Tides of Time" (which IGDB classifies
as a standalone expansion) are included in the first search pass and are not
confused with their parent game ("Ecco The Dolphin")
- Fix the expanded search fallback to fetch and compare ALL unique game IDs
returned by the IGDB search endpoint, instead of only the first result
- Add tests to verify both fixes
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/d6a0c1dd-e541-4d8e-a272-9e5511a2077e
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
Rom.regions can contain raw filename text like "europe" or "EUROPE"
(filename parsing in roms_handler doesn't normalize casing), so the
direct dict lookup missed those tags and the locale silently fell back
to scan.priority.region. Replace the dict access with a helper that
lowercases both sides.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When a ROM filename carries a region tag (e.g. (Europe)), use that
region first when picking artwork and localized titles, falling back to
the configured scan.priority.region. Previously the configured priority
was the only signal, so a US-first config would force US covers onto
European ROMs even when an EU asset was available.
Adds a shared name->provider-shortcode map and threads the rom through
the IGDB and SS lookup APIs so the rom-aware locale/region selection
can run for both providers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove provider-specific locale configuration and use existing scan.priority.region for IGDB regional variants.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add provider-specific locale config with UI dropdowns in Settings
- ScreenScraper: select language for synopsis/metadata
- IGDB: select region for localized names/covers
- Fallback warnings when locale not found
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>