65 Commits

Author SHA1 Message Date
Terri
a420c7da31 fix(saves): stop Pokemon scratch RAM writes from flooding save sync (#5758)
* fix(play): show the automatic Save synced toast at most once every 5 minutes

* fix(saves): let sigil decide when a Pokemon save is the same, ignoring scratch RAM

* pr-ready: code-review

* pr-ready: review-polish

* pr-ready: prose

* fix(play): hold SRAM changes in the browser and upload them once the game goes quiet

* fix(play): upload a held save before a state replaces it, and report only new snapshots

* 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 fixes)

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

* fix(play): leave a save a running session holds out of other tabs' sync passes

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

* build(sigil): pin ef9b51e

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 07:41:09 -05:00
renovate[bot]
83a050307d chore(deps): update python:3.14-alpine3.24 docker digest to 5862d97 (#5656)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-19 07:42:14 -05:00
renovate[bot]
48909e6918 chore(deps): update node.js to 6bd9ab4 (#5654)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-18 22:08:48 -05:00
Georges-Antoine Assi
c9bafb8df9 chore(deps): update js-dos to 8.5.4 and track it with Renovate (#5598)
* chore(deps): update js-dos to 8.5.4 and track it with Renovate

Bump the bundled js-dos release and the jsDelivr fallback from 8.4.1 to
8.5.4, which ships a newer DOSBox-X and audio and player cleanup fixes.
8.5.x adds an opt-in DOSBox-X debugger build (wdosbox-x-dbg), stripped
from the image with the other unused files.

Renovate now tracks caiiiycuk/js-dos across both Dockerfiles and the
CDN URL. It can't hash the release zip, so its PRs carry a note to
update JSDOS_SHA256 by hand.

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

* test: assert the js-dos pins match across images and the CDN fallback

CI builds only docker/Dockerfile, so a JSDOS_SHA256 left stale in the
root Dockerfile, or a CDN version left behind, would pass unnoticed.

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

* chore: condense the js-dos strip comment to two lines

Addresses Greptile's comment-length finding on both Dockerfiles.

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

* test: assert every shared Dockerfile pin matches across both images

Merge the uv and js-dos pin tests into test_dockerfile_pins.py. It now
compares every ARG with a default in both Dockerfiles, so a new shared
pin is covered without a test edit, and keeps the uv range and js-dos
CDN checks.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 10:38:13 -05:00
Terri
8a1e6280b1 feat(saves): add save channels and snapshots (#5198)
* feat(saves): add save channels and snapshots

* feat(saves): close spec gaps in save channels and hash with sigil

* feat(saves): play snapshots in the v2 player, which pushes snapshots

* fix(saves): code review: authorization, retention losses, held-save sync, batched responses

* refactor(saves): simplify pass

* refactor(saves): review-polish pass

* docs(saves): humanizer pass

* feat(saves): run every EmulatorJS page on the v2 player

* feat(saves): per-user snapshot pins

* feat(sigil): store the identity a save restore needs and pin sigil 0f05f25

* fix(saves): meet type-aware lint in the v2 player

* feat(sigil): store N64 header and playlist title ids, pin sigil 0847fda

* feat(saves): convert saves for a core on download and list save layouts

* feat(saves): prune unreachable archival snapshots and empty detached channels on delete

* feat(saves): device sync from the token, held snapshots and shared-card pushes

* feat(saves): arc restores past abandoned snapshots and color channels by age

* fix(saves): code-review and security-audit fixes

* refactor(saves): simplify pass

* chore(saves): review-polish pass

* docs(saves): humanizer pass

* fix(sync): file RetroArch autosave versions as their channel's next snapshot

* fix(saves): address review findings and trim docstrings

* fix(saves): share-lock planned rows by id so PostgreSQL accepts the lock

* test(saves): stub the detached-channels fetch in SaveDataTab stories

* feat(saves): carry the full current snapshot in a 409, pin sigil 2071dff

* chore(sigil): pin 5d4ddb4, which reads .cue and .gdi sheets

* docs(saves): drop v2 wording now that one UI remains

* chore(sigil): pin 0190443, which reads PS2 raw BIN images and cue sheets

* fix(sigil): treat a file too short for its format as routine during scans

* chore(migrations): renumber save channel migrations after upstream's 0154

* fix(snapshots): a hardcore switch on unchanged content makes a new current

* fix(sync): decide a channel's slot from its history and the device's snapshot

* chore(docker): pin sigil at 794d99f for PSP Store release save prefixes

* refactor(db): squash the save channel migrations into 0161

Fold the slot linking (0162) and the rom_files sigil identity columns (0163)
into 0161_save_channels, so the feature ships as one revision.

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

* fix(saves): close visibility and input gaps found in review (pr-ready step 2)

code-review --fix:
- negotiate_sync drops channel slots on ROMs hidden from the caller
- channel PATCH/attach/DELETE answer 404 when the channel's ROM is hidden
- a push copying a save from a hidden ROM answers 404
- _own_device applies require_token_device to bound client tokens
- adopting a legacy save syncs its sharing with the channel it joins

security-audit follow-ups:
- another user's detached public save or state is no longer downloadable
- profile and option values must be a single path segment
- companions are de-duplicated and capped at 8

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

* refactor(saves): share channel and asset lookups, drop duplicates (pr-ready step 3)

simplify:
- readable_channel_or_404 and channels_on_files replace four copies of the
  channel 404 check and two copies of the file-fed channel listing
- readable_rom_asset_or_404 serves both public save and state downloads
- _own_device resolves through require_device; _clone_origin takes the source
- reuse _unprocessable, DESCRIPTOR_EXTENSIONS, SAVE_SLOT_MAX_LENGTH, uniqueBy
  and uuidv7; neutral forms default their required pattern to the allowed one
- RetroArch delete checks held rows in one query, a guarded upload lists the
  slot only without a channel head, and uploads are read off the event loop
- snapshotSession builds push requests once; player comment cleanups

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

* docs(saves): trim two docstrings to two lines (pr-ready step 4)

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

* fix(saves): answer held RetroArch paths with 423, mirror slot labels

- RetroArch Cloud Sync answers 423 Locked for a PUT over a held unslotted save
  and for a DELETE where only held rows sit at the path, instead of 409 and 404
- channelLabelForSlot returns null for blank and state_ slots, as the backend's
  channel_label does, so the player files them under no channel either
- document that sharing a channel lets every user read and push into it

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

* chore(docker): pin sigil at 85f88a8 for Switch .nup containers

* fix(snapshots): a save pushed in another shape or format makes a new current

* refactor(saves): drop the always-true SAVE_SYNC.SNAPSHOTS heartbeat flag

Nothing reads it, and the SAVE_SYNC block's presence already tells a
client the server speaks the snapshot API. Also trim the rom detail
channel field comments to one line each.

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

* refactor(frontend): use uuidv7 for every client-generated id

Drop the randomToken wrapper and the notification inbox's Math.random tab
id, so uuidv7 is the one helper that works outside a secure context.

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

* refactor(saves): trim redundant snapshot API surface, dead code and duplicate logic

API:
- Drop PUT /snapshots/{id}/devices/{device_id}; GET /snapshots/{id}?hold=true holds.
- GET /snapshots is history only (channel_id required); GET /channels serves currents.
- A snapshot carries channel_id instead of an embedded channel.
- POST /saves/{id}/content takes the same query parameters as the GET, plus container_path.

Backend:
- Remove the archival write path, clone.py, DBStatesHandler.get_state, the sigil
  identity-hash path, unused relationships and composite snapshot indexes.
- One held/frozen lookup, one bulk-delete guard, SQLAlchemy dialect upserts, and
  the shared reserve_version_name in the writer.
- The writer takes a visibility filter and checks the channel and parent itself.
- The restore handler picks per-game or merge; fewer wrapper types and tables.

Frontend:
- Channel delete uses the shared typed confirm; DeleteChannelDialog is gone.
- Held offline pushes go through a per-channel SnapshotSession.
- Remove the slot-based pending upload path.
- The timeline shares the fan's badge logic.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* refactor(saves): release archival backups through module functions

The saves and states handlers each built a private DBSnapshotsHandler to
call release_backup and refresh_backup_digests, since they can't import
the shared instance. Both only ever ran inside the caller's session, so
they are now module functions taking it, like channel_for_slot.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* refactor(saves): share one deleted-assets handler instance

The saves handler built its own DBDeletedAssetsHandler because it can't
import the package's instance. The instance is now built in
deleted_assets_handler.py and re-exported by the package, so both use it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 21:59:19 -05:00
renovate[bot]
37ec1a84dd chore(deps): update docker base images (#5534) 2026-11-09 08:21:23 -06:00
renovate[bot]
1bc9a402b7 chore(deps): update node.js to v26 (#5469)
* chore(deps): update node.js to v26

* chore(deps): move the Node runtime pins to 26.13

Addresses Greptile's review: the engines and @types/node bump needs
frontend/.nvmrc and both Dockerfiles on Node 26 too, or npm ci fails
with EBADENGINE under engine-strict.

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

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:12:46 -05:00
Sam Dornan
a100ad9322 chore(docker): refresh base image digests and let Renovate track them (#5439) 2026-11-01 11:15:07 -06:00
Sam Dornan
983ee142fb refactor(docker): simplify the production Dockerfile (#5376)
- Drop the unused backend-dev-build, dev-slim and dev-full stages. No
  workflow or compose file targets them (the dev image is ./Dockerfile),
  and because dev-full was the last stage, build_local_image.sh (no
  --target) was building an image with the dev extras. full-image is now
  the default target.
- Fetch argosy-sigil, mod_zip and nginx with BuildKit's git ADD (which
  also pulls submodules) instead of git clone/checkout, as the gme stage
  already does, so those stages no longer install git. RALibretro keeps
  its clone: its Makefile builds RA_BuildVer.h from .git/HEAD and
  `git describe --tags`, which ADD strips.
- Hardcode /var/www/html in place of WEBSERVER_FOLDER: nothing sets the
  ARG, and the entrypoint and nginx template hardcode the path anyway.
- Stop copying the CPython headers into the runtime image; nothing
  compiles there.
- Remove a no-op chmod and a mislabelled comment.


Claude-Session: https://claude.ai/code/session_01NH5s4fzfhupfVnuw2VKdog

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 13:30:02 -05:00
Yukine
2662c36b70 chore(converto): bump rom-converto to v0.24.0 in both images (#5220)
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-27 21:32:22 -04:00
Georges-Antoine Assi
b39e1f13dd chore(docker): build the dev image on production's Alpine base (#5335)
* chore(docker): build the dev image on production's Alpine base

The dev image ran on Ubuntu 22.04 while production runs on Alpine 3.24, so
unpinned system tools drifted: 7-Zip 21.07 in dev against 26.01 in
production, which can't extract zstd-compressed zips. The dev Dockerfile now
uses the same pinned base images as docker/Dockerfile and mirrors its
RAHasher, sigil and rom-converto stages.

Node comes from the node:alpine image instead of nvm, uv uses the image's
Python, and npm installs from the lockfiles with `npm ci`, which also stops
the dependency resolution that exhausted memory (and segfaults under musl).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(docker): shorten the dev apk comment (Greptile review)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(docker): trim the dev image notes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test: read the dev image's uv pin from its UV_VERSION arg

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-25 13:34:22 -04:00
Georges-Antoine Assi
1b14abb9b0 chore(deps): bump Node to 24.22.1 for the October 2026 security release (#5295)
Node 24.22.1 distrusts the compromised eMudhra intermediate CAs, updates
the bundled root store to NSS 3.131.1, and fixes the TLS hostname
verification bypasses (CVE-2026-105483, CVE-2026-106069) and the Brotli
decoder out-of-bounds write (CVE-2026-111497).

Moves .nvmrc (CI and dev-setup), the pinned node:24.22-alpine3.24 build
image and its digest, and the dev container's nvm pin.


Claude-Session: https://claude.ai/code/session_01MH7wFM9YCxzurL1kP7vvLA

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 21:54:55 -04:00
Georges-Antoine Assi
e997ed7a0a chore(deps): bump uv to 0.13.4 (#5284)
uv 0.13.4 distrusts the compromised eMudhra intermediate CAs
(https://emudhra.we-have-a-problem.com/) in its bundled webpki roots.
required-version moves to >=0.13.4,<0.14, so local checkouts need
scripts/dev-setup.sh (or uv self update) after pulling.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 08:50:42 -04:00
Georges-Antoine Assi
ad0146a88e chore(trunk): fix the scheduled trunk check-all failures (#5141)
* chore(trunk): fix the scheduled trunk check-all failures

- Ignore hadolint DL3008 on the runtime stage apt-get, matching the
  emulator-download stage
- Build alias-search test ROMs with tests.factories.make_rom instead of
  the banned add_rom
- Drop a bandit B405 ignore that suppresses nothing
- Bump fast-uri to 3.1.8 for GHSA-hrr3-gc8f-f4qj

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(tests): type the alias-search rom helper kwargs as Any

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 08:05:38 -04:00
Georges-Antoine Assi
6f2a361481 Play RPG Maker 2000/2003 games in the browser with EasyRPG (#5077)
* feat(player): play RPG Maker 2000/2003 games in the browser with EasyRPG

Embed the EasyRPG web player for extracted game folders on the rpg-maker
platform. The backend generates the player's index.json from the scanned
files and merges in the free EasyRPG RTP under every name the official
and fan RTPs give its assets, so games that lean on the RTP find them.
In-game saves sync with the user's RomM saves through the player's
IndexedDB storage.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(easyrpg): read the free RTP from a fixed path instead of an env var

The full image always keeps the RTP at /var/www/html/assets/easyrpg/rtp,
so the path is a constant beside the web path nginx serves it under. The
dev container links its copy there at startup.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(easyrpg): code-review fixes for the save sync and asset endpoint

- Wait for an in-flight push before the quit push, so the newest save uploads
- Keep Play disabled until the fresh rom (and its saves) is fetched
- Stop onPlay and the rom fetch from acting after the view unmounts
- Leave through usePlayerExit like the other players
- Handle a rejected IDB commit when the run itself fails
- Track uploads by the browser's file name
- Load only visibility and files per asset request, not the full rom
- Serve DEV_MODE files as octet-stream, matching nginx
- Make the traversal test actually reach the endpoint

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(easyrpg): simplify pass over the player and asset endpoint

- Load only file paths per asset request, and look up RTP folders in O(1)
- Reuse RomFile.file_name_for_download and usePlayerFullscreen
- Share one dev/prod serve helper for game and RTP files
- Derive the save sync's game key from the rom
- Have the RTP table tool reuse normalize_name
- Make save-module internals private and tidy the prepare/read loops

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(easyrpg): flag RPG Maker game folders on the rom schemas

Gallery lists carry no files, so the frontend guessed that every multi-file
rom on the rpg-maker platform was playable, including RPG Maker XP/VX/MV
folders. Rom now has a deferred `is_easyrpg_game` subquery (an RPG_RT.ldb at
the folder root), loaded with the other gallery file stats and derived from
loaded files on the with_files path, and the frontend reads it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(easyrpg): drop server save sync, keep saves per user in the browser

Server sync moves to a follow-up that puts the web players on device sync.
Saves now stay in the player's IndexedDB, as js-dos does, with the same note
on the start page. The player is launched as `<rom id>-<user id>` so each
RomM account sharing a browser profile keeps its own saves; nginx and Vite
drop the user id when routing to the backend.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(easyrpg): address Greptile review

- Start timing the play session once the player page loads
- Use object-form props in the view test's button mock
- Keep the RTP table tool's docstring to one sentence

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(easyrpg): keep the RTP table in a fixtures folder

Matches handler/metadata/fixtures, where the other bundled data files live.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-03 17:51:38 -04:00
Sam Dornan
655976faa9 feat(soundtrack): play SPC, VGM, VGZ and GYM soundtracks in the browser (#5079) 2026-10-03 13:12:28 -04:00
Yukine
f0928e4f53 chore(converto): bump rom-converto to v0.23.2 in both images (#5041) 2026-10-02 19:00:42 -04:00
Georges-Antoine Assi
640a783f3f feat(converto): convert the library in place and serve downloads in a requested format (#4999)
* feat(converto): integrate rom-converto for title id extraction and download conversion

* fix(docker): ship rom-converto in the production image

Only the dev Dockerfile installed the binary, so the integration could
never enable on a released image. Fetch the same pinned, checksummed
musl build in a dedicated stage and copy it next to RAHasher.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(converto): skip the update check and batch info calls

The CLI asks api.github.com for a newer release on every run unless
told not to, so pass --no-update-check on each invocation. Inspect a
rom's files in one `info --paths-file` run instead of one subprocess
per file, and read the inspectable extensions from the capabilities
manifest so scans skip files info cannot recognize.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(scan): keep sigil authoritative for title ids

rom-converto ran first and overrode the ids sigil read. Sigil now runs
first and records its per-file ids; rom-converto only fills files sigil
left unset, on new or changed files, in one batch. Restore the base-id
selection for sigil extractions on every platform, as on master.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(downloads): make conversion opt-in and bound the cache

The download endpoint returned a converted file to every client once a
platform had a target, including the browser player and apps that check
hashes against RomFile. Conversion now needs ?converted=true.

A pre-warmed copy is served whatever its size; the in-request size cap
only gates starting a conversion. ROM_CONVERTO_CACHE_MAX_SIZE_GB
(default 20, 0 unbounded) caps the cache: conversions and the pre-warm
task stop when it is full, and cleanup evicts the least recently served
copies.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(types): regenerate frontend types for the converto schema

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(converto): address code-review findings (pr-ready step 2)

- Fall back to rom-converto's stored ids only when it ran this pass, in
  disc order, so a rescan that skipped extraction keeps sigil's save target
- Persist per-file title ids that extraction writes onto reused rows
- Only authenticated callers may start an in-request conversion; past a
  240s deadline serve the original and let the conversion finish into the
  cache instead of nginx returning 504
- Treat a probe OSError or timeout as a failed probe; kill the subprocess
  when the caller is cancelled
- Give the pre-warm task the scan timeout and report progress in the
  ConversionStats shape the task UI reads
- Reuse zip_cache constants, walk the cache off the event loop, tolerate
  files vanishing mid-cleanup, and trim long comments

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): simplify conversion code (pr-ready step 3)

- Move the converted-download policy (target lookup, cached-first, sync
  size cap, deadline) from the endpoint into utils/conversion_cache and
  share conversion_target with the pre-warm task
- Share one path lookup between get_cached_converted and get_or_convert;
  the pre-warm walks the cache once and tracks a running byte budget
  instead of walking it twice per rom
- One normalize_platform_formats beside TARGETS_BY_PLATFORM for the
  config loader (via _validated_platform_map) and the settings endpoint;
  update_converto_settings takes a ConvertoConfig and is written back
  with dataclasses.asdict
- read_infos owns its never-raise contract, so the scan drops its blanket
  except; drop the unused RomConvertoInfo.kind and error attributes
- Sort files for the rom-converto identity only when it is used; stat
  each cached file once during cleanup

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(converto): trim comments (pr-ready step 4)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): convert on first download instead of pre-warming

A library pre-warm fought the TTL: cleanup dropped every copy nobody
downloaded within a day. Remove the Convert library task and convert on
demand only. Files over ROM_CONVERTO_MAX_SYNC_SIZE_MB now start their
conversion in the background while the original is served, so the next
download within the TTL gets the converted copy at any size.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): drop decrypt and encrypt download targets

Downloads now only change a rom's container or compression (CHD, RVZ,
CSO, NSZ, ...); serving decrypted files is left for a separate decision.
NDS and PS3 have no remaining targets. Also note that the conversion
concurrency limit applies per process.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): move the cache limits into converto.*

cache_max_size_gb and max_sync_size_mb join cache_ttl_hours in
config.yml and PUT /api/config/converto_settings, replacing the
ROM_CONVERTO_CACHE_MAX_SIZE_GB and ROM_CONVERTO_MAX_SYNC_SIZE_MB env
vars, so every eviction knob is edited in one place at runtime. The
loader takes its defaults from ConvertoConfig and one table holds each
integer's minimum for both the loader and the payload.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): lock conversions with flock instead of a sentinel

A conversion now holds a non-blocking flock on its key dir, which the
kernel releases if the worker dies. That replaces the .partial sentinel,
its 6-hour staleness guess (which a long ROM_CONVERTO_TIMEOUT could
outlive), and the rename-aside takeover. Cleanup skips locked dirs, and
partial output gets a hidden name so it never counts as a served copy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(converto): parametrize repeated test cases

Collapse the per-platform info parsing, operation resolution and
converto_active cases into parametrized tests, so a new platform or
target is one row.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(scan): run rom-converto first with sigil as the fallback

rom-converto reads each rom's new or changed files first, in one batch,
and its title ids win. sigil still reads what it can, since it alone
provides save targets and Switch content types, and fills the ids
rom-converto left unset.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(converto): store per-file metadata read by rom-converto during scans

* fix(scan): keep the stored save target when sigil reads nothing

* fix(converto): read Xbox 360 disc ids and Wii title versions, store content type as text

* feat(converto): save file icons, banners and backgrounds read by rom-converto

* chore(converto): bump rom-converto to v0.23.0

* fix(converto): address review findings in the conversion cache, scan metadata and settings

* refactor(converto): move per-file metadata out of the conversion PR

Scan-time metadata (title ids, the 17 rom_files columns, artwork and
converto.scan_metadata) moves to its own PR so its columns land with the
UI that reads them. This PR keeps conversion only.

The conversion cache no longer has uncompressed_size_bytes to budget
with, so a conversion to an uncompressed target reserves a fixed
multiple of its input and the cleanup pass after it evicts any overshoot.

Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ

* feat(converto): let the client pick the download format with ?format=

`?format=zso,iso` lists the formats a client can read. The stored file is
served whenever its format is listed, even with conversion off, so most
emulator clients never trigger a conversion. Otherwise the first listed
format with a cached copy is served, then the first one rom-converto can
produce.

A conversion that outlasts a short wait answers 202 with Retry-After
instead of falling back to the original, so a URL never serves two
different files and a client never gets bytes it can't read. 406 means
no listed format can be served. HEAD reports the same without starting
a conversion. This replaces `?converted=true`, the per-platform download
target and `max_sync_size_mb`; `cache_ttl_hours` stays config.yml-only.

Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ

* feat(converto): convert the library in place with a manual task

`converto.platform_formats` now names the format a platform's library is
stored in, and the new "Convert library" task brings every matched rom
to it. Each output is staged in a `.romm_tmp_` directory beside the
original, moved into place, and only then are the originals (and a cue's
tracks) deleted. Single-file roms take the new name, folder roms keep
theirs and get their .m3u entries rewritten, and the file rows refresh,
so a rom keeps its id, saves and collections.

Only lossless conversions qualify, so xbox (xiso trims the dump) has no
library format. Unmatched roms are skipped because a converted file no
longer hash-matches a DAT. `/api/config` now carries the library targets
and, per input extension, the formats a download can be converted to.

Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ

* fix(converto): address Greptile and Copilot review findings

- Publish a converted library file with a no-replace link, so a file that
  appears during conversion is never overwritten.
- Delete originals only after the rom row or its playlists point at the new
  file, and keep them if that update fails. Playlists are rewritten atomically.
- Refuse a cue conversion whose tracks another rom or another cue holds.
- Remove stage dirs a killed conversion left behind.
- Try later ?format= targets when a conversion fails, treat any locked key dir
  as converting, and cap how many conversions downloads can start.
- Drop the unsupported iso target for CD platforms from the example config and
  list the ROM_CONVERTO_* variables in env.template.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(converto): address code-review findings (pr-ready step 2)

Serve converted outputs at 0644, read cue sheets and playlists with a BOM,
stage folder rom conversions outside the rom folder, keep one rom's failure
from stopping the convert library task, accept alias extensions as the stored
format, probe running conversions with a shared lock, and bound the timeout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): simplify conversion code (pr-ready step 3)

Check and chmod rom-converto output once in the adapter, canonicalize
requested format aliases, reuse LINK_FALLBACK_ERRNOS and the handler's atomic
write, make the download format table a constant, skip the probe lock once
cached, and fold duplicated name checks and cache stat passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(converto): trim comments (pr-ready step 4)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(converto): find rom-converto on PATH instead of ROM_CONVERTO_PATH

Both images install the binary on PATH, the variable was undocumented,
and RAHasher is already resolved the same way.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Yukine <devyukine@gmx.de>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: DevYukine <20647088+DevYukine@users.noreply.github.com>
2026-10-01 19:02:37 -04:00
Sam Dornan
864a0769fc chore(deps): bump uv to 0.12.19 and relax required-version for Dependabot (#4832) 2026-09-27 10:23:19 -04:00
Sam Dornan
6002b8fdaa chore(docker): verify downloads with ADD --checksum and pin RAHasher by commit (#4781) 2026-09-26 11:35:02 -04:00
nendo
a10a62a29a fix(sigil): bump the pin so gamecube save targets name a gci on disk 2026-09-22 08:01:57 +09:00
nendo
33c3011ef6 fix(docker): clone sigil from its rommapp home 2026-09-17 07:07:07 +09:00
nendo
ca17bfe7dd fix(docker): bump sigil to read lowercase and irregular PSX/PS2 boot serials 2026-09-16 21:22:47 +09:00
Sam Dornan
e371a80ffa fix(uv): pin uv exactly and cover the devcontainer image
The devcontainer image (./Dockerfile, built as the romm-dev compose
service) copies uv from a tag of its own and runs uv sync over the same
pyproject.toml, so the new required-version rejected its 0.11.2 and broke
dependency installation there. Bring it to the same version.

A floor also left the drift it was meant to close: setup-uv could resolve
a newer uv than either image runs, and a lock written by that uv would
pass CI and then fail an image build, which is label-gated and so not
part of an ordinary run. Pin the version exactly instead.

The test now covers both images and asserts the pin stays exact.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 00:56:05 +00:00
Sam Dornan
a1e12fb6ac fix(docker): bump sigil past the zstd asm link failure
The pinned sigil revision globs zstd's decompress sources as C only, so
huf_decompress_amd64.S is never assembled while huf_decompress.c still calls
into it. Building the cffi bindings fails at the shared-object link:

  undefined reference to `HUF_decompress4X2_usingDTable_internal_fast_asm_loop'
  relocation R_X86_64_PC32 against undefined hidden symbol ... can not be
  used when making a shared object

argosy-sigil fixed this on main by selecting zstd's C fallback with
ZSTD_DISABLE_ASM. Bump the pin to pick it up.

Verified on linux/amd64 against 4b0f138: cmake build, shared-object link, the
cffi binding build under Python 3.14, and importing the module. sigil.extract
keeps the signature adapters/services/sigil.py calls.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NtfAbk9LrxmwFnBktP3NkY
2026-09-09 16:11:43 -05:00
Georges-Antoine Assi
a44c3bbce9 docs(docker): drop the rationale from the DL4006 ignore
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 08:17:47 -04:00
Georges-Antoine Assi
609f1bcb3d chore(dev): provision the browser emulator runtimes in the dev image
Fetch EmulatorJS, Ruffle, js-dos and FAKE-08 in the dev Dockerfile, on the
same pins and checksums as the emulator stage of docker/Dockerfile, into
/opt/romm/emulators. The ./frontend bind mount hides anything the build
writes under /app/frontend, so entrypoint.sh links each runtime into the
assets tree the dev server serves, leaving names held by checked-in art
alone. The runtime directories join the dev watcher's ignore list so
chokidar does not crawl them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 21:27:04 -04:00
Georges-Antoine Assi
a3aecdf045 chore(python): restore the C accelerators lost on 3.14
The runtime moved to 3.14 but the pinned versions did not, so packages
without cp314 wheels silently resolved to their pure-Python universal
wheels. Bump each to the first release that ships cp314 wheels, all
within the existing pyproject specs:

- SQLAlchemy 2.0.41 -> 2.0.52 (cyextension, and greenlet is back so
  sqlalchemy.ext.asyncio is functional rather than merely importable)
- multidict, propcache, frozenlist (aiohttp/yarl accelerators)
- wrapt 1.17.2 -> 1.17.3 (OpenTelemetry instrumentation proxies)
- coverage 7.9.2 -> 7.16.0 (CTracer, and CI runs the suite under --cov)
- mysql-connector-python 9.3.0 -> 9.7.0 (C extension protocol)
- debugpy 1.8.14 -> 1.8.21 (pydevd accelerators)
- pyinstrument 5.0.3 -> 5.1.3 (no longer compiled from sdist on every
  `uv sync --all-extras`, which broke the no-toolchain dev setup)
- anyio 4.9.0 -> 4.14.2, dropping a PEP 765 SyntaxWarning printed on
  every process start

Run pytest and the migrations workflow when the runtime or the lock
changes: nothing in the 3.14 bump lives under `backend/`, so neither
workflow triggered on it. `e2e.yml` already listed those paths.

Make `.python-version` the single home for the version: `uv python
install` and `actions/setup-python` both read it. In the dev Dockerfile
that also fixes the interpreter layer not being invalidated when the pin
changes, and the sigil install now derives site-packages from the venv.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 21:48:52 -04:00
Sam Dornan
3c547dfbd0 chore(python): move the backend to Python 3.14
Bumps the runtime everywhere it is pinned: requires-python, the
.python-version uv reads, both Dockerfiles (with the python:3.14-alpine3.23
and uv 3.14 image digests), the six workflows that install Python, and the
contributor docs.

Several locked C-extension versions had no cp314 wheels, so the Alpine
image fell back to building them from source and failed on the missing
C++ and Rust toolchains. Those packages are upgraded within their existing
pyproject ranges: pydantic 2.11.7 -> 2.13.5 (pydantic-core 2.46.5), uvloop
0.22.1, grpcio 1.83.1, httptools 0.8.0, inflate64 1.0.4, markupsafe 3.0.3,
pyyaml 6.0.3 and streaming-form-data 1.20.0. The lockfile also drops the
3.13-only resolution branches.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 08:57:10 -05:00
Georges-Antoine Assi
97a16e2c79 refactor: tighten comments and tests on the sigil branch
Reverts the FileRow hash-chip loop. It was left over from the per-file
version chip that no longer exists, so it is unrelated to title ids.

Cuts the comments that restate the code or defend an obvious choice, and
the `Args:` block on `get_matching_missing_rom` that repeated its own
parameter names. The CNMT content-type rationale now lives only on
`CONTENT_TYPE_CATEGORIES`.

Tests exercise the production path: the title id regex is checked with
`fullmatch`, the way the caller uses it, and `test_identity` builds its
auth header the way every other endpoint test does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 17:13:20 -04:00
Georges-Antoine Assi
bcafc3d504 refactor(scan): tighten the sigil title id plumbing
Rename embedding now goes through the handler's own rename primitive
(`rename_fs_rom`), so it inherits the library-root path validation and
per-path locking every other write in that class gets, and builds the new
name with the repo's multi-part extension helpers.

Extraction no longer reads files it can never parse: archives, manuals,
soundtracks and screenshots are skipped, and on non-Switch platforms it
stops after the first result, since only Switch looks at a per-file
content type.

Also collapses the two rom-level branches (dropping a closure), gives the
Switch family one home in RomM's own terms instead of deriving it from
sigil's slug string, logs an unrecognized save target layout instead of
dropping it silently, deletes the `ScannedFSRomValues` mirror of `FSRom`,
drops a dead `rom.version` locale key, and slims the sigil Docker builds
to one layer with a filtered clone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 16:34:36 -04:00
nendo
a057c886ae feat(scan): extract PS3, Xbox and Xbox 360 title ids via sigil
sigil gained an Xbox extractor and learned to read PS3, PS Vita, Xbox 360
and Wii U out of their containers, so the three platforms it could
already name are now reachable from a scan. All three are non-hashable
or partly so, which is where a binary id earns the most: it is the only
identity those libraries carry. The extractors are flagged experimental
upstream.
2026-08-28 10:54:58 +09:00
nendo
b9261cdea6 fix(scan): store 3DS, Wii and Wii U save ids in the emulator's case
save_id is the literal on-disk save location, and azahar, dolphin and
cemu all build those directories with lowercase hex. On case-sensitive
storage an uppercase id addressed a second directory beside the
emulator's own, so a game's saves split across the two. Sigil now emits
the path in the case the emulator writes; the pin moves with it, and
0111 recases the ids already stored so an existing library does not have
to be rescanned. title_id keeps its canonical uppercase form.
2026-08-26 19:27:15 +09:00
nendo
0cf06f2200 Bump sigil pin for 3DS z3ds extraction fix 2026-08-17 03:21:41 +09:00
nendo
0c88dfdfe0 Extract 3DS save location via sigil folder-split usage
The 3DS nests its save under two directory levels, so sigil reports it as
a '/'-separated save_id (00040000/00033500) flagged with usage=folder-split
rather than a flat id. Add SaveUsage.FOLDER_SPLIT, migrate the saveusage
enum (0106), regenerate the frontend SaveUsage type, and bump the sigil
pin to 98f3c62.
2026-07-30 15:27:28 +09:00
nendo
6042a1c56b Merge upstream master into feature/sigil-title-ids
Re-integrate the sigil title-id feature on top of upstream's scan
reconciliation refactor and migration additions.

Scan reconciliation:
- _identify_rom now persists rom files via db_rom_handler.sync_rom_files
  instead of purge_rom_files + per-file add_rom_file. The obsolete
  RomFile copy-list (title_id/save_id/title_version) is removed; those
  fields now ride along through ROM_FILE_SCANNED_COLUMNS.
- Add title_id, save_id, title_version to ROM_FILE_SCANNED_COLUMNS so
  sync_rom_files copies them onto reconciled rows. Without this the
  extracted ids/version silently drop to NULL on rescan.
- Single-file embedding rename (renamed_rom_fs_name) preserved in both
  the new-entry and update paths of _identify_rom.

Migrations renumbered to chain after the new upstream head:
- 0102_sigil_title_ids -> 0104_sigil_title_ids (down: 0103_roms_facets_provider_ids)
- 0103_sigil_title_version -> 0105_sigil_title_version (down: 0104_sigil_title_ids)

Tests:
- Reworked TestIdentifyRomPersistsFileTitleVersion to capture
  sync_rom_files and assert the scanned RomFile carries title_id and
  title_version; added a direct assertion that ROM_FILE_SCANNED_COLUMNS
  includes the sigil columns.
2026-07-24 07:20:10 +09:00
nendo
fe0b4de169 Bump sigil pin for Switch CNMT content type and version 2026-07-24 05:20:09 +09:00
nendo
c90260500e Bump sigil pin for PS2 folder-prefix save_id 2026-07-24 04:23:41 +09:00
nendo
8fa9bc53e4 Bump sigil pin for the Linux large-CHD fix 2026-07-24 03:45:00 +09:00
nendo
2f1d69f834 Build sigil into Docker images as an optional dependency
docker/Dockerfile gains a sigil-build stage (python:3.13-alpine base so
the cffi extension matches the venv's cp313/musl ABI) whose staged
package is copied into the slim image's site-packages; the Ubuntu dev
image builds it inline after uv sync. Pinned by commit ARG. The
backend treats the package as optional, so images built without it
simply skip extraction. DEVELOPER_SETUP documents the optional local
build.
2026-07-24 02:54:37 +09:00
Georges-Antoine Assi
dc981f51c8 fix(archives): read RAR archives through bsdtar so they can be hashed
The bundled 7zz is built without the RAR codec (unRAR license), so it can
neither list nor extract RAR members. Every content-based match silently
came up empty for .rar: no RetroAchievements hash and no CRC/MD5/SHA-1 for
hash-database providers.

RAR listing and extraction now go through libarchive's bsdtar, added to the
images as libarchive-tools. Listing uses an mtree rewrite (libarchive's only
machine-readable listing) and member names are escaped before being handed
back to bsdtar, which matches them as globs.

Fixes #3884

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 10:13:50 -04:00
Georges-Antoine Assi
52163633e5 Merge branch 'master' into claude/server-side-rom-patching-EaQck 2026-06-23 07:01:07 -04:00
zurdi
8f879d0b59 chore: update Node.js version to 24.16 across workflows and Dockerfile, and enhance package.json with npm version specification 2026-05-26 09:23:47 +00:00
Georges-Antoine Assi
1ee4682845 feat: drive frontend patcher via server-side endpoint, isolate Node deps
- Rewrite frontend/src/views/Patcher.vue around library ROM/patch pickers
  (v-autocomplete with debounced search) and call POST /api/roms/{id}/patch
  with responseType: blob; download and/or re-upload the patched output.
- Drop the rom-patcher npm dep and vite-plugin-static-copy from the frontend;
  remove the now-unused web worker, type decls, and viteStaticCopy plugin.
- Move the Node patcher into a self-contained npm project at
  backend/utils/rom_patcher/ (dir uses underscore so it's a valid Python
  package). Patcher.js loads RomPatcher.js from its sibling node_modules.
- Extract the heavy subprocess logic into backend/utils/rom_patcher/patcher.py
  (apply_patch, PatcherError, SUPPORTED_PATCH_EXTENSIONS); slim patch.py to
  HTTP/DB plumbing and fix a stale .parent.parent path.
- Wire up Docker: dev Dockerfile installs the new npm project; prod
  Dockerfile adds a backend-node-build stage and copies rom-patcher-js into
  the production image; install nodejs at runtime.
- Add new patcher i18n keys to en_US (other locales fall back).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 07:39:31 -04:00
Georges-Antoine Assi
ec8583016b mega ton of fixes for 4.8 2026-04-03 10:54:31 -04:00
zurdi
56bc8c58dd feat: update RAHasher to version 1.8.3 and add Wii platform support 2026-03-20 13:24:19 +00:00
Georges-Antoine Assi
695a12a21a upgrade some base images 2026-02-16 22:11:47 -05:00
Georges-Antoine Assi
d005dba90b fix a bunch of shit 2025-08-09 11:16:12 -04:00
Georges-Antoine Assi
b247a5c5bb small tweaks 2025-08-07 17:39:57 -04:00
Georges-Antoine Assi
6b307afcd3 Run worker as a native process 2025-08-06 21:57:32 -04:00