Addresses Copilot review feedback on PR #4617.
The Docker dev image's bind-mounted .git is host-owned while the
romm-dev container runs as root; git 2.35.2+ refuses that mismatch
as "dubious ownership" and rev-parse fails, so GIT_BRANCH silently
stayed null and the UI kept showing "development" in the very
workflow the mount was added for. Pass safe.directory scoped to
this one read-only invocation instead of touching global git config.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
Trunk Check failed on the PR: bandit flags importing subprocess
(B404) and invoking "git" by name instead of an absolute path
(B607), on top of the B603 shell=False call already suppressed.
Both are accepted here for the same reason B603 was: git is
resolved from PATH by design so this works across dev setups
(Docker and bare-metal alike), and the arguments are hardcoded.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
- RMenu closes when it is disabled while open, so the cover dialog's sort
menu no longer stays interactive once its results go away (Copilot).
- Both search dialogs also drop late responses once their scope is
disposed, through useIsAlive (Greptile).
- One-line invariant comments for the search sequence and the result
filter reset (Greptile).
- Object-form stub props and Partial-based fixture factories in the
dialog tests (Greptile).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
- Switching saves first uploads (or holds) SRAM progress the auto-sync
tick has not taken yet, so the save being left keeps it (Greptile).
- A save download only applies while it is still the latest pick and
the player is alive; a stale or orphaned one no longer writes the SRAM
or restarts the core (Copilot).
- LoadSaveStateDialog forwards $attrs to RDialog and gains a component
test for the confirm, the save/state routing and the States reset
(Copilot).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
- test_git_branch.py: replace the repeated cache_clear()/try/finally
ritual in every test with one autouse fixture.
- useVersionDisplay: href's no-branch fallback now reads version.value
instead of re-deriving the same "branch ?? VERSION" expression from
the raw store a second time.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
Both settings tabs held their column to a readable width but pinned it
to the left edge of the page; it now sits centered on desktop and keeps
filling the width on phones.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
get_git_branch() resolves the repo root from backend/'s parent, but
docker-compose.yml only bind-mounts ./backend, ./frontend, and
./romm_mock, so the primary documented dev workflow never had a .git
to read and GIT_BRANCH always came back None. Mount it read-only.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
- AboutDialog's links list was a static array read once at setup, so it
never picked up a later heartbeat update; made it a computed.
- useVersionDisplay's GitHub tree link blanket-encoded the branch name,
breaking "/" as a path separator (e.g. "feature/foo"); now encodes
each segment. Deduped the dev-build/branch check into one computed.
- Trimmed two over-long comments/docstrings per house style.
- Added coverage: a CalledProcessError case for get_git_branch, and a
full test file for useVersionDisplay.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
- The cover dialog keeps every toolbar control mounted and disables what
does not apply, so a search no longer collapses and regrows the
toolbar, matching the match dialog.
- MatchRomDialog drops a search left running when it closes, so the
previous ROM's results can no longer fill the next session and be
matched to the wrong game. Covered by a new test.
- RDialog's compactBody becomes bodyPadding ("default" | "compact" |
"flush"); ManageCollectionsDialog uses "flush" instead of its unscoped
body override.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
With EmulatorJS auto-sync disabled, SRAM progress only reached the
server on Save & Quit. The ribbon now shows a "Sync save" button in that
configuration. It uploads the current SRAM with a screenshot of that
moment, as the auto-sync tick does, and answers with the same synced,
held-back or "no save data yet" notices. With auto-sync on, the button
stays hidden.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
Local checkouts have no release tag, so heartbeat.SYSTEM.VERSION always
falls back to the literal string "development". Add a GIT_BRANCH field
(backend-resolved via git, display-only, not used in the version string
that also feeds outbound User-Agent headers) and use it in the About
dialog and the auth-screen VersionTag so a dev build shows the branch
being worked on instead.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDMqXzXexRgC89YxeNjn9q
- The shell passes the Load button's label as a prop, so the shared
Player no longer reads the UI version to guess which picker answers.
- The file-picker fallback after a save or state download is gone:
an arraybuffer response is always an ArrayBuffer, so it never ran.
- The picker keeps its saves and states lists in one place for the tabs
and the lists.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
- The results block keeps the body's bottom padding by not shrinking in
the scrolling flex body, so the padding copy on the results stack is
gone.
- The sort options live in useCoverFilters with the other option lists.
- Opening and closing share one reset helper, which also collapses the
filter panel on close.
- A gridThumbs test helper and a corrected RDialog inset comment.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
- The save load only points writes at the picked save once its bytes
are in the core, so a failed download leaves the running save alone.
A failed switch logs, shows an error toast and skips the restart.
- The picker opens on States every time, as documented.
- v1's Load button keeps its "Load state" label, since its picker still
lists states only.
- useSaveStateTabs returns stateCount, so the launch view drops its copy.
- The EJS_Buttons comment also holds with auto-sync off.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
Closing the dialog mid-search left `searching` set, so reopening it
for another game skipped the new search and the stale response later
filled the dialog, letting the user pick the previous game's art. Each
search now carries a sequence number that closing bumps.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
The panel starts collapsed, so it no longer needs the scrolling body;
it sits under the Filters and sort row again, without the scroll-into-view
step and the card surface.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
Loading a save or a state from the in-game picker now asks first, since
either one replaces the running game and loses unsaved progress. That
replaces the note on the Saves tab.
The ribbon labels came partly from EmulatorJS's own language files,
which miss several of RomM's locales and strings such as "Disks", and
partly from hard-coded English on RomM's buttons (Load Latest State,
Quit, Save & Quit). Every ribbon button now takes its label from
RomM's locales: built-ins through EJS_Buttons displayName, the context
menu button (which EJS_Buttons cannot relabel) through its bottom-bar
handle, and RomM's buttons through a label argument.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
- The filter panel sits at the top of the scrolling body, on the same
surface as the cover blocks, so a short screen no longer loses the
cover list to a tall toolbar. Opening it scrolls it into view.
- Provider chips, the search field icon and the other controls use the
match dialog's sizes; the chip density prop is gone.
- RDialog exposes its toolbar/footer inset as --r-dialog-inset and a
compactBody prop that pads the body with it, replacing the unscoped
body override.
- useCoverFilters no longer returns the unused hasGridResults.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
EmulatorJS's "Export save file" and "Import save file" buttons were
intercepted and did not do what their labels said. Export uploaded the
SRAM, which auto-sync already does as the game writes it. Import only
listed server saves and wrote the SRAM without restarting the game, so
the save never took effect.
Both buttons are now hidden through EJS_Buttons. The Load State button
reads "Load save or state" and opens a picker with the launch screen's
Saves / States tabs. A state applies on the fly as before. A save is
written and the game restarts so it boots from it, and the Saves tab
says so.
The two v2 select dialogs merge into LoadSaveStateDialog. The tab
badges and core compatibility move into useSaveStateTabs, shared with
the launch view.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV
- The Filters count uses RTag, as the gallery filter drawer does, instead
of a hand-built pill.
- The Filters and sort chevrons use the shared .r-chevron-toggle flip
driven by aria-expanded.
- The content switch defaults live in one object read by the refs,
resetFilters and the active count.
- Tighter comments and a plainer sort test fixture.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
- Resolution, style and uploader picks come from the loaded results, so
they reset when a new result set arrives instead of hiding covers once
their select disappears.
- The Filters count only includes the content switches while they are
rendered.
- The provider chip row no longer scrolls, which clipped the chips'
focus ring.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
- Controls live in the dialog toolbar like the match dialog: provider
chips on top, then the search field and button, with the same 10px/8px
row rhythm.
- Filters (type, resolution, style, uploader and content switches) sit
in a panel that starts collapsed, behind a Filters button that counts
the active filters.
- Sorting is a Relevance / Most votes menu button beside Filters.
- The Search button only disables while loading, provider chips match
its height, the selects share the row evenly and the metadata
providers block opens by default.
- Phones get a full-width Search button, split action buttons and
centered switches; the body inset matches the toolbar's 14px.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZKZYnWkAQoTQ6k7z7CrWT
Addresses Greptile's review of #4613:
- Write the small cover and the WebP copies in a worker thread, since
Pillow's work now scales with an animation's frames.
- Annotate the new converter fixture and the artwork test's tmp_path.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The head owns its edge-to-edge padding, band radius and inset focus ring,
so the slot and core bands stop overriding it separately and line up by
construction. Drops dead padding on the centered state card actions.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The flush head put the key and pad outline ring past the band edge, where
a scrolling parent clips it. Adds a test that a core nothing can load
starts folded and opens from its head.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The slot head gets the same bottom padding as the core head, so the first
save row starts at the same depth as the first state tile.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Simplify pass over the animated cover change:
- Encode animated small covers as WebP whatever the source, which drops
the per-format GIF/APNG blending params and makes their WebP copy a
plain file copy.
- Fold the is_animated gate into frame_durations and decode the small
cover's frames in the same pass that reads their durations.
- Write uploaded animated artwork through the atomic write_file.
- Share test fixture constants and the animation encoder, and pin the
per-frame pixel budget with a GIF whose canvas grows mid-animation.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The core group head sat inside the band's padding, so its hit area stopped
short of the band edges. It now spans the band edge to edge, with padding
that keeps the icon and title where they were, and the band inset moves to
a fold wrapper so collapsing animates the whole body.
The action buttons on managed state cards are centered.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The "+ Add" button shown above a pending file list (Upload ROMs view,
firmware tab, and the shared PendingFilesDropzone used by the upload
dialogs) was a small text button. Match the other add buttons in v2:
flat, primary, default size.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDN1KWrq9Cvjy1FT8vyNWm
Code-review pass over the animated cover change:
- Cap the pixels decoded across an animation (MAX_ANIMATION_PIXELS),
counted per frame since a GIF canvas can grow mid-animation, so an
oversized animation falls back to its first frame.
- Fall back to the first frame when a later frame fails to decode,
instead of dropping the cover or escaping the error handlers.
- Store uploaded animated artwork as uploaded, like downloaded covers.
- Re-encode composited frames so each replaces the last (no GIF/APNG
ghost trails), and keep GIF loop counts when converting to WebP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The small cover and the WebP copies were written through PIL, which keeps
only the first frame, so an animated SteamGridDB cover showed as a still
image everywhere once applied. Resize and convert every frame with its
timing, copy WebP sources instead of re-encoding them, and keep all
frames of uploaded animated artwork.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Save & Quit gives the save the frame it just captured, unless the server
already holds those bytes with their own, and the exit flush captures one
while the game still runs for a save the tick had not held yet. A game with
no SRAM no longer breaks Save & Quit: its null save threw before the quit.
- A game's held captures upload oldest first, so the newest lands last and
stays the slot's newest version.
- A pass stops as soon as the account that started it signs out, so the rest
cannot land in the next account.
- A held save the slot refuses because another device left newer progress
there is uploaded as a separate archived save instead of being dropped, and
the player is told.
- A state is held without a request while the server is down, like a save.
- Passes in two tabs no longer upload the same rows: the drain takes a Web
Lock where the browser offers one.
- The details view no longer warns about a game the route has moved away from.
- The v1 wrapper tears the emulator down through the same once-only guard.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
The simplify commit (417f00ff1) swept in another session's uncommitted work on
empty ROM uploads (backend/endpoints/roms/upload.py, its test, and
services/api/rom.ts with its test), which has since landed on master through
#4610 and #4611. Those four files take master's version here, so they leave
this PR's diff entirely.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
The sync tick re-offers a failed upload on every pass, so an outage turned into
a failing request a second for as long as it lasted.
While the connection layer knows the server is down, a write now holds its
bytes and frame and makes no request at all; the next tick after the
connection comes back hands them over. A failure from a server that did answer
(a refusal, or a 5xx before the outage is noticed, or the v1 shell, which runs
no connection probe) spaces the retries out from 2s to 30s instead, and that
wait starts over once an upload lands or the connection returns.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
The notices the player raises in game are translated in every locale. Quick
load also stops saying it came from the server: it reads the browser's own
quick slot.
A save or state the server did not take was announced as kept in this browser
whether or not IndexedDB took it, so a private window promised a later sync
that would never come. The store now reports whether a write stuck, and when
it did not the player hears that the asset could neither sync nor be kept.
Less work behind the queue:
- The questions only about what an account still owes (the details view and
the shell's 30s pass) walk an owner index of keys and no longer deserialize
every held save, state and frame to read two fields.
- A pass loads its rows one at a time rather than every blob at once.
- A row stores the rom's file stem and cover when it is captured, so a retry
no longer fetches the full rom first; an older row without them still does.
Restoring the volume after a state no longer relies on the order in which
EmulatorJS persists its setting, which the nightly build used for netplay may
not share: the player's level and mute are written back explicitly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
review-polish.
Comments over two lines of prose are cut to one or two, comparisons with the
alternative not taken are dropped, and so is a test comment citing #4610, an
unrelated upload PR. The helper that covers the screen, mutes and gates writes
while a state lands is renamed after all three, and a comment still naming the
store's old module reads the check it describes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
simplify findings (reuse, simplification, efficiency, altitude).
Behaviour it fixes along the way:
- A state load held back the screen and the sound but not the writes, and
dumping the SRAM for the new baseline fires a tick of its own: a tick that
had already read the restored SRAM found it stable and changed, and uploaded
the restore before the baseline landed. A state now closes the same write
gate a save load does, and quick load goes through the same window.
- Save & Quit rewrote the held row without the frame the tick had stored. The
write now owns which frame goes with the bytes it is given, so no caller can
pass the wrong one, and it does not write out again bytes already held.
- A save whose first capture failed took a new screenshot on every retry.
- The shell kept polling the store every 30s while offline, and in game kept
a timer armed for a save only the running session would hand over.
- A store upgrade wiped every row, which after release would drop users'
unsynced progress. It now keeps them and only drops stores it stopped using.
Reuse and one home per rule:
- The save, state and screenshot files are built by the API modules for both
the live uploads and the retries.
- The core compatibility rule is shared by the launch screen and the in-game
picker.
- The banner uses useDelayedFlag, the toast host useEventListener, the retry
refresh useRomSync().refetchRom, the refusal text errorMessage(), and the
player's notices useSnackbar.
- The ledger of rows the server took is read in list() alone, and the retry
judges a refused upload and a failed request in one place.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QTsTgdoBinvvxzXeLUjBmV
Addresses the Copilot review on #4610. /start accepted a zero-byte file
declaring chunks, which then took chunk uploads and failed at assembly
on the size check. Zero chunks and zero bytes now have to go together,
both ways, and a parametrized test covers each mismatch.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018mKNYZbuF4aMns81Cptvxc