Commit Graph

11335 Commits

Author SHA1 Message Date
Georges-Antoine Assi
6a8d34bcad Merge pull request #4242 from sdornan/claude/fervent-noyce-aba3ea
test: fix flaky LaunchBox release date property test (DST fold)
2026-08-19 15:06:36 -04:00
Georges-Antoine Assi
5315499057 Merge pull request #4240 from darkpaul91/romm-getRoms-query-misses-grouped-game-entries-when-filter-doesnt-match-primary-version
fix(backend): make filters match against all grouped versions instead of only the main version of each game entry
2026-08-19 14:43:25 -04:00
Georges-Antoine Assi
edff89f913 Merge pull request #4239 from sdornan/claude/filename-underscores-scraping-513712
Match LaunchBox dumps that separate words with underscores
2026-08-19 14:43:15 -04:00
Georges-Antoine Assi
cd02cc5e68 Merge pull request #4235 from sdornan/claude/github-issue-2926-validation-4a3669
fix(hltb): fetch metadata when a HowLongToBeat ID is set by hand
2026-08-19 14:19:23 -04:00
Sam Dornan
323d7e9879 test: pin a DST timezone in the ambiguous release date test
CI runs with TZ unset, so no local time is ambiguous and both folds of
1981-10-25T01:00 named the same instant. The assertion held trivially and
would not have caught a regression in first-occurrence handling.

Pin America/New_York for the duration of the test, since a naive
datetime.timestamp() reads the process timezone, and assert the two folds
really are an hour apart so the test fails loudly instead of going vacuous
if that ever stops holding.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 10:32:37 -05:00
Sam Dornan
1c907c1557 test: fix flaky LaunchBox release date property test
st.datetimes() generates naive datetimes with fold=1 (the second
occurrence of an ambiguous local time on a DST fall-back day), which made
test_valid_iso_dates_parse_to_timestamp unsatisfiable: datetime.isoformat()
omits fold, so both occurrences reach parse_release_date as the same
string, while dt.timestamp() honours fold. The two sides then differ by
the DST offset.

Constrain the strategy to fold=0. This loses no coverage, since every
fold=1 value maps onto its fold=0 twin that the strategy already
generates, and it matches what fromisoformat returns for a string with no
fold information. Also add a deterministic test pinning the behaviour:
both folds serialize to the same ISO string, and the parser resolves it to
the first occurrence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 10:26:11 -05:00
Pablo Pérez Corral
795ff5c5ff apply existing metadata filters before grouping different roms versions under a single entry. 2026-08-19 15:14:01 +02:00
Sam Dornan
1cd29d7285 Match LaunchBox dumps that separate words with underscores
The LaunchBox name lookup rewrites a search term before hitting the
metadata index: " - " becomes ": ", and a trailing article is moved back
to the front. Both rewrites are anchored on literal spaces, so a dump
named with underscores reaches neither, and the folded fallback cannot
recover it either because the article is left in the wrong position.

Legend_of_Zelda,_The_-_A_Link_to_the_Past.smc missed every index stage
while its space-separated equivalent matched. Swap underscores for
spaces before the rewrites so both forms resolve to the same term.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 07:45:05 -05:00
Georges-Antoine Assi
2ba7e4fd2e Merge pull request #4234 from sdornan/claude/i18n-perm-entity-playlists
fix(i18n): add the missing playlists permission entity label
2026-08-19 08:07:44 -04:00
Georges-Antoine Assi
2ed4861a10 Merge pull request #4231 from sdornan/claude/settings-translation-title-bug-871d77
fix(i18n): translate route titles once locale messages are loaded
2026-08-19 07:58:05 -04:00
Sam Dornan
808745e7ae fix(hltb): don't mistake markup or a redirect for a rewritten page
Two ways the 502 could fire on a page RomM can still read:

The hydration tag was matched by exact attribute order, so a CSP nonce or a
reordered attribute would have been reported as a rewrite. The id alone
identifies it.

`raise_for_status` lets a 3xx through, so a hop HLTB added later would reach
the parser as a page with no payload. Redirects are now followed; the client
validates every hop against SSRF, redirects included.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 20:38:33 -05:00
Sam Dornan
03fe992101 fix(hltb): map every transport failure on the game page to 503
`ConnectTimeout` is the likely failure when HLTB is slow or unreachable, and
it is not a subclass of `ConnectError`, so it escaped `update_rom` as a bare
500 rather than the actionable 503 the other providers give.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 20:30:28 -05:00
Sam Dornan
e7440a2dfc fix(hltb): fetch metadata when a HowLongToBeat ID is set by hand
`update_rom` fetches from every metadata provider whose ID changed, except
HLTB, which had no by-ID lookup at all. A hand-entered ID was stored and the
How Long to Beat tab stayed empty.

HLTB's API only exposes search, so `get_rom_by_id` reads the record from the
`__NEXT_DATA__` payload the game page already ships. The canonical
`/game/{id}` path is requested directly, as `/game?id=` answers with a
redirect the shared httpx client does not follow, and the game page dates a
release in full where search returns just the year.

A page RomM can no longer read raises 502 naming the cause instead of
reporting a game with no times, since that failure is otherwise
indistinguishable from the bug this fixes.

Fixes #2926

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 20:19:26 -05:00
Georges-Antoine Assi
42fcf2764b Merge pull request #4230 from sdornan/claude/atomic-file-fix-extract-f7nail
fix(resources): publish downloaded resources atomically
2026-08-18 20:25:33 -04:00
Georges-Antoine Assi
7de0beb128 Merge pull request #4228 from TowyTowy/fix/ss-switch-fallback-manual-url
fix(ss): don't use the Switch icon URL as the manual URL
2026-08-18 19:20:59 -04:00
Georges-Antoine Assi
15775d73a2 Merge pull request #4225 from sdornan/claude/hltb-separator-retry
fix(hltb): match titles whose series prefix the catalogue omits
2026-08-18 19:20:43 -04:00
Sam Dornan
37b5b367f0 fix(i18n): add the missing playlists permission entity label
The permissions matrix labels each row with
`t(`settings.perm-entity.${e}`)`, and the entity list comes straight from
`/permissions/catalog`, which returns every `PermEntity` member. That
includes `playlists`, which had no label, so vue-i18n fell back to
rendering the key and the row read `settings.perm-entity.playlists`.

Follows the block's existing style: English everywhere, translated in
pt_BR, which is the only locale that has translated these labels.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 18:13:47 -05:00
Georges-Antoine Assi
cda2acd652 Merge pull request #4224 from sdornan/claude/launchbox-matching-regression-9cebe4
fix(launchbox): match titles differing only by punctuation
2026-08-18 19:12:45 -04:00
Sam Dornan
983caaa543 refactor(i18n): request global scope explicitly where the locale is set
`useI18n()` already resolves to the global scope while no SFC declares an
`<i18n>` block, but the components that switch the app's language now say
so, per the vue-i18n scope guide. An `<i18n>` block added to either SFC
would otherwise flip the write to component-local and silently stop the
language switch from reaching the rest of the app.

The v1 language selector is left alone: it writes the locale the same
way, but v1 is frozen and this is a defensive change, not a bug fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 17:32:27 -05:00
Sam Dornan
d0760f570e refactor(i18n): load locale bundles on demand and key every route title
Review follow-ups:

- Only the fallback and stored languages are awaited at boot; the rest
  load when switched to, so startup no longer blocks on every locale
  bundle. The locale watcher awaits the incoming language before
  re-applying the route title.
- `settings.controller-debug` already exists, so the last literal
  route title becomes a key, and the root route drops its redundant
  "RomM" title (the guard already falls back to it). Every `meta.title`
  is now an i18n key, which the test no longer has to exempt.
- Drop the em-dash from the new comment per the repo writing rule, and
  the trailing space in the locale load error.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 17:20:25 -05:00
Sam Dornan
3ebe5e7541 fix(i18n): translate route titles once locale messages are loaded
Opening a route in a new tab showed the raw i18n key (e.g.
"settings.scan-settings") as the tab title. Locale namespaces load as
separate chunks and nothing awaited them, so the router guard resolved
the title before any messages existed. Route definitions compounded it
by calling `t()` at module-eval time, baking the key into `meta.title`
and leaving the guard to translate it a second time.

Bootstrap now awaits a `localesReady` promise before installing the
router, `meta.title` holds the plain key, and a locale watcher
re-translates the current title — the stored language is applied when
the app mounts, after the first navigation guard has already run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 17:05:58 -05:00
Sam Dornan
7931b70d24 fix(resources): correct misleading error message in store_ra_badge
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 11:58:40 -05:00
Sam Dornan
6c781a1125 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-18 11:51:57 -05:00
Sam Dornan
2c31202e60 fix(resources): clean up the temp file when a download is cancelled
_atomic_write cleaned up in `except Exception`, which does not catch
CancelledError. Stopping a scan mid-download therefore stranded a
`.romm_tmp_*` file per cancelled transfer. Catch BaseException instead.
This also covers uploads, which have always gone through this path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YKbk4cDmdKKMcBxGmsRVT5
2026-08-18 15:05:12 +00:00
Sam Dornan
ce78561c41 fix(resources): publish downloaded resources atomically
Streamed downloads opened the destination directly, so an interrupted
transfer truncated the file in place. A truncated file is worse than a
missing one: it still satisfies the *_exists checks, so later scans skip
it and never refetch. The error paths cleaned it up, but only when the
process survived to run them, which a SIGKILL or host reboot does not.

write_file_streamed now writes to a temp file in the destination
directory and renames it over the target once the caller's block
completes, reusing the _atomic_write helper uploads already use. The
handle closes before the rename, so the target never sees a partial
flush.

The _discard_partial_file calls that followed a streamed write are gone.
There is no longer a partial file to remove, and the target now holds
either nothing or the previous good copy, which those calls would
delete. Refreshing a cover no longer costs the existing one when the
transfer dies.

The two disk-full tests patched write_file_streamed itself, so they were
asserting against the non-atomicity this removes. They now fail the
write from the response stream and exercise the real path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 9b81fef29564d053c0ba4bb21f2192e0b9dc1f50)
2026-08-18 14:57:06 +00:00
Sam Dornan
9e92e325f7 chore: drop review-flagged comments
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 08:11:09 -05:00
TowyTowy
18355f36a0 fix(ss): don't use the Switch icon URL as the manual URL
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 14:18:19 +02:00
Sam Dornan
66ddcab7d0 fix(hltb): split the retry term on colons only
Splitting on the shared separator pattern also split in-word hyphens, so
"spider-man 2" would have retried as "man 2" and invited a match on an
unrelated game. The retry fires on any rejected match rather than only an
empty result set, so it reaches that case far more readily than the Moby
and ScreenScraper retries do.

The term has already had " - " rewritten as ": " by this point, so a
series separator is a colon and any hyphen left is inside a word. Every
title the retry exists for splits identically.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 17:24:51 -05:00
Sam Dornan
e1fe2caf0f fix(launchbox): keep marks the script spells with when folding
A mark was dropped whenever it was not alphanumeric, and the accent strip
before it removed every mark carrying a combining class. Between them they
took the vowel signs and viramas Indic and Thai scripts spell with, so
"हिन्दी गेम" folded to "हनदगम" and titles differing only in those marks
collided.

A mark now only goes when it sits on a Latin letter, which is the case it
was meant for. Collisions across the dump are unchanged at 551 of 186505
keys, none differing in their digits, and the PlayStation 2 gain still
measures 96.7%.

Also build each game's dict once rather than per index write.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 17:19:57 -05:00
Sam Dornan
6cdac8ad6b test(hltb): cover the separator retry
Pins the behaviour the retry exists for and the limits it must respect: a
series prefix the catalogue omits resolves through the tail, a term that
matches whole is not searched twice, a term with no separator is not
either, and an entry with no recorded times is still no match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 17:08:07 -05:00
Sam Dornan
4929151048 fix(launchbox): keep letters of every script when folding a title
Folding to ASCII alone reduced a title written in another script to
whatever digits it carried, so "三國立志傳2" and "忍者村大战2" shared one key
and four Windows titles collapsed onto "2". Keeping every alphanumeric
character instead separates them and gives the 208 titles that folded to
nothing a key of their own.

Measured over all 187067 named games in the dump, colliding folded keys
drop from 597 to 551 and the PlayStation 2 gain is unchanged at 96.7%.
Every surviving collision is a punctuation variant of one game, and none
differ in their digits, so no entry in a series folds onto another.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 17:05:31 -05:00
Sam Dornan
26f595d8b9 fix(hltb): match titles whose series prefix the catalogue omits
HowLongToBeat is searched with the filename, and a series prefix that one
side carries and the other does not sinks a strict similarity gate: "007:
Quantum of Solace" scores 0.838 against the catalogue's "Quantum of
Solace", just under 0.85, and a term long enough returns no results at
all. Every James Bond title on PlayStation 2 missed for one of those two
reasons.

Retry with the part after the last separator, the same recovery Moby and
ScreenScraper already make. The trigger is broader than theirs, which
only retry an empty result set: a scored-but-rejected result has to
retry too, since that is how "Quantum of Solace" fails.

Verified against the live API: all five PlayStation 2 James Bond titles
now resolve, and six subtitle-heavy titles that could plausibly match the
wrong game on a tail-only search are unaffected, because the full term
matches first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 17:01:28 -05:00
Sam Dornan
51d27c2ec2 feat(scan): record which LaunchBox sources a scan can read
A local install is consulted on every lookup and the per-scan switch only
decides whether the cloud store is read too, so either can be selected
while holding nothing. A lookup against an absent source is silent, which
left "no install mounted" indistinguishable from "no matches" across a
whole platform.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 16:51:44 -05:00
Sam Dornan
6ce0a2f528 fix(launchbox): match titles differing only by punctuation
LaunchBox titles carry colons, diacritics and characters a filesystem
forbids that a ROM filename cannot, so an exact-key lookup misses games
the dump holds: "Burnout Revenge" against "Burnout: Revenge", "Asterix"
against "Astérix", "AC-DC" against "AC/DC".

Index every title under a folded form as well, and consult it only once
every exact form has missed so an exact hit still wins.

Measured over the 2585 Redump-style PlayStation 2 titles the dump names,
this lifts matching from 89.8% to 96.7%. All five colliding folded keys
are LaunchBox's own duplicate records for a single game.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 16:51:42 -05:00
Sam Dornan
09b3c92690 fix(docker): ship valkey-cli and log watchdog restarts
The image bundles valkey but not its CLI, which Alpine packages
separately, so the internal cache cannot be inspected from inside a
running container. The watchdog also restarted dead processes silently,
hiding both the crash and whatever state died with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 16:51:41 -05:00
Georges-Antoine Assi
7f5764660d Merge pull request #4219 from sdornan/claude/libretro-thumbnails-404-108626
fix(libretro): cache missing thumbnail listings
2026-08-17 08:56:16 -04:00
Georges-Antoine Assi
f30a58228e Merge pull request #4218 from sdornan/fix/rescan-reparse-filename-tags
fix(scan): re-read filename tags on a complete rescan
2026-08-17 08:45:01 -04:00
Georges-Antoine Assi
d072fdbe4c Merge pull request #4217 from sdornan/claude/invite-link-localhost-8acc9a
fix(auth): build invite links from ROMM_BASE_URL
2026-08-17 08:21:20 -04:00
Georges-Antoine Assi
f3e3dc09d4 refactor(config): move public base URL helpers to utils.urls
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-17 08:10:50 -04:00
Sam Dornan
7a104994d9 fix(libretro): only cache misses for absent directories
Caching every 4xx meant a transient 429, 408, or 403 on an existing
directory would suppress that platform's artwork for an hour. Restrict
the negative cache to 404 and 410, which mean the directory is absent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 23:27:30 -05:00
Sam Dornan
deae84a298 fix(libretro): cache missing thumbnail listings
Failed listing requests returned early without writing to Redis, so a
platform with no directory for an art type re-requested it once per ROM.
Scanning a 3DS library logged a 404 for Named_Logos on nearly every ROM.

Cache the empty result on a 4xx with a shorter TTL, since a missing
directory is stable but could be added upstream later. Server and
connection errors stay uncached because they are transient.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 23:23:35 -05:00
Sam Dornan
f22aadf77a fix(scan): re-read filename tags on a complete rescan
A rom parsed its filename tags when it was first inserted and never again,
so a change to parse_tags only reached rows scanned after it. The freshly
parsed values were built for every rom but only consumed on the insert
path, and scan_rom reseeded the tag columns from the existing row, so no
scan type could refresh them.

A complete rescan (or an explicit per-rom selection) now writes them back.
A hashes rescan still doesn't, since it is scoped to re-reading file bytes.

scan_rom also carries "version" forward now. It was the one tag column
missing from its attrs, so a re-parsed version would have been dropped, as
the value written by the reassociation path already was.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 21:38:12 -05:00
Sam Dornan
61ae17ee04 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-16 20:29:54 -05:00
Sam Dornan
ed65d6f5f4 fix(auth): reject all loopback hosts in public base URL
Classify the ROMM_BASE_URL host with `ipaddress` instead of an exact-match
list, so any loopback or unspecified address falls back to the browser
origin, and require an http(s) scheme.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 20:28:49 -05:00
Sam Dornan
e64944f2e5 fix(auth): build invite links from ROMM_BASE_URL
The invite link was assembled client-side from window.location.origin, so
generating one while browsing over localhost or a LAN address produced a
link the recipient could not open. The API now returns the full link built
from ROMM_BASE_URL, and the UI falls back to the origin when that setting
points somewhere non-shareable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 20:23:57 -05:00
Georges-Antoine Assi
304d3dd1b9 Merge pull request #4216 from rommapp/fix/state-upload-hidden-rom-visibility
fix(states): enforce ROM visibility when uploading a state
2026-08-16 19:28:58 -04:00
Georges-Antoine Assi
5e7913ecb8 Merge pull request #4215 from rommapp/copilot/add-xdelta-support
Add `.xdelta` support to server-side ROM patcher and v2 patcher UI
2026-08-16 19:28:26 -04:00
Georges-Antoine Assi
1ca754fe2a Merge pull request #4214 from rommapp/copilot/fix-http-log-level
fix: demote uvicorn HTTP access logs to WARNING/DEBUG only
2026-08-16 19:23:03 -04:00
Georges-Antoine Assi
4734352349 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-16 19:04:00 -04:00
copilot-swe-agent[bot]
63b98b1c2a feat(patcher): add xdelta patch extension support
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-08-16 23:01:06 +00:00