fix(scan): send Playmatch as a metadata source so the UI switch works

The Playmatch switch shipped its choice as a standalone `playmatch_enabled`
flag, but the backend gates the lookup on `MetadataSource.PLAYMATCH in apis`
and nothing ever read the flag, so UI-initiated scans never queried
Playmatch. Push `playmatch` into `apis` like `hasheous`, and drop the dead
flag from the payload and the scan plumbing.

Fixes #4505

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Georges-Antoine Assi
2026-09-15 17:23:21 -04:00
parent 1946b7ae01
commit fa8001c075
7 changed files with 7 additions and 37 deletions

View File

@@ -549,7 +549,6 @@ async def _identify_rom(
roms_ids: list[int],
metadata_sources: list[str],
launchbox_remote_enabled: bool,
playmatch_enabled: bool,
socket_manager: socketio.AsyncRedisManager,
scan_stats: ScanStats,
scanned_rom_ids: set[int],
@@ -745,7 +744,6 @@ async def _identify_rom(
metadata_sources=metadata_sources,
newly_added=newly_added,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
socket_manager=socket_manager,
)
@@ -794,7 +792,6 @@ async def _scan_selected_roms(
roms_ids: list[int],
metadata_sources: list[str],
launchbox_remote_enabled: bool,
playmatch_enabled: bool,
socket_manager: socketio.AsyncRedisManager,
scan_stats: ScanStats,
scanned_rom_ids: set[int],
@@ -849,7 +846,6 @@ async def _scan_selected_roms(
roms_ids=roms_ids,
metadata_sources=metadata_sources,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
socket_manager=socket_manager,
scan_stats=scan_stats,
scanned_rom_ids=scanned_rom_ids,
@@ -881,7 +877,6 @@ async def _identify_platform(
roms_ids: list[int],
metadata_sources: list[str],
launchbox_remote_enabled: bool,
playmatch_enabled: bool,
socket_manager: socketio.AsyncRedisManager,
scan_stats: ScanStats,
scanned_rom_ids: set[int],
@@ -996,7 +991,6 @@ async def _identify_platform(
roms_ids=roms_ids,
metadata_sources=metadata_sources,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
socket_manager=socket_manager,
scan_stats=scan_stats,
scanned_rom_ids=scanned_rom_ids,
@@ -1108,7 +1102,6 @@ async def scan_platforms(
scan_type: ScanType = ScanType.QUICK,
roms_ids: list[int] | None = None,
launchbox_remote_enabled: bool = True,
playmatch_enabled: bool = True,
platform_fs_slugs: list[str] | None = None,
) -> ScanStats:
"""Scan all the listed platforms and fetch metadata from different sources
@@ -1290,7 +1283,6 @@ async def scan_platforms(
roms_ids=roms_ids,
metadata_sources=metadata_sources,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
socket_manager=socket_manager,
scan_stats=scan_stats,
scanned_rom_ids=scanned_rom_ids,
@@ -1314,7 +1306,6 @@ async def scan_platforms(
roms_ids=roms_ids,
metadata_sources=metadata_sources,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
socket_manager=socket_manager,
scan_stats=scan_stats,
scanned_rom_ids=scanned_rom_ids,
@@ -1474,7 +1465,6 @@ async def scan_handler(sid: str, options: dict[str, Any]):
metadata_sources = options.get("apis", [])
launchbox_remote_enabled = bool(options.get("launchbox_remote_enabled", True))
playmatch_enabled = bool(options.get("playmatch_enabled", True))
if DEV_MODE:
return await scan_platforms(
@@ -1483,7 +1473,6 @@ async def scan_handler(sid: str, options: dict[str, Any]):
scan_type=scan_type,
roms_ids=roms_ids,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
platform_fs_slugs=platform_fs_slugs,
)
@@ -1498,7 +1487,6 @@ async def scan_handler(sid: str, options: dict[str, Any]):
scan_type=scan_type,
roms_ids=roms_ids,
launchbox_remote_enabled=launchbox_remote_enabled,
playmatch_enabled=playmatch_enabled,
platform_fs_slugs=platform_fs_slugs,
job_timeout=SCAN_TIMEOUT, # Timeout (default of 4 hours)
result_ttl=TASK_RESULT_TTL,

View File

@@ -486,7 +486,6 @@ async def scan_rom(
metadata_sources: list[str],
newly_added: bool,
launchbox_remote_enabled: bool = True,
playmatch_enabled: bool = True,
socket_manager: socketio.AsyncRedisManager | None = None,
) -> Rom:
rom_attrs = {

View File

@@ -743,7 +743,6 @@ class TestIdentifyRomTagReparse:
roms_ids=roms_ids,
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -909,7 +908,6 @@ async def run_identify_rom(platform: Platform, fs_rom: FSRom) -> None:
roms_ids=[],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1233,7 +1231,6 @@ class TestIdentifyPlatformMarksMissingBeforeScan:
roms_ids=[],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1320,7 +1317,6 @@ class TestIdentifyPlatformEmitsRestoredRoms:
roms_ids=[],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=socket_manager,
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1434,7 +1430,6 @@ class TestIdentifyPlatformFirmwareReporting:
roms_ids=[],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=socket_manager,
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1681,7 +1676,6 @@ class TestScanSelectedRoms:
roms_ids=[rom.id],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1726,7 +1720,6 @@ class TestScanSelectedRoms:
roms_ids=[rom.id],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1761,7 +1754,6 @@ class TestScanSelectedRoms:
roms_ids=[rom.id],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -1793,7 +1785,6 @@ class TestScanSelectedRoms:
roms_ids=[rom.id],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),
@@ -2592,7 +2583,6 @@ def identify_harness(mocker):
roms_ids=roms_ids,
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=socket_manager or AsyncMock(),
scan_stats=scan_stats or AsyncMock(),
scanned_rom_ids=set(),
@@ -2756,7 +2746,6 @@ class TestIdentifyPlatformLoadsFilesForQuickScan:
roms_ids=[],
metadata_sources=[],
launchbox_remote_enabled=False,
playmatch_enabled=False,
socket_manager=AsyncMock(),
scan_stats=AsyncMock(),
scanned_rom_ids=set(),

View File

@@ -47,7 +47,6 @@ vi.mock("@/v2/composables/useScanProviders", async () => {
buildScanPayload: () => ({
apis: sources.value.map((s) => s.value),
launchbox_remote_enabled: false,
playmatch_enabled: false,
}),
persistSelection,
}),
@@ -133,7 +132,6 @@ describe("RefreshMetadataDialog", () => {
type: "quick",
apis: [],
launchbox_remote_enabled: false,
playmatch_enabled: false,
},
]);
expect(persistSelection).toHaveBeenCalled();

View File

@@ -126,12 +126,11 @@ describe("useScanProviders Playmatch gate", () => {
});
describe("useScanProviders scan payload", () => {
it("sends the expanded provider list and the playmatch flag", () => {
it("sends the expanded provider list and both hash matchers", () => {
const { buildScanPayload } = useScanProviders();
expect(buildScanPayload()).toEqual({
apis: ["igdb", "ss", "moby", "ra", "hasheous"],
apis: ["igdb", "ss", "moby", "ra", "hasheous", "playmatch"],
launchbox_remote_enabled: true,
playmatch_enabled: true,
});
});
@@ -140,7 +139,7 @@ describe("useScanProviders scan payload", () => {
const { buildScanPayload } = useScanProviders();
const payload = buildScanPayload();
expect(payload.apis).not.toContain("hasheous");
expect(payload.playmatch_enabled).toBe(false);
expect(payload.apis).not.toContain("playmatch");
});
it("persists the explicit picks, leaving All-mode groups empty", async () => {

View File

@@ -4,10 +4,9 @@
// same payload for the same choices.
//
// Hash matchers are proxies, not catalogs: they match files by hash and
// feed IDs into the primary catalogs. Hasheous rides along in `apis`
// (backend gate: `MetadataSource.HASHEOUS in apis`); Playmatch has no enum
// entry and uses the separate `playmatch_enabled` flag (backend gate:
// `playmatch_enabled and IGDB in apis`), hence its IGDB requirement.
// feed IDs into the primary catalogs. Both ride along in `apis` (backend
// gate: `MetadataSource.HASHEOUS in apis`, and `MetadataSource.PLAYMATCH in
// apis` plus a supported catalog, hence Playmatch's IGDB requirement).
//
// A group's RSelect treats an empty model as "All", so an All-mode group
// contributes nothing to `metadataSources`, while the backend reads an
@@ -50,7 +49,6 @@ export interface HashMatcher {
export interface ScanPayload {
apis: string[];
launchbox_remote_enabled: boolean;
playmatch_enabled: boolean;
}
export interface UseScanProviders {
@@ -242,10 +240,10 @@ export function useScanProviders(): UseScanProviders {
function buildScanPayload(): ScanPayload {
const apis = effectiveMetadataSources.value.map((s) => s.value);
if (isOn("hasheous")) apis.push("hasheous");
if (isOn("playmatch")) apis.push("playmatch");
return {
apis,
launchbox_remote_enabled: launchboxRemoteEnabled.value,
playmatch_enabled: isOn("playmatch"),
};
}

View File

@@ -18,5 +18,4 @@ export interface ScanRequest {
roms_ids?: number[];
apis: string[];
launchbox_remote_enabled?: boolean;
playmatch_enabled?: boolean;
}