* 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>
* feat(sync): let a client ask negotiate to restore the saves it lost
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(saves): sync web player saves as a browser device
A shared layer for the in-browser players: each browser profile registers
as a sync device, keeps every account's saves in its own IndexedDB store,
negotiates them with the server at launch (restoring any it lost), and
pushes changes with the device's conflict guard. Hashes match the server's,
including its zip-entry hash.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(emulatorjs): save as the browser's sync device, with the slot guard
EmulatorJS now uploads and downloads as this browser's registered device
instead of the IP-based login device, confirms downloads with their hash, and
lets a write that continues the slot's head be refused when another device
wrote the slot since; that progress is archived and the session keeps
writing to the archive.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(settings): list, rename, pause and remove your devices
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(player): sync EasyRPG, js-dos, PICO-8 and Ruffle saves with RomM
Each player's own storage is restored from the browser's synced copy before
boot and captured back during play and on leave:
- EasyRPG: its IDBFS saves, one slot per in-game slot
- js-dos: its changes zip through fsChanges pull/push, migrating saves it
kept in OPFS before
- PICO-8: cartdata files, flushed by loading a blank cart on leave
- Ruffle: the game's SharedObjects zipped into one save, kept out of
localStorage between plays so accounts don't share them
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>
* fix(saves): address Greptile review on web device save sync
- Remove EasyRPG save files that sync deleted, so the game cannot load them
- Keep the stale-device guard on device sync's page-close uploads
- Restore only the Ruffle SharedObjects the current SWF can reach
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(saves): code-review pass on web device save sync
Restore master's EasyRPG RTP table path lost in the merge, serialize
DeviceSaveSync pushes, only mark a no_op synced when the server hash
matches, forget the browser device when it is removed, close a late
EasyRPG IndexedDB connection, send content_hash on unload updates, and
share the IndexedDB helpers and slot-conflict check.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(saves): simplify pass on web device save sync
Archive conflicts through uploadArchivedSave and isSlotConflict, skip
hashing unchanged bytes, share bytesEqual from saveSync/hash, pass
restore_unlisted from DeviceSaveSync, use newest() for the EmulatorJS
slot head, and trim one-off Ruffle and PICO-8 helpers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(saves): review-polish pass on web device save sync
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(saves): humanizer pass on web device save sync comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(saves): open every player IndexedDB through openDb
The save sync store now rejects when another tab blocks its upgrade
instead of waiting forever, as the EasyRPG and pending-asset stores
already did.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(sync): let negotiate scope server saves to the client's emulators
A browser player's saves load only in that player, so a native save in
the same slot must not pair with it or download into it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(saves): register the browser device on each launch
Registration returns the existing device, so calling it every time
brings back a device removed from any browser, which EmulatorJS
otherwise kept sending as a dead id. The cached id now serves only when
offline. DeviceSaveSync also negotiates within its own emulator.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(player): share web player save sync through useDeviceSaveSync
The coalesced polled push, the flush before leaving, the page-close
capture and the discard prompt live in one composable, and the player
suites share one DeviceSaveSync fake from test-utils.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(saves): update one archive per slot after another device takes it
A slot refused mid-session archived every later write as a new save.
Later writes now update that archive in place, page-close sends
included, and the next launch settles the slot.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(ruffle): skip unchanged polls and upload saves every 5 minutes
Polls compare the stored SharedObjects with the last read before zipping
them, and keep what changed in the browser, uploading it at most every
5 minutes. Leaving and page close still upload at once.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(ruffle): sync saves like EmulatorJS, polling every second
Polls compare the raw stored strings, so an idle second decodes,
zips and hashes nothing. A change uploads once two polls agree on it,
and a failing upload backs off from 2 to 30 seconds through the retry
backoff EmulatorJS uses, now shared from saveSync. Leaving still
uploads at once.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(v2): scope stored preferences to the signed-in user
Preferences in localStorage were shared by everyone using the same
browser, so one person's gallery layout, scan providers, chosen cores
and so on carried over to the next account. useUserLocalStorage stores
them under `user:<id>:<key>` while someone is signed in, and under the
bare key while signed out. The first user to sign in after this change
claims any unscoped value, so existing preferences carry over once.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(v2): address Greptile review on user-scoped storage
- Scope the core, BIOS and disc keys the shared EmulatorJS player writes
(and v1's matching reads), so a game start no longer leaves bare keys
for the next user to claim.
- Build the test user with userFixture.
- Trim the helper's header comment.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(v2): store the jukebox session under the user's storage key
The resume session now goes through userStorage like the other stored
preferences, so each user gets their own key instead of one shared key
carrying a userId to check on restore.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(v2): lint against storage that isn't scoped to the user
Adds romm/no-unscoped-local-storage, which rejects raw localStorage and
vueuse's useLocalStorage/useStorage outside frozen v1, so new stored
preferences go through useUserLocalStorage/userStorage. The locale read
at module load stays unscoped with an inline disable.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(v2): resume jukebox music after a reload
An opt-in "Resume music after reload" setting (Settings > User Interface >
Jukebox) saves the soundtrack player's track, queue, shuffle state and
position on the device and restores them on the next load.
Browsers block audio before the first user interaction, so a restored
session loads paused at its position and, if it was playing, starts on the
first click, tap or key press. The session is keyed to the signed-in user,
and a restored track that no longer loads is dropped without an error toast.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(v2): address Greptile review on jukebox resume
- Reset the soundtrack store on sign-out and restore on every sign-in,
so the next user neither inherits the queue nor saves it as theirs.
- Start a resumed session after the first press is handled, so a first
press on Play no longer pauses it, and keep waiting while a game
blocks the music instead of consuming the press.
- Validate the saved session's meta and queue entries before restoring.
- Build the test user with userFixture.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(v2): code-review fixes for jukebox resume
- Re-check the game block when the deferred start runs, and re-arm the
first-interaction listener when the press is blocked or play() is refused
- Disarm the listener when playback starts some other way, on track change
and on unmount, including its pending timeout
- Validate isShuffled, activePlaylistRomId and wasPlaying in stored sessions
- Skip deep watching the stored session and only watch it while the
setting is on
- Make the smAndDown test mock reactive
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(v2): simplify pass on jukebox resume
- Keep a single pendingResume in the store in place of the one-shot
takePendingResume, awaitingAutoplay and the component's resumedTrack
- Leave the first-interaction listener armed until the sink plays instead
of re-arming it by recursion
- Read and write the saved session with localStorage directly, so other
tabs don't re-parse the queue on every save
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(v2): review-polish comments on jukebox resume
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(v2): humanizer pass on jukebox resume comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(v2): don't autoplay a restored jukebox session another tab is playing
A new tab picked up the saved session of a tab still playing and started
the same track a second time on the first click. On restore, the tab now
asks the others on a BroadcastChannel whether one is playing and waits
200ms for a reply. A playing tab answers, so the session loads paused;
with no answer (a reload, or every tab closed) it starts on the first
interaction as before.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(v2): only save the jukebox session a tab changed itself
Every open tab wrote its own session on pagehide and after a restore, so
closing an idle tab, or a tab that restored the session paused, replaced
the session another tab was playing. A tab now saves only after its own
player changed, and not while a restored session is waiting to start.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(v2): fade in a resumed jukebox session
A session restored after a reload now ramps from silence to the user's
volume over a second instead of starting at full volume.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* 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>
* perf(frontend): load md-editor on demand instead of with the app
md-editor's config() ran from the app entry, which kept the library in
the entry's import graph. A Vite and Vitest alias now routes every bare
md-editor-v3 import, v1 included, through plugins/mdeditor.ts, which
applies the XSS config as a side effect of the first load. The
sanitizer stays on for every caller without an entry import.
ChangelogDialog (mounted on every v2 page) and NotesTab imported
MdPreview and MdEditor statically. They now load them through small
MarkdownPreview and MarkdownEditor wrappers with defineAsyncComponent,
so md-editor and CodeMirror download when a note or the changelog is
shown, and the editor only when editing starts.
Based on the lazy-loading approach from #4988 by @andest01.
* fix(storybook): keep the app's alias array when adding @ and @v2
Addresses Greptile: spreading the app's alias array into an object turned
it into numeric keys, so Storybook lost the md-editor-v3 alias and with
it the XSS config.
* refactor(frontend): address code-review findings
- Share one alias list between vite, vitest and (through vite.config.js) Storybook.
- Re-export MdEditor and MdPreview from typed modules instead of wrapper SFCs, so callers keep prop and v-model type checks.
- Block deep md-editor-v3 imports in ESLint, since they would skip the XSS config.
- Pass no-echarts where notes and the changelog render, so md-editor does not fetch echarts from unpkg.
* refactor(frontend): simplify the shared md-editor module
Simplify pass:
- Merge the editor and preview re-exports into one shared/markdown module; both pulled the same md-editor chunk and stylesheet.
- MarkdownViewer imports MdPreview from it too, and gets no-echarts like the other v2 previews.
- Drop the ESLint ignore for mdeditor-dist.d.ts, which has no deep import.
* style(frontend): trim the shared md-editor module comment (review-polish)
* fix(frontend): keep the md-editor preview and editor in separate modules
The simplify pass merged them into one module, which put MdEditor and CodeMirror in the preview's chunk: the changelog and note previews went from 78 KB to 290 KB gzip. MarkdownViewer keeps using the shared preview module.
* feat(frontend): show a spinner while the note editor loads
* fix(frontend): cover md-editor chunk loads with the existing spinners (code-review)
ChangelogDialog waits on the renderer chunk with the releases fetch, so a
load failure lands in the dialog's error state instead of blank bodies.
NotesTab's preview gets the same loading spinner as the editor. Document
the @v2 and md-editor-v3 aliases.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(frontend): share the async md-editor components (simplify)
Define the async MdPreview/MdEditor wrappers and their attr-dropping
spinner once in shared/asyncMarkdown.ts instead of per NotesTab instance
and again in ChangelogDialog. Keep the md-editor alias out of the tsconfig
paths block in the architecture doc.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(frontend): let TypeScript follow the md-editor-v3 alias
Only Vite knew about the alias, so go-to-definition on md-editor-v3 opened
the package types instead of src/plugins/mdeditor.ts, where the sanitizer
config lives. A tsconfig path now points there too.
* refactor(frontend): turn off md-editor's CDN renderers once for v2
The shared markdownPreview/markdownEditor modules wrap the components with
noHighlight, noKatex, noMermaid and noEcharts, so v2 call sites no longer
repeat the flags and a new one cannot miss them.
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>
* perf(frontend): keep the inactive UI and the markdown renderer out of the first load
vue-router fetches every named view of a route before entering it, so a v2 visit also downloaded the v1 view tree. The inactive UI's views are now deferred until rendered. The changelog dialog, mounted on every v2 page, loads md-editor-v3 on first open.
* perf(frontend): set up Storybook annotations only for the story test
Every vitest file paid for the Storybook preview (full Vuetify and the Storybook runtime) though only storybook.test.ts renders stories.
* fix(frontend): address pr-ready code review
* style(frontend): pr-ready polish
* docs(frontend): pr-ready humanizer pass
* fix(frontend): address Greptile review
- router.test.ts: cover an in-place UI switch, so a deferred view that renders blank fails the suite.
- storybook.test.ts: narrow the preview setup comment to the invariant it guards.
* refactor(frontend): drop the view-loader check from the deferred-view guard
Every route view is a lazy import loader, so a typeof check finds the
inactive UI's views without copying vue-router's own heuristic.
* chore(frontend): restrict direct md-editor-v3 imports
md-editor-v3 now loads lazily on v2 pages outside the game details route,
so an eager import anywhere else would quietly pull it back into a shared
chunk. ESLint now flags it and points at the MarkdownPreview wrapper. Type
imports stay allowed, the frozen v1 trees are skipped, and the list is
shared with the v2/lib block so primitives keep their own restrictions.
* fix(frontend): pr-ready code review
Prefetch every deferred view of the current route on a UI switch, lint
static imports of the md-editor wrappers, make the hand-back test
self-contained, and drop redundant mock resets.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(frontend): pr-ready simplify
Render MarkdownViewer through the shared MarkdownPreview wrapper, inline
the route-entering check, and set the test UI version once in beforeEach.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(frontend): load md-editor config with its consumers and skip echarts
The md-editor config module now applies itself on import, and each
md-editor consumer (v1 details, NotesTab, MarkdownPreview) imports it,
so md-editor's config, json5 and the XSS filter leave the entry chunk.
Lint flags eager imports of the config module.
Echarts fences render as code and a stub instance stops md-editor from
fetching echarts from unpkg whenever a preview mounts.
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>
* perf(tests): skip empty tables in clear_database and run migration tests first
clear_database issued 20 DELETEs after every test. One EXISTS query now finds which tables hold rows and only those are cleared. The slow migration tests are scheduled first so they overlap the rest of the suite under xdist.
* perf(tests): clone a migrated template into each MariaDB xdist worker
Replaying every migration in each worker at once was most of a cold run. The template database is migrated once under a server lock and copied into each empty worker database. PostgreSQL keeps running migrations per worker.
* fix(tests): address pr-ready code review
Key the MariaDB template on a digest of the migrations and the helpers
they import, so an edited revision or a template left at another
branch's head or half-migrated is rebuilt instead of reused or failing.
Copy alembic_version last and reset a worker database that has tables
but no version row, so a clone cut short is redone on the next run.
* refactor(tests): pr-ready simplify pass
* style(tests): pr-ready polish
* style(tests): pr-ready humanizer pass
* test(tests): cover the template copy and empty-table cleanup
Addresses the Greptile finding that the new database setup paths had no
assertions:
- test_copy_schema_reproduces_the_migrated_database copies the migrated
worker database with _copy_schema and checks tables, views, triggers,
row checksums and the alembic version match the source (MariaDB only).
- test_clear_tables_deletes_only_from_tables_with_rows checks that cleanup
issues a DELETE only for tables holding rows. The fixture body moves into
_clear_tables so the test can call it.
* fix(tests): address pr-ready code review (xhigh)
Hash all of models/ and utils/ into the template digest, warn when the
clone falls back to migrating, defer the digest past the early returns,
and dedupe the DEFINER regex, statement capture and schema-name queries.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(tests): pr-ready simplify pass
Read tables and views in one query, strip DEFINER once, use the
inspector for the version check, always recreate an unversioned worker
DB, and pull the server lock and template build into helpers.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* style(tests): pr-ready polish
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(db): clear every model table between tests
Derive the cleared tables from BaseModel.metadata.sorted_tables, children
first, instead of a hand-kept list of 20 models. Views and the
permission tables the migrations seed are skipped. A new model is now
cleared without editing the fixture.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(tests): build the MariaDB template once in the xdist controller
pytest_configure_node checks each worker's database on the controller
and, for one with no version row, builds the template (once per session)
and hands its name over through workerinput. Workers copy it without
taking the lock, so copies run in parallel, and a broken migration
fails once instead of once per waiting worker. The template is shared
by every checkout and ROMM_TEST_DB_TAG run, since its digest pins the
schema. DEVELOPER_SETUP.md documents it.
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>
* test(db): give worktree runs their own temporary test database
Checkouts share romm_test, so a worktree on another branch can migrate it
to a revision the current branch lacks, and every test then errors in
setup with "Can't locate revision". ROMM_TEST_DB_TAG gives a run its own
romm_test_<tag> databases (one per xdist worker) that are dropped when
the session ends. AGENTS.md tells worktree sessions to use it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(db): address Greptile review on temporary test databases
- Prefix tagged databases with tmp_ so they can never share a name with
an untagged xdist worker database that teardown would then drop.
- Normalize the tag to [A-Za-z0-9_] so tags like my-worktree work.
- Drop the temporary database even when the migration fails.
- Shorten the new comment to two lines.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* perf(config): read config.yml values with a plain dict walk
pydash.get parses the path and probes every container type on each call, and the scan reads config values per rom. A dotted-path lookup over the parsed YAML dicts returns the same values.
* fix(config): address Greptile review
Drop the _config_get docstring, which restated the four-line dict walk below it (AGENTS.md comment discipline).
* refactor(config): move nested config lookup to utils.database as get_nested
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>
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
* 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>
* 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>
* 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>
* fix(input): show the focus ring when arrow keys move focus in Firefox
After a mouse click, Firefox treats a script-driven focus() as mouse focus and
skips :focus-visible, so the tile an arrow key moved to had no ring. Pass
focusVisible: true from the three arrow-key focus sites (useSpatialNav,
useGridNav, useWrapGridNav). Browsers without the option ignore it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(input): show the focus ring on menu and calendar arrow moves in Firefox
Apply the same focusVisible hint to RMenu (arrow keys between items, and its
keyboard/pad initial focus) and RDateField (arrow, Home and End between days).
The calendar's focus on open stays with the browser, so a mouse open shows no
ring.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* remove comments
* test(input): cover the focus ring on grid, menu and calendar moves
Addresses Greptile review on #5066: drops a comment that restated the
modality guard, and asserts focusVisible on the useGridNav,
useWrapGridNav, RMenu arrow and RDateField arrow/End paths.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* pr-ready step 2 (code-review): always request focusVisible on calendar days
The day outline is gated on input modality, so the ring flag on
focusDayCell was redundant and relied on nextTick resolving to
undefined. Tighten the RMenu and RDateField focus-ring assertions to
the element that should receive focus.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* pr-ready step 3 (simplify): fold the focus-ring tests into existing ones
Merge the RMenu initial-focus ring check into the initialFocus test,
let mountMenu take props and panel content instead of repeating the
activator template, and cover RDateField's single focusDayCell path
with one test for opening and one arrow move.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(input): route v2 focus through a modality-aware helper
- focusFromInput asks for focusVisible only on key and pad input, and
every v2 focus() call now goes through it. ESLint flags a bare
.focus() under src/v2.
- useInputModality counts Home, End, PageUp and PageDown as keyboard
input and listens in the capture phase, so navigation handlers see
the new modality. useGamepad switches to pad before dispatching its
synthetic key for the same reason.
- RDateField: PageUp/PageDown move the cursor and focus with the view,
and the cursor stops at min/max instead of landing on a disabled day.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* ci(e2e): copy frontend/assets into the preview build
The CI e2e run serves `vite build` output through `vite preview`, but the
build leaves out frontend/assets, which only the Docker image copies on top
of dist. Platform icons, logos, fonts and default covers came back as the
SPA fallback HTML. Copy the folder into dist the same way the image does.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Address Greptile review: shorten the asset-copy comment
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* 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>
* 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>
* 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>