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
A zero-byte file splits into zero chunks, and the chunked upload start
endpoint required at least one byte and one chunk, so it answered 422
before the upload began. An empty file now starts with zero chunks and
goes straight to /complete, which writes it empty. A non-empty file
declaring zero chunks is still refused.
The upload store only marks a file finished from chunk progress, so an
empty file is marked done explicitly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ZaRofXECKT5Jom48cLeav
* fix(v2): drop the box behind platform icons in the list row
The thumb carried `background: var(--r-color-surface)` and a
`--r-list-cover-w` sizing, left over from when the row copied the game
list's cover slot. Platform art is a transparent square logo, so the
surface painted a soft box behind every icon, most visible on the
platforms whose art does not reach the edges of its own viewBox.
The token is defined nowhere: `tokens/index.ts` retired the dedicated
list-cover token in favour of `cardArtWidthXs / HeightXs` feeding
`<GameCard size="xs" />`. Both declarations were therefore already
invalid at computed-value time, so the layout is unchanged and only the
background and radius go away.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Update frontend/src/v2/components/Platforms/PlatformListRow.vue
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* docs(v2): correct the platform row docstring's stale thumb description
It claimed the thumb was an RPlatformIcon at the 48px cover-slot scale. The
icon is 40px, and the cover-slot framing is what this branch removed, so the
parenthetical goes rather than restating the prop's value.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
The list view sized its cover column from the widest cover ratio measured
so far, but ratios only arrive once the covers load, so the column started
at the 48px fallback and jumped mid-load, dragging the title column with
it. Size it from the row's art cap instead, which no cover can exceed.
The two placeholder rows also disagreed on the gap between the title bars
(4px vs 2px), so the bars moved the moment the bootstrap skeleton handed
over to the pending rows. Both now build that cell from one spec, and the
parity test compares the whole cell rather than the bar sizes alone.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* test(backend): stop the suite emitting warnings
The backend suite reported 4838 warnings. Three sources, all now clear:
- 18 uses of the deprecated HTTP_422_UNPROCESSABLE_ENTITY, renamed to
HTTP_422_UNPROCESSABLE_CONTENT.
- Unawaited coroutines in the streaming and scan tests. A bare MagicMock
drops the coroutine handed to spawn_sync_task, and a bare AsyncMock's
return_value is itself an AsyncMock, so the to_dict() call on it leaked
out of the scan handler.
- About 4780 from sentry-sdk 2.32 and opentelemetry 1.36 calling
asyncio.iscoroutinefunction, which Python 3.14 deprecates and 3.16
removes. Bumping both in the lock clears them.
The remaining starlette warning wants httpx2 in place of the httpx 0.27 the
metadata providers pin, so it is filtered rather than fixed: a second HTTP
stack for the test client is a larger change than the warning justifies.
4815 passed, 2 skipped, 0 warnings.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(backend): address review on the warning fixes
Greptile flagged the pytest.ini rationale as over the two-line comment limit,
and the new scan fake as untyped. Both fixed: the filter comment is one
non-obvious fact, and the fake now takes `scan_stats` as a typed keyword-only
parameter, which is a real contract rather than `**kwargs`.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Nothing changes size because the input is a touchscreen rather than a
mouse: the match rom provider chips size off the breakpoint, and so do
the screenshot actions and the soundtrack heart, which used to be
revealed by modality because touch has no hover.
Hover itself is no longer split between mouse and touch, and a row the
gamepad highlights now lights up the same way hover does. Modality still
gates focus rings and pad focus competing with a parked cursor.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
The layout switcher moves up to the header, the one row that doesn't
reflow as the filters or the search state change. The filter label is
gone and the provider chips are one scrolling row, smaller on phones so
all of them fit; the search button keeps its own full-width row.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
Option subtitles no longer size the menu: they take the width set by the
field and the titles and wrap, so the scan type menu in refresh metadata
matches its field on phones.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
Adds a skill for reading Greptile's synthesized knowledge base through its
MCP server (lookup flow, search and truncation limits, verifying claims
against the checkout, fallbacks when the tools are missing) and lists it
in CLAUDE.md.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
`GET /api/roms/{id}/files` 500'd on its success path: `RomFileSchema` reads
`is_top_level`, which needs `file.rom`, and `get_rom_file_by_id` only loaded
`track_meta` and `doc_meta`. Validation happens after `begin_session` closes,
so the lazy load raised `DetachedInstanceError`. The parent rom now comes
along in the same load, narrowed to the columns `Rom.full_path` needs.
`last_modified` is nullable in the column but was required in the schema, so
a row added outside a scan validated to nothing. It is now nullable to match,
and the regenerated frontend type follows.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
- Route tab and subtab writes through patchQuery.
- Keep the CRT/reduced-motion rule inside useCrtMode: reduced motion hides
CRT without erasing the saved choice, and turning CRT on turns it off.
- Reuse the global asset fade on Home's empty library.
- useLoadingPhase: refAutoReset for the skeleton hold, drop the unused delay
parameter.
- One computed per empty state in Streaming and platform stats; drop RTable's
unused empty slot.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
* perf(backend): resolve roms without the related load in the file and props routes
Eleven routes opened with `get_rom(id)` to reach two scalars: `id` for the
404 and `id` plus `platform_id` for `assert_rom_visible`. `get_rom` runs the
whole `with_details` eager load, so each request paid for the platform,
files, metadata, saves, states, screenshots, rom_users, siblings,
collections and notes of the rom. The bulk delete was worse: it ran inside a
per-id loop, so an N-id delete ran the graph N times.
Three narrow projections replace it, alongside the `get_rom_visibility` that
#4587 added for the rom-note routes:
`get_rom_visibility` id, platform_id
`get_rom_visibility_label` the above plus the name pair the file-delete
log lines print
`get_rom_deletion_target` the above plus fs_path and the joined platform
label the bulk delete logs when a rom's file is
already missing from disk
`assert_rom_visible` accepts either narrow row as well as a full `Rom`, so
the check itself is unchanged for every other caller.
Statement counts per request, captured with the `executed_statements`
fixture in `tests/endpoints/roms/test_visibility_loads.py`:
PUT /api/roms/{id}/props 19 -> 9
GET /api/roms/{id}/soundtracks/metadata 15 -> 5
GET /api/roms/{rom_id}/files/{file_id}/progress 20 -> 8
DELETE manuals / walkthroughs / screenshots /
soundtracks files 20 -> 8 each
DELETE /api/roms/{rom_id}/files/{file_id} 20 -> 8
GET /api/roms/{id}/files (hidden 404) 25 -> 13
GET /api/roms/{id}/files/content/{name} 25 -> 13
POST /api/roms/delete, 1 id 16 -> 6
POST /api/roms/delete, 5 ids 64 -> 14
The marginal cost of each extra id in a bulk delete falls from 12 statements
to 2.
The upload handlers on the same routers are left alone: `receive_rom_file`
hands the rom to `prepare_upload_destination`, so they need the full entity.
`Rom.fs_resources_path` moves its format string into a module-level function
so `RomDeletionTarget` can compute the same value.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(backend): trim the change rationale out of the new docstrings
Greptile flagged the module docstring in the new test file, `_rom_lookup` and
`RomDeletionTarget` for carrying the reasoning behind the change rather than
describing what the code does. The rationale lives in the commit message and
the PR body, so the docstrings keep only the one sentence a reader needs.
The `assert_rom_visible` docstring loses the paragraph added alongside the
widened type union, which restated what the signature already shows.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(roms): share one rom factory in the visibility-load guard
Step 3 of the pr-ready gauntlet (simplify). The bulk-delete test built its
three roms from an inline `Rom(...)` literal; `test_random.py` already keeps a
module-local `_add_rom(platform, name)` for exactly this, so the guard grows
the same helper instead of a second copy of the field list.
`_flat` had one caller, so it folds into `_rom_lookup`.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
- Drop ?note= along with ?subtab= on tab switch; remove NotesTab's dead watcher.
- Hold Home's empty library while a shared store fetch is still in flight.
- Start RTable's entrance timer once rows actually paint.
- Keep the Jukebox error title through a retry.
- Restore the streaming loading block's own styles.
- Trim new comments, stop test effect scopes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
- REmptyState replaces the duplicate shared EmptyState and the hand-rolled
empty blocks; it gains a plain variant for framed surfaces (RTable).
- Missing games/firmware render it outside their list frame, matching
Excluded, and pair a pill count with the round kebab.
- useLoadingPhase only paints a skeleton when a load outlasts 200ms, holds
it for 300ms, and keeps the settled view through a quick refetch. Applied
to RTable, the Missing sections, Home, the platform/collection indexes,
Activity, the Jukebox sidebar and the soundtrack queue.
- RBtn's loading debounce moves to the shared useDelayedFlag.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
Reduced motion collapses every animation to one near-instant pass, which
breaks the CRT overlay. Turning either on now turns the other off, and a
device with both saved on keeps reduced motion.
Fixes#4562
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
The route crossfade snapshot showed through the transparent scrollbar
track, blurred background art included, and swallowed the thumb. Give
the v2 page scrollbar an opaque track.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
The per-tab cleanup watchers never fired: the tab unmounted before the
route replace landed. GameDetails now drops ?subtab= in the same replace
that switches tabs, and useSubtabQuery only reads a subtab that belongs
to its own tab.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ
* fix(collections): project identifier columns instead of loading whole collections
`GET /api/collections/identifiers` reads only ids, owners and visibility, but
the accessor it called eagerly loaded every rom of every collection
(`@with_roms`) and built a full `User` per row (`Collection.user` is
`lazy="joined"`). A column projection drops both, while `load_only` cannot
cancel either one.
Measured on a seeded database of 100 collections and 200 roms (20,000
memberships): rows read 20,100 to 100, statements 2 to 1, SQL text 1,172 to
113 bytes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(collections): keep the new identifier assertions to one-line comments
The repo caps comments at one line when the rationale is not recoverable
from the code, and test docstrings at one sentence, so the m2m reasoning
belongs in the PR body rather than repeated at the call sites.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* perf(backend): check rom-note visibility without the related load
The five `/api/roms/{id}/notes*` routes each opened with `get_rom(id)` to
reach two scalars: `id` for the 404 and `id` plus `platform_id` for
`assert_rom_visible`. `get_rom` runs the whole `with_details` eager load, so
every note read or write paid for the platform, files, metadata, saves,
states, screenshots, rom_users, siblings, collections and notes of the rom,
about 12 statements.
`DBRomsHandler.get_rom_visibility` selects those two columns and nothing
else, and `assert_rom_visible` now takes the `RomVisibility` row it returns
as well as a full `Rom`, so no other caller of the check changes.
Measured on a 3,000-rom library with 300 notes on the target rom, one admin
request:
GET /api/roms/{id}/notes/identifiers 17 statements / 30,059 bytes -> 5 / 8,066
POST /api/roms/{id}/notes 17 statements / 23,209 bytes -> 5 / 1,216
The server-side `Questions` delta per request falls from 33 to 21.
The `executed_statements` fixture moves to `tests/conftest.py` so the new
endpoint tests can use it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(roms): match the rom lookup across dialects
The notes-load guard pinned the exact SQL text of the visibility lookup,
including MariaDB's `?` bind placeholder. psycopg renders the same query
as `%(id_1)s::INTEGER`, so the assertion could never match on the
PostgreSQL leg of the CI matrix and all three tests would have failed
there. Compare a dialect-independent prefix instead.
Step 2 of the pr-ready gauntlet: correctness fix plus the comment and
docstring trims it flagged.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test: drop the second copy of the statement-capture fixture
`test_released_days.py` carried its own `captured_sql`, the same
before_cursor_execute listener the notes-load guard now shares as
`executed_statements` from tests/conftest.py. Point that file at the
shared fixture and drop the now-unused imports.
Step 3 of the pr-ready gauntlet: reuse and simplification fixes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test: name the notes auth helper as the other endpoint tests do
Seven endpoint test modules already define `_auth` for the bearer header;
this file introduced a third name for the same one-liner.
Step 4 of the pr-ready gauntlet: review-polish consistency pass, after
trunk fmt and the affected-suite run.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
`UserNoteSchema.username` was validated straight off the `RomNote` row, which
has no such column, so `GET /roms/{id}/notes` raised a ValidationError on any
rom carrying at least one note. The create/update routes dodged it by filling
the author fields from the request user.
Move the mapping into `UserNoteSchema.from_rom_note`, which takes the author
off the `user` relationship the note query already joins, and reuse it for the
list route and `DetailedRomSchema` (where the same mapping was inlined).
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* fix(backend): project the identifier endpoints onto the id column
The `/identifiers` routes for saves, states, firmware, platforms, smart
collections and rom notes each asked their handler for entities with
`only_fields=[Model.id]`. `load_only` narrows the selected columns but does
not cancel an eager relationship, so a `lazy="joined"` join still fired and a
full entity was still built for every row. The platforms route was the worst
of the six: `with_firmware` eager-loads every firmware row and its platform,
and `load_only` does not cancel that either.
Each handler grows a small query builder shared by its existing accessor and a
new `*_ids` accessor that projects onto the id column with
`with_only_columns`, which drops the entity and with it the eager joins. The
firmware accessor already applied `noload`, so its SQL is unchanged; it moves
to the projection only to stop building rows.
`/api/users/identifiers` and the two `/collections` callers that use more than
an id are left alone, because nothing eager fires for them.
The `executed_statements` fixture moves to `tests/conftest.py` so the new
endpoint tests can use it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* Update backend/tests/endpoints/test_identifier_endpoints.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* style(backend): drop the leading blank line black rejects
Removing the module docstring in the GitHub edit left an empty first line,
which is the only thing black wanted to change.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* test(backend): drive the note-identifier test through the endpoint
Greptile flagged the handler-level test for bypassing the route's auth,
404, and visibility checks. It now issues the request the frontend would
and asserts the id-only projection holds among the route's own reads.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* refactor(backend): fold the duplicate SQL-capture fixtures into the shared one
Step 3 of the PR-ready gauntlet (simplify). The shared
`executed_statements` fixture gains the two roms test files that still
declared byte-identical local copies, and the id-only assertions share one
statement parser instead of two.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(backend): tighten the get_platform_ids docstring to one line
Step 4 of the PR-ready gauntlet (review-polish).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Addresses Copilot's review note: the pause only watched the game stage, so a
desktop window narrowed to phone width while a game ran kept playing with the
top-bar controls hidden.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
Vue compiles `:global(X) .foo` to plain `X`, so the Collections light-theme
tweaks tinted the whole app and the reduced-motion rules for the nav bar and
covers styled <html> instead. Plain descendant selectors keep them scoped.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
Read the queue position from the store's currentIndex, drop the play button
radius rules RBtn's inline radius always overrode, bind the vertical slider's
pointer listeners only when vertical, hide the reduced-motion stream glow with
display: none, and trim the long component headers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
Tighten the tabs-to-toolbar gap, show only the icon and number in the
Missing Games counter, stretch both Missing counters to the toolbar height,
and give Missing Games and Excluded the same empty card as Missing Firmware.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
RMenu's click-outside check no longer keeps its own registry of child
panels. Every open overlay already sits on the shared escape stack with a
panel getter, in open order, so a new `isInsideEscapableAbove` helper
answers "is this press inside something opened above me?" for nested
menus, and for dialogs or drawers opened from a menu too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
RMenuItem links to the page already on screen now take their hover look,
so the user menu shows which settings section is open. That matters on
phones, where the settings sidebar that carries the same cue is hidden.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
The tokens view added its own bottom margin to the search field on top of
the section stack's gap, leaving twice the space the Users and Permission
Groups tabs use. The margin goes, along with an unused header rule.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
- usePlaybackTime advances the playing position every frame from the
audio's coarse time reports, so the progress bar and the pill's ring
move continuously instead of in steps.
- SeekBar is the shared timeline for the soundtrack panel and the mini
player card: elapsed time, a scrubber and the duration. While dragging
it follows the finger rather than the playback clock, and only it
re-renders per frame, not the whole panel or card.
- RSlider gains a `scrubber` look (with a story): a thin track with no
thumb at rest that thickens and shows a solid thumb on hover, keyboard
focus or drag, which sets the progress bar apart from volume.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
Touch browsers do not drag a rotated range input, so once the vertical
slider claimed touch gestures neither the page nor the thumb moved. In
vertical mode RSlider now reads the pointer itself: a press or drag sets
the value from its height along the track, with pointer capture while
dragging. The native input keeps serving keyboard and assistive tech.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
Dragging the volume slider on a phone also scrolled the page, and at the
top of the page it could trigger pull-to-refresh. The vertical slider now
claims touch gestures, so a vertical drag only moves the thumb.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
The gaps, paddings and margins this branch adds now come from the
`--r-space-*` scale instead of pixel literals. Off-scale values round to
the nearest step: the phone save rows keep the desktop 12px side inset,
and the 2px and 6px gaps become 4px and 8px.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
- MiniPlayer: on phones, music pauses when a game takes the screen, since
the top bar that carries its controls hides while the game runs.
- ScanningIndicator: phones shorten large counts (1.8K / 45.7K) so the
pill always fits beside the now-playing pill on narrow screens.
- NowPlayingChips: the queue position chip hides while no track is shown,
instead of reading "0 / 0" during a load or on an empty queue.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW