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>
A `total` aiohttp timeout raises a bare asyncio.TimeoutError rather than
ServerTimeoutError, so the retry branch never fired and a hung storefront
escaped `_request` as an opaque scan error.
aiohttp also defaults HEAD to not following redirects, unlike GET, so a
3xx on the capsule path would silently drop the portrait art for every
ROM.
Reading `name` unguarded on a storesearch item could raise out of
`get_rom`, which is meant to always degrade to no match.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`_request` is typed `-> dict` but handed back whatever `res.json()` decoded.
A throttled storefront answers 200 with a bare `null`, so both callers hit
`AttributeError: 'NoneType' has no attribute 'get'` - swallowed as an
unmatched ROM during a scan, surfaced as a 500 on `PUT /api/roms/{id}` with
a hand-entered app id. Coerce a non-mapping payload to `{}` so it degrades
to "no result" like every other failure path in the class.
The SteamMetadata comment claimed the facet columns read Steam. They don't:
the generated columns coalesce over manual/igdb/moby/ss/launchbox/ra/
flashpoint/gamelist only.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The portrait-capsule HEAD request was the one Steam call living outside
SteamService, with its own session, user-agent and timeout. It moves in as
get_library_capsule_url, following LibretroThumbnailsService.head, so the
handler just picks the capsule or falls back to the header image.
get_app_details grows a filters passthrough, and the heartbeat asks for
"basic" instead of pulling a whole store page to read one success flag.
Guard the facet mirror against a provider that reaches the model but not a
migration's trigger column list: test_every_provider_id_is_mirrored writes
every METADATA_SOURCE_COLUMNS id and asserts each roms_facets twin follows.
Verified against triggers rebuilt without steam_id, where it fails naming
the missing provider.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Remove the roms_facets backfill from 0115: the steam columns are created by
that same revision, so it was a full-table UPDATE writing NULL over NULL at
container start. Migration 0114, which adds provider columns the same way,
has no backfill either.
Collapse the nine hand-written raw_*_metadata blocks in updateRom into a loop
over raw_metadata, so a new provider no longer needs a copy-pasted block.
Reuse the shared disable_metadata_rate_limiters fixture for the Steam adapter
tests instead of a second local one, move STEAM_PLATFORMS up to the constant
block it belongs to, and trim a test docstring that restated the rationale
already sitting next to resolve_steam_rom.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Resolves the additive conflicts against master:
- config, handler registry and the roms endpoint imports keep both the
Steam and the new UPC-lookup entries.
- Renumbers the Steam migration to 0113 (master took 0109) and rebases it
onto 0112_publisher_developer_split.
- Syncs the migration's pre-Steam facet mirror list with 0112, which added
publishers/developers to the roms_facets triggers.
- Groups SteamMetadata's publishers/developers with the shared provider
keys, now that master has made them a shared field.
Trims the comments and docstrings to the repo's one-to-two-line rule,
drops an unreachable `or ""` behind a truthiness guard, and guards the
roms_facets column drop with if_exists to match the add in upgrade().
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Steam covers the PC platforms RomM otherwise has thin metadata for, and
its store payload is provider-grade on its own: title, description,
portrait capsule art, screenshots, genres, developers, publishers,
release date and Metacritic score, with no API key.
Valve documents no storefront API, so this reads the two endpoints that
back the store's own search box and app pages, paced well under the ~200
requests per 5 minutes they tolerate. Every failure path degrades to "no
match" rather than aborting a scan, and the provider is opt-in behind
STEAM_API_ENABLED, matching HowLongToBeat and Flashpoint.
Matching is gated on the platform slug so the three PC platforms are the
only ones that spend a request. The storefront's search index carries
DLC, soundtracks and tools alongside games, so hits are filtered by type
and then confirmed against the app page, which is the only place a demo
or a video is distinguishable from a game. A (steam-12345) filename tag
pins a match by hand when the title is ambiguous.
SteamMetadata reuses the key names the other providers already use for
the values they share, so wiring Steam into the generated facet columns
later is a SQL change with no stored-row reshaping.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>