Commit Graph

11458 Commits

Author SHA1 Message Date
Georges-Antoine Assi
4e845b9fd5 chore(alembic): rechain the locked_fields migration after 0112
Master took 0108 for the primary_region column while this branch was open, so
both revisions claimed 0108 and pointed at 0107, leaving alembic with two heads.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 19:37:38 -04:00
Georges-Antoine Assi
005db06525 Merge remote-tracking branch 'origin/master' into fix/artwork-provenance-update-scan 2026-08-29 19:21:27 -04:00
Georges-Antoine Assi
9588287984 Merge pull request #4305 from rommapp/refactor/rom-ids-scope-assets
refactor(assets): make rom_ids the only ROM scope on saves and states
2026-08-29 17:50:23 -04:00
Georges-Antoine Assi
b75c499d8b refactor(assets): make rom_ids the only ROM scope on saves and states
The saves handler carried two ROM filters that ANDed together, and the states
handler had only the singular one, so the same "which ROMs" question had three
answers across two sibling handlers. Collapse both onto rom_ids: a single-ROM
lookup is just a one-element scope, which is what the three internal callers in
the saves endpoint now pass.

That leaves the routes to fold their own public rom_id param into the scope.
Rather than write the fold twice, narrow_rom_id_scope joins utils/validation
beside RomIdScope, keeping the documented "combined with rom_id" semantics: both
filters still apply together, so the effective scope is their intersection.

GET /api/states gains the rom_ids param GET /api/saves got in #4304, declared
with the same shared RomIdScope, so a client syncing a known set of ROMs can
discover states the same way it discovers saves, under the same cap and the same
422 on a bad scope.

One behaviour shift falls out of the handler's old falsy check: rom_id=0 used to
be ignored and return the whole library, and now scopes to nothing, which is
what RomIdScope's positive-ID rule says a zero means.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 17:38:08 -04:00
Georges-Antoine Assi
c0ab254c59 Merge pull request #4077 from Spinnich/fix/missing-firmware-cleanup
feat(firmware): let missing firmware be found, cleaned up, and kept out of the player
2026-08-29 17:04:23 -04:00
Georges-Antoine Assi
c3241a7236 Merge pull request #4304 from rommapp/feat/scoped-save-discovery
feat(saves): scope save discovery to a set of ROM IDs
2026-08-29 16:48:50 -04:00
Georges-Antoine Assi
bec9846718 refactor(firmware): trim comments and name the platform list
Cut the comment blocks that ran past two lines, and rename
platformItems to affectedPlatforms since it holds only the platforms
that have missing firmware, unlike the all-platforms list of the same
name in MissingGamesSection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 16:46:51 -04:00
Georges-Antoine Assi
cffe65971e refactor(saves): take rom_ids as a repeated query param
Comma-separated ID params in this codebase are a download-route convention
(/roms/download, and the two file_ids params), built by hand for URLs the
browser navigates to. Every JSON API route that takes a list of IDs repeats
the parameter instead, and roms' platform_ids documents that form explicitly.
GET /api/saves is a JSON route, so it should match those.

Declare the scope once as a shared RomIdScope annotation: the cap and the
positive-ID rule become schema constraints that both routes enforce alike and
that now appear in the OpenAPI schema as maxItems and exclusiveMinimum, so
clients can read the limits instead of discovering them from an error. That
drops the hand-rolled parser and the two validation-to-HTTPException
translations; a bad scope is a 422 on both routes.

One semantic change: the query param can no longer express an explicit empty
scope, since an omitted parameter is the only empty form. Negotiate keeps it,
as a JSON body can still send [].

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 16:24:45 -04:00
Georges-Antoine Assi
65819d15b4 refactor(saves): move the rom_ids validators to utils/validation
The scope validator and its cap were sitting in the saves DB handler, which
made two endpoints the first non-test callers to import a behavioral symbol
straight through the handler.database facade, for a helper with no DB content
and that get_saves never calls. They belong beside the repo's other
endpoint-facing validators.

Fold the comma-separated ID parse into a shared parse_comma_separated_ids so
the "comma-separated integers" message the tests assert on has one home, and
call it from the ROM download route that already had it inline. Both scope
validators now raise ValidationError like the rest of the module, which lets
negotiate validate in the endpoint body next to its other request-shape
checks: the two routes reject a bad scope with the same 400 instead of one
returning 400 and the other 422.

Also narrow the sync-record lookup to the newest row per slot (superseded rows
were fetched and discarded), and share one second_rom / second_save fixture
instead of three near-identical builders across the new tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 16:09:51 -04:00
Georges-Antoine Assi
78777e6dff Merge pull request #4301 from rommapp/refactor/v2-player-shell
refactor(v2): extract a shared player shell
2026-08-29 16:07:40 -04:00
Georges-Antoine Assi
36bcb85921 refactor(v2): fold the last player chrome copies into the seams
Follow-up pass over the extraction:

- `usePlayerNav` gives the two back links one home. EmulatorJS's copy read
  `rom.value?.id`, so it pushed undefined params during the seed window the
  hero seeding exists to cover.
- EmulatorJS drops its hand-rolled spinner for `RSpinner` and takes
  `heroRom` for its render guard, so `heroSeed` leaves the composable's
  public surface.
- The shell owns the full-width brand row instead of letting a consumer
  reach across the seam for `grid-column`.
- Ruffle's rom ref is shallow, matching the other simple players.
- `PlayerShell.test.ts` covers the play/quit emits, the missing-platform
  guard and the loading branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:58:21 -04:00
Georges-Antoine Assi
24f1d4b44e fix(platform): make firmware_count mean what rom_count means
firmware_count skipped rows flagged as missing while its sibling
rom_count counted every row, so the two fields answered the same
question differently.

Count every firmware row instead, and filter for usable BIOS in the
InfoPanel that presents the stat. The firmware list ships with the
schema, so the caller already has what it needs to decide.

rom_count keeps counting missing ROMs on purpose: the gallery and nav
gate on rom_count > 0, so excluding them would hide the platforms whose
missing ROMs still need cleaning up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:57:05 -04:00
Georges-Antoine Assi
841a7a2f9f fix(settings): scope a cleanup to every selected platform
The cleanup tasks took a single platform_id while both Missing tabs
offer a multi-select, so picking two platforms ran the unscoped
cleanup over the whole library. The confirmation dialog still named
the selection, so the tab deleted more than it said it would.

Take platform_ids on both cleanup tasks and filter firmware by the
whole list, so what runs matches what the dialog names.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:56:56 -04:00
Georges-Antoine Assi
68168f8b5a refactor(v2): adopt the player shell in the js-dos view
The js-dos player landed on master with its own copy of the pre-game
chrome. It now takes `usePlayerHero` and `PlayerShell` and keeps only the
fullscreen switch, the browser-save note and its stage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:47:51 -04:00
Georges-Antoine Assi
85be36dc0b refactor(v2): extract a shared player shell
EmulatorJS.vue and Ruffle.vue each carry their own copy of the block every v2
player opens with: the synchronous hero seeding, title, platform label and
background-art watch. Ruffle additionally hand-rolls the cover column,
settings card, back buttons and loading spinner that any simple player needs.

Extract two seams:

  * usePlayerHero — the seed/hero/title/platform-label block plus the
    background-art watch, adopted by both players. The caller keeps ownership
    of the `rom` ref because EmulatorJS needs a deep one for the save and
    state lists it mutates.

  * PlayerShell — the cover column, settings card, play and back buttons, the
    full-bleed running stage and the loading state, with `settings`, `stage`
    and `brand` slots. Ruffle keeps only its colour picker, brand strip and
    stage. EmulatorJS deliberately opts out: its hero sits inside a card with
    an alt-art glow and it lays out three panels on its own breakpoints, so it
    takes the composable alone.

Stream.vue is left alone: its label comes from the streaming container, its
background art clears while playing, and it has its own back route.

No intended behaviour change. Ruffle's hand-rolled loading spinner is now
RSpinner, matching the other players.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:44:48 -04:00
Georges-Antoine Assi
e36d7646b2 feat(saves): scope save discovery to a set of ROM IDs
Sync clients that hold a subset of the library had no bounded way to ask
for the saves relevant to the ROMs on the device: `GET /api/saves` filters
one ROM at a time, and negotiation always evaluated the user's whole
slotted save set, offering downloads for ROMs the device cannot play.

Add a `rom_ids` scope to both. `GET /api/saves` takes a comma-separated
list (matching the `/roms/download` convention) and `POST /api/sync/negotiate`
takes a list in the request body, so a client with many ROMs is not bound by
URL length. Negotiation widens the scope with the ROMs the client sent saves
for, so a client save is never misread as an upload because its ROM was
omitted. The scope is read-only: an omitted ROM is outside the request, never
a deletion signal.

Both share one limit and one validation rule in the saves handler, and both
reject a scope that is non-positive or over the cap rather than truncating.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:44:44 -04:00
Georges-Antoine Assi
e32c8c68cd refactor(firmware): reuse shared helpers in the missing firmware code
Swap the hand-rolled platform picker in MissingFirmwareSection for the
shared PlatformSelect, and fold the triplicated firmware builder in the
tests into an add_firmware factory fixture.

Keep Platform out of list_firmware: the relationship is lazy="joined",
so every row also ran Platform's rom_count and fs_size_bytes aggregate
subqueries over roms, for data no caller reads.

In useTaskCompletion, the resolver already identifies the live wait, so
drop the parallel generation counter and the unused cancel export.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 15:42:22 -04:00
Georges-Antoine Assi
c45587fe7c Merge remote-tracking branch 'origin/master' into fix/missing-firmware-cleanup
# Conflicts:
#	frontend/src/locales/pt_BR/settings.json
#	frontend/src/v2/views/Player/EmulatorJS.vue
2026-08-29 15:18:00 -04:00
Georges-Antoine Assi
55065ef893 Merge pull request #4061 from bphenriques/3143-jsdos-backend
feat: playable Win3.x and Win9.x using js-dos
2026-08-29 12:15:35 -04:00
Georges-Antoine Assi
025febc17f fix(nginx): keep cross-origin isolation when a player URL carries a query
$request_uri includes the query string, so the end-anchored player pattern
missed /rom/<id>/jsdos?x=1 and nginx dropped COOP and COEP, leaving the
threaded runtime without SharedArrayBuffer. Accept an optional query instead
of anchoring at the path end.

Matching stays on $request_uri: try_files rewrites $uri to /index.html before
add_header runs, so a $uri map would match no player URL at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:56:40 -04:00
Georges-Antoine Assi
0708216236 refactor(jsdos): trim comments and inline a single-use constant
Review-polish pass: cut the js-dos docstrings and the CDN-base comment back to
the non-obvious fact, drop JSDOS_BUNDLE_EXTENSION now that it has one call site
whose meaning is plain, and remove a redundant Partial<SimpleRom> cast from the
new fixture helper.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:44:18 -04:00
Georges-Antoine Assi
74be063522 fix(jsdos): only offer the player for .jsdos bundles
js-dos boots exactly one format. Its `url` option runs the file through
emulators.bundleConfig(), which requires an archive carrying
`.jsdos/dosbox.conf`; handed an ordinary scanned game it panics with
"Broken bundle, .jsdos/dosbox.conf not found" and the player never starts.

Gate canPlayJsDos on the file extension so Play is offered only for files the
player can actually boot, instead of routing a win3x/win9x ROM to a dead
screen. The platform-level check is unchanged: usePlatformPlayable knows only
a slug, and a win3x platform is still playable in browser given a bundle.

Booting unbundled games would mean supplying `dosboxConf` and `initFs`
ourselves, which needs entrypoint detection and, for Win9x, a system image.
That is a feature in its own right, not a fix.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:34:47 -04:00
Georges-Antoine Assi
416afe0c40 fix(jsdos): only pass fullScreen when it is enabled
js-dos applies the option at construction, and its browserSetFullScreen()
calls exitFullscreen() unguarded on the false branch, which rejects with
"Not in fullscreen mode" when the document was never fullscreen. Passing the
option only when the preference is on keeps the launch free of an unhandled
rejection.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:27:03 -04:00
Georges-Antoine Assi
5593890706 fix(jsdos): fall back to a CDN when the runtime is not served locally
The js-dos runtime is only installed by docker/Dockerfile into the full image.
Slim images ship without it, and the dev container has no emulator assets at
all, so /assets/jsdos/js-dos.js resolved to the SPA fallback: 200 with
index.html, which fails the stylesheet as text/html and rejects the script.
EmulatorJS and Ruffle already fall back to a CDN in exactly this situation;
js-dos was the only player without one, leaving it dead on slim images.

Fall back to jsDelivr pinned to the same 8.4.1 the image bundles. It is the
only source that is both version-pinned and sends
`cross-origin-resource-policy: cross-origin`, so it still loads under the COOP
and COEP headers nginx attaches to the player document; the official CDN sends
no CORP header and has no versioned path. The emulator payloads follow
whichever base served the runtime.

Lift EmulatorJS's script injection and its content-type pre-flight into a
shared module rather than adding a fourth copy. The pre-flight is what makes
the fallback fire at all: a <script> tag "loads" an index.html body happily, so
onerror never runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 11:21:48 -04:00
Georges-Antoine Assi
4142fbc018 refactor: dedupe js-dos emulation checks and player plumbing
usePlatformPlayable is the platform-level twin of useCanPlay, but only the
latter learned about js-dos, so win3x/win9x games offered Play while their
platform tile showed no playable badge and sorted into the unplayable bucket.
Teach resolveEmulator about js-dos and derive `playable`/`isPlayable` from it
instead of hand-maintained OR chains.

Collapse the duplication the new backend introduced: a shared
resolvePlatformSlug in utils, a supportedBy factory for useCanPlay's three
identical computeds, one COOP/COEP nginx pattern per map, and a single
hard-navigation branch in useGameActions that reuses the canPlay useCanPlay
already returns.

In JsDos.vue, share the teardown tail between leavePlayer and onBeforeUnmount,
collapse four derivations of the route rom id into one, start the js-dos
runtime alongside the rom request rather than behind it, and hold the rom in a
shallowRef since the view only reads scalars off it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 10:20:47 -04:00
Georges-Antoine Assi
c38282f989 test: cover the useCanPlay file gate
useCanPlay had no tests of its own, and useGameActions mocks it wholesale,
so nothing exercised the has_file_on_disk gate that keeps a physical or
missing-file game from offering a Play action. Add the missing suite,
including a case per engine so the js-dos route cannot regain the gate.

Also apply trunk fmt to a js-dos case in utils/index.test.ts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:59:27 -04:00
Georges-Antoine Assi
29bad62e58 chore: trim unused js-dos assets from the image
The js-dos release bundle ships a demo index.html that would be served
unauthenticated under /assets/jsdos, plus source maps, Emscripten symbol
tables and type declarations that no runtime code loads.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:57:35 -04:00
Georges-Antoine Assi
eed9549a2a Merge branch 'master' into 3143-jsdos-backend
Resolve conflicts in useCanPlay and its useGameActions tests, where master
added the has_file_on_disk gate to the play checks while this branch added
the js-dos route. Keep both: js-dos also boots from the ROM file, so it gets
the same gate as EmulatorJS and Ruffle.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:33:18 -04:00
Georges-Antoine Assi
4c1a2b5b3b Merge pull request #3988 from rommapp/feat/emulatorjs-multi-disc-playback
feat(player): let multi-disc games boot every disc at once
2026-08-29 09:30:15 -04:00
Georges-Antoine Assi
144e3adda3 fix(download): restore the zip writer for dev-mode multi-file downloads
The dev-mode in-memory ZIP branch of `get_rom_content` never called the
`zipfile._get_compressor` shim, so `zipfile-inflate64`'s one-arg override
raised a `TypeError` inside `_ZipWriteFile.__init__`. That leaves
`ZipFile._writing` stuck `True`, and `__exit__` masks the real error with
"Can't close the ZIP file while there is an open writing handle on it",
returning a 500 for any multi-file ROM.

The shim is now shared with the endpoint, so it drops its underscore.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:24:37 -04:00
Georges-Antoine Assi
c4c17d5eea fix(player): keep the whole-set disc choice out of v1's key
v1's <Player> is loaded with defineAsyncComponent, so it mounts well after
the post-flush watcher that stored the choice. Booting a set with All discs
selected therefore handed the child a null disc, and its mount-time cleanup
removed the key the watcher had just written, so the next launch fell back
to the default disc.

Ordering was the wrong thing to lean on. Give v2 its own key and read v1's
only as a seed, so whatever the deprecated component does to its own key no
longer matters, and write the choice next to rememberCore in onPlay.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:14:06 -04:00
Georges-Antoine Assi
b71b8279d9 refactor(player): let v2 own the disc preference
The disc choice was resolved in v2 but persisted from the frozen v1
Player.vue, through a prop that could not carry a whole-set boot: v2
narrowed ALL_DISCS to null and v1 guessed it back from files.length > 1.

Give playerDisc.ts the storage key and expose resolveRememberedDisc /
rememberDisc, matching the neighbouring coreStorage.ts that the same view
already uses for cores. v2 now writes the preference once the game boots,
after the v1 child has mounted, so its mount-time cleanup cannot clear it.
Player.vue goes back to its master state and the branch touches only v2.

Also cache the disc select items in a computed and trim the comments that
had grown to three copies of the same rationale.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 09:03:09 -04:00
Georges-Antoine Assi
140bd6d02d Merge branch 'master' into feat/emulatorjs-multi-disc-playback 2026-08-29 08:50:54 -04:00
Georges-Antoine Assi
a7b580ade8 Merge pull request #4286 from sdornan/claude/github-issue-4285-164dcd
fix: restore HowLongToBeat lookups and repair endpoint discovery
2026-08-29 08:46:43 -04:00
Georges-Antoine Assi
2a9f7251fd style: trim the HLTB comments down to the non-obvious why
Drop a comment that restated the constant it sat above, and cut the clauses
that defended the approach against the one it replaced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 08:36:38 -04:00
Georges-Antoine Assi
2a7953ed58 refactor: share the HLTB search wire contract with endpoint discovery
The discovery script imported build_search_payload from hltb_handler, which
pulls in handler/metadata/__init__ and so instantiates every metadata handler,
opens Redis and writes a config file at import time. That import side effect is
why the workflow needed a dummy ROMM_BASE_PATH.

The script also hand-forked the rest of the protocol (base headers, the /init
mint, the session headers and the honeypot body merge), so it validated a
candidate route against a copy of what the handler sends rather than against
the real thing.

Move the contract into utils/hltb_search.py, a leaf module both sides import,
and drop ROMM_BASE_PATH from CI.

Pace failed session mints too: _ensure_session retried on every lookup, so a
down or IP-blocking HLTB cost each ROM in a scan its own rate-limited /init
round trip.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 08:31:14 -04:00
Georges-Antoine Assi
eb22ce3ca5 ci: silence the checkov secret false positive on the HLTB workflow
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 08:09:06 -04:00
Georges-Antoine Assi
cf55619ff0 Merge pull request #4292 from rommapp/dependabot/uv/asyncssh-2.23.1
chore(deps): Bump asyncssh from 2.23.0 to 2.23.1
2026-08-28 22:24:42 -04:00
Georges-Antoine Assi
5b824629c9 Merge pull request #3898 from rommapp/feat/publisher-developer-split
feat: split company metadata into publishers and developers
2026-08-27 18:49:58 -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
876dba7ab4 feat: translate the new publisher and developer locale strings
Fill in the publisher/developer keys for every non-English locale, and
retranslate the Korean company labels, which used the developer wording
and would otherwise collide with the new developer labels.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 17:27:25 -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
dependabot[bot]
d8f4641f03 chore(deps): Bump asyncssh from 2.23.0 to 2.23.1
Bumps [asyncssh](https://github.com/ronf/asyncssh) from 2.23.0 to 2.23.1.
- [Changelog](https://github.com/ronf/asyncssh/blob/develop/docs/changes.rst)
- [Commits](https://github.com/ronf/asyncssh/compare/v2.23.0...v2.23.1)

---
updated-dependencies:
- dependency-name: asyncssh
  dependency-version: 2.23.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-27 17:13:23 +00:00
Georges-Antoine Assi
b31727284b Merge pull request #3848 from rommapp/posthog-code/physical-games
feat: Physical games
2026-08-27 11:13:49 -04:00
Georges-Antoine Assi
bc95411239 feat: filter the gallery by physical games
Physical games were addable and visible but not selectable: nothing let a user
ask "what do I own on a shelf?" or exclude shelf entries from a view of what is
actually on disk.

Expose the handler's `physical` filter as a `GET /roms` query param and carry it
through the v2 gallery the way `filterSoundtrack` is carried: a tri-state row in
the filter drawer (all / physical only / file-backed only), the toolbar's active
count, `?filterPhysical=` in the URL so a filtered view stays bookmarkable, and
the smart-collection criteria plus their summary row.

Reuses mdi-cube-outline, already this feature's icon, with cube-off-outline as
the negative. Translated into all 18 locales, taking each one's existing term
for a physical game from rom.json.

Verified against the dev library (74898 roms): physical=1, file-backed=74897,
an exact partition, with the filtered gallery showing only the physical entry in
both themes and the control reachable by keyboard.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 11:01:47 -04:00
Georges-Antoine Assi
6558c4129e fix: gate physical-game creation on platform visibility, roll back partial creates
Two findings from review, both in create_physical_rom.

The platform lookup was unscoped, so an editor holding library-wide roms write
could create a rom on a platform hidden from them and drive the metadata
download, cache invalidation and smart-collection refresh that follow.
404-mask it the way add_firmware already does, reusing the endpoint's own
not-found message so a hidden platform reads as a missing one.

The initial add_rom is committed before enrichment runs, so a failure in
scan_rom or download_rom_resources left a metadata-less row behind. Now that
duplicate names are rejected rather than suffixed, the unique index answers
every retry with a 409 pointing at that row, so the user cannot recover without
finding and deleting it. Roll the row and its resources directory back and
re-raise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 10:45:39 -04:00
Georges-Antoine Assi
c78424b2a8 fix: reject a duplicate physical game instead of suffixing its name
build_physical_fs_name probed for an existing row and appended " (2)", " (3)"
and so on, which silently minted a second entry for a title the platform
already had. Two copies of one physical game on one platform is not a library
anyone owns, and the unique index on (platform_id, fs_name) already says so.

Drop the loop and its per-creation SELECT: the sanitized name is the fs_name,
and a duplicate falls through to the IntegrityError handler the endpoint
already had. Reword its 409 accordingly, since a duplicate is now the ordinary
way to reach it rather than a race. The add-physical-game dialog already
surfaces `detail` in an error snackbar, so it needs no change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 07:32:18 -04:00
Georges-Antoine Assi
88d06b1dad refactor: make UPC_LOOKUP_URL the full endpoint
The handler was joining `/lookup` onto a base URL it used for nothing else, so
the config value could not be pointed at an alternative service whose path
differs. Fold the path into the default and rename the variable to match.

That leaves UPCHandler.__init__ aliasing a module constant and nothing more, so
drop it and read UPC_LOOKUP_URL at its one call site.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 07:32:10 -04:00
Georges-Antoine Assi
a5f37d32e3 refactor: drop file-less roms in the query, not after loading
Every surface that enumerates roms to point at their files was fetching the
whole platform and discarding the file-less ones in Python. Give filter_roms a
`physical` filter to sit alongside `missing`, and pair the two in
HAS_FILE_ON_DISK_FILTERS, the query-side twin of Rom.has_file_on_disk.

- The device feeds lose _servable_roms(); the three get_roms_scalar calls spread
  the filters instead, so the dropped roms no longer get their RomFile rows
  selectin-loaded just to be thrown away.
- Both exporters filter in SQL. Pegasus was collecting and copying assets for
  roms it went on to skip, and the ES-DE guard's `not rom` arm was dead.
- The bulk zip download applies them to its platform/collection selector. A
  physical game contributes no files, so it only inflated the rom count in the
  log line, the generated "N ROMs (crc).zip" filename, and the bulk cache
  namespace. Roms named by explicit id still bypass this.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 21:42:01 -04:00
Sam Dornan
75fcb8582c test: mint and search the same HLTB endpoint in the lazy-mint tests
The lazy-mint tests POSTed to a hard-coded /api/search/site while the handler
still defaulted search_url to /api/find, so the mint and the search addressed
unrelated endpoints and the tests would have passed with the two out of sync.

Handlers under test are now built pointed at one endpoint, requests go to
handler.search_url, and the mint is asserted against f"{search_url}/init" rather
than against search_init_url, which the mint reads and so can never contradict.

Stops naming /api/bleed throughout the file as well, since this branch is what
makes that endpoint dead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 14:44:25 -05:00