add_rom skips the regroup when the merge changed no identity column. The
post-scan repair regroups the scanned ROMs for a ROM-scoped scan and
rebuilds only the scanned platforms otherwise, since no group spans two
platforms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(docker): supervise the container with s6-overlay
The init script was a hand-rolled supervisor: PID files, /proc polling, a
5s watchdog loop and a trap-based shutdown. Its shutdown wait was unbounded,
so a process that refused to exit stranded PID 1 and left the container up
and serving nothing, which no restart policy can detect.
s6-rc replaces it with a declared service graph. Ordering and readiness
gates that were sequential bash become dependencies, and the failure modes
become configuration:
- timeout-kill bounds SIGTERM before SIGKILL, and flag-timeout-killpg
escalates to the whole process group.
- S6_BEHAVIOUR_IF_STAGE2_FAILS=2 exits the container when a startup step
fails, so the restart policy retries instead of the container wedging.
- valkey gets --shutdown-on-sigterm force, so it stops refusing to exit
when the snapshot it writes on shutdown cannot be written.
A crashed service is now restarted on its own instead of taking the whole
container down. Its leftover children are swept first, because children
reparented from a hard-killed master keep holding its listening sockets and
would make every replacement fail to bind.
Optional services have no conditional mechanism in s6-rc, so they start,
check their environment variable, and take themselves down with s6-svc -O.
Running with a read-only root filesystem now needs /run mounted exec, since
s6 executes its generated stage scripts from there.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(docker): always start the RQ scheduler under s6
The s6 service carried over the four-flag ENABLE_SCHEDULED_* gate from the
init script, which #4033 has since removed on master. Since this branch
deletes that script, the fix would be lost on rebase.
Nothing else respects the condition: startup.py registers the netplay,
upload-tmp and zip-cache cleanups unconditionally, three more flags gate
periodic tasks absent from the list, and the watcher defers its rescans
through the scheduler. Any of those leaves jobs in the scheduler registry
with no process to run them, and a stuck delayed scan_platforms entry reads
to the concurrent scan guard as a scan already queued, refusing every
manual scan.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix(docker): port master's init changes to the s6 services
Master reworked docker/init_scripts/init while this branch replaced it,
so carry those changes into the s6-rc services:
- Replace rq-scheduler with `rq cron` (romm-rq-cron) on tasks.cron_config.
- Add romm-rq-scan-worker (scans queue) and romm-rq-streaming-worker
(streaming queue, down unless config.yml enables streaming).
- Run every worker with --with-scheduler and the RomMRedis connection
class, passing the Redis URL through RQ_REDIS_URL so the password stays
off the command line, and read REDIS_SSL as a boolean.
- Bring gunicorn's flags in line: --no-control-socket, a private-range
FORWARDED_ALLOW_IPS default, 4 workers and a 65s keep-alive.
- Check the sync folder and SSH keys path in romm-init, and switch the
features off through the container environment when they're unusable.
- Accept the backend's truthy values for the watcher flags.
- Point the serving-layer guard tests at the gunicorn run script and
drop the PID-file tests, which guarded the bash watchdog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(docker): guard the s6-overlay service tree
Check that every service is in the user bundle, depends on something
that exists, and that every longrun has its finish sweep, kill timeout
and process-group flag. Also check that the dev entrypoint starts the
same RQ workers and cron scheduler as the image, since it keeps its own
launcher.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(dev): pass the image's RQ flags in the dev entrypoint
The dev image's RQ cron scheduler and workers ran without the RomMRedis
connection class, and the workers without --results-ttl, so they kept
redis-py's maintenance notification probe and RQ's default result TTL.
The s6 guard test now compares each rq command's flags with the image's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(docker): address Greptile review on the s6 service tree
- Cut the s6 script comments to two lines, keeping the reason each
helper exists.
- Compare the values of the dev entrypoint's RQ options with the
image's, not only their names, allowing for the dev image's path,
PID files and LOGLEVEL default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci(docker): check every s6 service stays up after boot
The heartbeat only proves gunicorn and nginx came up. Enable both watchers
and require each longrun in the s6 tree to report up for 15s straight, so a
crashing or restart-looping worker, cron, valkey or watcher fails the job.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci(docker): enable streaming so its worker is checked too
The streaming worker turns itself off when streaming.enabled is false in
config.yml, which the services check read as a failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Let the platforms filter exclude as well as include
The search filter drawer gains an Any/None toggle next to the platforms
select. `GET /api/roms` takes a new `platforms_logic` parameter ("any" or
"none"); "all" is rejected because a rom has one platform.
An exclusion keeps the grouped single-platform cache from answering, is
carried into the filter-values scope, round-trips through the URL, and
is stored on smart collections as `platforms_logic: "none"`. A platform
route always includes its own platform.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4icN79J4F1bZ15pmZG
* Rename the filter drawer's "Tags" heading to "Attributes"
The section holds genre, franchise, company, region, status and more,
with "Tag" as just one of its rows, so the heading read as if every row
were a tag. The platforms select joins it as the first row, and the rows
share one column grid so the selects line up even though the platforms
toggle has no "all" button.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4icN79J4F1bZ15pmZG
* Fix three gaps in platform exclusion found in review
- A URL with platforms but no platformsLogic now includes them, so
following an inclusion link after an exclusion no longer keeps
excluding. Without platforms the logic is left alone, since it is
never written to the URL then.
- Smart collection criteria give the route's platform priority, as the
gallery request does, so a collection saved on a platform page never
excludes the games on screen.
- The drawer's Reset button resets the platforms toggle to Any.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4icN79J4F1bZ15pmZG
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(emulatorjs): expose download cache enable setting
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(config): move cache_limit under emulatorjs.cache and read config.yml strictly
emulatorjs.cache.limit replaces emulatorjs.cache_limit, which is still read
with a deprecation warning and is rewritten to the new key on the next save.
Every config.yml read now goes through one reader that exits with code 3 when
a parent block is not a dictionary (e.g. `netplay: true`), where get_nested
silently fell back to the default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(emulatorjs): clear every EmulatorJS cache and keep nightly's cache size
The clear-cache dialog now also deletes EmulatorJS-bios (4.2.3) and
EmulatorJS-Cache (nightly), which kept serving downloaded files.
Nightly turns EJS_CacheLimit, a per-file byte cap in 4.2.3, into its total
cache size in MB, so a limit under 1 MiB gave a 0 MB cache. Passing
cacheMaxSizeMB explicitly keeps nightly at its own 4096 MB default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(utils): drop get_nested
The config loader reads config.yml through its own strict reader now, so
get_nested has no callers left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ra): hash an arcade set by its archive, not the CHD beside it
RetroAchievements identifies an arcade game by its set's name. A folder
holding a set and its disc was hashed by the CHD, which is named after the
disc (gdl-0018.chd beside azumanga.zip).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Pass the arcade set's archive to RAHasher directly. RAHasher on Linux
does not expand a /* wildcard, so the arcade hash of <folder>/* is the
MD5 of an empty name. Prefer the archive named after the folder so a
larger BIOS or parent zip beside it does not win.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: plain-prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
RetroAchievements' Arcade has sets for games Flycast runs (Atomiswave,
NAOMI, NAOMI 2 and NAOMI GD-ROM) and for Gaelco games FinalBurn Neo runs.
Since #5273 those folders have slugs of their own with no RetroAchievements
console, so their games get no hash.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(auth): use the OIDC picture claim as the user's avatar
On each OIDC sign-in, a user with no avatar, or one synced from the
provider earlier, gets the picture claim stored as their avatar. An
uploaded avatar is never replaced. The download goes through the
SSRF-guarded client (the configured provider's origin may reach a LAN
address), is capped at 5 MB, must sniff as a supported image, and any
failure is logged without blocking the sign-in.
Closes#4297
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(auth): address review on the OIDC avatar sync
Addresses Greptile's review on #5730:
- ask the UserInfo endpoint when the ID token has no picture claim
- keep an avatar uploaded while the picture downloaded
- allow only the OIDC provider's origins to reach private addresses
- trim docstrings and narrow await_args in the callback test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(auth): type the OIDC avatar test helpers for mypy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Bound the OIDC picture download with an overall deadline, trust the
OIDC CA bundle, catch hostname encoding errors so sign-in never 500s,
and set the synced avatar with a conditional update so a concurrent
upload wins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish
Type the pytest fixtures and helpers in the OIDC avatar tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(auth): remove the synced OIDC avatar when the user uploads one
Once avatar_path points at the uploaded avatar.<ext>, the sync never
touches the user's avatar again, so the old oidc-avatar.<ext> file
would otherwise stay on disk for good.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Each failed password, token or OIDC sign-in now logs one warning line,
auth.login_failed method=... reason=... username=... ip=..., so tools
like fail2ban and CrowdSec can detect username enumeration as well as
brute force. A name that matches no account is logged as a short keyed
hash, since it may be a password typed in the wrong box.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A file below no category folder is part of the game, so the file schema
now reports it as game, the same as a top-level file. Clients selecting
a folder game's files by category get the whole game.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(scan): list the ROMs a ScreenScraper breaker skipped in the scan summary
A ROM whose ScreenScraper lookup was answered by the quota or credentials
breaker is now recorded, and the end-of-scan summary lists those ROMs beside
the rate-limited ones. A ROM whose name lookup still reached ScreenScraper
after a short-circuited hash lookup is not listed.
Closes#4358
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ss): list quota-skipped roms by path
Addresses Greptile's review on #5727: same-named roms on different
platforms collapsed into one entry in the skipped list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(demozoo): send an API key with every Demozoo request
Demozoo's API has required an API key since 2026-11-01. Add
DEMOZOO_API_KEY, sent as an Authorization: Api-Key header, and enable
Demozoo when it is set, like the other key-based providers. It replaces
DEMOZOO_API_ENABLED, since requests without a key are refused.
Fixes#5698
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(scan): fetch file rows per rom on quick scans
A quick scan loaded every file row of a 200-rom batch up front, so a
platform with a few extracted multi-file games held hundreds of thousands
of RomFile objects at once and the worker was OOM-killed. Each rom now
fetches its own rows inside the scan semaphore, capping the rows held to
SCAN_WORKERS roms.
Refs #5706
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style(scan): shorten the batch lookup comment
Addresses Greptile's review on #5725.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): restore only broker-pulled save archives natively
A device client (Argosy with Eden or Azahar) can sync its own zip under the
emulator name a streaming container uses. RomM treated any .zip from that
emulator as a native broker archive and pushed it as-is, so the broker
refused the restore with a 422 for members outside its save subtrees.
Only archives RomM filed from a broker pull (*.saves.zip) restore natively
now. A client zip is skipped by the default launch and, when picked, goes
through the broker's import path where it accepts saves.
Fixes#5268
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(saves): keep a broker archive's suffix through a rename
Addresses Greptile's review on #5724: renaming a broker-pulled save to
another .zip dropped the .saves.zip marker, so the next launch stopped
restoring it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A change to a platform directory scheduled an UPDATE scan of the whole
library, which only refreshes ROMs that already exist, so a new platform
showed up empty until the next quick scan. Every change now schedules a
quick scan scoped to its platform, and a folder with no platform row is
scoped by its slug so the scan creates the platform and adds its ROMs.
Fixes#5707
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The cover search asked SteamGridDB for every content variant, so a user
under an age limit could browse NSFW artwork through a client. The
server now asks for SFW grids only when the caller has an age rule.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A push stored its save with origin_device_id and its states with none.
The web player counts a state with no origin_device_id as its own and
prefers a state on a tie, so after a console pushed a save and states in
the same snapshot, the web player booted the console's state instead of
its save, though that state may be another core's or older than the save.
A pushed state now carries the same origin_device_id as the save beside
it.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(saves): hash bytes that only end like a zip as one file
zipfile.is_zipfile is true for any file whose last 64 KB hold a zip's end
record. An emulator state can: Power Stone's Flycast (Naomi) state holds
the tail of the game's own TorrentZip archive. Reading such a file as a
zip fails, so compute_content_hash returned None, and a snapshot push
carrying the state was refused whole with "does not hash to the
manifest's value".
When the bytes cannot be read as a zip (BadZipFile), compute_content_hash,
hash_save_content and the memory card hash now hash them as one file, as
the web player's saveContentHash and the snapshot identity hash already
do. A real zip they cannot read within the limits stays unknown.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Hash bytes as one file when the copied central directory points an entry
before the bytes start, as the tail of an archive longer than the state does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: plain-prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(saves): decide what is a zip archive by one rule
Bytes are a zip archive only when their entries start at the first byte.
A state or save holding another archive, whole or only its tail, after
data of its own is hashed, shaped, uploaded and unpacked as one raw file
everywhere: the content hashers, the identity hash, save_shape_of,
check_upload and unpack_save_unit. A real archive with a corrupt entry
stays unknown to the content hashers, and the identity hash falls back to
the bytes for one past the limits too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Pruning a channel re-syncs the sharing of the save and state rows the
deleted snapshots shared with snapshots that stay. That Core UPDATE of
is_public also ran updated_at's onupdate, so each kept row took the
prune's time though nothing in it changed. The web player resumes the
newest save by updated_at, so after a push that pruned a snapshot more
than ten back it booted an old save another snapshot still held, often
another app's.
sync_content_visibility now keeps updated_at, as touch=False does for the
sharing routes: sharing is not a write. The same holds where a push into a
public channel, a channel's sharing change and a snapshot's sharing change
sync it.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* test(api): check returned and forwarded error statuses too
The route error check only saw HTTPException with a literal status. It
now also counts error responses a route returns, statuses passed to a
helper, status maps, IfExp and local variables. A status it still cannot
read fails the check instead of passing silently. Routes left out of the
schema are skipped, and 422 counts as documented only when FastAPI
documents it. The API description now names the middleware errors no
route lists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(api): fail on documented statuses a route cannot raise
Add a stale check, the reverse of the undocumented one. To keep its
false positives near zero, the analyzer now follows functions run
through asyncio.to_thread and similar offloads, and skips a try body
whose handler swallows every error (keeping the responses it returns).
A new `# route-errors: raises <codes>` marker declares what a line
raises when the analyzer cannot follow or read it.
Following offloads found an undocumented 502 on save-and-exit: a
container with no broker address fails the card wipe. search_cover
declares the SteamGridDB 401 it re-raises from a gather.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: plain-prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review (best-effort broker PUT never raises)
put_binary_json looked up the broker URL outside its try, so a container
with no broker address raised a 502 from a helper documented as never
raising. Evacuation already fails first on that container, so the 502
documented on save-and-exit could not happen; drop it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: plain-prose (code-review additions)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish (build a real container in the broker test)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): offer disc sheets, not their tracks, as stream discs
The start-disc picker and disc-swap dialog only treated .cue as a disc
sheet, so .gdi, .ccd and .mds sets listed their raw tracks, which the
backend rejects. Pick discs the way utils/m3u.disc_files does.
Fixes#5709
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): keep patches and variants out of the disc lists
The start-disc list now drops patch files by extension, as disc_files
does, and the swap dialog lists only the base game's discs, as
playlist_files does, so neither offers a file the backend rejects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): order stream discs by disc number
The backend's disc_files sorts by the disc tag, so a set of ten or more
discs listed Disc 10 before Disc 2 in the start and swap pickers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): offer no disc pick before the first heartbeat
Patches are recognised by the heartbeat's supported extensions, which are
empty until a heartbeat lands, so a root-level patch showed up as a disc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): decide the disc swap from the disc sent with the claim
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
get_public_base_url promises the URL only when it is shareable, else
None, but yarl.URL raised ValueError on a value such as "http://[invalid",
so invite and notification rendering failed instead of omitting the link.
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
* test(api): check that routes document the error statuses they raise
protected_route now documents the scope guard's 401 and 403 on every
route that declares scopes, appending to a route's own description when
it has one.
tools/route_errors.py follows each route's calls through imports,
handler instances, custom exception classes and HTTPException subclasses
to the statuses it can raise. test_raised_statuses_are_documented fails
on a status the route's responses= leaves out, against a baseline of
existing gaps that can only shrink.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for roms routes
Describe every 4xx and 5xx the rom routes and their helpers raise in each
decorator's responses=, so the OpenAPI schema lists them. A hidden rom,
platform or file is described like a missing one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for saves routes
Describe every 4xx/5xx the saves, states, screenshots, snapshots,
play-sessions and sync routes raise in their responses=, and rewrite the
states identifiers docstring that carried Args/Returns blocks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for devices routes
Describe the 4xx/5xx statuses that the device, device auth, install,
client token, notification, notification channel, sync channel and
heartbeat routes raise, and fill the empty install route entries.
Rewrite the setup and heartbeat docstrings that published Args and
Returns blocks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for streaming routes
Describe the 4xx and 5xx statuses the streaming, memory card and netplay routes raise in their responses= declarations, and replace the Args: blocks in route docstrings that FastAPI published verbatim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for admin routes
Describe the 4xx and 5xx statuses the config, permissions, user, auth,
tasks, logs, activity and export routes raise, and rewrite their
Args/Returns docstrings as plain operation descriptions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for library routes
Describe the 400/403/404/409/500 statuses the collection, feed, firmware,
platform, music, playlist and search routes raise, and replace route
docstrings that carried Args/Returns blocks with plain sentences.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(api): answer like a missing resource for hidden play sessions and private collections
DELETE /play-sessions/{id} deleted the caller's session even on a rom
hidden from them, so 204 versus 404 showed the session existed. The
handler now takes the caller's rom visibility.
Another user's private collection, smart collection or playlist
answered 403, which showed it existed. It now answers 404 on every
route; a public one the caller does not own still answers 403 on write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): describe private collections and playlists as missing
Matches #5686, where another user's private collection or playlist
answers 404 and a play session on a hidden rom answers like a missing
one. The read routes drop their 403, and the write 403 now covers only
a public resource another user owns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(collections): use #5693's docstrings on the routes this PR touches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): address Greptile review on route error docs
Fold the nine multi-paragraph route docstrings into one line, and keep
the device-scope 403 descriptions in utils/auth.py next to
resolve_device, which raises them, instead of in both saves.py and
states.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(api): follow route dependencies in the status analyzer
Addresses Greptile's review: route_errors now follows the callable in
Depends(...) and Security(...), whether it is a parameter default or
inside an Annotated alias, and the module docstring is one line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): tighten wording of route error descriptions
Give clipped responses descriptions and helper docstrings their missing
subjects and verbs, use 'the caller lacks' and 'is not allowed to'
consistently, and replace 'picked' with 'chosen'.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(api): drop the route error baseline
Every status left in the baseline was one a client cannot get:
- The export routes' empty platform list check is dead, since FastAPI
answers a missing required list query with 422. Removed.
- get_save_layouts went through _restore_error, whose 500 fallback it
cannot reach. It raises its 400 and 503 directly now.
- The notification test and confirm routes only catch ChannelError,
since the cooldown and email errors come from other actions.
- The analyzer now skips asyncio.gather(..., return_exceptions=True),
which covers search_rom.
- A '# route-errors: ignore' marker, with its reason, skips code whose
errors never reach the client: the metadata heartbeat probe, the
force-release teardowns, and the legacy save adoption.
The check now fails on any undocumented status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for roms routes
Describe every 4xx and 5xx the rom routes and their helpers raise in each
decorator's responses=, so the OpenAPI schema lists them. A hidden rom,
platform or file is described like a missing one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for saves routes
Describe every 4xx/5xx the saves, states, screenshots, snapshots,
play-sessions and sync routes raise in their responses=, and rewrite the
states identifiers docstring that carried Args/Returns blocks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for devices routes
Describe the 4xx/5xx statuses that the device, device auth, install,
client token, notification, notification channel, sync channel and
heartbeat routes raise, and fill the empty install route entries.
Rewrite the setup and heartbeat docstrings that published Args and
Returns blocks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for streaming routes
Describe the 4xx and 5xx statuses the streaming, memory card and netplay routes raise in their responses= declarations, and replace the Args: blocks in route docstrings that FastAPI published verbatim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for admin routes
Describe the 4xx and 5xx statuses the config, permissions, user, auth,
tasks, logs, activity and export routes raise, and rewrite their
Args/Returns docstrings as plain operation descriptions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error responses for library routes
Describe the 400/403/404/409/500 statuses the collection, feed, firmware,
platform, music, playlist and search routes raise, and replace route
docstrings that carried Args/Returns blocks with plain sentences.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): describe private collections and playlists as missing
Matches #5686, where another user's private collection or playlist
answers 404 and a play session on a hidden rom answers like a missing
one. The read routes drop their 403, and the write 403 now covers only
a public resource another user owns.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): address Greptile review on route error docs
Fold the nine multi-paragraph route docstrings into one line, and keep
the device-scope 403 descriptions in utils/auth.py next to
resolve_device, which raises them, instead of in both saves.py and
states.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): plain-prose pass on route error descriptions
Spell out clipped error descriptions, replace internal slang (picked,
taken, live, moved past), name the parameter an ID comes from, and split
the long save conversion 400s into sentences.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): merge the webstation exit delta over the restored save archive
A webstation exit export holds only the files changed since launch, but
RomM filed it as a standalone .saves.zip and the next launch restored only
the newest zip. A session that exited without an in-game save therefore
filed an archive with no save data, and the next Play booted without it.
The launch now records which native archive it restored on the session
record, and the exit pull lays the delta over that archive before filing
it, so every stored archive is a full snapshot.
Fixes#5544
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(streaming): type the stored exit archive as bytes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): skip the exit merge when the restored archive was replaced
PUT /saves/{id} rewrites a save in place under the same id, so the exit
merge could combine the session's delta with save data it never loaded.
Record the restored archive's content hash at launch next to its id, and
merge only while the base still has it; otherwise file the delta alone.
Addresses Greptile's review on #5673, including folding the
_over_restored_archive docstring into one sentence.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(streaming): drop ensure_zipfile_writable from the archive overlay
#5678 applies the zipfile_inflate64 fix where it is imported, and removed the helper.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose (code-review additions)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(streaming): keep imported states, folders and the entry cap in the exit merge
A launch that imported a state left the base archive's states off the
container, so the exit merge now leaves them out too. The merge keeps
both archives' folders and refuses past the archive entry limit, so a
merged archive always gets a content hash. The webstation hydrate now
uploads the save its caller resolved instead of looking it up again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(db): query a platform id no sequence can reach
Postgres keeps id sequences across tests, so a worker that has created
about a thousand platforms hands id 999 to the fixture's own platform.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(converto): move save channels to the converted files
Convert library pointed the game at its new file and refreshed its files,
but a channel names its file by SHA-1, name and size, and those still named
the original. Afterwards GET /api/channels?rom_file_id=<new file> found
nothing and a push into the channel with the new file was refused 422
("the ROM file does not match the channel's").
After the refresh, every user's channels on the game move: one on a
replaced file (an iso, a cue, its tracks, a rewritten m3u) to the file that
replaced it, and one on the game's sync file (channel_file_id) to its new
sync file, since name order picks that once no cue is left. The move keeps
updated_at, which orders a user's channels.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(converto): move channels before deleting the originals
Convert library now refreshes a ROM's files while the originals are still
on disk, moves what keys to them onto the outputs in one transaction, and
only then deletes the originals. A failure before the deletion removes the
outputs, puts rewritten playlists back and keeps the channels on the
originals, so no failure leaves a channel on a file that is gone.
The sync-file redirect follows only to a file this run wrote, so a disc
that failed to convert no longer takes a converted disc's channels, and it
yields to the channel's own replacement when the user already has a channel
of that label on the new sync file.
The same transaction moves the ROM's snapshot hashes, so archival snapshots
still reattach after a rescan, and its states' capture disc, so a resume
mounts the right disc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(converto): skip the ROM-level hash in the early file refresh
The refresh that runs while a folder ROM's originals and outputs are both
on disk rereads every top-level file for the ROM-level hashes and RAHasher,
and the refresh after the originals go does it again. A new rom_hashes flag
on refresh_rom_files keeps the stored ROM-level hashes in the early
refresh, which then reads only the new and changed files, so the originals
are never reread and the ROM-level hashes are computed once.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
is_shareable_host only rejected the literal "localhost", so a base URL
of http://localhost.:8080 (the same loopback name, per RFC 6761) was
used to build invite and notification links.
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
A legacy upload to a slot files its save under the channel of that name,
found on the game's sync file when no earlier upload links the slot. A
snapshot client keys a game's channels to that file and its saves carry no
slot, so once a file added to the game becomes the sync file (a cue beside
a chd), the next upload to autosave made a second, empty default channel
on the new file instead of joining the player's.
When the sync file holds no channel of that name, the slot now takes the
game's own channel of that name on another of its files still on disk,
before making one on the sync file. The sync file's channel still comes
first, and a channel on a file the game no longer holds, or on another
game's copy of the file, is not taken.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A scan skipped every archive before asking sigil for a title id, but sigil
reads a .zip in place: a Vita dump through its sce_sys/param.sfo, any other
platform through the largest member. So a zipped game got no title id and
no cart facts, which left its saves nothing to convert between emulators by.
PS Vita is the common case, since a zip is the usual Vita dump.
Let .zip through both checks and keep skipping every other archive, which
sigil doesn't open. A hashed single-file archive also never queued its file
for extraction, so that branch now does, as the others do.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(coherence): give each worktree its own test database automatically
The rootdir conftest now sets ROMM_TEST_DB_TAG to the linked worktree's
folder name when it is unset, so a worktree never runs against the shared
romm_test. With the rule enforced, the "worktree test database" practice
no longer fires on every `uv run pytest`: each firing reopened an owed
enactment at Stop, and sessions committed one identical record per run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: load the rootdir conftest by path
Under a full run, `from conftest import` resolves to whichever conftest
pytest imported first, so the worktree_tag tests failed to collect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(tests): hash the worktree path into its test database tag
Addresses the Greptile review on #5680: worktree folders that sanitize or
truncate to the same name no longer share a temporary test database.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(jsdos): play a .jsdos bundle that sits inside a game folder
The play check read the ROM's own extension, which is empty for a folder,
so a bundle moved into a folder (for example beside its manual) lost its
Play button. The backend now exposes has_jsdos_bundle, true when the ROM
is a bundle or has one at its folder's top level, and the js-dos player
asks the content endpoint for that file instead of a zip of the folder.
Fixes#5615
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(jsdos): assert the player downloads only the bundle file
Addresses Greptile's review on #5672: covers the bundle file id in the player URL and drops a comment that restated the constant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Pin has_jsdos_bundle's value for a plain single file and for a bundle
missing from disk, on both the SQL and the with_files path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
* pr-ready: code-review
Expose missing_from_fs on RomFileSchema so the js-dos player skips a
bundle gone from disk, the same rule has_jsdos_bundle applies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
* pr-ready: simplify
Share the top-level file predicate and the present-file exists subquery
between is_easyrpg_game and has_jsdos_bundle, compute the top-level files
once in apply_file_stats, and fold the two marker flag tests into one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
* pr-ready: review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
* pr-ready: prose
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
* refactor(jsdos): rename isJsDosBundle to hasJsDosBundle
It also matches a folder that holds a bundle, so the name now says what
the backend flag it reads says.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
* fix(scan): derive a scanned rom's file flags from the files it read
A scan emits scan:scanning_rom before it writes the rom's file rows, so a
new rom reached clients with every file flag false (has_simple_single_file,
has_multiple_files, has_jsdos_bundle and the rest) until a reload. The
emits now derive those flags from the files the scan just read whenever it
rebuilt them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011waFLKWoBw9KCu31UJJ7Te
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(states): send each state's content hash in the state list
RomM stores a content hash for every state, and the save list already
sends each save's. StateSchema never had the field, so GET /api/states,
GET /api/states/{id} and a ROM's user_states left it out. A client that
keeps its own copies of states can now tell it already has one without
downloading it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(pr-ready): code-review fixes
Document what a state's content_hash covers in the schema and cover the
ROM detail user_states/all_user_states in the endpoint test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(pr-ready): simplify
Declare content_hash once on ManagedAsset, the schema side of the
ChannelContent model that owns the column, so saves and states share one
documented field. Build the hash test on the state fixture with a single
hash value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* fix(scan): auto-export only the platforms a scan covered
A new-platforms scan skips every platform already in the database, but
the gamelist.xml and Pegasus auto-export still rewrote all of them,
copying media for the whole library before scan:done was emitted. On a
large library that left the UI on "Scanning" for hours after the log
said the scan completed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(scan): patch GamelistExporter on its defining module
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(scan): cover the Pegasus auto-export loop too
Addresses Greptile's review on #5671.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
store_media_file streamed the raw response body without decode_gzip, so
media served with Content-Encoding: gzip (the LaunchBox image CDN does
this whenever the client accepts gzip) was written to disk still
compressed. Covers, screenshots and manuals already inflated it.
Fixes#5669
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore(skills): add plain-prose skill and prose-check linter
A skill for clipped sentences in API descriptions, docstrings, comments,
en_US strings and error messages, run in pr-ready before humanizer. A
stdlib tool extracts the prose a diff adds for batched review, and a Trunk
linter enforces the rules a regex can decide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(skills): run pr-ready reviews in parallel subagents
Simplify, polish, prose and the security audit run as background agents
over the same range while code-review runs in the main session, since it
fans out reviewers of its own. Their commits land in step order, and the
verification gate runs once on the merged branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(skills): route errors go in responses, not docstrings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(prose-check): address Greptile review
- Expand directory arguments into their source files.
- Accept paths after --diff (parse_intermixed_args).
- Extract positional messages of raised exceptions and logger calls.
- Point each locale unit at its own key, not the first key with that name.
- Run the Trunk linter on the pinned Python runtime.
- Trim the module docstring to one sentence; usage lives in the skill.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): describe the core endpoints and add a docs test
Give the parameters, operations and response fields of the core routers a
description in the OpenAPI document: roms, platforms, collections, users,
saves, states, screenshots, channels, snapshots, streaming, devices, client
tokens, play sessions, search, auth, music, memory cards, firmware, sync,
config, feeds, notifications and permissions.
Response models read attribute docstrings (`use_attribute_docstrings` on the
shared response `BaseModel`), so a string after a field is its description.
The update-rom form reads its descriptions from `RomUpdateForm`, so they
have one home. The paging parameters gain examples, such as 72 per page.
`tests/endpoints/test_openapi_docs.py` reads `app.openapi()` and fails when a
parameter or operation of a listed router has no description, or when a
schema with some described fields leaves others bare. Add a router to
`DOCUMENTED_ROUTERS` once its parameters and operations are described.
Descriptions only: no parameter, constraint or default changes. The frontend
types need regenerating (`npm run generate`).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* docs(api): describe the remaining routers and the roms list parameters
Cover the last routers (tasks, activity, heartbeat, audit events, stats, logs
and netplay) and add the routers to the docs test's allow-list, so every
router is now held to a description on each parameter and operation.
Describe the schemas that test found partly documented: the task status
responses and `TaskInfo` (as `Annotated[..., Field(...)]`, since a TypedDict
takes no attribute docstrings) and the audit page's `max_id`.
Rewrite the `GET /api/roms` parameters that did not say what they do:
`with_char_index`, `with_filter_values`, `with_rom_id_index`, `with_total`,
`with_provider_metadata`, `order_by`, `with_files`, `group_by_meta_id` and
`search_term`, each with an example or the values it accepts.
Replace a franchise name in an existing docstring example with a neutral one.
Descriptions only: no parameter, constraint or default changes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* chore(api): regenerate the frontend types
Run `npm run generate` against the backend so the generated models carry the
descriptions added to the OpenAPI document. Only comments change: no type,
field or signature differs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* docs(api): fix alternative_names and shorten docstrings per review
Address the review feedback:
- Describe `alternative_names` as the hand-set titles when there are any,
otherwise the titles from IGDB, MobyGames and ScreenScraper, as
`resolve_alternative_names` returns them. It said every matched provider.
- Check HEAD routes in the docs test. Both existing HEAD routes already pass.
- Keep docstrings to one paragraph, as the repository asks. The test module
docstring is one sentence and its two rules are short comments. Nineteen
operation docstrings added in this change drop their second paragraph.
Descriptions and a test only: no parameter, constraint or default changes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* chore(api): regenerate the frontend types
Pick up the corrected `alternative_names` description. Only comments change.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* docs(api): correct descriptions that disagree with the code (pr-ready: code-review)
Fix 12 OpenAPI descriptions that contradicted handler behavior (empty
provider metadata, virtual collection types, streaming container lookup,
save device sync, user collections, search terms, file order, firmware
file name, audit max_id, play session offset, save target layouts).
Share the music filter descriptions through Annotated aliases and drop
comments that restated the new docstrings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(api): share parameter aliases and check every router (pr-ready: simplify)
Move the rom id and sort direction aliases to utils/router.py and reuse
them, add per-router id path aliases in place of repeated inline params,
let LimitOffsetPage inherit the shared BaseModel config, and drop Args
blocks that restated parameter descriptions. The docs test now covers
every /api path instead of an allowlist. The OpenAPI spec is unchanged
apart from description strings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(api): form model for rom updates, shared schema config and rom id alias
- Take RomUpdateForm as a FastAPI form model instead of 33 Form params
and a duplicate field dict; only sent keys still count as provided.
- Document TypedDict responses with attribute docstrings through
@with_config(API_SCHEMA_CONFIG) instead of per-field Annotated wrappers.
- Move request payload models onto the shared BaseModel and use
attribute docstrings for their descriptions.
- Replace the 32 inline rom id path params with RomIdPath, which now
carries ge=1 (adds minimum: 1 to the activity and streaming rom ids).
The update rom request body now references a RomUpdateForm schema; the
multipart fields are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): keep only the descriptions that explain something
Drop the field and parameter descriptions that restate the name, the
type, or what the schema already shows (enum and literal values,
defaults, bounds, nullability), along with the wrappers and aliases
that only carried them. Reword four that did not say what the field
is. The docs test now checks operations only, since requiring a
description on every parameter and field is what produced the filler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): plainer wording for three sync and rom descriptions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): rewrite clipped descriptions as full sentences
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document error statuses in responses instead of docstrings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): document pairing code exchange errors
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(api): move error statuses from route docstrings into responses
Covers the routes whose docstrings stated an error in prose or in a
Raises: block, new in this PR or older.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* feat(roms): load roms by an array of ids
GET /api/roms accepts up to 256 rom_ids and returns those roms in the
order given. Ids the caller can't see, or that don't exist, are left out.
Closes#5659
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(roms): code-review pass on rom_ids window
Reuse RomIdScope (dedupe, shared 500 cap), skip sidecar and grouped page
cache reads for a window by id, report offset 0 and the id count as limit,
and rename the shadowed rom_ids local in _transform.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(roms): simplify pass on rom_ids window
Return early for rom_ids before building the filtered query, the sidecars
or any cache key, through a shared _hydrate helper, so the paged path is
back to its prior shape. Tests use the headers fixture.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(roms): review-polish pass, cover a hidden platform in the rom_ids window
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(collections): refuse malformed virtual collection ids, require page-row visibility
A malformed virtual_collection_id raised an uncaught decode error (500) on
the gallery, random and bulk download routes. It is now a 422 at the query
boundary, and GET /collections/virtual/{id} answers 404.
get_page_rows_query takes visibility as a required argument, since it is
the access check on caller-supplied rom ids.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(gallery): load scroll windows by rom id
Once the bootstrap holds the whole ordered id index, a window fetch sends
that slice as rom_ids, so the backend skips the filtered, offset-paged
query. Items are placed by id, since ids that went missing or hidden are
dropped from the response.
On a 100k-rom MariaDB library, a filtered grouped window went from
0.8-2.0 s to ~50 ms, and a deep ungrouped window from 106 to 50 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* chore(seeder): fill IGDB and ScreenScraper metadata to real-world size
Seeded provider JSON was about half the size of a real library's, so
gallery benchmarks understated decode and payload cost. IGDB now carries
keywords, platforms, realistic alternative names and always ten similar
games; ScreenScraper carries every media url and path key a match stores.
List lengths follow percentiles measured on a 9,172-game library.
New values draw from a per-game stream, so every other column, every
fill rate and the library shape match the previous seed exactly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(seeder): wipe snapshots before the saves and states they hold
--wipe failed on any database with save-channel snapshots, because
snapshots reference saves and states with ON DELETE RESTRICT.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(seeder): tighten comments to what the code shows
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(seeder): draw distinct keywords and test the snapshot wipe order
A keyword list now samples without replacement from a pool larger than the
longest measured list (213), so long lists keep their distinct values.
A test pins that snapshots are wiped before the saves and states they hold.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix(seeder): apply code-review fixes to realistic metadata
Insert ROMs 100 rows per statement, seed the metadata stream from
provider and drawn facts so it follows --seed, fill search_titles and
min_age on Core-inserted rows, sample real distinct IGDB platforms, and
derive SS media kinds from SSMetadataMedia.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(seeder): simplify realistic metadata builders
Share the alias and similar-games builders between providers, pass rom
rows straight to compute_search_titles and compute_min_age, and name the
SS media kinds that carry a path. Output is unchanged for a given seed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(seeder): humanizer pass on extra_rng comment
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(seeder): fill every scan key, match similar-game slugs, pin the main stream
Seeded IGDB and ScreenScraper metadata now carry every required key of
IGDBMetadata and SSMetadata (publishers, developers, themes, player
perspectives, rating count, physical disc), so the facet columns that
read them are populated. Similar-game slugs follow their names without
shifting the main stream, and a test pins the main stream's position
after the builders so a draw moved onto it fails loudly.
compute_derived_columns in models/rom.py now derives search_titles and
min_age from a mapping, shared by the insert listener and the seeder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
zipfile_inflate64 replaces zipfile._get_compressor with a one-argument
wrapper, while CPython 3.13+ passes compresslevel too, so every zip write
raises TypeError once it is imported. Each writer had to call
ensure_zipfile_writable() first, and a new writer that forgot it broke.
Wrap the patched function right after the import in utils/archives.py,
the only module that imports zipfile_inflate64, and drop the per-site
calls and the helper.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sync): preserve RetroArch saves before WebDAV overwrites
* fix(sync): lock RetroArch backups across workers and honor zero retention
Address Greptile review on #5648: publish backups under an flock on the
backup folder so workers cannot prune each other's copies, replace the
os.link publish with an exists check and os.replace under that lock (no
hardlink support needed), and skip pruning when MAX_SAVES_PER_SLOT is 0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sync): harden RetroArch COPY backups (code-review)
pr-ready step 2. Lock through a regular file so NFS grants the flock,
answer 404 for PSP bundle paths so RetroArch still uploads, back up the
state the upload overwrites rather than a served stream capture, compare
the Destination authority without default ports, accept a lowercase
Overwrite value, prune backups by age, and share the stamp regex.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(sync): simplify RetroArch COPY backups (simplify)
pr-ready step 3. Check the source once before copying, publish backups
with the served file mode, drop the redundant deleted/ segment from the
backup storage path, and fold the two retention tests into one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(sync): back up RetroArch deletes and share upload targets
Back up the file a MOVE into deleted/ drops before dropping it, and read
only the Destination tail so a reverse proxy may rewrite the host and
prefix. COPY resolves its source first, answering 404 whenever an upload
writes over nothing (versioned saves, PSP members), from the same upload
target helpers PUT uses. Backups are hardlinked when the filesystem
allows, and the stamp grammar and retention policy move to the sync
handler.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(sync): list the RetroArch COPY route with the other WebDAV verbs
COPY authenticates through _authorize like the rest of the WebDAV
routes, so the route guard test lists it as handled in its module.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(env): quote empty values in env.template so Compose reads them as empty
Docker Compose's dotenv parser only treats ` #` as an inline comment
after a value. For `KEY= # comment` it takes the comment text as the
value, both for env_file and for ${KEY:-default} interpolation in
docker-compose.yml. A .env copied from the template therefore hands 46
settings their description instead of an empty string, and the dev
backend fails at startup on OIDC_AUTH_PARAMS ("not valid JSON").
Quoting the empty values (`KEY="" # comment`) parses as empty in both
Compose and python-dotenv. The docs generator already strips surrounding
quotes, so the env var reference renders unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(env): fail when env.template leaves an empty value unquoted
Docker Compose reads `KEY= # comment` as the value "# comment", so a
new setting added in that shape would break .env files copied from the
template again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(env): code-review pass on env.template quoting
Tell users to single-quote JSON values, since double-quoted JSON inside
"" breaks Compose's .env parsing. Point REDIS_SAVE_POLICY at "" for
disabling snapshots, and widen the guard test to catch KEY=#comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(env): humanizer pass on env.template comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* perf(roms): page grouped galleries from the cached id index
With group_by_meta_id, every gallery page ran the sibling-dedup window
over the whole library, because the frontend fetches pages with
with_rom_id_index=false. Grouped pages for the whole library or a plain
platform list now slice the versioned, cached id index instead, so only
the first page after a change pays for the window. Filtered, searched and
collection pages still run live.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q367p1Ri2c1dKeYCpQgHeh
* fix(roms): share one cached key for grouped platform sidecars (pr-ready: code-review)
Grouped platform-only sets read their char index, id index and pages
from one key, deleting a platform invalidates the cached lists, and the
platform-only gate derives from has_scope().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(roms): simplify grouped sidecar caching (pr-ready: simplify)
Add RomFilterParams.has_only_platform_scope, share one str key base
between the sidecar key builders, collapse the total and index
branches, and dedupe the platform-key tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(roms): cover has_only_platform_scope (pr-ready: review-polish)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(roms): page grouped galleries from a Redis list, bump on deletes
- Store the cached id index as a Redis list. A grouped page reads its
window with LRANGE/LLEN instead of decoding the whole list.
- Page requests only read the cache; on a miss they run the live page
query, so only the index request rebuilds the list.
- Cache grouped platform sets only for a single platform, and never
store an empty list, so client-chosen platform ids can't grow Redis.
- delete_rom and delete_platform queue the after-commit version bump,
replacing the hand-placed calls in the endpoints and cleanup task.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>