Commit Graph

12321 Commits

Author SHA1 Message Date
zurdi
24cd55abe5 feat(player): sync in-game saves seconds after the game writes them
The periodic save upload only ran on EmulatorJS' "System Save interval"
tick (5 minutes by default, never when the player disabled it), and was
off unless emulatorjs.auto_save_sync was set. The player now flushes the
SRAM itself every 5 seconds while the game runs, so the existing tracker
sees a new in-game save on the next two agreeing ticks and uploads it,
and the config flag defaults to on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MozJiij1oQbu12GvtAPBFR
2026-09-16 19:34:39 +02:00
Zurdi
1444b0454a Merge pull request #4550 from rommapp/claude/unify-rom-file-uploads
chore(uploads): manual file uploads into a ROM across the Files and Media tabs
2026-09-16 17:18:37 +02:00
zurdi
1f631e7962 Bound the refresh lock wait instead of spinning on sleep
ruff ASYNC110 flags a while loop whose body is only an await sleep. The
wait is now a bounded poll that gives up with a TimeoutError once the
lock expiry has elapsed, so a stuck holder cannot hang the upload.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 17:09:54 +02:00
zurdi
071787311d Take the refresh lock with SET NX instead of a Lua-backed Lock
redis-py releases its Lock through a Lua script, which the fakeredis CI
runs without, so every registration failed there with an unknown evalsha
command. The lock is now a SET NX EX with an owner token, released only
by its owner, the same shape the log forwarder already uses.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 17:03:59 +02:00
Zurdi
51b0aa038e Merge pull request #4551 from rommapp/fix/task-worker-followups
fix(tasks): read older cleanup stats, and check the worker where it enqueues
2026-09-16 17:02:13 +02:00
zurdi
e869ecb6b6 Enforce media allowlists and walkthrough provenance in the shared upload path
A folder the scanner maps to a media category now refuses files that
category cannot hold inside resolve_upload_destination, so the chunked
flow the v2 tabs use gets the same allowlist the media routes had, and
those routes drop their own copies. commit_upload records an upload
provenance for walkthrough files that arrive without one and returns the
registered row, which the walkthrough route uses for author and title.
The refresh lock moves to Redis so uploads landing on different gunicorn
workers cannot drop each other rows. An empty body filename is rejected
instead of falling back to the header.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 16:27:38 +02:00
zurdi
e8d2e26cff fix(tasks): a worker that announced its death is not live
`has_live_worker` reads each registered worker again and skips the
ones carrying a death date as well as the suspended ones, with both
states covered in the handler test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 16:25:13 +02:00
zurdi
73d5789da4 test(tasks): give every successful-run test a live worker
The fixture that stubs a listening worker was scoped to one class, so
the integration and argument-handling runs answered 503 in CI, where no
worker is registered.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 16:22:37 +02:00
zurdi
be81b1c89b refactor(tasks): apply the simplify pass
`has_live_worker` asks RQ for the worker count and the suspension flag,
two constant-cost reads, instead of hydrating every registered worker.
The cleanup stats serialize through `dataclasses.asdict`, so a new
counter is declared in two places rather than three. The task endpoint
test takes the shared task fixture, the legacy-stats shim says when it
can go, and the two Settings specs share one axios-error helper under
`src/test-utils` while the games spec starts from a non-empty list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 16:16:00 +02:00
zurdi
dafccf55fd Ask before replacing a file the ROM folder already holds
A name the folder already has is refused by /roms/upload/start with a 409,
and the tabs used to surface that as a plain error. useRomFileUpload now
collects the refused files, asks once in a danger-toned confirm dialog and
retries them with the new optional overwrite body field, which lets the
chunked flow replace the file instead of claiming the name exclusively. A
declined file is dropped without a toast. The strings ship in all locales.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 16:13:34 +02:00
zurdi
83569d6678 fix(tasks): read older cleanup stats, and check the worker where it enqueues
Follow-up to #4548 from the code-review pass. Stats a 5.2.0 release
stored under `platform_id` are widened to `platform_ids` when a job is
reported, so listing old finished cleanups validates again. The live
worker check moves next to the queues as `has_live_worker`, with its
own tests, and the endpoint names the queue it enqueues on so the check
and the enqueue cannot drift apart. The cleanup tasks return the typed
stats the response schemas declare. The developer setup points the RQ
commands at the backend's own Redis settings through `-c config`, and
the architecture doc mentions the 503.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 15:57:59 +02:00
Zurdi
ab9c90685d Merge pull request #4548 from rommapp/fix/missing-roms-cleanup
fix(tasks): refuse a manual task run when no worker is listening
2026-09-16 15:35:49 +02:00
zurdi
f9f68dc0f1 Unify manual file uploads into a ROM across the Files and Media tabs
The Files tab streamed chunks through /roms/upload/* and registered the
result with the scanner listing, while each Media route (soundtracks,
screenshots, manual files, walkthrough files) carried its own copy of the
sanitize, promote, mkdir, stream, stat and DB upsert sequence. Those copies
crashed with FileNotFoundError on a file name outside Latin-1: the browser
sends the header as Latin-1 and the multipart field name as UTF-8, so the
parser target registered under the header name never received the part
and os.stat failed after the folder had been created.

handler/rom_upload.py now owns the shared ingestion (resolve and prepare
the destination, stage next to the target, move into place, refresh the
ROM's file rows through the scanner) and both the chunked completion and a
new receive_rom_file sit on it. The media routes only check the extension
and delegate; a body naming the part differently is a 400. /start gains an
optional body filename that wins over the header, so names outside Latin-1
arrive intact, and rom_id becomes optional in that body.

On the v2 frontend a single useRomFileUpload composable wraps the chunked
upload, the single-file conversion prompt, the toasts and the refetch; the
Files tab, Soundtrack panel, Screenshots subtab, Walkthrough subtab and the
manual "add to ROM folder" target all call it with their folder. The
service sends the real name in the body and a percent-encoded one in the
header. The v2-only uploadScreenshots/uploadWalkthroughFiles service
functions and the soundtrack-only toasts are gone. Media subtabs now
refuse an existing file name (409) like the Files tab, instead of
overwriting it silently.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X1FgnCzXjM3rzkxggi7g6C
2026-09-16 15:29:22 +02:00
zurdi
02fd6ea638 Merge branch 'master' into fix/missing-roms-cleanup
Keeps both the server-detail snackbar test from this branch and the
selection-bar tests master added to the missing games section.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 14:07:18 +02:00
zurdi
bd90488e73 fix(tasks): count only live workers, and cover the review's gaps
The worker guard now ignores workers that announced their death or are
suspended, and the tests run with a live worker on the task queue by
default, so the other successful-run tests pass again; a scan-only,
dead or suspended worker is checked to be refused. The developer setup
runs each worker in its own terminal, adds the RQ cron process that
registers the schedule, and ties the Redis URL to the `.env` defaults.
The Japanese, Korean and Chinese cleanup messages use their own
punctuation, and both Settings sections have a test that the server's
reason reaches the error snackbar.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 13:58:45 +02:00
Georges-Antoine Assi
f2fd26fccf Merge pull request #4549 from rommapp/claude/pr-description-artifacts
docs: require screenshots and mermaid diagrams in PR descriptions
2026-09-16 07:53:26 -04:00
Zurdi
348352558d Merge pull request #4526 from rommapp/claude/fix-4509-state-screenshot
fix(player): attach a real screenshot to a manual save state
2026-09-16 13:51:53 +02:00
Georges-Antoine Assi
7a7347f9a9 docs: require screenshots and mermaid diagrams in PR descriptions
A reviewer who can't see a UI change reviews the diff instead of the
result, and a boundary change described in prose takes several reads.
Ask for both in the PR body: enough screenshots to convey what changed,
and a mermaid block when the change moves a boundary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 07:51:20 -04:00
Georges-Antoine Assi
5cba9c26d9 Merge pull request #4528 from rommapp/claude/fix-4037-missing-file-actions
fix(v2): stop offering a missing rom's files for download
2026-09-16 07:39:52 -04:00
Georges-Antoine Assi
b44c3ba5b6 Merge pull request #4527 from rommapp/claude/fix-4036-missing-games-actions
fix(v2): make the Missing games selection actionable
2026-09-16 07:35:17 -04:00
zurdi
3972feabb5 fix(tasks): describe the cleanup stats a finished job actually carries
`GET /tasks/status` failed response validation once a missing-ROMs
cleanup had run: the task reports `platform_ids` while the schema
still declared `platform_id`, and the missing-firmware cleanup had no
schema at all. Both shapes are declared now, the generated types follow,
and the task-by-id test checks a finished job of each kind.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F9ta8rXUTP9aMdatPYKX4K
2026-09-16 13:30:15 +02:00
Georges-Antoine Assi
c9364d0872 fix(v2): scope the missing-games wording and drop its download action
Review follow-ups on #4527. `settings.cleanup-all` is shared with the
missing-firmware controls, so the "Delete all missing games" wording moves
to its own key and the shared one goes back to "Clean up all". The rows on
this tab point at files that are gone, so the bar's download can only 404:
hide it behind a `hideDownload` prop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 07:27:52 -04:00
zurdi
91134e8cfe test(player): cover the state screenshot wiring
The player and console callbacks now share `resolveStateScreenshot`
(live canvas first, EmulatorJS's picture as the fallback) and the
console builds its multipart body through `buildStateFormData`, so the
utils spec can check what reaches the upload: the screenshot named
after the state, no screenshot part without a picture, and the
fallback order.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 13:20:38 +02:00
zurdi
83800f56d1 Merge branch 'master' into claude/fix-4509-state-screenshot
Resolves the conflicts with the save-slot work: `buildSaveName` is gone
(the backend tags slotted uploads), `captureStateScreenshot` stays next
to `buildStateName`, and the utils spec keeps both the saveSave cases
from master and the capture cases from this branch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 13:12:40 +02:00
zurdi
27da58c6fe fix(tasks): refuse a manual task run when no worker is listening
A task run with no RQ worker sat queued forever while the UI reported
it queued and later refreshed as if it had run. The endpoint now
answers 503 with the reason, the Settings sections show that reason
instead of the axios wrapper, and the developer setup documents how to
start the workers. The delete-ROM dialog's filesystem warning gets its
bottom padding above the footer, and the cleanup-queued message loses
its em dash in every locale.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 12:47:53 +02:00
Zurdi
ed3619dcd2 Merge pull request #4545 from rommapp/feat/asset-facts-presentation
style(player): one presentation for save and state facts
2026-09-16 12:33:35 +02:00
zurdi
83d0a53a3e fix(player): apply the Copilot review on the shared asset facts
One "Latest" tile per core even when timestamps tie, tracked by the
first asset holding the newest timestamp; the list layout keeps the
timestamp last on a fixed width so its right edge lines up whatever the
owner chip's width; AssetActions forwards attributes through a contents
wrapper; the stale list-layout comment describes the current pieces.
AssetChips, AssetTimestamp, the grouped strip and AssetActions get
their own specs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 12:26:26 +02:00
Zurdi
7b821304d1 Merge pull request #4547 from rommapp/fix/gamecard-selected-double-border
fix(v2): remove double border on selected game cards
2026-09-16 12:24:41 +02:00
zurdi
a0f77fe066 fix(v2): remove double border on selected game cards
The selected-state box-shadow stacked a flush 0 0 0 2px ring on top of
the outline, both drawing a border. Hovering happened to hide the
extra ring (the hover rule replaces box-shadow wholesale), so the
double border only appeared once hover ended while still selected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-16 12:22:59 +02:00
zurdi
0c03c833c2 fix(player): hover feedback on the launch screen only, no save restore
State tiles now lift and highlight on hover like the save rows, and
neither does so in the Save data tab: the entrance animation released
its transform so the lift shows, and static tiles keep a flat hover.
Clearing a picked state leaves nothing picked again; the save it
displaced no longer comes back. The Save data tab's four copies of the
per-item buttons collapse into one AssetActions composite.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 11:53:57 +02:00
zurdi
029a78d213 style(player): border state cards like the save rows
State cards take the save rows' 1px border tokens: the plain border at
rest, the strong one on hover and the brand one with a tinted fill when
selected, in place of the invisible-until-hovered ring and its shadow.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 11:37:50 +02:00
zurdi
fd6f44bfc6 style(player): ring the whole state card on hover and selection
The hover and selection ring moves from the screenshot to the tile, so
a picked state is outlined as one card, body included. The thumbnail
and the body round their outer corners inside the ring, and list rows
stay flat.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 11:36:41 +02:00
zurdi
8c704af5a7 style(player): make each state tile one flush card
The screenshot and the tinted body no longer have a gap between them:
the thumbnail rounds only its top corners, the body only its bottom
ones, and the tile stacks them edge to edge.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 11:35:54 +02:00
zurdi
e714dbad26 style(player): give state cards a tinted lower half
The facts and the action buttons under a state's screenshot sat on a
fully transparent area and read as loose text. They now share a soft
translucent panel with the card's radius, so the card reads as one
piece. The list layout keeps its flat rows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 11:35:04 +02:00
zurdi
22fea0a03f style(player): one presentation for save and state facts
Saves and states now describe themselves the same way: an AssetChips
row (newest-in-group tag, emulator tag, file size chip with its icon)
and an AssetTimestamp block (relative time over the exact moment). The
save rows keep their columns and the state tiles keep their stack; the
tiles gain the Latest tag within a core group and hide the emulator tag
there, since the group already names it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 11:33:47 +02:00
Zurdi
227f4424b8 Merge pull request #4544 from rommapp/renovate/github-actions
chore(deps): update docker/setup-buildx-action action to v4.4.1
2026-09-16 10:54:15 +02:00
renovate[bot]
0249a164d8 chore(deps): update docker/setup-buildx-action action to v4.4.1 2026-09-16 08:51:38 +00:00
Zurdi
6ebfb362a6 Merge pull request #4540 from rommapp/feat/ejs-save-slot-followups
feat(player): slot-aware saves list, server-side slot retention and launch-screen fixes
2026-09-16 10:50:40 +02:00
zurdi
5a4b4a6657 style(player): more room between the slot picker and the saves list
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 10:17:25 +02:00
zurdi
5e5f14b741 fix(player): keep the title gap on the subgridded states columns
A subgrid's own gap replaces the parent grid's, so zeroing it left the
states titles flush against the core bands and the preview while the
saves tab kept its 14px. The columns keep their base gap instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 10:14:52 +02:00
zurdi
6c9fadfef3 style(player): one title-over-content rhythm for both resume tabs
The view now owns every section title on the launch screen, including
the preview's, so "Save progress to" on the saves tab and "All states"
/ "Resume from state" on the states tab sit on the same 18px row and
their content starts the same 14px below. The 4px tile inset no longer
applies with the core bands, so the preview column drops it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 10:10:50 +02:00
zurdi
7deb7f8693 refactor(states): share the asset removal helpers with saves
The save and state delete endpoints carried the same row, file and
screenshot removal sequence inline. `remove_asset_file` and
`remove_screenshot` now live in the asset store, and each endpoint
keeps a one-line `_delete_save` / `_delete_state` over them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 10:04:51 +02:00
zurdi
1723a71325 fix(saves): prune the slot on a deduplicated upload too
A retried upload whose bytes already sit in the slot returned before the
retention pass, so a slot above a newly lowered cap stayed that way
until a different file arrived. The cap now applies on that path as
well.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 05:32:59 +02:00
zurdi
4ea0cd2317 style(player): trim the asset list file headers
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 05:30:51 +02:00
zurdi
76b80e0e1a refactor(player): apply the simplify pass
Slot pruning is one locked handler query that selects only the tail of
the slot by column, so an upload no longer loads every joined version;
the retention tests share their seeding helpers. Both asset lists fold
their groups through one useGroupFold composable, render the owner chip
through one AssetOwnerChip, and AssetStrip tracks each group's newest
timestamp while it builds the group. The two upload dialogs share a
PendingFilesDropzone for the drop zone and file list. The slot title
and the newest-by-timestamp lookup live in the utils next to their
siblings. The split states layout aligns its label and content rows
with a subgrid instead of hand-matched heights, so AssetPreview loses
the consumer-driven eyebrow height. Stories take explicit ids.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 05:21:45 +02:00
zurdi
b536aced56 fix(player): apply the code-review findings
Correctness: the upload dialog seeds dropped files immediately (three of
its tests ran vacuously), dedupes them by name, submits on Enter and
rejects a blank slot name; slotted manual uploads are new versions even
when the bytes match; the core picker sees the nightly cores the player
offers; clearing a state hands the boot back to the save it displaced;
a slot or core group can be folded even while it holds the selection
and reopens when the selection moves into it; the entrance stagger
counts only rendered rows; the stream save picker keeps its flat list;
slot retention orders by id as a tiebreaker for same-second uploads.

Reuse: asset helpers shared by both lists move to v2/utils/assets.ts,
the write slot follows the picked save in one place, the upload payload
carries its type, and the endpoint's delete sequence is one helper.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 05:05:29 +02:00
zurdi
e07eb69249 fix(v2): honor numeric-string dialog widths
`width="520"` reaches RDialog as a string, which was passed through as
an invalid CSS length, so those dialogs sized themselves to their
content. A numeric string now resolves to px like a number does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 04:13:13 +02:00
zurdi
30e4d94bd6 style(details): inline labels on the upload pickers and a shorter core hint
Both pickers carry an inline "Slot" / "Core" label with its icon, like
the launch-screen slot picker, and the core hint stops at "The
emulator these were made with."

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 04:08:55 +02:00
zurdi
f155a704fc fix(details): ask saves only for a slot when uploading
The core picker is for states; a save upload now shows just the slot
picker and never tags an emulator.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 04:06:51 +02:00
zurdi
e9ee27d522 feat(details): ask for the slot and core when uploading saves and states
Uploads from the Save data tab went straight to the server, so every
save landed slot-less and every asset under "Any core". A dialog now
sits in front of both the Upload button and the drop zones: saves pick
a slot (none, autosave, a slot in use or a new named one) and both
kinds tag the core they were made with, chosen from the platform's
cores plus whatever the existing assets already carry. The slot helpers
move out of the player view into a shared util so the dialog can use
them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 04:00:46 +02:00