Commit Graph

9 Commits

Author SHA1 Message Date
HadNutz
b1d7d2b57a feat(emulatorjs): expose download cache enable setting (#5737)
* 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>
2026-11-23 11:13:18 -05:00
Zach Clendenen
c63f44133d perf(config): read config.yml values with a plain dict walk (#5071)
* perf(config): read config.yml values with a plain dict walk

pydash.get parses the path and probes every container type on each call, and the scan reads config values per rom. A dotted-path lookup over the parsed YAML dicts returns the same values.

* fix(config): address Greptile review

Drop the _config_get docstring, which restated the four-line dict walk below it (AGENTS.md comment discipline).

* refactor(config): move nested config lookup to utils.database as get_nested

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

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-03 10:58:36 -04:00
Sam Dornan
9c1e6b2d86 refactor(backend): move engine-specific query SQL out of handlers into utils/sql_dialect.py (#4793) 2026-09-26 13:48:33 -04:00
Georges-Antoine Assi
78ba4c4721 fix(migrations): give the trigger-DDL probe a name no schema can hold
Trigger names are schema-wide, so the fixed probe name could name an
operator's own trigger, and DROP TRIGGER IF EXISTS would really remove it.
A fresh uuid per call makes the statement a guaranteed no-op, so the only
error it can raise is the refusal it is looking for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 09:20:54 -04:00
Georges-Antoine Assi
8c1ea8c083 review(pr-ready step 4): sharpen the gate name and trim the guard prose
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 07:58:48 -04:00
Georges-Antoine Assi
c4e9f1c934 review(pr-ready step 3): one predicate, one test home, real command names
The gate tested command names alembic never passes: it hands its environment
the per-command `fn` name, so `do_stamp` and `display_version` are what reach
it. Pin that with a canary over the closure the gate matches.

Probe before reading the applied heads, so only a server that refuses pays for
the lookup and the other dialects pay nothing, and fold the tests into the
module they mirror.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 07:56:55 -04:00
Georges-Antoine Assi
a8385cdaa8 style(anniversaries): trim the comments and simplify the day parser
Comment and docstring pass over the `released_days` change: cut the copies of
rationale that already live next to the thing they describe, and drop the
sentences defending obvious choices.

`RELEASED_DAY_REGEX` now carries the calendar ranges, so a match is a valid day
and `parse_released_days` needs no sentinel pair and no second range check.
`release_day_ranges` stops re-sorting what `epoch_ms_in_ranges` already sorts.
`anniversaryQuery`'s return type is a named export, so the widget imports it
instead of unwrapping a `ReturnType`, and the widget's two reset paths share
`showEmptyDay`.

`loadMore` is `loadNextPage`, since it appends one page rather than the rest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 12:34:49 -04:00
Georges-Antoine Assi
976dd09930 refactor(anniversaries): read the day off the shared rom list
`GET /api/roms` already does what `/roms/anniversaries` hand-rolled: it selects
ordered ids over the filtered set, takes the total from that index, hydrates
only the page asked for, and re-projects the rows into id order. So the widget
now asks it for a page rather than owning an endpoint that pulls the whole day.

`released_days` on the list endpoint takes days as "M-D", matching any year, and
`released_before_year` bounds them. Both go through `filter_roms`, so the same
day-of-year match is available to the gallery filters and to smart-collection
criteria, and the range union stays where it was: still sargable, still a
covering index range scan on `idx_roms_generated_first_release_date`, no SQL
date function and no dialect branching. Verified on a 73k-rom database that the
plan through the list endpoint's join is unchanged: `type=range`,
`Using where; Using index`, no filesort.

The filter means exactly what it says, so the calendar policy moved to the
client, where the clock it depends on already lived. `anniversaryQuery` picks
the days and the year bound off the viewer's own date: it skips 1 January,
where several providers park year-only metadata, rolls 29 February onto 28
February in a non-leap year, and bounds the years at the viewer's own. The
server no longer has to second-guess a timezone offset, so the 31 December
asked for on 1 January UTC correction is gone rather than fixed.

Consequences for the widget: the counter is the day's real total instead of one
clipped at a 500-row ceiling that no longer exists, and a card costs one page
of 24 rather than up to 4 MB up front. Paging backwards stays in memory;
only moving past the loaded pages fetches, with the spinner on the arrow so
focus is never yanked mid-page. A failed page keeps the card on screen.

`released_days` is added to the list endpoint's unscoped-cache gate: the
sidecar keys encode no filters, so a narrowed page must not be served under the
shared "all" key. Covered by a test that primes the unscoped key first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 12:02:32 -04:00
Spinnich
868a5c03e7 feat(home): add a game anniversary widget
Shows games released on today's date in an earlier year, one at a time,
with arrows to page through the rest. Sits in the Home widget rail beside
Random pick and Library stats, with its own Settings toggle (default on)
and an entry in the drag-reorder list.

New endpoint GET /api/roms/anniversaries, ROMS_READ, whole-library,
returning up to 24 SimpleRomSchema oldest release first. Clients send
their own local month and day so "today" matches the calendar in front of
the user rather than the server's UTC clock.

The day-of-year match is a union of one-day ranges over
generated_first_release_date rather than MONTH()/DAY() on the value.
Ranges are sargable, so idx_roms_generated_first_release_date serves both
the match and the sort as one covering range scan: 195 rows examined and
~2 ms against 63,334 rows and ~70 ms for the function predicate on a
100k-row table. Emitting no SQL date function also means no dialect
branching and no migration.

1 January returns empty. Several providers park year-only metadata there
(ScreenScraper parses a bare year with %Y, CSDb publishes nothing else,
IGDB reports year precision as 1 January), so nothing in the stored data
tells a real 1 January release apart from an unknown day. Leap-day
releases roll onto 28 February in non-leap years.

Visibility follows /random: filter on hidden platforms and roms, then
re-check each hydrated row with perms.can_see_rom.

Closes #3440

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 17:31:27 +00:00