Commit Graph

13730 Commits

Author SHA1 Message Date
Sam Dornan
b7fb3b820d fix(v2): centre the md RSectionLabel icon on the capitals
Flex centres the icon on the text's line box, which keeps descender room
below the baseline that uppercase text never fills. At 12px that left the
icon about 1.25px below the caps; lifting it 1px brings every label icon
within a quarter pixel on average at 1x and 2x.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BYiFXo8o1n1wy9Zbd4AgYF
2026-10-04 00:28:57 +00:00
Sam Dornan
1ea4e42541 fix(v2): widen the step between RSectionLabel sizes
md goes from 11px to 12px (icon 13px to 14px) so section headings in a
page or dialog read clearly larger than the 10.5px group labels in menus,
drawers and sidebars.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BYiFXo8o1n1wy9Zbd4AgYF
2026-10-04 00:20:39 +00:00
Sam Dornan
83c0e607d6 feat(v2): add RSectionLabel and move hand-rolled section labels onto it
Adds an RSectionLabel primitive for the small uppercase label that heads a
section or names a group of fields (as, size, tone, icon, append slot) and
migrates the ~30 components that each styled their own copy. Drops the
global .r-eyebrow and .r-section-head classes, which it replaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BYiFXo8o1n1wy9Zbd4AgYF
2026-10-03 23:55:26 +00:00
Sam Dornan
d519534765 Age limit settings in the admin dialogs (#5083) 2026-10-03 19:28:43 -04:00
Sam Dornan
839041c5c5 feat(v2): add an active toggle state to RBtn (#5090) 2026-10-03 18:54:14 -04:00
Sam Dornan
ef3128e154 Hide ROMs above a user's or group's age limit (#5081) 2026-10-03 18:26:52 -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
Zach Clendenen
65247bf82c perf(frontend): load md-editor on demand instead of with the app (#5080)
* perf(frontend): load md-editor on demand instead of with the app

md-editor's config() ran from the app entry, which kept the library in
the entry's import graph. A Vite and Vitest alias now routes every bare
md-editor-v3 import, v1 included, through plugins/mdeditor.ts, which
applies the XSS config as a side effect of the first load. The
sanitizer stays on for every caller without an entry import.

ChangelogDialog (mounted on every v2 page) and NotesTab imported
MdPreview and MdEditor statically. They now load them through small
MarkdownPreview and MarkdownEditor wrappers with defineAsyncComponent,
so md-editor and CodeMirror download when a note or the changelog is
shown, and the editor only when editing starts.

Based on the lazy-loading approach from #4988 by @andest01.

* fix(storybook): keep the app's alias array when adding @ and @v2

Addresses Greptile: spreading the app's alias array into an object turned
it into numeric keys, so Storybook lost the md-editor-v3 alias and with
it the XSS config.

* refactor(frontend): address code-review findings

- Share one alias list between vite, vitest and (through vite.config.js) Storybook.
- Re-export MdEditor and MdPreview from typed modules instead of wrapper SFCs, so callers keep prop and v-model type checks.
- Block deep md-editor-v3 imports in ESLint, since they would skip the XSS config.
- Pass no-echarts where notes and the changelog render, so md-editor does not fetch echarts from unpkg.

* refactor(frontend): simplify the shared md-editor module

Simplify pass:
- Merge the editor and preview re-exports into one shared/markdown module; both pulled the same md-editor chunk and stylesheet.
- MarkdownViewer imports MdPreview from it too, and gets no-echarts like the other v2 previews.
- Drop the ESLint ignore for mdeditor-dist.d.ts, which has no deep import.

* style(frontend): trim the shared md-editor module comment (review-polish)

* fix(frontend): keep the md-editor preview and editor in separate modules

The simplify pass merged them into one module, which put MdEditor and CodeMirror in the preview's chunk: the changelog and note previews went from 78 KB to 290 KB gzip. MarkdownViewer keeps using the shared preview module.

* feat(frontend): show a spinner while the note editor loads

* fix(frontend): cover md-editor chunk loads with the existing spinners (code-review)

ChangelogDialog waits on the renderer chunk with the releases fetch, so a
load failure lands in the dialog's error state instead of blank bodies.
NotesTab's preview gets the same loading spinner as the editor. Document
the @v2 and md-editor-v3 aliases.

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

* refactor(frontend): share the async md-editor components (simplify)

Define the async MdPreview/MdEditor wrappers and their attr-dropping
spinner once in shared/asyncMarkdown.ts instead of per NotesTab instance
and again in ChangelogDialog. Keep the md-editor alias out of the tsconfig
paths block in the architecture doc.

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

* fix(frontend): let TypeScript follow the md-editor-v3 alias

Only Vite knew about the alias, so go-to-definition on md-editor-v3 opened
the package types instead of src/plugins/mdeditor.ts, where the sanitizer
config lives. A tsconfig path now points there too.

* refactor(frontend): turn off md-editor's CDN renderers once for v2

The shared markdownPreview/markdownEditor modules wrap the components with
noHighlight, noKatex, noMermaid and noEcharts, so v2 call sites no longer
repeat the flags and a new one cannot miss them.

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 17:04:09 -04:00
Sam Dornan
6d4c1d7ec9 fix(i18n): say "Plataforma actualizada" for es_ES platform.updated (#5089) 2026-10-03 16:54:52 -04:00
Sam Dornan
4f14c64dd7 fix(v2): validation, spinner, nested button and label bugs (#5088) 2026-10-03 16:38:38 -04:00
Sam Dornan
8c154be288 fix(v2): input follow-ups: phantom-pad right stick, LB/RB on gallery routes (#5086) 2026-10-03 16:18:49 -04:00
Sam Dornan
0498a4f158 fix(v2): unsubscribe from the emitter on unmount via useEmitterEvent (#5085) 2026-10-03 15:55:52 -04:00
Sam Dornan
dc32cfcec6 refactor(v2): simplify keyboard/gamepad handling (#5084) 2026-10-03 15:26:05 -04:00
Sam Dornan
1dcda140e2 fix(rom): keep a disc an .m3u lists in place when promoting to a folder (#5076) 2026-10-03 13:37:24 -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
Zach Clendenen
a0ede752f4 perf(frontend): smaller first load and faster vitest setup (#5072)
* perf(frontend): keep the inactive UI and the markdown renderer out of the first load

vue-router fetches every named view of a route before entering it, so a v2 visit also downloaded the v1 view tree. The inactive UI's views are now deferred until rendered. The changelog dialog, mounted on every v2 page, loads md-editor-v3 on first open.

* perf(frontend): set up Storybook annotations only for the story test

Every vitest file paid for the Storybook preview (full Vuetify and the Storybook runtime) though only storybook.test.ts renders stories.

* fix(frontend): address pr-ready code review

* style(frontend): pr-ready polish

* docs(frontend): pr-ready humanizer pass

* fix(frontend): address Greptile review

- router.test.ts: cover an in-place UI switch, so a deferred view that renders blank fails the suite.
- storybook.test.ts: narrow the preview setup comment to the invariant it guards.

* refactor(frontend): drop the view-loader check from the deferred-view guard

Every route view is a lazy import loader, so a typeof check finds the
inactive UI's views without copying vue-router's own heuristic.

* chore(frontend): restrict direct md-editor-v3 imports

md-editor-v3 now loads lazily on v2 pages outside the game details route,
so an eager import anywhere else would quietly pull it back into a shared
chunk. ESLint now flags it and points at the MarkdownPreview wrapper. Type
imports stay allowed, the frozen v1 trees are skipped, and the list is
shared with the v2/lib block so primitives keep their own restrictions.

* fix(frontend): pr-ready code review

Prefetch every deferred view of the current route on a UI switch, lint
static imports of the md-editor wrappers, make the hand-back test
self-contained, and drop redundant mock resets.

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

* refactor(frontend): pr-ready simplify

Render MarkdownViewer through the shared MarkdownPreview wrapper, inline
the route-entering check, and set the test UI version once in beforeEach.

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

* perf(frontend): load md-editor config with its consumers and skip echarts

The md-editor config module now applies itself on import, and each
md-editor consumer (v1 details, NotesTab, MarkdownPreview) imports it,
so md-editor's config, json5 and the XSS filter leave the entry chunk.
Lint flags eager imports of the config module.

Echarts fences render as code and a stub instance stops md-editor from
fetching echarts from unpkg whenever a preview mounts.

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 12:55:05 -04:00
Zach Clendenen
7d3e3ec1ab perf(tests): faster database setup and cleanup in the backend suite (#5073)
* perf(tests): skip empty tables in clear_database and run migration tests first

clear_database issued 20 DELETEs after every test. One EXISTS query now finds which tables hold rows and only those are cleared. The slow migration tests are scheduled first so they overlap the rest of the suite under xdist.

* perf(tests): clone a migrated template into each MariaDB xdist worker

Replaying every migration in each worker at once was most of a cold run. The template database is migrated once under a server lock and copied into each empty worker database. PostgreSQL keeps running migrations per worker.

* fix(tests): address pr-ready code review

Key the MariaDB template on a digest of the migrations and the helpers
they import, so an edited revision or a template left at another
branch's head or half-migrated is rebuilt instead of reused or failing.
Copy alembic_version last and reset a worker database that has tables
but no version row, so a clone cut short is redone on the next run.

* refactor(tests): pr-ready simplify pass

* style(tests): pr-ready polish

* style(tests): pr-ready humanizer pass

* test(tests): cover the template copy and empty-table cleanup

Addresses the Greptile finding that the new database setup paths had no
assertions:
- test_copy_schema_reproduces_the_migrated_database copies the migrated
  worker database with _copy_schema and checks tables, views, triggers,
  row checksums and the alembic version match the source (MariaDB only).
- test_clear_tables_deletes_only_from_tables_with_rows checks that cleanup
  issues a DELETE only for tables holding rows. The fixture body moves into
  _clear_tables so the test can call it.

* fix(tests): address pr-ready code review (xhigh)

Hash all of models/ and utils/ into the template digest, warn when the
clone falls back to migrating, defer the digest past the early returns,
and dedupe the DEFINER regex, statement capture and schema-name queries.

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

* refactor(tests): pr-ready simplify pass

Read tables and views in one query, strip DEFINER once, use the
inspector for the version check, always recreate an unversioned worker
DB, and pull the server lock and template build into helpers.

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

* style(tests): pr-ready polish

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

* test(db): clear every model table between tests

Derive the cleared tables from BaseModel.metadata.sorted_tables, children
first, instead of a hand-kept list of 20 models. Views and the
permission tables the migrations seed are skipped. A new model is now
cleared without editing the fixture.

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

* perf(tests): build the MariaDB template once in the xdist controller

pytest_configure_node checks each worker's database on the controller
and, for one with no version row, builds the template (once per session)
and hands its name over through workerinput. Workers copy it without
taking the lock, so copies run in parallel, and a broken migration
fails once instead of once per waiting worker. The template is shared
by every checkout and ROMM_TEST_DB_TAG run, since its digest pins the
schema. DEVELOPER_SETUP.md documents it.

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 12:52:09 -04:00
Sam Dornan
c420f92085 fix(v2): draw under the iOS status bar and respect safe-area insets (#5075) 2026-10-03 12:22:21 -04:00
Georges-Antoine Assi
503c9b290b test(db): give worktree runs their own temporary test database (#5074)
* test(db): give worktree runs their own temporary test database

Checkouts share romm_test, so a worktree on another branch can migrate it
to a revision the current branch lacks, and every test then errors in
setup with "Can't locate revision". ROMM_TEST_DB_TAG gives a run its own
romm_test_<tag> databases (one per xdist worker) that are dropped when
the session ends. AGENTS.md tells worktree sessions to use it.

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

* test(db): address Greptile review on temporary test databases

- Prefix tagged databases with tmp_ so they can never share a name with
  an untagged xdist worker database that teardown would then drop.
- Normalize the tag to [A-Za-z0-9_] so tags like my-worktree work.
- Drop the temporary database even when the migration fails.
- Shorten the new comment to two lines.

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 11:28:24 -04: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
b3ad84c296 Route ROM visibility through a single RomVisibilityFilter (#5064)
Replace the hidden_platform_ids/hidden_rom_ids parameter pairs with one
RomVisibilityFilter that builds the WHERE clauses and checks loaded ROMs,
so a new visibility rule (the age-rating cap for #2013) lands in one place.
No behaviour change; the visibility-filtered queries send the same SQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Wc3NzFkv97CXavLyZg5kJE
2026-10-03 10:46:47 -04:00
Zach Clendenen
10865b8663 perf(roms): faster smart collection and filter value queries (#5069)
* perf(roms): stop MariaDB rescanning the library for smart collections

MariaDB plans the smart collection membership IN (subquery) as a semi-join that rescans every rom per page query. A NO_SEMIJOIN hint keeps it a plain subquery; other dialects don't emit the hint.

* perf(roms): parse each distinct filter value list once

The filter dropdown query decoded every JSON column of every row. The columns are now read as text, deduplicated, and each distinct list is parsed once. PostgreSQL decodes JSON in the driver, so its lists are merged as returned.

* test(roms): cover repeated filter value lists in pr-ready code review

* refactor(roms): pr-ready simplify pass

* style(roms): pr-ready polish

* fix(roms): address Greptile review

Fold filter value rows in batches of 5000 instead of materializing the whole result, keeping the parse-each-distinct-list-once dedup across batches, so /api/roms/filters no longer holds one row per ROM in memory (Greptile: filter requests retain every row). The repeated-lists test now runs with a batch size of 2 to cover the cross-batch path.

* fix(roms): pr-ready code review fixes

- Cast filter JSON columns to text in SQL, so PostgreSQL gets the
  parse-once saving and a scalar JSONB value no longer crashes json.loads
- Stream filter rows with yield_per instead of only partitioning
- Name the JSON filter columns instead of hard-coding positions
- Add optimizer_hint_on_mysql next to force_index_on_mysql, with tests
- Make the repeated-lists test span batches regardless of row order

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

* refactor(roms): pr-ready simplify pass

Collect each filter column's distinct JSON texts and parse them once at
the end, and key the JSON filter columns by their RomFiltersDict field so
the positional unpack and per-field return go away.

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

* style(roms): pr-ready polish

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:29:25 -04:00
Zach Clendenen
6fb4e4ea1b perf(scan): skip the second write and reload for newly inserted roms (#5070)
* perf(scan): skip the second write and reload for newly inserted roms

A new rom is inserted and reloaded by the socket scan just before scan_rom, which then merged and reloaded it again before identification. Only existing roms take that write now. The insert carries the file hashes, size and title id so a scan that stops early still leaves a row rename detection can match.

* refactor(scan): address pr-ready code review

* chore(scan): pr-ready code-review pass

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

* refactor(scan): pr-ready simplify pass

Fold the new insert tests into TestIdentifyRomReassociation, rename
_added_rom to scanning_rom, and name the emit test after both checks.

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

* test(scan): pr-ready review-polish pass

Assert the unset file columns one by one, since mypy rejects comparing
the int-typed fs_size_bytes against None in a tuple.

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:23:13 -04:00
Zach Clendenen
b1f4ac4888 fix(db): keep iterated query results away from the cyclic GC (#5068)
* fix(roms): read filter values with .all() so the GC never frees the cursor

Looping over the filter-values Result directly makes SQLAlchemy 2.1 memoize
an iterator closure that captures the Result, which puts the CursorResult,
its execution context and the mariadb cursor in a reference cycle. The
cyclic GC then frees them on whatever thread triggers a collection, and
under concurrent gallery requests that segfaults the mariadb connector
(1.1.14, Python 3.14) inside the pool checkout. .all() never builds that
closure, so nothing is left for the GC.

* fix(roms): address pr-ready code review

* style(roms): pr-ready polish

* fix(db): read every iterated query result with .all()

The same reference cycle that segfaulted the filter values also hits smart
collection matching on every save, the screenshot binding check, playlist and
favourite adds, the recommendation reads and the stopword probe. The IGDB
related-games stream keeps yield_per and closes its Result with a with block.
A source scan test now fails on any Result iterated directly.

* fix(roms): address Greptile review

Keep gc.garbage entries that predate the filter-values cursor test: only the
objects this test collects are inspected and removed, so a runner that already
saves garbage keeps its list intact (Greptile, test_rom_facets.py).

* pr-ready: code-review fixes

Keep a generator's begin_session open until it finishes, read the
streamed IGDB scan by partition, and widen the iterated-Result guard to
names, unpacking, yield from and iterating methods.

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

* pr-ready: simplify

Share the app-source AST scan between the two guard tests, fold the
generator session's two branches into one nullcontext, and drop the
call-site comment the guard test already carries.

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

* test(db): flag iterated legacy session.query() results

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:06:49 -04:00
Stu Anderson
3c85052025 fix(input): show the focus ring when arrow keys move focus in Firefox (#5066)
* fix(input): show the focus ring when arrow keys move focus in Firefox

After a mouse click, Firefox treats a script-driven focus() as mouse focus and
skips :focus-visible, so the tile an arrow key moved to had no ring. Pass
focusVisible: true from the three arrow-key focus sites (useSpatialNav,
useGridNav, useWrapGridNav). Browsers without the option ignore it.

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

* fix(input): show the focus ring on menu and calendar arrow moves in Firefox

Apply the same focusVisible hint to RMenu (arrow keys between items, and its
keyboard/pad initial focus) and RDateField (arrow, Home and End between days).
The calendar's focus on open stays with the browser, so a mouse open shows no
ring.

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

* remove comments

* test(input): cover the focus ring on grid, menu and calendar moves

Addresses Greptile review on #5066: drops a comment that restated the
modality guard, and asserts focusVisible on the useGridNav,
useWrapGridNav, RMenu arrow and RDateField arrow/End paths.

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

* pr-ready step 2 (code-review): always request focusVisible on calendar days

The day outline is gated on input modality, so the ring flag on
focusDayCell was redundant and relied on nextTick resolving to
undefined. Tighten the RMenu and RDateField focus-ring assertions to
the element that should receive focus.

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

* pr-ready step 3 (simplify): fold the focus-ring tests into existing ones

Merge the RMenu initial-focus ring check into the initialFocus test,
let mountMenu take props and panel content instead of repeating the
activator template, and cover RDateField's single focusDayCell path
with one test for opening and one arrow move.

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

* fix(input): route v2 focus through a modality-aware helper

- focusFromInput asks for focusVisible only on key and pad input, and
  every v2 focus() call now goes through it. ESLint flags a bare
  .focus() under src/v2.
- useInputModality counts Home, End, PageUp and PageDown as keyboard
  input and listens in the capture phase, so navigation handlers see
  the new modality. useGamepad switches to pad before dispatching its
  synthetic key for the same reason.
- RDateField: PageUp/PageDown move the cursor and focus with the view,
  and the cursor stops at min/max instead of landing on a disabled day.

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

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-03 09:44:24 -04:00
Sam Dornan
e40c5f98d5 Enable exactOptionalPropertyTypes (#5067) 2026-10-03 08:58:13 -04:00
Sam Dornan
fbfa12cf07 Prepare v2 and shared code for exactOptionalPropertyTypes (#5065) 2026-10-03 00:38:46 -04:00
Sam Dornan
893c77f47d Enable noUncheckedIndexedAccess (#5063) 2026-10-02 22:56:24 -04:00
Sam Dornan
e7a9815780 Prepare the shared frontend code for noUncheckedIndexedAccess (#5062) 2026-10-02 22:18:43 -04:00
Sam Dornan
c24cc98a6c Prepare the rest of the v2 app code for noUncheckedIndexedAccess (#5061) 2026-10-02 21:19:42 -04:00
Sam Dornan
b26a8ab6f2 Render v2 QR codes with useQRCode from @vueuse/integrations (#5060) 2026-10-02 20:33:19 -04:00
Sam Dornan
5d9705e01b Prepare the gallery and grid-nav composables for noUncheckedIndexedAccess (#5058) 2026-10-02 19:40:16 -04:00
Sam Dornan
116732ff70 Split the frontend tsconfig into project references (#5057) 2026-10-02 19:20:36 -04:00
Georges-Antoine Assi
229da1ce6b ci(e2e): copy frontend/assets into the preview build (#5056)
* ci(e2e): copy frontend/assets into the preview build

The CI e2e run serves `vite build` output through `vite preview`, but the
build leaves out frontend/assets, which only the Docker image copies on top
of dist. Platform icons, logos, fonts and default covers came back as the
SPA fallback HTML. Copy the folder into dist the same way the image does.

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

* Address Greptile review: shorten the asset-copy comment

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-02 19:08:34 -04:00
Sam Dornan
8e715926e9 ci: cache frontend node_modules and skip npm ci on a lockfile match (#5044) 2026-10-02 19:05:19 -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
3deb38d93a fix(scan): keep an uploaded manual when the rom had no scraped one (#5030)
* fix(scan): keep an uploaded manual when the rom had no scraped one

Update, unmatched and hashes scans pin a stored manual url, but a manual
uploaded to a rom without a scraped url has nothing to pin. The provider's
url then won, differed from the empty stored one, and its download
overwrote the upload at the shared manual path. A locked manual, or one
on disk with no source url, now keeps its empty url through the scan.

Fixes #4101

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

* fix(scan): drop a scraped manual's path on unmatch, test the download stage

Addresses Greptile's review on #5030:
- Unmatch cleared url_manual but kept path_manual, so the next scan read the
  old scraped manual as an upload and never fetched the new match's one. It
  now clears path_manual too, unless url_manual is locked (an upload).
- Trim the url_manual comment to two lines.
- Carry the scan result through download_rom_resources in the upload test and
  check the manual is never stored over.

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-02 18:59:08 -04:00
Georges-Antoine Assi
746df798c0 fix(scan): refresh screenshots when only their order changes (#5029)
* fix(scan): refresh screenshots when only their order changes

Stored screenshots are named by position (0.jpg, 1.jpg, ...), but the
re-download check compared the provider's urls as an unordered set, so a
reorder was never picked up. Compare the lists directly, in both the scan
download step and update_rom.

Fixes #4103

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

* test(scan): cover the screenshot reorder in update_rom

Address Greptile review on #5029: add an endpoint test for update_rom's
own reorder check, and narrow await_args before reading its kwargs.

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

* fix(scan): drop the old screenshot when its replacement fails

With overwrite on, a failed download left the previous image at that
index. The next scan saw matching urls and a file on disk, so it kept
the stale image for good. Remove it instead, so the next scan refetches.

Addresses Greptile review on #5029.

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-02 18:58:37 -04:00
Ilyas Hallak
27ddb88967 feat(api): Add a REST endpoint to start a library scan (#5014)
* Add a REST endpoint to start a library scan

POST /api/tasks/scan queues a scan with the options of the `scan` socket
event, so clients authenticating with a bearer or client token can
start one without a Socket.IO session. It answers 202 with the queued job,
409 while a library scan is queued or running, and 503 when no worker
listens on the scan queue.

The enqueue path moves into queue_scan, shared with the socket handler.
A short Redis lock now covers the in-flight check and the enqueue, so two
requests landing on different web workers cannot both queue a library
scan. The socket handler also answers scan:done_ko for an unknown scan
type instead of raising.

* Default a scan without apis to the enabled sources, lease the request lock

A scan request that leaves out `apis` now uses every enabled metadata
source, on the REST endpoint and the socket alike, as the scheduled scan
and the watcher do. An explicit empty list still means no sources. The
web UI always sends `apis`, so its scans are unchanged.

redis_lock takes an optional lease_seconds, and the library scan request
lock holds its key for 30s while waiters give up after 5s, so a slow
holder cannot lose the lock to a waiter that then queues a second scan.

* Narrow optional mock call args in the new scan tests

* pr-ready step 2 (code-review): narrow the scan lock timeout handling to acquiring the lock

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

* pr-ready step 3 (simplify): share the held-lock stub, read the task name off the queued job

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

* pr-ready step 4 (review-polish): drop a test comment that recorded old behaviour

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

* Validate socket scan options with ScanPayload and list workers once per scan request

The socket handler now parses its options with the same ScanPayload the REST
endpoint uses, so an unknown key, scan type or metadata source answers
scan:done_ko instead of falling back to a scan of everything. v1 callers that
could send a null platform id now send a real one or none.

queue_scan checks for a live scan worker itself, so the socket also refuses a
scan no worker would pick up, and it lists the workers once for that check and
the in-flight check. The blocking RQ calls run in a thread, off the event loop.

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

* Rename useScanProviders' ScanPayload to ScanSourceOptions

It shared its name with the generated ScanPayload request type while holding
only the metadata source options.

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-02 18:46:28 -04:00
Sam Dornan
400efee658 Enable strictVModel and make RSelect, PlatformSelect and RTabNav generic (#5055) 2026-10-02 18:39:18 -04:00
Sam Dornan
2e9650875f Tighten frontend typechecking (#5053)
* Tighten frontend typechecking

Remove the "*.vue" ambient module shim. vue-tsc resolves real SFCs on its
own, so the shim only matched imports that failed to resolve, letting a
mistyped .vue path compile as a loosely typed component.

Enable noImplicitOverride and noFallthroughCasesInSwitch, and the vue-tsc
checkUnknownComponents, checkUnknownDirectives and checkUnknownEvents
template checks. Drop the top-level "types" key, which sat outside
compilerOptions and was ignored.

checkUnknownComponents caught a missing Skeleton import in the v1 game
RAvatar, so its image placeholder never rendered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCYJHvDi4usaxAYPZNSLF

* Keep v1 frozen: drop the RAvatar fix and checkUnknownComponents

The v1 UI is frozen and check-v1-frozen rejects any edit there outside a
critical fix. The missing Skeleton import in RAvatar is not critical, and
checkUnknownComponents cannot stay on without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCYJHvDi4usaxAYPZNSLF

* Enable checkUnknownComponents and fix the missing RAvatar import

checkUnknownComponents fails a template that uses a component it never
imported. Its one hit is v1 RAvatar, where <Skeleton> was never imported,
so the image placeholder never rendered. The PR carries the
allow-v1-changes label for this one-line v1 fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSCYJHvDi4usaxAYPZNSLF

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 15:58:21 -05:00
Sam Dornan
03c584cf5f Use VueUse for v2's image previews, remaining observers, rAF loops and timers (#5052)
* Use VueUse for v2's image previews, remaining observers, rAF loops and timers

The four upload previews that still read the file through a FileReader
(CollectionSettingsTab, EditUserDialog, UserProfile, EditRomDialog) now
use useObjectUrl, as SetupStepAdmin already does: no base64 copy of the
image, and the URL is revoked when the file changes or the view goes.
EditRomDialog keeps "last pick wins" between an upload, a SteamGridDB
cover and Remove through a coverOverride ref. UserProfile's preview now
gives way to the saved avatar once Apply succeeds.

Resize and mutation observers move to useResizeObserver and
useMutationObserver in RTabNav, RSliderBtnGroup, RVirtualScroller,
usePinnedToolbar, CardRow and useReadingProgress's deferred restore.
Pico8's frame loop and useCoverAnimation's disc spin move to useRafFn,
the spin taking its frame delta from it. The one-shot timers in
useCoverAnimation, PasswordField, useGalleryCoverRatios,
useReadingProgress and usePendingAssetSync move to useTimeoutFn. Each
stops with its scope, so the matching disconnect, cancel and clear calls
in unmount hooks go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DepBmr5rnZ9ABYne6z2Y8d

* Stop Pico8's and the cover spin's frame loops after the frame returns

useRafFn queues its next frame after the callback returns, so pausing
from inside a frame (a failed Pico8 frame, a disc coming to rest) left
that frame queued. Resuming before it fired started a second chain.
Both loops now follow a ref through a watcher, which pauses once the
frame has returned and cancels the queued one. Adds tests that replay
and re-hover on the stopping frame, with a rAF stub that cancels only
the frame it is given.

Shortens CardRow's observer comment to two lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DepBmr5rnZ9ABYne6z2Y8d

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 15:38:41 -05:00
Sam Dornan
acc6fe05fb Follow the browser's language by default, with an "Auto" language option (#5051)
* Follow the browser's preferred language until one is picked manually

Use VueUse's usePreferredLanguages so the UI language tracks the
browser's languagechange event live while no language is stored, instead
of reading navigator.languages once at startup. Move the locale matching
into a pure matchPreferredLocale helper, and preload the detected locale
in localesReady so the first paint doesn't wait on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018b5usHDmucy3s4X4dLppW7

* Load a browser-picked language before switching to it

Address Greptile review on the language auto-detection: move the logic
into a useBrowserLocale composable so it can be tested, and await the
locale's messages before applying it, so a live browser change doesn't
flash the fallback language. Tests cover first load, live changes,
manual override, cross-component storage writes and the load ordering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018b5usHDmucy3s4X4dLppW7

* Add an "Auto" language option that follows the browser

The v2 language selector now lists "Auto (<detected language>)" first.
Picking it clears the stored locale, so useBrowserLocale goes back to
following the browser's preferred language; picking a language stores it
as before. The selector now only writes the setting and lets the root
composable apply it, after its messages load. Adds the language-auto key
to every locale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018b5usHDmucy3s4X4dLppW7

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 15:11:39 -05:00
Sam Dornan
666f231e77 Share v2's visible-tab poll and move the last timers and RTooltip to VueUse (#5048)
* Share v2's visible-tab poll and move the last timers and RTooltip to VueUse

Home's live sessions, Activity's streaming board and TasksSection's
status poll each paired useIntervalFn with a document.hidden guard and a
visibilitychange refetch. useVisiblePoll, built on useDocumentVisibility
and useIntervalFn, now owns that: it ticks only while the tab is
visible and calls once more when it is shown again. Activity's mount
fetch no longer waits for a visible tab, matching Home and TasksSection.

The remaining one-shot timers move to VueUse: Stream's broker volume
debounce to useDebounceFn (still cancelled on unmount), StreamStage's
control-bar hide to useTimeoutFn, and useDelayedFlag's timer to
useTimeoutFn.

RTooltip's open and close delays become two useTimeoutFns, its
outside-tap close a useEventListener that targets document only while an
openOnTap tip is open, and its parent-attach pairs useEventListener on
the anchor's parent, so its unmount hook only unsubscribes from overlay
dismissal.

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

* Drive Stream's volume tests through the rendered slider

The broker-volume tests set the view's volume ref through an
`as unknown as` cast. They now start a game so the control bar renders,
and emit `update:modelValue` from its RSlider, the path a viewer's drag
takes.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 13:47:19 -05:00
Sam Dornan
515d393b6f Fix the RTooltip ParentAttach story so the tooltip renders (#5047)
* Demonstrate RTooltip parent-attach on an element that renders it

The ParentAttach story nested the tooltip in an icon-only RBtn, which
renders only its RIcon and drops the default slot, so the tooltip never
mounted. Attach it to a plain focusable badge instead, and add a play()
that hovers the parent and asserts the tooltip appears.

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

* Narrow the ParentAttach comment to string-icon RBtns

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 13:41:55 -05:00
Sam Dornan
4a53fcd172 Use VueUse for v2's rAF loops, listener pairs and grid observers (#5045)
* Use VueUse for v2's rAF loops, listener pairs and grid observers

Hand-managed requestAnimationFrame loops in useGamepad, usePlaybackTime,
useRightStickScroll, ControllerDebug and RBox3D move to useRafFn, and
the listener pairs and MutationObservers in useGridNav, useWrapGridNav,
RBox3D and useGamepad's connect listener move to useEventListener and
useMutationObserver. Each stops with its scope, so the matching cancel,
remove and disconnect calls in unmount hooks go. The grid composables
still register from onMounted, keeping listener order unchanged.

ControllerDebug pauses its loop before leaving on hold-B. RBox3D's root
listeners now bind once its template ref settles, a microtask after
mount, instead of synchronously in onMounted.

Adds tests for usePlaybackTime, useRightStickScroll, ControllerDebug and
RBox3D, the late-cell autofocus of both grid composables, and
useGamepad's unmount. They also pass against the previous versions.

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

* Keep ControllerDebug polling past a back that goes nowhere

Hold-to-exit paused the frame loop before calling router.back(), so in a
tab opened straight onto /controller-debug the back did nothing and the
inspector froze. The loop now keeps running and fires once per hold, and
with no history entry to return to it goes home instead.

The useGamepad, useRightStickScroll and ControllerDebug tests build pads
from a shared, fully typed gamepad fixture rather than casting partial
objects to Gamepad.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 13:38:18 -05:00
Sam Dornan
efb78679f8 Restore real timers globally and echo params from the shared i18n mock (#5043)
* Restore real timers from the global test setup and drop redundant teardown

vitest.setup.ts now calls vi.useRealTimers() after every test, so the 24
v2 test files that undid fake timers in their own afterEach no longer
need to, nor do three tests that wrapped their body in try/finally for
it. The hook is registered before enableAutoUnmount: Vitest runs
after-hooks in reverse, so components unmount while a test's fake clock
is still installed.

Also removes teardown that #5026 and #5028 made redundant: afterEach
unmounts of VTU wrappers in 11 files (with the variables and comments
that only existed to track them), and per-file setActivePinia calls
that the global beforeEach already makes.

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

* Echo params and expose locale from the shared vue-i18n mock

The shared mock's `t` now renders `key:{json params}` and `locale` is a
real ref, which covers what 19 test files built their own factory for:
a `locale` field, or a `t` that echoes params with `:` or `::`. Those
files now use the bare `vi.mock("vue-i18n")`, and the four `::` files'
assertions switch to the single colon.

24 assertions in 13 files that checked only a key now include the
params the component passes, so a dropped or wrong param fails them.
Factories that spy on `t` or render params in a test-specific shape
stay as they are.

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

* Echo every argument to t from the shared vue-i18n mock

Pluralized messages pass the count second and the named values third,
so echoing only the second argument let a dropped `{n}` pass. The mock
now renders each argument after the key, and the four pluralized
assertions include the named values.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 12:55:24 -05:00
Georges-Antoine Assi
05bf29fe09 feat(converto): read per-file title ids with rom-converto during scans (#5031)
* feat(converto): read per-file title ids with rom-converto during scans

The title-id half of #5002: rom-converto's info runs fill rom_files.title_id
and title_version, sigil fills what rom-converto can't read and keeps owning
save targets, and roms in a scan batch share info runs of up to 64 files.
A converto_read_at marker lets quick scans backfill files rom-converto has
not read yet. converto.scan_metadata (config.yml only) turns it off.

The other per-file fields and embedded images stay out until a UI reads them.

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

* refactor(converto): name the same-content check that keeps unread title ids

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

* refactor(converto): queue unread files in one pass over the built rows

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

* fix(converto): address Greptile review on #5031

- A file refresh now persists converto_read_at when rom-converto's read
  confirms a reused row's stored title id, so the file isn't re-read on
  every refresh.
- RomConvertoService.read_infos splits its paths into info runs of at
  most INFO_BATCH_SIZE, so a rom with many files can't send them all
  through one run.

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

* fix(converto): apply code-review fixes

- A stored file title id counts as rom-converto's only once rom-converto
  has read the row, so a stale sigil id can't override a fresh extraction.
- Fresh hashes decide whether unread title ids still describe a file,
  ahead of a size and mtime a copy can preserve.
- One rom's failed candidate listing no longer aborts its scan batch.
- The info paths file's cleanup can't raise out of read_infos.
- _rom_file_order sorts by Path like _TitleIdSource.order.
- Restored the in-place reconcile test for _identify_rom.

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

* refactor(converto): apply simplify pass

- sync_rom_files reads 'rom-converto read this pass' off converto_read_at
  instead of an inspected set threaded through ParsedRomFiles, FSRom, the
  scan socket and the refresh.
- One _converto_may_read check serves the scan and the batch candidates.
- converto_candidates reuses _list_rom_dir, validates paths off the event
  loop and is best-effort itself, so the scan socket gathers it plainly.
- get_rom_files builds rom-converto paths from the validated rom dir
  instead of validating each file again.
- _rom_level_identity returns early on sigil's extraction.

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

* chore(converto): apply review-polish pass

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

* refactor(converto): drop the shared info batch

Sharing rom-converto info runs across a scan batch saved about 2 ms per
rom (one process start) in exchange for a second directory walk per
rebuilt rom, the RomConvertoInfoBatch bookkeeping and the scan socket
wiring. Each rom now reads its own files; read_infos still caps a run
at INFO_RUN_MAX_FILES.

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

* refactor(converto): name the rom-converto columns inline

Drops ROM_FILE_CONVERTO_COLUMNS and ROM_FILE_CONVERTO_KEPT_COLUMNS, so
_copy_scanned_columns keeps master's frozenset keep_when_unset.

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-02 13:49:40 -04:00
Sam Dornan
c08aced08a Load self-fetching v2 components through useFetchState (#5038)
* Load missing firmware with useAsyncState

Replaces the hand-rolled loading ref, try/finally and onMounted fetch in
MissingFirmwareSection with VueUse's useAsyncState, as a trial of the
pattern for component-local fetches. It also discards a stale response
when two fetches overlap.

resetOnExecute is disabled so a post-cleanup refetch keeps the current
rows up instead of flashing the skeleton, and onError routes failures
to the snackbar instead of the default reportError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J28XLfUSEgeZ6uMDiCL6vy

* Add useFetchState and use it for missing firmware

useFetchState wraps VueUse's useAsyncState with the defaults v2 wants:
a refetch keeps the current data, nothing goes to reportError, and
onSuccess/onError only fire for the newest call. useAsyncState fires
them for every call, so a stale response could still trim the platform
selection in MissingFirmwareSection.

The frontend-v2-patterns skill now points components that fetch their
own data at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J28XLfUSEgeZ6uMDiCL6vy

* Load v2 component data through useFetchState

Moves the self-fetching v2 components onto useFetchState: the streaming,
users and client token settings, scan and conversion settings, the
library stats widget, the changelog dialog, the text and markdown
viewers, and the memory card manager and picker. Each keeps its messages
and refetch call sites. A refetch no longer resets their data, and a
stale response (an older call, or one for a previous prop value) can no
longer overwrite a newer one.

useFetchState now runs onSuccess/onError after the newest call has
written state, so a callback reads the new data. The client tokens page
also shows its loading state from the first render instead of flashing
the empty message.

InstallOnDeviceDialog keeps its own loader: its guard checks the dialog
is still on the same ROM, which a newest-call guard doesn't match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J28XLfUSEgeZ6uMDiCL6vy

* Type useFetchState's immediate run with overloads

A fetcher that takes arguments now has to pass immediate: false, so the
setup run no longer needs a double cast to call it with no arguments,
and forgetting the flag is a type error. Also trims the memory card
picker's fetch comment to its non-obvious part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J28XLfUSEgeZ6uMDiCL6vy

* Decide useFetchState's callback from the call's outcome

onError used to be picked by checking error for undefined, which is
also VueUse's "no error" value, so a fetcher rejecting with no reason
ran onSuccess(undefined). useAsyncState now rethrows, and execute
catches it, so the outcome is known directly and execute still never
throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J28XLfUSEgeZ6uMDiCL6vy

* Log failed fetches with console.error in converted v2 loaders

v2 ships only console.error. The memory card and streaming loaders
carried over a console.warn from before the conversion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J28XLfUSEgeZ6uMDiCL6vy

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 12:21:41 -05:00
Sam Dornan
37610a51a2 Size the re-sort skeleton to the known result count (#5042)
* Size the re-sort skeleton to the known result count

A re-sort clears the gallery before refetching, which zeroes `total`, so
the bootstrap skeleton fell back to a full page (16 list rows, 4 full grid
rows) even for a two-result search. A new order can't change the count,
so the store keeps it as `reorderTotal` across a re-sort and the skeleton
paints at most that many placeholders. Grid skeleton rows now carry their
card count so the last row can be partial. Any other invalidation (search,
filters, scan, delete) drops the hint.

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

* Keep a known empty result empty across a re-sort

`reorderTotal` used 0 for "unknown", so re-sorting an empty result still
flashed a full skeleton. It is now null when unknown and taken only once
metadata has loaded, and a known count of 0 renders the empty state
straight away. Adds a GalleryShell test that drives the sort watcher, so
dropping `reorder: true` there fails a test.

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

* Shorten the invalidateWindows docstring

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 12:17:50 -05:00