The newest compatible state is still armed by default, but when a save
postdates it the resume panel shows a warning with a one-click "Boot
from save" action, so a handheld's newer in-game progress is not
silently rolled back by an older browser state. The save preview row
also shows the save's own screenshot when it has one.
Closes#4278
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XXrMndq8eYexafm6nhajLo
Seed the save tracker once per boot and from the bytes just loaded
instead of re-reading the SRAM, fold the "wait for the queue, skip
unchanged bytes" sequence into one helper used by both forced writes,
and upload the state and the save in parallel on Save & Quit. The
loaded save is a plain variable, the slot fallback lives in one place,
the selection id derives from the selected asset, and the byte compare
is a plain loop.
The viewport-fit layout drives AssetList's own scrollable prop from the
lg-and-up and tall breakpoints instead of a CSS custom property, and
the fit selectors drop the redundant root modifier. The slot length is
validated by the upload endpoint from a limit on the model, and the
datetime tag helper takes its timestamp explicitly.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XXrMndq8eYexafm6nhajLo
Save writes from the periodic tick, the in-game Save button and Save &
Quit now run through one chain, so two first writes cannot both open a
version; loading a save bumps a generation that voids in-flight writes,
and byte-identical uploads are skipped since a slotted upload bypasses
the backend dedupe. Slotted uploads let the backend stamp the timestamp
and tag the screenshot with the same one, so save and screenshot match
by stem again, and a session version opened without a screenshot can
still receive one on update.
A slot-less save is no longer kept as a write target when a state is
armed, slot names are compared exactly like the backend does, the custom
slot field is capped at the column length, and an empty-string slot no
longer collides with the "new slot" sentinel. The viewport-fit layout
uses a new `tall` breakpoint token gated on `lg-and-up`, gives the hero
column a scroll fallback, and lets AssetList keep its own scroll cap via
a custom property. The slot info icon becomes a tappable button so the
tooltip also opens on touch.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XXrMndq8eYexafm6nhajLo
The test shrinks the claim refresh and staleness windows to 0.05s and 0.2s and
races them against a 0.5s activate, so whether the refresh lands before the
read depends on scheduling. It passed and failed in alternating runs on an
unchanged tree.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Picking a save on the v2 EmulatorJS launch screen never disarmed the
auto-selected newest state, and the player loads a state in preference
to a save, so the pick was ignored whenever any state existed. Selection
rules now live in a pure module: a picked save disarms the state, a
picked state keeps the bound save as the write-back target.
Web saves now follow the sync clients' slot model. New saves go to the
"autosave" slot (capped history) or the slot picked on the launch
screen; a save that already has a slot keeps it; a legacy slot-less save
stays as an archive and its progress moves to the picked slot. Each
session opens one new version in the slot and updates it on later
writes, so periodic sync does not churn the history.
The launch screen gains a slot selector with an info tooltip, the save
preview collapses to a compact row so the list gets the height, the
pre-game screen fits the viewport on desktop with only the asset list
scrolling, and the slot chip drops its redundant label.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
review-polish pass over the save-picker change.
Two comments carried more prose than the rule allows. The emulator comparison
re-normalized a value ResolvedContainer already lowercases at resolve time,
which the sibling state resolver relies on, so it now reads the same way.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
simplify pass over the save-picker change.
The claim validated the pick, dropped the resolved row and passed the bare id
down two layers, where hydration fetched and re-checked the same save. It now
carries the row the way the resume state and the memory card already are, so
the restorability rule has one home and the claim one lookup.
The picker holds the picked id rather than the row, so an id that is no longer
on offer falls back to the newest by construction instead of through a watch,
and the list of archives uses AssetList, the variant meant for saves, rather
than the tile strip whose thumbnail area a save never fills.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Follow-up to #4515, merged before its review landed:
- Mark the card logo decorative (empty alt); the provider name sits
next to it and screen readers announced each provider twice.
- Add a name-tag prop so the scan reference dialog renders provider
names as h4 again, keeping heading navigation.
- Restore the ul/li provider collection in the setup wizard so screen
readers keep list semantics.
- Finish the Flashpoint label normalization in the GameDetails
provider registry and the heartbeat store scan options; the
remaining copies live in frozen v1 files.
- Replace raw hex colors in the story's placeholder logo URLs with
CSS color names.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
code-review pass over the save-picker change.
The launch screen listed every save this emulator wrote, but the broker only
restores .zip archives, so a bare save file could be named as the one about to
be restored while a much older archive actually went up. One restorable list
now feeds the panel, the tab and the picker alike.
A claim that carries a pick looks the save up by id instead of loading every
save on the ROM to scan for it, and the emulator comparison normalizes both
sides so a config value that is not already lowercase cannot silently match
nothing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The settings tiles, setup wizard step and scan reference dialog each
hand-rolled their own provider card markup and duplicated the provider
display data (names, logos, links, locale keys) three times. The
LaunchBox and Flashpoint tiles in the settings grid also showed a gap
under the footer: the tile was not a flex column, so a card stretched
by a taller sibling in its grid row left the spare space below the
footer instead of above it.
- Add the MetadataProviderCard shared composite with tile and row
layouts, status chip, setup/caveat pills, and #description /
#actions slots, plus a Storybook story covering both layouts.
- Add the METADATA_PROVIDER_INFO registry as the single home for
provider display data; all three surfaces derive from it. This
normalizes "Flashpoint Archive" -> "Flashpoint" and
"How Long To Beat" -> "HowLongToBeat".
- Pin the tile footer to the card's bottom edge, fixing the gap.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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>
The magic-byte test moves behind `_is_png`, so the two places that need it (the
broker body, where the answer decides whether the embedded frame is tried, and
the filesystem sink) read as one rule instead of two. Narrowing the extract
catch back to the failures a savestate archive can raise keeps a programming
error loud rather than logging it as a missing thumbnail.
The frame fetch gets its own 10s deadline: it runs while the claim is still
held and the player waits on the exit screen, and a thumbnail does not need the
archive-transfer budget.
From the pr-ready simplify pass.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The broker's screenshot now shadows the frame PCSX2 embeds in its own state,
so a 200 that is not a PNG has to read as no frame rather than as an unusable
one, or the state lands with no thumbnail at all. Extraction moves onto a
thread alongside the fetch it falls back from, since the body it inflates runs
to hundreds of megabytes.
From the pr-ready code-review pass.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The live ticker rescheduled itself through requestAnimationFrame with no
stop condition, so the loop kept running after the story unmounted. Once
the suite tore the environment down, a pending callback fired against a
gone requestAnimationFrame and failed the run with an unhandled
ReferenceError, even with every test passing.
Drive it from an interval started on mount and cleared on unmount, the
way the RProgressCircular and RImg animated stories already do.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The member picker reused patcher.select-file, so a ROM with several base
files rendered two dropdowns both labelled "Select file". Add
patcher.select-archive-member across all 18 locales and use it.
Treat an empty archive_member_name form field as "not specified" rather
than as a member name that matches nothing.
Fold getZipMembers into the archiveMembers computed and watch that, so
the selection also resets when the member list itself changes.
Add PatcherTab coverage for sending the selected member, typed against
RomArchiveMember so the fixture cannot drift from the schema.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A module-level exception tuple freezes zipfile.BadZipFile, but seven test
modules reload the zipfile module, which rebinds the class. After any of
them runs, a corrupt archive escaped the handler and surfaced as a raw
BadZipFile instead of a 400. Look the class up at raise time instead.
NotImplementedError goes with it, being a RuntimeError subclass.
Declare each rebuilt entry's final size instead of passing force_zip64,
so zipfile marks an entry ZIP64 only when it needs to; a patched ROM
handed to a basic unzip implementation was otherwise rejected even though
the unpatched archive loaded fine.
Drop the extracted and patched intermediates once they are consumed,
rather than holding three full-size copies for the life of the download.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The workflow triggers on `pull_request: types: [labeled]`, so adding any
label starts a run. `prepare`, `build` and `merge` are each gated on the
`build-preview` label and are skipped without it, but `report` was gated
only on the event type, so it ran and read `needs.merge.result` of
`skipped` as a failure. Every PR that received any other label got a
false "Preview build failed" sticky comment.
Claude-Session: https://claude.ai/code/session_01YBBbdsDv9BiYJnKwcCGE6A
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
- `rebuild_generated_columns` owns the index drop, since it is the one
place a column is dropped, so 0123's downgrade gets it too.
- `ensure_roms_columns` builds its action list first and runs on it, and
no longer re-reflects the table to re-test a column it just added.
- One list behind `STEAM_FED_COLUMNS`, and `INHERITED_COLUMNS` says what
the set difference at the use site used to.
- 0112 builds the view through `roms_metadata_view_sql`, and 0126 drops
the add-column branch the shared copy made unreachable.
- Tests share one generated-expression helper and read index and column
names off the module that owns them.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- `drop_roms_columns` drops a composite index that still spans a column
it removes before the ALTER: MariaDB and MySQL would otherwise keep the
index over the remaining columns, so 0126's unique index left by a run
that died before its stamp would become UNIQUE (platform_id).
- `ensure_roms_columns` recreates `roms_metadata` whenever it is absent,
so a run that died between its ALTER and the CREATE VIEW gets the view
back on the replay instead of only when a rebuild is pending.
- A generated column the engine does not reflect as computed counts as
not reading Steam and is rebuilt, rather than raising a KeyError.
- One home for the `steam_metadata` column name, imported by 0123.
- Tests pin the lost view, the leftover MariaDB default and the surviving
unique index; the ALTER recorder matches `roms` as a whole word.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
review-polish pass over the save-picker change.
The comments explaining why an older pick only lands where the broker clears
the save tree said the same thing in four places, so each one now carries only
what its own reader cannot get from the code. The save fixture in the launch
screen test becomes a typed factory, which the emulator-scoping case it did not
cover yet now uses.
simplify pass over the save-picker change.
`resolve_save_archive` loaded every save the user has for the ROM just to find
one row by id. `db_save_handler.get_save` is the owner-scoped point lookup the
save endpoints already use for exactly this, so call it and check the rom_id,
which drops a list load per claim that carries a pick.
The ROM scoping moves from the query into the check, so pin it with a test.
code-review pass (xhigh, --fix) over the save-picker change.
The launch screen inherited `user_saves` ordered by `updated_at` from the rom
schema, while the backend picks the archive to restore by `(created_at, id)`.
A content-hash rewrite on an older row was enough to make the two disagree, so
the no-picker panel could name a save the broker would not restore. The list
is now sorted the way the backend orders it.
Also give the restorability rule one home on the backend, so the validator and
the selector cannot drift, and correct a stale comment that still called the
memory card id claimSession's third argument.
Containers whose broker clears the save tree before restoring can land an
archive older than the container's own files, so offer the pick there and
validate it at claim time.
The docstring said the other emulators write the frame as its own file,
served by /state-screenshot. romm-broker PR 36 removed state_screenshot_path()
from every emulator module and replaced it with a single pixelflux capture of
the stream, so there are no per-emulator frame files left. PCSX2 is still the
only format that embeds one, read only when the broker's capture 404s.