Commit Graph

13563 Commits

Author SHA1 Message Date
Georges-Antoine Assi
9b9217ceae Merge pull request #4974 from LoneAngelFayt/fix/streaming-desktop-pad-nav
fix(streaming): let the desktop session own the controller
2026-10-01 09:09:04 -04:00
Georges-Antoine Assi
1f2abb6974 Merge pull request #4971 from andest01/fix/wcag-aa-misc-fixes
chore(wcag): AA misc fixes
2026-10-01 08:36:12 -04:00
Georges-Antoine Assi
c6fd1bd130 fix(confirm): open confirm dialogs on Cancel
ConfirmDialog focused Cancel on the next tick, but RDialog's own initial focus
ran after it and landed on the header's close button. Mark Cancel autofocus,
which RDialog already prefers, so a stray A or Enter cancels as intended.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 07:54:24 -04:00
Georges-Antoine Assi
77cf9f6cb0 fix(a11y): floor aria-valuenow so progress bars never announce 100 early
Addresses Greptile's review on #4971: rounding reported 100 at 99.6%.
Flooring keeps the value a whole number.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-01 07:16:32 -04:00
Georges-Antoine Assi
cfbf78d7c8 Move through the gallery grid with Home, End and the page keys
Home and End go to the ends of the row, and with Ctrl to the first and
last item of the grid. A row of one cell (list view) has nowhere to go
inside it, so there Home and End move through the grid too. PageUp and
PageDown move about one viewport of rows, keeping the column. The
gallery and Missing games scroll the virtualised list to the edge row
and wait for it to load before focusing it.

The list row's click, Space and context-menu handlers move onto its
name link, which already takes every click on the row, so the row
element carries no handlers of its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 23:12:31 -04:00
Georges-Antoine Assi
23fe4e7c12 refactor(player): drive the playing flag through usePlayingWhile
Pico8, Ruffle, JsDos and EmulatorJS each set and cleared the flag by hand next
to gameRunning, with their own unmount resets. Each now mirrors gameRunning
through usePlayingWhile, which clears the flag on dispose. JsDos hands input
back at unmount rather than in teardown; every exit from a running JsDos
replaces the document, so the difference is not observable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 23:03:50 -04:00
Georges-Antoine Assi
a00b0cb0cb fix(input): move focus by arrow and D-pad inside open overlays
Spatial nav used to bail whenever an overlay was open, and no dialog moves
focus on arrows, so a pad could only reach a dialog's first control:
ConfirmDialog's Confirm was unreachable app-wide. It now moves focus among the
controls of the topmost overlay's panel, including a dialog over a running
game, which replaces Stream's own exit-dialog arrow handler.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 23:03:47 -04:00
Georges-Antoine Assi
d6d98ebdfa Make the gallery an ARIA grid
The gallery's rows now form a role="grid" with aria-multiselectable,
aria-rowcount and aria-rowindex. Each card sits in a gridcell carrying
aria-selected; in list view each row is a role="row" of gridcells
with aria-selected, under a header row of columnheaders that carry
aria-sort. Letter headings are rowheaders and skeleton rows are hidden.

RVirtualScroller gains bodyAttrs and a #head slot so the grid can own
the list header row without the toolbar above it. The list row's root
is now a div, and its name is the link, stretched over the row so a
click anywhere still opens the game.

useGridNav gains a roving mode that keeps a single tab stop in the
grid, including for rows mounted while scrolling. Space selects the
focused card or row and Shift+Space selects a range. This replaces the
Selected/Not selected description, whose strings are removed.

The Missing games list gets the same grid semantics and arrow keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 22:49:22 -04:00
Georges-Antoine Assi
0d549b4888 docs(streaming): humanizer pass on the exit chord comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 22:47:31 -04:00
dependabot[bot]
acafe37287 chore(deps): bump tornado from 6.5.8 to 6.5.9 (#4985) 2026-09-30 22:46:20 -04:00
Georges-Antoine Assi
647bc61491 refactor(streaming): simplify pass on the exit chord move
Share one flag-mirror helper between useStageActive and usePlayingWhile, add a
deferred() test helper for Desktop's hand-answered calls, and note that players
opt into the pad exit by listening for gamepad:exitchord.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 22:45:54 -04:00
Sam Dornan
a31136cd21 Keep the FULLTEXT index on searches with short words or stopwords (#4970) 2026-09-30 22:45:44 -04:00
Georges-Antoine Assi
acfa9d97b3 fix(streaming): code-review pass on the exit chord move
Release a desktop claim still held at unmount, mark an unstarted chord hold
with null rather than 0, and cover the Stream listener, the held-through-close
latch, and escape-stack cleanup in tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 22:44:13 -04:00
Georges-Antoine Assi
d3792142ab refactor(gamepad): detect the exit chord in useGamepad's frame loop
Drops the separate 100ms useExitChord poller. useGamepad already reads every
pad each frame and knows when the game owns input, so it now fires a
gamepad:exitchord window event after a 1.5s Select+Start hold, only while
playing with no overlay open. Stream and Desktop listen for it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 22:32:56 -04:00
Sam Dornan
76a14954da docs: recommend pytest-xdist for local backend test runs (#4983) 2026-09-30 22:06:00 -04:00
Sam Dornan
b5b0de02ab fix(tests): give each event loop its own fake async Redis client (#4979) 2026-09-30 21:36:38 -04:00
Georges-Antoine Assi
0f5f4e09ad Make gallery selection keyboard and screen reader friendly
The card and list row stay links. While the gallery is selecting they
describe their state (Selected / Not selected), Space toggles them, and
aria-keyshortcuts names the Ctrl/Cmd+Enter gesture that starts selecting.

The checkbox drawn on each item is now decorative: RCheckbox gains a
decorative mode that renders the box without an input or label, so it
is no longer a hidden tab stop or interactive content inside a link.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 21:20:11 -04:00
Georges-Antoine Assi
3aba36d18b pr-ready: humanizer pass on comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 20:35:30 -04:00
Georges-Antoine Assi
380017b9fa pr-ready: apply simplify cleanups
Collapse the pair shells' footer into one flex row like AuthLayout's,
and name the list row's title and checkbox label once.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 20:31:15 -04:00
Georges-Antoine Assi
554ddeffcc pr-ready: apply code-review fixes
Keep the pair shells' footer out of the grid flow, label the bottom nav
landmark, name list-row checkboxes, reveal a keyboard-focused card
checkbox, drop aria-pressed from static cards that are not toggles, and
round the circular progressbar's aria-valuenow.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 20:28:32 -04:00
Sam Dornan
6cf38d6d25 fix(tools): make generate_test_data work on PostgreSQL (#4978) 2026-09-30 20:06:29 -04:00
Sam Dornan
5d93201874 feat(search): rank multi-word searches by phrase on PostgreSQL (#4977) 2026-09-30 20:05:43 -04:00
Sam Dornan
fb553b3409 refactor(db): escape LIKE searches with SQLAlchemy's autoescape (#4976) 2026-09-30 20:02:19 -04:00
Sam Dornan
fed6fc9172 refactor(db): follow-ups to the derived-state fixes (#4969) 2026-09-30 19:00:30 -04:00
Sam Dornan
6941de13db Remove unused code and deduplicate copied helpers (#4975) 2026-09-30 18:51:36 -04:00
Zach Clendenen
a2948ee280 fix(streaming): address Greptile review on the desktop pad handoff
Require a release before a held Select+Start can fire again, so cancelling
the exit dialog with the chord still held no longer reopens it. Guard the
late desktop claim with useIsAlive instead of a local unmount flag.
2026-09-30 17:24:31 -05:00
Zach Clendenen
67f1d73d3f docs(streaming): review-polish pass on the desktop pad handoff
Trim the new comments on useExitChord, usePlayingWhile and the desktop
view to the one fact each needs.
2026-09-30 16:37:09 -05:00
Zach Clendenen
4675b87f03 refactor(streaming): simplify pass on the desktop pad handoff
Add usePlayingWhile next to useStageActive so both stream views mirror
their session into the playing flag, and clear it on dispose, through one
helper instead of a hand-wired watch and unmount reset each.

useExitChord reads the shared PAD_BUTTON names and skips disconnected
phantom pads via isUsablePad. A late desktop claim goes back through
release() rather than a second hand-written release call, and the desktop
tests share one claim fixture and release assertion.
2026-09-30 16:32:49 -05:00
Zach Clendenen
28fbeb8c04 fix(streaming): code-review pass on the desktop pad handoff
With useGamepad muted for the whole desktop session, B no longer reached
the exit confirmation, leaving a pad-only admin with no way out. Move the
player's Select+Start hold into a useExitChord composable and use it in
both views, including while the claim is loading.

A claim that answers after the view has gone is now released straight
away instead of standing unrenewed until it goes stale. Tests cover the
flag while loading, the drop on exit, the exit hold and the late claim.
2026-09-30 16:19:32 -05:00
Georges-Antoine Assi
1bcc1401ad Merge pull request #4963 from rommapp/chore/renovate-hold-typescript-7
chore(deps): update typescript to 6.0.3 and hold below 7
2026-09-30 17:18:00 -04:00
Zach Clendenen
36cd73762d fix(streaming): let the desktop session own the controller
The desktop view never set the global playing flag, so useGamepad kept
translating pad presses into RomM navigation behind the stream: B popped
history (prompting to end the session), the D-pad moved focus and Start
opened the user menu while an admin configured the emulator. Hold the flag
while the desktop is opening or open, as the game player does.
2026-09-30 16:06:12 -05:00
Georges-Antoine Assi
ce980b677f Merge pull request #4957 from beemines/feat/configurable-cleanup-schedules
feat: make netplay and upload cleanup schedules configurable
2026-09-30 16:48:05 -04:00
Georges-Antoine Assi
8be4802e26 Make ZIP cache and sync session cleanup schedules configurable
Adds ENABLE_SCHEDULED_CLEANUP_ZIP_CACHE, SCHEDULED_CLEANUP_ZIP_CACHE_CRON,
ENABLE_SCHEDULED_CLEANUP_SYNC_SESSIONS and SCHEDULED_CLEANUP_SYNC_SESSIONS_CRON,
defaulting to the previous hardcoded behavior.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 16:32:50 -04:00
Georges-Antoine Assi
640e8eb96b Skip scheduled tasks whose cron expression is invalid
rq only parses the cron when the scheduler loads it, then logs and drops
the job while cron_config had already logged it as scheduled. Validate it
up front and log an error instead. croniter was a transitive rq dependency
and is now declared directly, with its typeshed stubs for mypy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 16:32:49 -04:00
Georges-Antoine Assi
ef99d147fc pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 16:20:45 -04:00
Georges-Antoine Assi
7fc4722c23 pr-ready: code-review fixes
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 16:18:19 -04:00
Georges-Antoine Assi
360f73e84a Merge pull request #4956 from beemines/feat/play-sessions-all-devices
feat: read play sessions across devices and page sync sessions
2026-09-30 16:00:34 -04:00
Georges-Antoine Assi
76012dafca Read play sessions across devices without a token fallback
GET /api/play-sessions no longer narrows to the token's device when
device_id is omitted, so the all_devices flag is dropped. Reading anything
beyond the token's own device now requires devices.read, matching the
saves and device endpoints. GET /api/sync/sessions takes the shared
PageParams and gains offset paging.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 15:45:23 -04:00
Georges-Antoine Assi
71a1962f69 pr-ready: review-polish
Type the paging test parameter so mypy passes over backend/tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 15:38:29 -04:00
Georges-Antoine Assi
1a607bd2c5 pr-ready: simplify
Reuse the shared PageParams for limit/offset, build device tokens through
tests.factories.make_device_token (the add_device_token fixture is gone on
master), and flatten the effective device_id expression.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 15:37:23 -04:00
Georges-Antoine Assi
20226b52aa Merge remote-tracking branch 'origin/master' into pr-ready/13b801b03 2026-09-30 15:36:04 -04:00
Georges-Antoine Assi
2ccfde2f92 pr-ready: code-review fixes
Bound limit/offset at 0 so negative paging returns 422 instead of a 500,
use the Annotated Query style for all_devices, clarify that the flag only
affects device-bound tokens, and cover the omitted-flag default.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 15:34:16 -04:00
Georges-Antoine Assi
ec097ea7e9 Merge pull request #4955 from andest01/fix/dark-mode-wcag-aa
fix(a11y): dark mode typography is WCAG AA safe
2026-09-30 15:23:25 -04:00
Georges-Antoine Assi
5a41e34363 Merge pull request #4953 from rommapp/fix/emulatorjs-player-fixes
fix(player): EmulatorJS multi-disk boot, Safari fullscreen quit, sparse gamepads, netplay audio, mame2003_plus default
2026-09-30 15:16:02 -04:00
Sam Dornan
79fbce6beb test(backend): build test rows through shared factories and enforce them with ruff (#4972)
* test(backend): build test ROMs through one make_rom factory

Tests created Rom rows by hand in dozens of places, each spelling out the
same slug and filename fields and deriving the slug inline. Production never
computes a slug from a name, so this was test-only filler duplicated across
files.

tests/factories.py adds make_rom(platform, name, *, fs_stem, fs_extension,
**overrides), which fills the slug and filename columns and persists through
db_rom_handler.add_rom. The shared conftest fixtures, scan_stubs.add_rom and
the local helpers and inline constructors across 35 test files now use it.
Each test keeps its filename shape (underscored stems in the FULLTEXT search
tests, spaced "Name (USA)" stems in the sibling tests), and fixtures shared
across files keep their exact slugs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(backend): keep extensionless filenames intact in scan_stubs.add_rom

rpartition(".") on a name with no dot returned an empty stem and the whole
name as the extension, so make_rom stored ".README" for "README".
os.path.splitext leaves such names whole.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(backend): build test saves, states and screenshots through factories

Tests built Save, State and Screenshot rows by hand across about 20 files,
each spelling out file_name_no_tags, file_name_no_ext and file_extension
although BaseAsset already derives them from file_name.

tests/factories.py adds make_save, make_state and make_screenshot. Each sets
the rom and user ids, the file name, and a default file_path under the rom's
platform, applies overrides last, and persists through the matching db
handler. The conftest asset fixtures and the persisted constructors and local
helpers now use them. Rows a test observes keep their file_path, emulator,
slot, size and hash, and a filename part stays an override wherever it
differs from what the model derives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(backend): ban direct add_* persistence in tests via ruff TID251

The factories only stay the one home for test rows if nothing routes
around them. Ruff's banned-api rule now flags db_rom_handler.add_rom,
db_save_handler.add_save, db_state_handler.add_state and
db_screenshot_handler.add_screenshot anywhere under tests/ except
tests/factories.py. Production code is unaffected.

The remaining add_rom calls move onto make_rom: the unique-path, soundtrack
and id-index tests in test_roms_handler.py, the scan tests in
test_fastapi.py, physical and missing rows in the feed, download and model
tests, and the name=None exporter rows. Scan tests keep a filename-derived
placeholder as the name, which scan_rom treats the same as no name. Three
calls keep a noqa: the tests of how add_rom merges a partial scanned row,
and the rescan test that persists scan_rom's output as a scan does.

The backend skill and the architecture doc now point at tests/factories.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(backend): move the firmware and client-token factories into tests/factories.py

The add_firmware and add_device_token conftest fixtures returned a builder,
unlike the importable make_* functions. They become make_firmware and
make_device_token alongside them, with the same defaults, and their callers
import them rather than requesting a fixture. make_device_token now draws the
raw credential from auth_handler.generate_client_token, so it carries the
real rmm_ prefix instead of restating it, and the hand-built client tokens in
the auth tests use it too.

The ruff TID251 ban now also covers db_firmware_handler.add_firmware and
db_client_token_handler.add_token under tests/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: point at every test factory, not just the ROM and asset ones

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 14:01:56 -05:00
Sam Dornan
5f50afa123 Search the gallery by providers' alternative titles (#4941)
* Search the gallery by providers' alternative titles

A search for "FF9" or "Final Fantasy 9" did not find "Final Fantasy IX":
the gallery search only matched roms.name and roms.fs_name, while the
alternative titles IGDB, MobyGames and ScreenScraper report lived in the
raw metadata blobs where no index reaches.

Add generated_search_aliases, a STORED generated column the engine fills
from those blobs, so every write path (scans, metadata refreshes, the
bulk update_rom, raw metadata edits) keeps it current with no backfill.
Migration 0145 rebuilds the MariaDB/MySQL FULLTEXT index over
(name, fs_name, aliases) and adds a pg_trgm GIN index on PostgreSQL, and
the search matches the column on both paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy

* Compare the alias JSON type under the table's collation

On a utf8mb3_unicode_ci table, JSON_TYPE's result and the 'ARRAY'
literal carry different collations, so creating the generated column
failed with an illegal mix. CAST re-derives it, as _maria_text does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy

* pr-ready step 2 (code-review): defer the alias column, share search columns

Loading a ROM no longer fetches generated_search_aliases, which only the
gallery search reads. The FULLTEXT match and the ILIKE fallback both take
their columns from one ROM_SEARCH_COLUMNS tuple.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy

* pr-ready step 3 (simplify): register the search indexes, share the CAST

Both search indexes join the generated-column index registry, so any
later rebuild of the alias column puts them back instead of leaving
MariaDB's FULLTEXT index narrowed (and every MATCH failing) or the
PostgreSQL trgm index gone. 0145 shrinks to ensure_roms_columns plus
retiring 0084's index, and its downgrade guards DROP COLUMN with
has_column, since MySQL has no DROP COLUMN IF EXISTS.

_maria_char carries the collation CAST that _maria_text and the alias
expression share, the alias expression extracts each array twice
instead of three times, and the dialect test runs the handler's own
_fulltext_match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy

* Store the search aliases as plain titles

The alias column held each provider's array as JSON text, so a short
ILIKE search for '"', ',' or '[' matched every ROM with any alias. Both
engines print an array as ["a", "b"] however it was stored, so the
expression strips the brackets and quotes and keeps the titles
separated by spaces, which search terms can never match on their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy

* Shorten the alias-search docstrings to one sentence

The migration and test-module docstrings explained the design in
several paragraphs; AGENTS.md asks for one sentence. The design notes
live in the PR description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A62FTdVyav4wK5Nkj55MGy

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-09-30 13:16:13 -05:00
Stuart Anderson
6c8a968f4f fix(a11y): add selectable to storybook 2026-09-30 11:50:35 -05:00
Stuart Anderson
9ae3680a94 fix(a11y): group the pair page's corner controls in a footer
The language selector and version tag sat outside the page's <main>
with no landmark around them (axe region). A plain <footer> gives them
one; both stay absolutely positioned against the shell, so the layout
is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 11:40:15 -05:00
Stuart Anderson
19bb525e5b fix(a11y): stop nesting a second <main> in the jukebox home view
Like the browse view, this view renders inside the app layout's
<main>, so its own <main> duplicated the main landmark on /music. A div
keeps the same layout without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 11:40:09 -05:00
Stuart Anderson
ed5804f0e3 fix(a11y): stop nesting a second <main> in the jukebox browse view
The view renders inside the app layout's <main>, so its own <main>
nested one main landmark in another (axe landmark-main-is-top-level
and landmark-no-duplicate-main on /music). A div keeps the same layout
without the duplicate landmark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 11:40:03 -05:00