* fix(ra): count RomM's own RA hash match as RetroAchievements verification
The RetroAchievements verification chip, the header Verified badge and the
library verified filter only read Hasheous' `ra_match` flag. RetroAchievements
hashes only part of some ROMs (NDS, PSP), so Hasheous never flags those from
their file hashes, and a ROM RomM matched to its RA game by RA hash still
showed a grey chip.
The RA handler now records `hash_match` in `ra_metadata` whenever the ROM's
RA hash is one RetroAchievements lists for the matched game, whichever route
found the game (hash lookup, Hasheous-supplied id, filename tag, update scan
or a manual edit). The frontend verification helper and the backend verified
filter count it alongside Hasheous' flag. Existing ROMs pick it up on their
next scan.
Fixes#4801
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
* style: satisfy trunk isort and no-emdash-in-comment
Sort imports with the repo's .isort.cfg and replace the comment em-dashes
in MetadataTab.vue that trunk flags once the file is modified.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
* fix(ra): address code-review findings on the RA hash match
- A HASHES rescan whose RA lookup ran and found nothing clears
`hash_match`, mirroring the Hasheous guard; a lookup that errored keeps it.
- A manual RA id change that can't be resolved no longer keeps the previous
game's `hash_match`.
- `_search_rom` no longer caches a failed hash-list download ({}) as an
empty index for the whole refresh window.
- Update the `verified` filter description and trim the romVerification
header comment.
Step: pr-ready code-review (xhigh --fix)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
* fix(ra): don't let a failed hash check block an RA ID lookup
`get_rom_by_id` now treats the hash-list check as secondary: on failure it
logs, keeps a match already recorded for the same game, and still returns
the game. A failed hash-list download raises "RetroAchievements
unavailable" instead of reading as "no match", so scans treat RA as
inconclusive and keep the stored flag.
Addresses the Copilot and Greptile review findings on ra_handler.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
* refactor(ra): simplify the RA hash-match verification
- Cache the parsed RA hash index per platform, keyed by the cache file's
mtime, so a scan parses it once instead of once per ROM.
- Check the hash only after `get_rom_by_id` has resolved the game.
- Give each frontend verification database its own `matches(rom)`, which
drops the `ra_match` special case in the shared helper along with
`matchesDatabase` and `VERIFICATION_KEYS`.
Step: pr-ready simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
* style(v2): polish romVerification naming and comment
Rename the Hasheous matcher factory to `anyHasheousFlag` and trim the
VERIFICATION_DATABASES comment to two lines.
Step: pr-ready review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
* fix(ra): keep a recorded hash match only for the same RA hash
When the hash-list check fails, `get_rom_by_id` now keeps a stored
`hash_match` only if both the game and the ROM's RA hash are unchanged, so
a rehashed ROM isn't left verified by a hash nobody checked. The
romVerification tests build on the shared typed `SimpleRom` fixture
instead of casting a bare object.
Addresses the Greptile review findings on ra_handler.py and
romVerification.test.ts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LfQbq2ZUFK53NMXPNktdaM
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
compare_save_state decides a side changed from its timestamp, and
emulators rewrite a save on exit, so an untouched save looks new and a
server change elsewhere turns into a false conflict.
device_save_sync now records what each side held at the last sync
(last_sync_hash from the device, last_sync_server_hash from the server,
migration 0140). A baseline match proves that side unchanged; a mismatch
or NULL falls back to the timestamp logic, so this only removes
conflicts. It runs after the removed_at check in compare_save_state.
- Baselines are recorded only for versions the device provably holds:
confirm_download pins to the served version, update_save records the
client hash only when the file was uploaded, deduplicated uploads and
pushed saves record against the surviving save, and push-pull no-ops
record hashes only for identical content.
- Identical-content no-ops in negotiate and the watcher record a
boundary without re-tracking untracked saves.
- The SSH push-pull and file-transfer watcher paths hash device saves
through hash_save_file, matching compute_content_hash for zipped
saves, and treat unreadable saves as unknown.
Squashes rommapp/romm#4768 onto master.
Claude-Session: https://claude.ai/code/session_01WAKUdfLb6fyduEqaFbf5A8
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Greptile review on #4811:
- IndexShell gives focus-keyed tiles a scroll-margin matching the top bar,
pinned toolbar and bottom tab bar, so a centred tile taller than the
uncovered band no longer lands under the chrome on short viewports.
- Cover the saved-focus restore path with a test.
- Drop the comparison with "nearest" from the scroll comment.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Shorten the replay comment to two lines, and make the replay test assert
the pad lands in a player slot through a listener shaped like EmulatorJS's,
not just that dispatchEvent was called.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
State names were built with toISOString() in the browser, and save,
streaming save and memory card names with datetime.now(timezone.utc) on
the server, so every timestamp in an asset's file name was UTC. States
now use the browser's local time and server-named assets use the
server's local time (the container's TZ). Matching and ordering read the
stored file_name and the DB timestamps, so existing files are unaffected.
Fixes#4726
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The upload view and the patcher's "upload to RomM" emitted a scan
unconditionally. With a library scan in flight the backend refuses it with
scan:done_ko, which flipped the UI out of the scanning state and showed a
failure until the running scan's next progress event flipped it back.
Both now go through useScanTrigger, which warns instead of emitting.
Fixes#4690
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Moving up the platforms/collections grid scrolled with block "nearest",
which parks the row at the viewport top edge, under the fixed top bar and
pinned toolbar, so focus ended up hidden. Vertical moves and focus
restoration now center the target row, matching useGridNav.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On Chromium for Android, the full-viewport backdrop-filter on the CRT
overlay left platform and collection images unpainted until touched.
The xs breakpoint keeps scanlines, vignette and flicker but skips the
saturation/contrast grade. Also swaps the file's em-dashes for
punctuation so it passes the no-emdash lint.
Fixes#4770
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
EmulatorJS's GamepadHandler polls navigator.getGamepads() once inside its
constructor, before the emulator registers its "connected" listener. A pad
the page already knows about (such as the one that pressed Play) lands in
the handler's list without ever being assigned to a player slot, so its
input is dropped until it disconnects and reconnects.
Replay the "connected" event for those pads from the EJS_emulator
assignment trap, right after the constructor returns.
Fixes#4797
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The player last-played updates now send an empty payload, the v1 main
sibling toggle sends only its field, and the v1 personal tab leaves
pinned_media out of its debounced save.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Put the unpinned pin on the overlay scrim so it reads over artwork, and
trim the header comments this PR touches to two lines.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
is_system was true exactly when system_key is set, so 0137 now drops it
after backfilling the key, and downgrade rebuilds it from the key. The
group API returns system_key instead, and the admin UI reads it for the
system tag and edit warning.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Build each media source once per resolve, gate isPinned on scope inside
the composable, sync cached ROM copies on pin writes, require pinKey on
screenshot items, and share the order-preserving dedupe validator.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Cap the default selection at the pin limit, settle writes on the live
rom_user, gate pin controls on roms.user.write, dedupe keys server-side,
store resets as SQL NULL, and reuse MediaShelfItem for artwork entries.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Share one write queue per ROM across the Overview, Screenshots and
Artwork tabs, so pins from different tabs reach the server in order.
- On a failed write, restore the last server-confirmed pins only when no
newer write is queued, instead of a stale pre-toggle snapshot.
- Refuse a pin past PINNED_MEDIA_MAX_ITEMS client-side with a snackbar,
rather than sending a list the API rejects with 422.
- Trim MediaShelf comments to the repo's comment rules.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Simplify pass. Move firmwareExternalFiles into v2/utils/playerFirmware
next to resolveInitialFirmware so one module owns the player's firmware
logic and FirmwareLike stays private, replace the single-member core set
with a direct check, and fold the filename guards into one regex.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Code review follow-up. Drop the all-firmware fallback for other cores:
a cleared picker there means "no BIOS" on purpose, and the fallback
refetched every platform file uncached on each launch. PUAE again gets
every Kickstart, including the selected one, as originally tested.
Console mode's player now sets EJS_externalFiles too, so #4733 is fixed
there as well.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reuse FirmwareLike instead of a duplicate type, correct the archive
comment for the nightly EmulatorJS build, and cover the dot-name filter
and URL encoding in tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A cron run replaces the per-push build, so the tag is renamed from
`edge` to `nightly` (and `nightly-slim`), using metadata-action's
`type=schedule`. The version string becomes `nightly-<short sha>`.
The concurrency guard is dropped since scheduled runs can't overlap.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Generalize the PUAE helper to any core. Filename-selecting cores (PUAE)
still receive every firmware file in the system directory, minus the one
already loaded through EJS_biosUrl. Every other core now receives all
firmware next to the game when no file is selected, the case where
EJS_biosUrl previously loaded nothing. Archives are skipped because
EJS_externalFiles writes them unextracted; they keep loading through the
picker.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Move the slug-to-URL resolver into src/v2/utils/platformIcons so
PlatformIcon no longer pulls in the blob cache, and normalize slugs
through one helper.
- Keep PlatformIcon's tooltip as title or alt, which drops the three
:show-tooltip="false" overrides the slug fallback needed.
- Drop the plugin's unused directory argument, the redundant onError
guards and the doubled fsSlug lookup, and shorten the test helper.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Emit the slug-to-file map from the manifest plugin and reload it when
icons change under the dev server.
- Default the plugin's icon directory so both configs share one path.
- Keep decorative platform icons at an empty alt, and turn off the slug
tooltip where the display name already sits next to the icon.
- Clean up the manifest test's temp dir and cover CachedPlatformIcon.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
simplify pass:
- useInputModality gains pin(), which gates setModality so pinned modes
ignore the listeners (and useGamepad) instead of a watcher undoing their
writes; drops the manual data-input write and the HMR dispose
- one INPUT_DEFAULT shared by initialGlobals and the decorator fallback
- the Input Navigation stories share one render on meta
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
code-review (xhigh) pass:
- lazy-load useGamepad so vitest.setup.ts no longer caches it ahead of
useGamepad/index.test.ts's vue-router mock (5 failures in the full suite)
- drop flush: "sync" on the re-pin watcher, which ran between setModality's
ref write and DOM write and let a listener's data-input win
- stop the re-pin watcher on HMR
- test that a pin survives the live listeners, and assert data-input in play()
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The v2 platform icon components probed /assets/platforms/<slug>.svg, then
.ico, and let the browser 404 on every miss before settling on default.ico.
A build-time manifest of the shipped filenames (virtual:platform-icons) now
picks the right file up front, so unknown slugs go straight to the default
and the prefetch cache makes at most one request per shipped slug.
The manifest is a Vite virtual module rather than an eager import.meta.glob,
which would emit hashed copies of all ~240 icons and inline the small ones
into the lib chunk just to read their names.
RPlatformIcon moves out of lib/ to components/shared/PlatformIcon, since it
now depends on platform-specific asset knowledge. Its tooltip also falls
back to the slug when no title or alt is given (the empty-string alt default
used to short-circuit the `??` chain).
Based on the approach in #4728 by @andest01.
Fixes#4671
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Stories had no data-input on <html>, so the key/pad focus rings and other
modality-gated styles never rendered in Storybook. The new Input toolbar
pins data-input to mouse, touch, key or pad, or tracks live devices with
the real useInputModality + useGamepad stack so a connected controller
drives the story. An Input Navigation story demos a useWrapGridNav grid
and covers arrow-key movement in play().
Slimmed-down take on the idea in #4695.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- config: one _keys_by_label grouping serves both the unique-label map
and the shared-label warning.
- claim_session: one abort-and-raise for either refused pick; the
newest-save lookup is a single conditional expression.
- launch: pick refusal fields off one optional ImportRefusedError.
- imports: skip_state is always true for a foreign save archive; drop an
unreachable KeyError and the unused str form of _read_member.
- webstation: ImportSpec.state_channel is a Literal.
- Stream.vue: the 400 refusal hint folds into the generic server branch;
pickableStates drops a guard nativeStreamStates already has.
Security (from the step 1 audit):
- Inflate zip entries a chunk at a time, so an entry whose header
understates its size fails the CRC check instead of inflating in full.
- Cap the broker manifest at 1 MiB before reading it.
- Rebuild copied entries as regular files, keeping only permission bits,
so a symlink entry cannot ride into the container.
Code review (xhigh):
- Bound the broker error body read at 1 MiB and truncate what is logged
and returned.
- De-duplicate refusal hints in Stream.vue.
- Unpack only save members as zips; a zip-shaped state stays whole.
- Pick the newest state off an archive by created_at.
- Run newest_restorable off the event loop.
- Name a carried base entry by its staged path in the manifest.
The backend's Rom.path_cover_large/path_cover_small return "" rather than
null for a ROM without a cover, and a complete rescan resets url_cover to "".
resolveSoundtrackGameArtwork chained them with ??, so the empty string won
and the v2 mini player rendered <img src=""> instead of the default album
cover. The same value also leaked into the soundtrack panel's header art.
Treat empty strings as missing in resolveSoundtrackGameArtwork and in
playerCoverUrl, with tests for both.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The streaming config now ships import_kinds per container, from the broker's
cached import-spec, so the picker hides foreign saves and states a broker would
refuse instead of failing them after the launch starts.
On DuckStation and RPCS3, a save pick other than the newest archive no longer
lets that archive's own exit state stand in for the picked state: the state
rides the import archive, or the resume is reported lost where the broker
cannot import it.
* Tell a device when the save it holds was deleted here
Deleting a save took its row, its file and its device pairings, leaving nothing
that says it ever existed. A negotiation then read a client still holding the
save as a client with a save the server lacks, answered "upload", and the next
launch put the deleted save back. There was no way to say "this is gone": the
protocol's actions are upload, download, conflict and no_op.
So a slot emptied on purpose is now remembered. `deleted_saves` keeps one row
per (user, rom, slot) with what the slot held and when it was emptied, written
by the delete endpoint, which is the only place a deletion is the owner's
decision rather than housekeeping: autocleanup rotating a version out leaves
newer rows in the slot and is never recorded.
Negotiation reads it only when the slot has no row left, and answers the new
"delete" action when the client's copy is the one that went: the same content
hash, or a copy last written before the deletion. Anything written after it is
progress the server never held, so that still answers "upload" -- emptying a
slot is not a licence to delete a newer save.
The generated frontend models are hand-edited to match: this environment has
only CPython 3.14.0rc2, which the locked pydantic cannot import, so the backend
will not start for `npm run generate`. Both edits are mechanical (the new
literal in the union, the new count field), and `npm run typecheck` passes
against them.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015B86R6sN9CZ2uAWXCB9Y3U
* Decide a deletion by identity, and record it before the row goes
Three real findings from the review, and the layering rule.
The record was written after the save row and its file were gone, with two
transactions and a filesystem removal between them. Anything failing in that
window left a deletion nothing remembered, which is the resurrection this
change exists to prevent. It is written first now: a record for a save that is
somehow still there is never read, because a negotiation only consults it when
the slot has no row left.
The client's copy was matched on its own timestamp against the server's
deletion time. Those clocks are not comparable, and a device running slow
would have been told to delete progress it made after the deletion. The match
is now identity alone: the slot remembers every version it lost, capped at the
twenty most recent, and a client holding any of them is told to drop it.
Anything else is offered back, which costs a deletion that does not reach that
device rather than a save that is gone.
Recording replaced the row with a delete and an insert, which two deletions of
the same slot could race into a uniqueness error. It locks the row and merges
into it, with the house savepoint-and-catch for the case where there is no row
yet to lock.
The comparison itself moves to handler/sync/comparison.py beside
compare_save_state, where the endpoint delegates to it and the rule is tested
on its own.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015B86R6sN9CZ2uAWXCB9Y3U
* Trim the new comments to the repo's rule
One or two lines each, with the rationale in the commit messages and the PR
description where the rule puts it. The model's docstring is one sentence, and
the comparison keeps its Args and Returns.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015B86R6sN9CZ2uAWXCB9Y3U
* Sort comparison imports
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015B86R6sN9CZ2uAWXCB9Y3U
* Widen the window a deletion is remembered in
A slot's record keeps a bounded list of the versions it lost, and the trim
drops the oldest, which are exactly the ones a long-offline device is
likeliest to still hold. At twenty, a device that missed twenty
delete-and-refill cycles of one slot comes back with a digest that has
aged out and is answered `upload`, which puts a deleted save back.
Raised to a hundred, where the device would have had to miss a hundred
manual deletions of the same slot. The residual is deliberate and cannot
be designed away by a longer list alone: past the bound the server does
not know those bytes were deleted, and the answer degrades to `upload`,
which fails by not propagating a deletion rather than by destroying a
save. A test now names that case so the next reader meets it as a choice
rather than as an oversight.
Found by Greptile on #4674.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015B86R6sN9CZ2uAWXCB9Y3U
* Trim the retention comments back to the rule
Both were over the two-line limit, and the constant's was a six-line
design essay of exactly the kind the last round of this review already
removed from this PR. The reasoning belongs in the commit that made the
change and in the pull request, where it is.
What stays is the part the code cannot say: the trim drops the oldest,
and past the bound a device is answered `upload` rather than `delete`.
Found by Greptile on #4674.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015B86R6sN9CZ2uAWXCB9Y3U
* Name the deletion record for assets, not only saves
Unreleased, so the table can take a name that states can share later
without another migration.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Apply code-review fixes to deletion records
Record a deletion in short separate transactions so concurrent first
deletions no longer deadlock on MariaDB, hash a save that never
recorded one, keep a re-deleted version from being trimmed, scope the
negotiation's read to emptied slots, and require total_delete.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Simplify deletion records
Drop the unread deleted_at column, record from _delete_save so every
caller of it is covered, skip a record no hash could ever match, let
comparison decide delete vs upload with its reason, count actions once,
and fold the near-duplicate tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Polish the deletion record's index comment
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>