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>
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>
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>
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>
`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>
`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>
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>
`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>
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>
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>
_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
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>