mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 12:52:19 +01:00
feat/windows-wsl-prototype
2696 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
be6ad905b1 |
fix(sync): serve the newest on-disk RetroArch state in a slot (#5193)
* fix(sync): resolve RetroArch paths across emulators sharing a core folder Several RomM emulator ids map to one RetroArch folder (mednafen_psx_hw, beetle_psx_hw and the raw "Beetle PSX HW" all sync through saves/Beetle PSX HW/). The manifest built paths from whichever id an asset carried, but GET parsed the folder back to the canonical id and matched it exactly, so an asset filed under another alias was advertised and then 404'd. Uploads also started a second autosave history beside the alias's. The manifest now lists the newest asset per folder, and GET, PUT and DELETE resolve a path across every alias. Rewrites of an existing unslotted save or state stay under that row's own emulator. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): prefer on-disk alias saves and share newest-per-key grouping pr-ready step 2 (code-review --fix). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): one alias helper and a lineage computed once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): type the alias fixture's asset kind pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): isolate the asset dir per RetroArch sync test The alias tests write different bytes to the same asset paths, and user and ROM ids repeat across xdist worker databases, so parallel runs raced on those files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): serve the newest on-disk RetroArch state in a slot Missing states are dropped before slot grouping for the manifest and reads, so a newer missing state (or alias) no longer hides an older one still on disk. A PUT still matches the missing row and revives it in place. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): fall back past a RetroArch file that vanished unflagged Addresses Greptile's review on #5193: a state whose file was deleted before `missing_from_fs` was set still won its slot. The manifest now rebuilds when hashing flags an asset, and GET flags a missing file and resolves again, so an older asset at the path is listed and served. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
57ebac8efe |
perf(sync): resolve RetroArch core aliases in one query (#5192)
* fix(sync): resolve RetroArch paths across emulators sharing a core folder Several RomM emulator ids map to one RetroArch folder (mednafen_psx_hw, beetle_psx_hw and the raw "Beetle PSX HW" all sync through saves/Beetle PSX HW/). The manifest built paths from whichever id an asset carried, but GET parsed the folder back to the canonical id and matched it exactly, so an asset filed under another alias was advertised and then 404'd. Uploads also started a second autosave history beside the alias's. The manifest now lists the newest asset per folder, and GET, PUT and DELETE resolve a path across every alias. Rewrites of an existing unslotted save or state stay under that row's own emulator. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): prefer on-disk alias saves and share newest-per-key grouping pr-ready step 2 (code-review --fix). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): one alias helper and a lineage computed once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): type the alias fixture's asset kind pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): isolate the asset dir per RetroArch sync test The alias tests write different bytes to the same asset paths, and user and ROM ids repeat across xdist worker databases, so parallel runs raced on those files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * perf(sync): resolve RetroArch core aliases in one query The saves handler now filters on a collection of lineages and looks up a file name across several folders, so the RetroArch alias resolvers issue one query each instead of one per alias. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * perf(sync): filter a RetroArch delete to autosave and unslotted saves in SQL Addresses Greptile's review on #5192: saves_at_path loaded every slot of the matching lineages and dropped the named slots in Python. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
79d1feba6c |
fix(sync): resolve RetroArch paths across emulators sharing a core folder (#5191)
* fix(sync): resolve RetroArch paths across emulators sharing a core folder Several RomM emulator ids map to one RetroArch folder (mednafen_psx_hw, beetle_psx_hw and the raw "Beetle PSX HW" all sync through saves/Beetle PSX HW/). The manifest built paths from whichever id an asset carried, but GET parsed the folder back to the canonical id and matched it exactly, so an asset filed under another alias was advertised and then 404'd. Uploads also started a second autosave history beside the alias's. The manifest now lists the newest asset per folder, and GET, PUT and DELETE resolve a path across every alias. Rewrites of an existing unslotted save or state stay under that row's own emulator. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): prefer on-disk alias saves and share newest-per-key grouping pr-ready step 2 (code-review --fix). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): one alias helper and a lineage computed once pr-ready step 3 (simplify). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): type the alias fixture's asset kind pr-ready step 4 (review-polish). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): isolate the asset dir per RetroArch sync test The alias tests write different bytes to the same asset paths, and user and ROM ids repeat across xdist worker databases, so parallel runs raced on those files. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): delete every aliased state in a slot and prefer one on disk Addresses Greptile review on #5191: a slot's state is picked live-first across aliases, so a newer missing alias no longer hides an older one on disk, and DELETE removes every state in the slot so an older alias can't resurface at the same path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
e232a52656 |
fix(docker): boot when the container runs as a non-default UID (#5189)
* fix(docker): boot when the container runs as a non-default UID Unraid runs the container as 99:100, which can't write to the image's /romm (owned by 1000, mode 755), only to the mounted subfolders. The PSP pending dir at /romm/cache/retroarch_sync was created at import time, so every gunicorn worker failed to boot. - Buffer pending PSP save files under the user's assets folder (assets/users/<user>/retroarch/psp_pending/), beside the other RetroArch Cloud Sync files and outside the client-reachable blob categories. - Move the zip and rom-converto download caches to /tmp/romm/cache, and point nginx's internal /cache/ alias there. - Put gunicorn's control socket in /tmp/gunicorn instead of $HOME/.gunicorn, since HOME is / for that UID. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(docker): honor ROMM_TMP_PATH for caches, explain an unwritable sync folder - The download caches live under $ROMM_TMP_PATH/cache when it's set, so installs with a small Docker disk (Unraid's docker.img) can point them at a share. The entrypoint exports the same path for nginx's /cache/ alias. - With ENABLE_SYNC_FOLDER_WATCHER on and /romm/sync not writable, /init warns and skips the watcher instead of dying on mkdir under errexit. - The compose example lists the /romm/sync mount the sync features need. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): cover reading back and clearing buffered PSP files Addresses Greptile's review on #5189. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): apply code-review findings to PSP pending buffer Remove the emptied psp_pending folder after a merge, define the sync folder path once in init, update the architecture doc's PSP and blob locations, and drop a stale .gitignore entry. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): apply simplify findings to PSP pending cleanup Clear the buffered folder with remove_directory, let the startup check own creating the sync folder, and reword the test fixture docstring. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): cap buffered PSP files and drop them on delete Buffered files for an unresolved save folder now count against the bundle limits, so a folder can't fill the assets share and then fail every merge once it resolves. A DELETE also removes the buffered copy, so a deleted file isn't merged back when the folder resolves. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(docker): check the sync folder for push-pull sync too ENABLE_SYNC_PUSH_PULL keeps SSH keys and device saves under /romm/sync as well, so an unwritable folder now disables it with the watcher and warns at boot instead of failing when the task runs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(docker): strip whitespace from env vars like the backend does The backend strips every variable it reads, while the init script and nginx templates used raw values, so a padded ROMM_TMP_PATH sent nginx's /cache/ alias somewhere the backend never writes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(config): drop the CACHE_BASE_PATH comment Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(docker): say which backend config strips env whitespace Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * revert(docker): drop the entrypoint env whitespace trimming Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): apply pr-ready code-review findings Gate push-pull on its SSH keys path rather than a writable sync folder, accept the same truthy values as the backend, and clear only the merged PSP pending files so another worker's buffered file survives. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor: apply pr-ready simplify findings Share one truthy pattern across init's flag checks (the watcher gates now accept the same values as the backend), disable gunicorn's unused control socket instead of placing it, derive the converts redirect from its own cache path, and factor the unknown PSP folder in tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(docker): apply pr-ready humanizer pass to the sync mount note Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(fs): create handler base folders on first write, skip leftover temp files FSHandler no longer mkdirs its base path when constructed, so a module-level handler rooted at an unmounted or unwritable folder can't take down boot; every write path already creates its parent folders. Blob listings skip .romm_tmp_ files a crashed write left behind, so they are never merged into a PSP bundle or advertised in the sync manifest. The prefix now lives in one TEMP_FILE_PREFIX constant. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
ec10e5b930 |
fix(platforms): give platforms missing from IGDB a family (#5187)
* fix(platforms): give platforms missing from IGDB a family Platform families only came from the IGDB platform list, so platforms IGDB doesn't list (win9x, win3x, Sega arcade boards, TI computers, ...) landed in "Other" when grouping the platforms page by family. Platforms IGDB doesn't list now either share the family and category of an IGDB sibling (win9x -> Windows), or get an explicit family, which can override the sibling's (Sega Model 2 -> Sega, Arcade). 108 of the 242 unlisted platforms get a family; the rest are engines, generic groups, single-member makers or ambiguous. Fixes #5178 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(platforms): satisfy mypy when applying a platform family Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(platforms): check every unlisted platform mapping resolves a family Addresses Greptile review on #5187. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
38dfb208f0 |
fix(streaming): file RetroArch streaming exits as raw saves (#5174)
* fix(streaming): keep foreign saves offered when the import-spec check fails A broker that misses the 5 s import-spec deadline used to read as "imports nothing": the Saves tab vanished and foreign picks were refused with "Save is not a restorable archive". Keep the last good answer in Redis so every worker can fall back on it, cache 404s for five minutes instead of forever, answer a pick that can't be checked with a retryable 503, and refetch the streaming config whenever the Stream page mounts. * fix(streaming): code-review fixes for the import-spec fallback Hold a fallback answer for 10 s so one claim's checks don't each wait out the broker timeout, read the stored answer back through the broker response parser, and warn about a pre-import broker once per worker instead of at every cache expiry. * refactor(streaming): simplify pass on the import-spec fallback Make ImportSpecUnavailable the 503 itself so the save and state pickers no longer convert it by hand, and store the broker's own response body as the last answer instead of rebuilding its shape. * chore(streaming): review-polish on the import-spec fallback Trim the cache comments and the exception docstring, fit the 503 detail within the line limit, and annotate the fresh-worker test dict for mypy. * docs(streaming): humanizer pass on import-spec comments and test docstrings * fix(streaming): tell lasting import-spec failures from passing ones Only timeouts, connection errors, 5xx and 429 fall back to the broker's last answer. A refused request (401, other 4xx) or a reply RomM can't read caches no imports for 30 s and logs an error, so a pick gets a refusal instead of an endless retry. A 404 from a broker that answered before uses that answer, since it is likelier a restart behind a proxy than a downgrade. * fix(streaming): ask for a retry when a picked state can't be checked An older save with the newest state resumes the pick only through an import, so an unanswered import-spec check now returns the 503 instead of launching from the older archive's own state. * fix(streaming): share an in-flight config request App load and the Stream page both fetch the config; two requests could land out of order and leave the older answer in place. (Stability item 5.) * fix(streaming): hold the resume picker until the fresh config lands What the broker imports decides which saves and states are on offer, and the app-load config can predate its answer. The panel shows a spinner until the Stream page's own refetch settles, so a pick can't vanish under the player. (Stability item 4.) * fix(streaming): ask every platform's broker at once on /config The checks ran on the default thread pool (cpu+4 threads), so a broker serving more platforms than that cost one timeout per wave: 10.7 s for 14 platforms on a 6-CPU dev box with a silent broker. The Stream page's picker now waits on /config, so the checks get a pool of their own. * fix(streaming): address Greptile review on the import-spec fallback - Play waits on the fresh config with the resume picker, so it can't send a preselected state the player can't see yet. - The streaming store gets a reset() for logout, and a config reply asked for as the previous account is dropped instead of landing in the next one. - The configFresh write after the refetch checks useIsAlive(). - Trimmed the require_import_spec docstring, the configFresh comment and the /config pool comment to the house length. - Declined: a worker-wide pool for the /config checks. Each request's threads end within the broker timeout, and a shared bounded pool would bring back timeout waves under concurrent loads. * fix(streaming): share /config broker checks across requests Addresses Greptile's re-raised finding on #5174 that each /config request opened its own pool of up to 64 threads, so overlapping page loads during a silent broker multiplied the worker's threads. - The checks run in one worker-wide pool, and a check already in flight for the same container and platform is joined rather than asked again, so concurrent page loads hold no more threads than one does, with no queued-timeout waves. - Callers await the shared run through asyncio.shield, so a request that disconnects doesn't cancel the check others are waiting on. * fix(streaming): file a RetroArch exit's save raw and boot the newest save A RetroArch exit holding one .srm and its states is no longer stored as a .saves.zip: the .srm is filed bare under the core's emulator name with a timestamped name, and each state goes through the state store. Exits with more than one save, a memory card, or unlabelled members still keep the zip. A launch with no pick now boots the newest save, raw or zip. A newer bare .srm goes through the broker's save import when the broker accepts one, and the launch screen defaults to the same save. * fix(streaming): keep the exit zip when a raw save can't be filed safely pr-ready step 2 (code review). - Keep the zip for a core that isn't one plain folder name, a malformed manifest kind, a member that fails to unpack, or a broker that doesn't import saves. - Fall back to the newest archive when the default raw save fails to import. - File exit states oldest first; one unreadable stored state no longer drops the rest. - Rename locals that shadowed the archive module; fix a test return type and a stale comment. * refactor(streaming): simplify the default save comparison pr-ready step 3 (simplify): default_save reuses _newest's ordering, and newestSave takes the first match in the newest-first list. * docs(streaming): trim the raw-save docstrings pr-ready step 4 (review-polish). * fix(streaming): rank saves by their last write and read .ZIP as an archive The web player writes into its existing save row, which only moves updated_at, so ranking by created_at let a stream with no pick boot an older streaming zip over newer web-player progress. The backend default and the launch screen now rank by updated_at, and the picker dates rows by it. Upper-case .ZIP saves are now read as archives on both sides, to match the web player's case-insensitive guard. * feat(states): hash states so duplicate checks skip reading files Adds states.content_hash (migration 0149), filled on every state write: streaming capture, the states upload and update endpoints, the scan and the RetroArch sync push. The streaming duplicate check compares hashes and falls back to reading the file for rows stored before this, which are not backfilled. * fix(streaming): leave an untouched default off the claim and skip missing saves Review items 1 and 2: a default sent as a pick bypassed the zip fallback, and a save marked missing could become the newest. * fix(streaming): code-review fixes for raw exit filing and state hashing pr-ready step 2: keep the zip when a state can't be filed, don't treat a missing state file as a duplicate, fall back to the native archive when a defaulted save fails, hash off the event loop, count filed states as new. * docs(streaming): review-polish, trim the newest-save comment * fix(streaming): bind the background exit pull's states to the swapped disc Decision 1: the exit save job filed states without the session's disc id, so on a multi-disc game its copy could lose the disc binding. The second copy is still dropped by the hash dedupe. * fix(streaming): keep the exit zip when one of its states fails to store Decision 2: a state that threw on store was logged and lost, since the zip holding it was dropped. The zip holds the same .srm, so booting it as the default loses nothing. * fix(sync): keep updated_at when RetroArch sync flags a vanished save or state * fix(streaming): record a legacy state's hash when dedupe reads its bytes * fix(streaming): file a RetroArch exit's auto state raw instead of keeping the zip The auto state now goes into the state history under its own capture stamp, so an exit carrying one files its .srm raw like any other. It is never hydrated, and a resume pick of it is refused, since the broker would file it into its numbered working slot. * fix(streaming): hydrate the newest state still on disk A newer row sync flagged as gone from disk made hydrate push nothing. It now skips such rows the way the save picks already do. * docs(streaming): note the auto-state refusal in resolve_resume_state * fix(streaming): resume a RetroArch auto state like any other state The broker files any pushed state into its working slot, so .state.auto reads as slot 0 like a bare .state. Hydrate and the resume pick now push it instead of skipping or refusing it. * fix(streaming): address Greptile review on raw RetroArch exits - A default .srm the broker refuses at activate now boots the newest native archive instead of failing the launch. Only a default save that rode the import alone falls back; a hand pick still fails. - Exit states the history hasn't seen are filed just under the next state it already holds, so an older slot no longer heads the history over the exit capture teardown filed first. - A raw exit save is skipped only when it matches the newest usable save, so returning to an older save records the play, and a match on a row whose file is gone no longer deletes the new copy. - Stream.test.ts clicks the rendered play button instead of casting the view model to call onPlay. - Trim the raw-exit docstrings to one sentence. * fix(streaming): reserve a free version name for a raw RetroArch exit save Addresses Greptile: the exit's .srm took a second-resolution tag without checking whether another save held that name, so it could overwrite one. Also compares updated_at naively in the mark-missing test, which failed on PostgreSQL's UTC-aware column. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(streaming): file each RetroArch exit state on the disc it was saved on Addresses Greptile: every state in the exit archive took the session's final disc, so a hotkey slot saved before a swap resumed on the wrong one. The session now keeps each swap with its time, and a session that ran more than one disc files each state by its archive timestamp. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
a1466d9233 |
perf(tasks): batch RetroAchievements status writes, make add_rom_user race-safe (#5179)
* perf(tasks): batch RetroAchievements progress sync reads
Add get_roms_by_ra_ids and get_rom_users_by_rom_ids (single index-backed
IN queries, no eager joins) and fold the per-user feed to {ra_id: status}
so each user costs 2 reads plus writes instead of 2 reads per game.
* fix(tasks): skip joined eager-loads in RA sync batch reads
* style(tasks): trim batch-read comments to house style
* fix(tasks): sync every ROM sharing an ra_id, skip empty rom set early
* fix(tasks): raiseload instead of deprecated noload, fix CI failures
* fix(tasks): apply code-review fixes to RA progress sync batching
pr-ready step 2 (code-review xhigh --fix): load only id/ra_id for the
batched ROM read, flatten the sync loop, isolate per-user status sync
failures, log the ROM id, add a real-row test, and move the batched
RomUser getter next to its siblings.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(tasks): simplify RA progress sync batching and its tests
pr-ready step 3 (simplify): select (id, ra_id) columns instead of Rom
entities, drop early returns the getters already short-circuit, and
fold the mocked sync tests into shared helpers and one parametrized
status-transition test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* style(tasks): trim batched RomUser getter comment
pr-ready step 4 (review-polish).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(tasks): tighten unknown-award test docstring
pr-ready step 5 (humanizer).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(tasks): batch RA status writes and make add_rom_user race-safe
set_rom_user_statuses writes one user's statuses in a single
transaction: it inserts missing RomUser rows, then runs one conditional
UPDATE per distinct status. The RETIRED/NEVER_PLAYING guard lives in the
WHERE clause, so a status the user sets mid-sync is never overwritten,
and the per-user cache bumps are queued once.
add_rom_user now inserts inside a savepoint and returns the existing row
when a concurrent writer won the unique (rom_id, user_id) insert, so the
sync no longer needs a catch-all around each user.
A rolled-back savepoint fires after_rollback, which drops every queued
user cache bump, so bumps are queued only after the savepoints finish.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(tasks): skip existing rom_user rows in the batch insert
Addresses Greptile review on #5179. The batch read existing rows before
inserting, so under MariaDB's REPEATABLE READ a row another writer
committed in between raised IntegrityError, and the fallback SELECT (or a
FOR UPDATE read, which MariaDB's snapshot isolation refuses) could not see
it. The insert now skips duplicates itself (ON CONFLICT DO NOTHING /
INSERT IGNORE) with no prior read. The race test commits the competing row
right before the INSERT instead of mocking the lookup. Also trims the
set_rom_user_statuses docstring to one sentence.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(tasks): apply code-review fixes to batched RA status writes
Batch set_rom_user_statuses to stay under PostgreSQL's bind parameter
cap, keep queued cache bumps across a rolled-back savepoint, fold the
single-caller insert helper into add_rom_user, and fix stale comments.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(tasks): apply simplify pass to batched RA status writes
Group by status before batching to drop a loop level, name the
user-owned statuses, split the dialect insert out of the execute call,
and share a status lookup across the write tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(tasks): type the dialect insert for mypy (review-polish)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Shreeniwas <105774423+Shreeniwas1@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
||
|
|
3b8eabdb77 |
feat(sync): sync RetroArch Cloud Sync saves through save slots (#5170)
* feat(sync): sync RetroArch Cloud Sync saves through save slots RetroArch saves were unslotted and overwritten in place, so they never reached the slot-based sync the native clients use, and a bad upload replaced the only copy. A save path now serves the newest slotted version for its ROM, core and extension, from any slot, under RetroArch's own file name. An upload adds a version to that slot (or autosave), skips unchanged bytes, and prunes to MAX_SAVES_PER_SLOT. A delete removes every save the path covers, so none resurfaces on the next sync. Unslotted saves keep serving until the first slotted upload; PSP bundles and states are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): lock RetroArch save uploads and prune per core and extension Addresses Greptile's review on #5170: - Move the RetroArch save upload into sync_handler.store_save_version, leaving the endpoint to validate and map the result to a status. - Hold a Redis lock per (user, rom, core, extension) across the lookup, write, scan and row update, so concurrent same-second uploads never file two rows over one tagged file. A lock timeout answers 503. - Prune only the uploaded path's core and extension in the slot, so another core's or a .rtc's current save is never dropped. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): pr-ready code-review fixes for RetroArch save slots - Scope an extensionless prune to dotless file names, since every name ends in an empty extension. - Treat only NULL slots as unslotted in the manifest, matching the query it replaced and the PSP bundle lookup. - Share one helper for the slot versions a RetroArch path covers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(sync): pr-ready simplify pass for RetroArch save slots - Scope a slot prune by save ids, so the versions a RetroArch path covers are decided once in Python instead of again in SQL. - One newest-per-key helper for states and save versions, and resolve_save_by_slot reuses it. - A canonical_save_file_name helper next to the state one. - The upload builds its tagged name once, checks its length in the handler, and finds a same-second version in the list it already loaded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(sync): pr-ready review-polish pass Drop a comment the canonical_save_file_name helper now says. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): map RetroArch saves onto autosave lineages with unique version names - Only RetroArch's .srm goes through slots, as the autosave versions of its ROM and core. Companion files such as .rtc stay single unslotted saves, so a slot never offers a clock file as the save. - RetroArch reads, writes and deletes in autosave only, leaving named slots alone. - Every slot prune, web uploads included, is scoped to the uploaded save's lineage (emulator and extension), so one core's uploads never drop another's only save. - The manifest lists the newest version under the client's spelling of the game when it still names the ROM. - reserve_version_name moves a taken tag on a second and claims it in Redis, so same-second, concurrent or repeated-hour uploads from either endpoint never share a file. The RetroArch lock and its 503 go. - The manifest reads only the newest version per lineage, through one window query. - An upload is hashed before it is written, so an unchanged re-send writes nothing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): seed the client-spelled save instead of uploading it Uploading TEST_ROM.srm only resolves to the test_rom ROM under MariaDB's case-insensitive collation, so the test 409'd on PostgreSQL. Seeding the version directly still checks that the manifest keeps the client's spelling of the game. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): resolve RetroArch saves to ROMs case-insensitively on PostgreSQL Cloud Sync matches a save's game name to a ROM's fs_name_no_ext. MariaDB's collation ignores case, but PostgreSQL compared exactly, so TEST_ROM.srm never reached the test_rom ROM. PostgreSQL now compares lowercased names, served by a new expression index (0150), and the endpoint test uploads the differently-cased name again. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): address Greptile review on RetroArch save slots - add_save derives the prune lineage from the tagged name it stores, so a dotted upload such as game.rev.srm is counted against its own versions. - Deleting a RetroArch .srm path also removes unslotted saves in that lineage spelled in another case, which the manifest hid behind the autosave head and PostgreSQL's exact match left behind. - reserve_version_name looks up existing versions off the event loop. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
75e8a9efae |
fix(sync): keep RetroArch Cloud Sync from stalling the event loop (#5171)
* fix(sync): keep RetroArch Cloud Sync from stalling the event loop Basic auth ran its bcrypt check (~250ms) on the event loop for every WebDAV request, and the manifest ran its queries there too, so parallel RetroArch requests queued behind each other. Both now run in a thread. Cloud Sync resolves every save and state to a ROM by fs_name_no_ext, which no index led with; 0149 adds one so unmatched uploads fail fast. The upload dialog now offers a core for saves as well as states, so a manually uploaded save lands in the core folder RetroArch reads, and its slot hint says only unslotted saves reach RetroArch. Refs #5158 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(sync): cover manifest queries running off the event loop Addresses Greptile review on #5171: trim the 0149 migration docstring to its summary, annotate the new MockConnection constructor, and add regression tests that build_manifest and list_manifest_paths query from a worker thread. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(auth): mark Basic-auth users active off the event loop pr-ready step 2 (code-review): run the user lookup, password check and set_last_active in one worker-thread hop, and test that SaveDataTab offers save cores and forwards the picked core on upload. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(v2): build SaveDataTab test saves and states from shared fixtures pr-ready step 3 (simplify): replace the hand-cast UserSaveSchema and UserStateSchema stubs with saveFixture/stateFixture plus toUserSave/toUserState. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(sync): drop restating index comment and type the test spy pr-ready step 4 (review-polish): remove the comment that only restated idx_roms_fs_name_no_ext, and type the manifest test's get_saves spy so mypy passes across the backend. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(auth): check the password grant's credentials off the event loop The OAuth password grant ran bcrypt (~250ms) on the event loop, stalling every other request the worker was serving. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(sync): run RetroArch WebDAV database work off the event loop GET, PUT, DELETE and PROPFIND resolved ROMs, looked up and wrote save, state and screenshot rows, and listed whole platforms synchronously inside async handlers; the PSP bundle helpers did the same. Each now runs that work in a worker thread. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(saves): keep another core's same-named save on upload A slot-less upload matched an existing save by file name alone, so uploading game.srm for a second core rewrote the first core's row to the new folder and deleted its file. The lookup now only matches a save made with the requested core. Clients that send no core still match any, so device conflict detection is unchanged, preferring a save filed under no core. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * feat(v2): file a save picked with a core out of the slots RetroArch Cloud Sync only lists unslotted saves, so picking a core in the upload dialog moves an untouched slot from autosave to "No slot", and clearing the core moves it back. A slot the user picked is kept. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * revert(i18n): restore the original upload slot hint Picking a core now files a save out of the slots, so the hint no longer needs to explain RetroArch Cloud Sync. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
77f064561a |
fix(streaming): keep a slow broker from hiding save imports (#5172)
* fix(streaming): keep foreign saves offered when the import-spec check fails A broker that misses the 5 s import-spec deadline used to read as "imports nothing": the Saves tab vanished and foreign picks were refused with "Save is not a restorable archive". Keep the last good answer in Redis so every worker can fall back on it, cache 404s for five minutes instead of forever, answer a pick that can't be checked with a retryable 503, and refetch the streaming config whenever the Stream page mounts. * fix(streaming): code-review fixes for the import-spec fallback Hold a fallback answer for 10 s so one claim's checks don't each wait out the broker timeout, read the stored answer back through the broker response parser, and warn about a pre-import broker once per worker instead of at every cache expiry. * refactor(streaming): simplify pass on the import-spec fallback Make ImportSpecUnavailable the 503 itself so the save and state pickers no longer convert it by hand, and store the broker's own response body as the last answer instead of rebuilding its shape. * chore(streaming): review-polish on the import-spec fallback Trim the cache comments and the exception docstring, fit the 503 detail within the line limit, and annotate the fresh-worker test dict for mypy. * docs(streaming): humanizer pass on import-spec comments and test docstrings * fix(streaming): tell lasting import-spec failures from passing ones Only timeouts, connection errors, 5xx and 429 fall back to the broker's last answer. A refused request (401, other 4xx) or a reply RomM can't read caches no imports for 30 s and logs an error, so a pick gets a refusal instead of an endless retry. A 404 from a broker that answered before uses that answer, since it is likelier a restart behind a proxy than a downgrade. * fix(streaming): ask for a retry when a picked state can't be checked An older save with the newest state resumes the pick only through an import, so an unanswered import-spec check now returns the 503 instead of launching from the older archive's own state. * fix(streaming): share an in-flight config request App load and the Stream page both fetch the config; two requests could land out of order and leave the older answer in place. (Stability item 5.) * fix(streaming): hold the resume picker until the fresh config lands What the broker imports decides which saves and states are on offer, and the app-load config can predate its answer. The panel shows a spinner until the Stream page's own refetch settles, so a pick can't vanish under the player. (Stability item 4.) * fix(streaming): ask every platform's broker at once on /config The checks ran on the default thread pool (cpu+4 threads), so a broker serving more platforms than that cost one timeout per wave: 10.7 s for 14 platforms on a 6-CPU dev box with a silent broker. The Stream page's picker now waits on /config, so the checks get a pool of their own. * fix(streaming): address Greptile review on the import-spec fallback - Play waits on the fresh config with the resume picker, so it can't send a preselected state the player can't see yet. - The streaming store gets a reset() for logout, and a config reply asked for as the previous account is dropped instead of landing in the next one. - The configFresh write after the refetch checks useIsAlive(). - Trimmed the require_import_spec docstring, the configFresh comment and the /config pool comment to the house length. - Declined: a worker-wide pool for the /config checks. Each request's threads end within the broker timeout, and a shared bounded pool would bring back timeout waves under concurrent loads. * fix(streaming): share /config broker checks across requests Addresses Greptile's re-raised finding on #5174 that each /config request opened its own pool of up to 64 threads, so overlapping page loads during a silent broker multiplied the worker's threads. - The checks run in one worker-wide pool, and a check already in flight for the same container and platform is joined rather than asked again, so concurrent page loads hold no more threads than one does, with no queued-timeout waves. - Callers await the shared run through asyncio.shield, so a request that disconnects doesn't cancel the check others are waiting on. |
||
|
|
361e18cc56 |
perf(tasks): batch RetroAchievements progress sync reads (#5144)
* perf(tasks): batch RetroAchievements progress sync reads
Add get_roms_by_ra_ids and get_rom_users_by_rom_ids (single index-backed
IN queries, no eager joins) and fold the per-user feed to {ra_id: status}
so each user costs 2 reads plus writes instead of 2 reads per game.
* fix(tasks): skip joined eager-loads in RA sync batch reads
* style(tasks): trim batch-read comments to house style
* fix(tasks): sync every ROM sharing an ra_id, skip empty rom set early
* fix(tasks): raiseload instead of deprecated noload, fix CI failures
* fix(tasks): apply code-review fixes to RA progress sync batching
pr-ready step 2 (code-review xhigh --fix): load only id/ra_id for the
batched ROM read, flatten the sync loop, isolate per-user status sync
failures, log the ROM id, add a real-row test, and move the batched
RomUser getter next to its siblings.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(tasks): simplify RA progress sync batching and its tests
pr-ready step 3 (simplify): select (id, ra_id) columns instead of Rom
entities, drop early returns the getters already short-circuit, and
fold the mocked sync tests into shared helpers and one parametrized
status-transition test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* style(tasks): trim batched RomUser getter comment
pr-ready step 4 (review-polish).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(tasks): tighten unknown-award test docstring
pr-ready step 5 (humanizer).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
||
|
|
3f13d1e752 |
fix(sync): store RetroArch Cloud Sync blobs under the assets volume (#5155)
The config/, thumbnails/ and system/ blobs lived at /romm/retroarch_sync, which no documented mount covers, so they sat in the image's anonymous /romm volume and were lost on `compose down`/`up`, `-V`, or a docker rm/run upgrade. RetroArch can then treat the missing files as deleted on the server and drop its local copies. They now live at assets/users/<user>/retroarch/<category>/, beside the user's saves and states. The old path never shipped in a release, so no data migration is needed. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
377405e514 | fix(igdb): harden Twitch auth; test the IGDB client and handler (#5133) | ||
|
|
7b1028bedd | feat: search platforms by slug, abbreviation and alternative names (#5107) | ||
|
|
6735a318e6 | refactor(metadata): share heartbeats, filename id tags and the Moby rom builder (#5134) | ||
|
|
97c6a29170 | refactor(metadata): share provider request retries and error mapping (#5132) | ||
|
|
b23bc79b46 | feat(launchbox): scrape box front, back, spine and 3D box art (#5129) | ||
|
|
858fd64f7f | refactor(metadata): share the indexed filename lookup across IGDB, Moby and SS (#5130) | ||
|
|
c1c3058499 | fix(metadata): four provider fixes; test Hasheous, TGDB, CSDb, gamelist and libretro (#5128) | ||
|
|
02663721c7 | fix(metadata): five provider fixes; test UPC, LaunchBox media, Demozoo, ScreenScraper and HLTB (#5126) | ||
|
|
01b92cb2d2 | fix(activity): coalesce activity refreshes and keep one list request in flight (#5125) | ||
|
|
b52d4a1c0e | fix(metadata): five provider fixes; test RetroAchievements, SteamGridDB, MobyGames, Playmatch and Pouët (#5123) | ||
|
|
aa1c038004 | fix(activity): send play activity only to users who can see the ROM (#5121) | ||
|
|
f8b3173bea |
feat: searchable alternative titles for ROMs (#5111)
* feat: searchable alternative titles for ROMs Add an editable "Alternative titles" field to manual metadata, folded into the search titles alongside provider aliases. IGDB localization titles now join the ROM's alternative names, and the canonical IGDB name is kept as one when a regional title is displayed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: list hand-added titles in alternative_names, test the field Address Greptile review on #5111: the response's alternative_names now appends the hand-added titles to the first provider's, and the Alternative titles field gets a component test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test: type the alternative titles field lookup Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: code-review pass on alternative titles Validate title lists from client-written metadata in one helper, list hand-added titles first so the search text cap never drops them, and let the titles combobox keep commas inside a title. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor: simplify pass on alternative titles Dedupe IGDB titles once in build_igdb_rom, inline the manual title source, and reword the combobox comma comment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs: review-polish pass on alternative titles Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs: humanizer pass on alternative titles Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: hand-set alternative titles override, providers join A non-empty manual list replaces every provider's titles, in the list and in search; otherwise every provider's titles are joined. IGDB and Hasheous store every title they know, the canonical name and regional localizations included, and the ROM's displayed name is left out only when listing them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: validate manual metadata on ROM update A malformed raw_manual_metadata is rejected with a 422 instead of being stored and failing every later response for that ROM. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: list each alternative title once however it is spaced Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
9e4b080403 | fix(metadata): one UTC helper for release dates, a lint rule against local-time parsing, and Flashpoint tests (#5114) | ||
|
|
0d9d7a345b | fix(sync): use only the device's own SSH key; test push-pull sync and the folder watcher (#5108) | ||
|
|
93c98c71c0 | chore(deps): upgrade apprise to 2.0 (#5102) | ||
|
|
3204037797 | fix(auth): validate reset passwords and make the last-admin guard atomic, with tests (#5106) | ||
|
|
ef3128e154 | Hide ROMs above a user's or group's age limit (#5081) | ||
|
|
6f2a361481 |
Play RPG Maker 2000/2003 games in the browser with EasyRPG (#5077)
* feat(player): play RPG Maker 2000/2003 games in the browser with EasyRPG Embed the EasyRPG web player for extracted game folders on the rpg-maker platform. The backend generates the player's index.json from the scanned files and merges in the free EasyRPG RTP under every name the official and fan RTPs give its assets, so games that lean on the RTP find them. In-game saves sync with the user's RomM saves through the player's IndexedDB storage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(easyrpg): read the free RTP from a fixed path instead of an env var The full image always keeps the RTP at /var/www/html/assets/easyrpg/rtp, so the path is a constant beside the web path nginx serves it under. The dev container links its copy there at startup. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(easyrpg): code-review fixes for the save sync and asset endpoint - Wait for an in-flight push before the quit push, so the newest save uploads - Keep Play disabled until the fresh rom (and its saves) is fetched - Stop onPlay and the rom fetch from acting after the view unmounts - Leave through usePlayerExit like the other players - Handle a rejected IDB commit when the run itself fails - Track uploads by the browser's file name - Load only visibility and files per asset request, not the full rom - Serve DEV_MODE files as octet-stream, matching nginx - Make the traversal test actually reach the endpoint Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(easyrpg): simplify pass over the player and asset endpoint - Load only file paths per asset request, and look up RTP folders in O(1) - Reuse RomFile.file_name_for_download and usePlayerFullscreen - Share one dev/prod serve helper for game and RTP files - Derive the save sync's game key from the rom - Have the RTP table tool reuse normalize_name - Make save-module internals private and tidy the prepare/read loops Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * feat(easyrpg): flag RPG Maker game folders on the rom schemas Gallery lists carry no files, so the frontend guessed that every multi-file rom on the rpg-maker platform was playable, including RPG Maker XP/VX/MV folders. Rom now has a deferred `is_easyrpg_game` subquery (an RPG_RT.ldb at the folder root), loaded with the other gallery file stats and derived from loaded files on the with_files path, and the frontend reads it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(easyrpg): drop server save sync, keep saves per user in the browser Server sync moves to a follow-up that puts the web players on device sync. Saves now stay in the player's IndexedDB, as js-dos does, with the same note on the start page. The player is launched as `<rom id>-<user id>` so each RomM account sharing a browser profile keeps its own saves; nginx and Vite drop the user id when routing to the backend. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(easyrpg): address Greptile review - Start timing the play session once the player page loads - Use object-form props in the view test's button mock - Keep the RTP table tool's docstring to one sentence Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(easyrpg): keep the RTP table in a fixtures folder Matches handler/metadata/fixtures, where the other bundled data files live. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
1dcda140e2 | fix(rom): keep a disc an .m3u lists in place when promoting to a folder (#5076) | ||
|
|
655976faa9 | feat(soundtrack): play SPC, VGM, VGZ and GYM soundtracks in the browser (#5079) | ||
|
|
b3ad84c296 |
Route ROM visibility through a single RomVisibilityFilter (#5064)
Replace the hidden_platform_ids/hidden_rom_ids parameter pairs with one RomVisibilityFilter that builds the WHERE clauses and checks loaded ROMs, so a new visibility rule (the age-rating cap for #2013) lands in one place. No behaviour change; the visibility-filtered queries send the same SQL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wc3NzFkv97CXavLyZg5kJE |
||
|
|
10865b8663 |
perf(roms): faster smart collection and filter value queries (#5069)
* perf(roms): stop MariaDB rescanning the library for smart collections MariaDB plans the smart collection membership IN (subquery) as a semi-join that rescans every rom per page query. A NO_SEMIJOIN hint keeps it a plain subquery; other dialects don't emit the hint. * perf(roms): parse each distinct filter value list once The filter dropdown query decoded every JSON column of every row. The columns are now read as text, deduplicated, and each distinct list is parsed once. PostgreSQL decodes JSON in the driver, so its lists are merged as returned. * test(roms): cover repeated filter value lists in pr-ready code review * refactor(roms): pr-ready simplify pass * style(roms): pr-ready polish * fix(roms): address Greptile review Fold filter value rows in batches of 5000 instead of materializing the whole result, keeping the parse-each-distinct-list-once dedup across batches, so /api/roms/filters no longer holds one row per ROM in memory (Greptile: filter requests retain every row). The repeated-lists test now runs with a batch size of 2 to cover the cross-batch path. * fix(roms): pr-ready code review fixes - Cast filter JSON columns to text in SQL, so PostgreSQL gets the parse-once saving and a scalar JSONB value no longer crashes json.loads - Stream filter rows with yield_per instead of only partitioning - Name the JSON filter columns instead of hard-coding positions - Add optimizer_hint_on_mysql next to force_index_on_mysql, with tests - Make the repeated-lists test span batches regardless of row order Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(roms): pr-ready simplify pass Collect each filter column's distinct JSON texts and parse them once at the end, and key the JSON filter columns by their RomFiltersDict field so the positional unpack and per-field return go away. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * style(roms): pr-ready polish Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
6fb4e4ea1b |
perf(scan): skip the second write and reload for newly inserted roms (#5070)
* perf(scan): skip the second write and reload for newly inserted roms A new rom is inserted and reloaded by the socket scan just before scan_rom, which then merged and reloaded it again before identification. Only existing roms take that write now. The insert carries the file hashes, size and title id so a scan that stops early still leaves a row rename detection can match. * refactor(scan): address pr-ready code review * chore(scan): pr-ready code-review pass Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(scan): pr-ready simplify pass Fold the new insert tests into TestIdentifyRomReassociation, rename _added_rom to scanning_rom, and name the emit test after both checks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(scan): pr-ready review-polish pass Assert the unset file columns one by one, since mypy rejects comparing the int-typed fs_size_bytes against None in a tuple. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
b1f4ac4888 |
fix(db): keep iterated query results away from the cyclic GC (#5068)
* fix(roms): read filter values with .all() so the GC never frees the cursor Looping over the filter-values Result directly makes SQLAlchemy 2.1 memoize an iterator closure that captures the Result, which puts the CursorResult, its execution context and the mariadb cursor in a reference cycle. The cyclic GC then frees them on whatever thread triggers a collection, and under concurrent gallery requests that segfaults the mariadb connector (1.1.14, Python 3.14) inside the pool checkout. .all() never builds that closure, so nothing is left for the GC. * fix(roms): address pr-ready code review * style(roms): pr-ready polish * fix(db): read every iterated query result with .all() The same reference cycle that segfaulted the filter values also hits smart collection matching on every save, the screenshot binding check, playlist and favourite adds, the recommendation reads and the stopword probe. The IGDB related-games stream keeps yield_per and closes its Result with a with block. A source scan test now fails on any Result iterated directly. * fix(roms): address Greptile review Keep gc.garbage entries that predate the filter-values cursor test: only the objects this test collects are inspected and removed, so a runner that already saves garbage keeps its list intact (Greptile, test_rom_facets.py). * pr-ready: code-review fixes Keep a generator's begin_session open until it finishes, read the streamed IGDB scan by partition, and widen the iterated-Result guard to names, unpacking, yield from and iterating methods. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * pr-ready: simplify Share the app-source AST scan between the two guard tests, fold the generator session's two branches into one nullcontext, and drop the call-site comment the guard test already carries. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(db): flag iterated legacy session.query() results Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
3deb38d93a |
fix(scan): keep an uploaded manual when the rom had no scraped one (#5030)
* fix(scan): keep an uploaded manual when the rom had no scraped one Update, unmatched and hashes scans pin a stored manual url, but a manual uploaded to a rom without a scraped url has nothing to pin. The provider's url then won, differed from the empty stored one, and its download overwrote the upload at the shared manual path. A locked manual, or one on disk with no source url, now keeps its empty url through the scan. Fixes #4101 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(scan): drop a scraped manual's path on unmatch, test the download stage Addresses Greptile's review on #5030: - Unmatch cleared url_manual but kept path_manual, so the next scan read the old scraped manual as an upload and never fetched the new match's one. It now clears path_manual too, unless url_manual is locked (an upload). - Trim the url_manual comment to two lines. - Carry the scan result through download_rom_resources in the upload test and check the manual is never stored over. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
746df798c0 |
fix(scan): refresh screenshots when only their order changes (#5029)
* fix(scan): refresh screenshots when only their order changes Stored screenshots are named by position (0.jpg, 1.jpg, ...), but the re-download check compared the provider's urls as an unordered set, so a reorder was never picked up. Compare the lists directly, in both the scan download step and update_rom. Fixes #4103 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(scan): cover the screenshot reorder in update_rom Address Greptile review on #5029: add an endpoint test for update_rom's own reorder check, and narrow await_args before reading its kwargs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(scan): drop the old screenshot when its replacement fails With overwrite on, a failed download left the previous image at that index. The next scan saw matching urls and a file on disk, so it kept the stale image for good. Remove it instead, so the next scan refetches. Addresses Greptile review on #5029. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
27ddb88967 |
feat(api): Add a REST endpoint to start a library scan (#5014)
* Add a REST endpoint to start a library scan POST /api/tasks/scan queues a scan with the options of the `scan` socket event, so clients authenticating with a bearer or client token can start one without a Socket.IO session. It answers 202 with the queued job, 409 while a library scan is queued or running, and 503 when no worker listens on the scan queue. The enqueue path moves into queue_scan, shared with the socket handler. A short Redis lock now covers the in-flight check and the enqueue, so two requests landing on different web workers cannot both queue a library scan. The socket handler also answers scan:done_ko for an unknown scan type instead of raising. * Default a scan without apis to the enabled sources, lease the request lock A scan request that leaves out `apis` now uses every enabled metadata source, on the REST endpoint and the socket alike, as the scheduled scan and the watcher do. An explicit empty list still means no sources. The web UI always sends `apis`, so its scans are unchanged. redis_lock takes an optional lease_seconds, and the library scan request lock holds its key for 30s while waiters give up after 5s, so a slow holder cannot lose the lock to a waiter that then queues a second scan. * Narrow optional mock call args in the new scan tests * pr-ready step 2 (code-review): narrow the scan lock timeout handling to acquiring the lock Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * pr-ready step 3 (simplify): share the held-lock stub, read the task name off the queued job Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * pr-ready step 4 (review-polish): drop a test comment that recorded old behaviour Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Validate socket scan options with ScanPayload and list workers once per scan request The socket handler now parses its options with the same ScanPayload the REST endpoint uses, so an unknown key, scan type or metadata source answers scan:done_ko instead of falling back to a scan of everything. v1 callers that could send a null platform id now send a real one or none. queue_scan checks for a live scan worker itself, so the socket also refuses a scan no worker would pick up, and it lists the workers once for that check and the in-flight check. The blocking RQ calls run in a thread, off the event loop. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * Rename useScanProviders' ScanPayload to ScanSourceOptions It shared its name with the generated ScanPayload request type while holding only the metadata source options. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
05bf29fe09 |
feat(converto): read per-file title ids with rom-converto during scans (#5031)
* feat(converto): read per-file title ids with rom-converto during scans The title-id half of #5002: rom-converto's info runs fill rom_files.title_id and title_version, sigil fills what rom-converto can't read and keeps owning save targets, and roms in a scan batch share info runs of up to 64 files. A converto_read_at marker lets quick scans backfill files rom-converto has not read yet. converto.scan_metadata (config.yml only) turns it off. The other per-file fields and embedded images stay out until a UI reads them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): name the same-content check that keeps unread title ids Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): queue unread files in one pass over the built rows Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(converto): address Greptile review on #5031 - A file refresh now persists converto_read_at when rom-converto's read confirms a reused row's stored title id, so the file isn't re-read on every refresh. - RomConvertoService.read_infos splits its paths into info runs of at most INFO_BATCH_SIZE, so a rom with many files can't send them all through one run. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(converto): apply code-review fixes - A stored file title id counts as rom-converto's only once rom-converto has read the row, so a stale sigil id can't override a fresh extraction. - Fresh hashes decide whether unread title ids still describe a file, ahead of a size and mtime a copy can preserve. - One rom's failed candidate listing no longer aborts its scan batch. - The info paths file's cleanup can't raise out of read_infos. - _rom_file_order sorts by Path like _TitleIdSource.order. - Restored the in-place reconcile test for _identify_rom. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): apply simplify pass - sync_rom_files reads 'rom-converto read this pass' off converto_read_at instead of an inspected set threaded through ParsedRomFiles, FSRom, the scan socket and the refresh. - One _converto_may_read check serves the scan and the batch candidates. - converto_candidates reuses _list_rom_dir, validates paths off the event loop and is best-effort itself, so the scan socket gathers it plainly. - get_rom_files builds rom-converto paths from the validated rom dir instead of validating each file again. - _rom_level_identity returns early on sigil's extraction. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(converto): apply review-polish pass Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): drop the shared info batch Sharing rom-converto info runs across a scan batch saved about 2 ms per rom (one process start) in exchange for a second directory walk per rebuilt rom, the RomConvertoInfoBatch bookkeeping and the scan socket wiring. Each rom now reads its own files; read_infos still caps a run at INFO_RUN_MAX_FILES. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): name the rom-converto columns inline Drops ROM_FILE_CONVERTO_COLUMNS and ROM_FILE_CONVERTO_KEPT_COLUMNS, so _copy_scanned_columns keeps master's frozenset keep_when_unset. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
6215ab341e | Disable redis-py maintenance notifications probe (#5015) | ||
|
|
e23b049694 | Replace deprecated noload() with raiseload() (#5009) | ||
|
|
3b4e230b7c | Upgrade SQLAlchemy to 2.1 (#5007) | ||
|
|
640a783f3f |
feat(converto): convert the library in place and serve downloads in a requested format (#4999)
* feat(converto): integrate rom-converto for title id extraction and download conversion * fix(docker): ship rom-converto in the production image Only the dev Dockerfile installed the binary, so the integration could never enable on a released image. Fetch the same pinned, checksummed musl build in a dedicated stage and copy it next to RAHasher. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(converto): skip the update check and batch info calls The CLI asks api.github.com for a newer release on every run unless told not to, so pass --no-update-check on each invocation. Inspect a rom's files in one `info --paths-file` run instead of one subprocess per file, and read the inspectable extensions from the capabilities manifest so scans skip files info cannot recognize. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(scan): keep sigil authoritative for title ids rom-converto ran first and overrode the ids sigil read. Sigil now runs first and records its per-file ids; rom-converto only fills files sigil left unset, on new or changed files, in one batch. Restore the base-id selection for sigil extractions on every platform, as on master. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(downloads): make conversion opt-in and bound the cache The download endpoint returned a converted file to every client once a platform had a target, including the browser player and apps that check hashes against RomFile. Conversion now needs ?converted=true. A pre-warmed copy is served whatever its size; the in-request size cap only gates starting a conversion. ROM_CONVERTO_CACHE_MAX_SIZE_GB (default 20, 0 unbounded) caps the cache: conversions and the pre-warm task stop when it is full, and cleanup evicts the least recently served copies. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(types): regenerate frontend types for the converto schema Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(converto): address code-review findings (pr-ready step 2) - Fall back to rom-converto's stored ids only when it ran this pass, in disc order, so a rescan that skipped extraction keeps sigil's save target - Persist per-file title ids that extraction writes onto reused rows - Only authenticated callers may start an in-request conversion; past a 240s deadline serve the original and let the conversion finish into the cache instead of nginx returning 504 - Treat a probe OSError or timeout as a failed probe; kill the subprocess when the caller is cancelled - Give the pre-warm task the scan timeout and report progress in the ConversionStats shape the task UI reads - Reuse zip_cache constants, walk the cache off the event loop, tolerate files vanishing mid-cleanup, and trim long comments Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): simplify conversion code (pr-ready step 3) - Move the converted-download policy (target lookup, cached-first, sync size cap, deadline) from the endpoint into utils/conversion_cache and share conversion_target with the pre-warm task - Share one path lookup between get_cached_converted and get_or_convert; the pre-warm walks the cache once and tracks a running byte budget instead of walking it twice per rom - One normalize_platform_formats beside TARGETS_BY_PLATFORM for the config loader (via _validated_platform_map) and the settings endpoint; update_converto_settings takes a ConvertoConfig and is written back with dataclasses.asdict - read_infos owns its never-raise contract, so the scan drops its blanket except; drop the unused RomConvertoInfo.kind and error attributes - Sort files for the rom-converto identity only when it is used; stat each cached file once during cleanup Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(converto): trim comments (pr-ready step 4) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): convert on first download instead of pre-warming A library pre-warm fought the TTL: cleanup dropped every copy nobody downloaded within a day. Remove the Convert library task and convert on demand only. Files over ROM_CONVERTO_MAX_SYNC_SIZE_MB now start their conversion in the background while the original is served, so the next download within the TTL gets the converted copy at any size. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): drop decrypt and encrypt download targets Downloads now only change a rom's container or compression (CHD, RVZ, CSO, NSZ, ...); serving decrypted files is left for a separate decision. NDS and PS3 have no remaining targets. Also note that the conversion concurrency limit applies per process. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): move the cache limits into converto.* cache_max_size_gb and max_sync_size_mb join cache_ttl_hours in config.yml and PUT /api/config/converto_settings, replacing the ROM_CONVERTO_CACHE_MAX_SIZE_GB and ROM_CONVERTO_MAX_SYNC_SIZE_MB env vars, so every eviction knob is edited in one place at runtime. The loader takes its defaults from ConvertoConfig and one table holds each integer's minimum for both the loader and the payload. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): lock conversions with flock instead of a sentinel A conversion now holds a non-blocking flock on its key dir, which the kernel releases if the worker dies. That replaces the .partial sentinel, its 6-hour staleness guess (which a long ROM_CONVERTO_TIMEOUT could outlive), and the rename-aside takeover. Cleanup skips locked dirs, and partial output gets a hidden name so it never counts as a served copy. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * test(converto): parametrize repeated test cases Collapse the per-platform info parsing, operation resolution and converto_active cases into parametrized tests, so a new platform or target is one row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(scan): run rom-converto first with sigil as the fallback rom-converto reads each rom's new or changed files first, in one batch, and its title ids win. sigil still reads what it can, since it alone provides save targets and Switch content types, and fills the ids rom-converto left unset. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * feat(converto): store per-file metadata read by rom-converto during scans * fix(scan): keep the stored save target when sigil reads nothing * fix(converto): read Xbox 360 disc ids and Wii title versions, store content type as text * feat(converto): save file icons, banners and backgrounds read by rom-converto * chore(converto): bump rom-converto to v0.23.0 * fix(converto): address review findings in the conversion cache, scan metadata and settings * refactor(converto): move per-file metadata out of the conversion PR Scan-time metadata (title ids, the 17 rom_files columns, artwork and converto.scan_metadata) moves to its own PR so its columns land with the UI that reads them. This PR keeps conversion only. The conversion cache no longer has uncompressed_size_bytes to budget with, so a conversion to an uncompressed target reserves a fixed multiple of its input and the cleanup pass after it evicts any overshoot. Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ * feat(converto): let the client pick the download format with ?format= `?format=zso,iso` lists the formats a client can read. The stored file is served whenever its format is listed, even with conversion off, so most emulator clients never trigger a conversion. Otherwise the first listed format with a cached copy is served, then the first one rom-converto can produce. A conversion that outlasts a short wait answers 202 with Retry-After instead of falling back to the original, so a URL never serves two different files and a client never gets bytes it can't read. 406 means no listed format can be served. HEAD reports the same without starting a conversion. This replaces `?converted=true`, the per-platform download target and `max_sync_size_mb`; `cache_ttl_hours` stays config.yml-only. Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ * feat(converto): convert the library in place with a manual task `converto.platform_formats` now names the format a platform's library is stored in, and the new "Convert library" task brings every matched rom to it. Each output is staged in a `.romm_tmp_` directory beside the original, moved into place, and only then are the originals (and a cue's tracks) deleted. Single-file roms take the new name, folder roms keep theirs and get their .m3u entries rewritten, and the file rows refresh, so a rom keeps its id, saves and collections. Only lossless conversions qualify, so xbox (xiso trims the dump) has no library format. Unmatched roms are skipped because a converted file no longer hash-matches a DAT. `/api/config` now carries the library targets and, per input extension, the formats a download can be converted to. Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ * fix(converto): address Greptile and Copilot review findings - Publish a converted library file with a no-replace link, so a file that appears during conversion is never overwritten. - Delete originals only after the rom row or its playlists point at the new file, and keep them if that update fails. Playlists are rewritten atomically. - Refuse a cue conversion whose tracks another rom or another cue holds. - Remove stage dirs a killed conversion left behind. - Try later ?format= targets when a conversion fails, treat any locked key dir as converting, and cap how many conversions downloads can start. - Drop the unsupported iso target for CD platforms from the example config and list the ROM_CONVERTO_* variables in env.template. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(converto): address code-review findings (pr-ready step 2) Serve converted outputs at 0644, read cue sheets and playlists with a BOM, stage folder rom conversions outside the rom folder, keep one rom's failure from stopping the convert library task, accept alias extensions as the stored format, probe running conversions with a shared lock, and bound the timeout. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): simplify conversion code (pr-ready step 3) Check and chmod rom-converto output once in the adapter, canonicalize requested format aliases, reuse LINK_FALLBACK_ERRNOS and the handler's atomic write, make the download format table a constant, skip the probe lock once cached, and fold duplicated name checks and cache stat passes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * chore(converto): trim comments (pr-ready step 4) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * refactor(converto): find rom-converto on PATH instead of ROM_CONVERTO_PATH Both images install the binary on PATH, the variable was undocumented, and RAHasher is already resolved the same way. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Yukine <devyukine@gmx.de> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: DevYukine <20647088+DevYukine@users.noreply.github.com> |
||
|
|
2d58122d29 |
feat(search): Rank exact title matches first in relevance-ordered searches (#4996)
* Rank exact title matches first in relevance-ordered searches Relevance only scored whether a ROM's name, filename or aliases held the search as a phrase, so a spin-off whose alias contains "Final Fantasy 7" tied with the game whose alias is exactly that, and the tie fell to title order. Searches ordered by relevance now rank an exact name or alias match first, then names starting with the search, then the phrase score. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready step 2 (code-review): match escaped aliases and tidy search parsing The alias pre-check now looks for the term as the joined aliases store it, with JSON escapes, so a quoted alias (and, on MariaDB, a non-ASCII one) can rank as exact. Search phrases reuse the shared term split, the order_by API description matches the current ranking, and the dialect test's NULL row is a real SQL NULL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready step 3 (simplify): flatten the search rank and share helpers The exact-name check is one IN over the folded terms, the provider alias check has its own helper, json_titles_contain_folded folds the title itself and builds on json_array_contains_value, PostgreSQL only scans the aliases for the raw form of a term, and the running-engine dialect tests share one scratch-table helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Rank one-word searches of three or more characters A search for an alias like "ff7" now puts the exact match first. The rule for when relevance leads (and the letter index is dropped) moves to search_relevance_leads, which the order clauses and the endpoint share: no explicit sort, and either a multi-word phrase or a term of at least three characters. Shorter terms keep the name order, since they match most of a library and ranking would sort every match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Rank exact titles stored with extra spaces or accented capitals The exact and prefix tiers now collapse runs of whitespace on the stored name and alias side too, so "Final Fantasy VII" ranks as exact for "final fantasy vii". On MariaDB, which stores non-ASCII characters as \uXXXX escapes that LOWER can't fold, a non-ASCII term is checked against the aliases decoded through JSON_TABLE, and the alias pre-check goes word by word, skipping words it can't match in escaped text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Rank search results against a stored, folded title column Search ranking compared the term against the name and each provider's alternative titles, which meant decoding JSON blobs per row and working around MariaDB's escaped Unicode, tabs and newlines. Store the folded name and aliases in a new `roms.search_titles` column instead, kept in sync by mapper events and `update_rom`, and backfilled by migration 0147 in batches. Ranking becomes two LIKE checks against that column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Keep fitting aliases after one that overflows the search titles cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Rank a name prefix only where the search ends a word "final fantasy viii" starts with "final fantasy vii", so Final Fantasy VIII took the prefix rank for that search. The name now has to continue with a non-alphanumeric character after the search, which a regex checks on the rows the LIKE prefix already narrowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready code review: fix punctuation prefixes and hidden sort direction - A search ending in punctuation has already ended its word, so the name prefix rank no longer needs a further non-alphanumeric character. - Relevance has no direction: a hidden descending order no longer reverses its ties, in the order clauses or the grouped aggregate. - An alias equal to the name isn't stored twice in `search_titles`. - `update_rom` reads the stored row once instead of up to three times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready simplify: keep relevance's direction rule with its order clauses - `_gallery_order_clauses` decides once whether relevance leads and drops the direction there, rather than each caller overriding it. - The search terms are built only where the rank needs them. - The page hydration query drops a sort its rows are reordered out of. - The ranking tests share one helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4080cee68e |
feat(search): Order v2 search results by relevance until a sort is picked (#4995)
* Order v2 search results by relevance until a sort is picked The Search page fell back to the gallery-wide title sort whenever the URL named none, so the backend only used search relevance to break ties between identical titles. Search now sends an empty order_by by default, letting relevance lead; clicking a column still sorts by it and lands in the URL as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready step 2 (code-review): fix relevance-order edge cases The backend now decides whether relevance leads and returns an empty char_index when it does, so single-word searches (still name-ordered) keep the A-Z strip and letter grouping, and multi-word searches get no letter headers over rows that are not in letter order. A write under a relevance-ordered search refetches, since the row lacks the filename and aliases relevance ranks on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready step 3 (simplify): drop duplicated defaults and test setup Gallery order clauses check order_by directly again, since the phrases are already known there; useGalleryOrderUrl takes its default from the caller only; the default key comes from DEFAULT_ORDER_BY in useRomSync; and the new tests reuse the existing setup and mount helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Offer Relevance as a sort on Search and read it off the backend Search's sort menu (grid toolbar and the compact list header) now lists Relevance, and a third click on a desktop column header returns to it, so the default order is reachable again after picking a column. The direction toggle hides under relevance, which has no direction. useRomSync's refetch now follows the backend's own signal for a relevance order (an unset sort answered without letter positions) instead of treating every search as one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Check the Relevance sort entry when it is active Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Show the order the backend applied in Search's sort controls An unset sort the backend still answered by name (an empty or one-word search) now reads as Title in the sort controls, with its direction toggle, rather than as Relevance. The store records whether the last answer led with relevance and keeps it through refetches, so the controls don't flicker while a search reloads. Picking Relevance from the toolbar now also resets the direction, as the list header's third click does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * pr-ready simplify: read the applied order from effectiveOrderBy - The letter strip reads `effectiveOrderBy` instead of re-checking `charIndex`, which also stops it vanishing during every refetch of a relevance-ordered search. - `useRomSync` reads `effectiveOrderBy`, so `relevanceLeads` goes. - `setOrderBy(null)` resets the direction itself, so `clearOrder` and the shell's toolbar handler go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 * Tell the sort controls whether relevance is applied The controls read a null sort key as "unsorted", but the shell also passes null for a gallery key no column carries, so `/search?orderBy=last_played` ticked Relevance and hid the direction toggle. The toolbar, list header and phone sort menu now take an explicit `unsorted` flag from the store's `effectiveOrderBy`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015iCApu4gYrGBWDX8JD9JH6 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
25ee88e5dc |
Merge pull request #4997 from LoneAngelFayt/fix/upload-name-length-and-status-codes
fix(api): return 4xx for overlong names and duplicate collections |
||
|
|
374b626f2e |
fix: address code-review findings (pr-ready step 2)
Check screenshot names before the state or save is stored, move the update_rom fs_name check ahead of provider fetches, check the stamped state name on pull, skip the length check on a no-op rename, and share the sanitize-and-check block through sanitize_asset_filename. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
cab6cfa3a4 |
fix(streaming): check the stamped name of a pulled state
Addresses Greptile review on #4997: the library stores a pulled state with a 22-byte capture stamp, so that is the name to check. Also types the new test parameters and trims a rationale comment. |
||
|
|
5faa695987 |
Merge pull request #4991 from rommapp/claude/ecstatic-wozniak-1xpe7c
fix: eight bugs from hand-maintained lists drifting apart |