A RetroArch container's core filter comes from the core activate reports
booting, or before launch from the configured core and the broker's
default (asked over its cores route and cached for a minute). Hydration,
an explicit resume and the config payload all apply it, so a state
written by one core never lands where another core's quick-load reads it.
A resume the booted core cannot load launches fresh, and the resume
endpoint refuses such a state up front with a 400.
Cut the docstrings and comments this branch added down to the one non-obvious
fact each, in the resolver and in the tests alike, and rename the new helper to
_claimable_broker_host so it says what it returns next to _derive_broker_host.
Move the three ways a raw entry fails to resolve into one helper with a guard
clause each, so none of them has to unset a broker host a sibling branch set.
The subfolder match moves onto WebstationProtocol, next to the normalization it
has to agree with, and interchangeable_with compares protocol names, the
discriminator the record already uses elsewhere.
The holder gate added with the pool ran before the stale-takeover walk, so a
player whose tab crashed was refused their own container until its TTL lapsed.
Block only on a live holder, and when the holder's own session is stale narrow
the candidates to that container so the existing takeover path reclaims it.
Also widen the proxy path check to compare the host's URL path, so a container
on another origin mounted at a path that disagrees with its subfolder is
refused the same way a bare path already was.
The webstation migration guide belongs in rommapp/docs, where users reading
about emulator streaming will find it (rommapp/docs#128). The deprecation
warning and the protocol module now link to the published page.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A broker's launch, join and desktop replies name the URL the browser loads
in an iframe, and urljoin keeps an absolute (or `javascript:`) URL verbatim,
so a container that answered with one could run script in RomM's origin
instead of its own. The three sites now share one resolver that drops a room
URL leaving the configured host, the stage refuses a source that is not
http(s), and the frame is sandboxed without allow-top-navigation so a
container page cannot steer the tab it sits in.
Also drop the shared secret from the config entry a resolution warning
prints, which named the misconfigured container by dumping it whole.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- The five new modules each defined `log = logging.getLogger("romm")`, which is
what `logger.logger` already exports; they import it now.
- `ACK_TIMEOUT` had two homes. It is a protocol fact, so `protocol.py` owns it
and the endpoint imports it from there; the unused
`BROKER_LOAD_STATE_TIMEOUT` copy goes.
- Module and function docstrings trimmed to what the code cannot say: the
change history and the justifications belong in the commit messages they came
from.
- `asset_store` takes the union `write_file` accepts rather than `Any`.
- Four hand-rolled `setInterval` pairs (presence beat, session poll, exit
chord, live sessions, activity tick) become `useIntervalFn`, which also
cleared a real gap: the presence composable's timer had no scope teardown.
- The launch pushes are matched on the container the claim's 202 named, not on
the platform: a pool serves one platform from more than one container, so a
second tab could otherwise act on the first's launch.
- Test helpers typed: the push capture and the resume-claim tuple carry real
types, and an unused `_claim_ready` helper goes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two shapes of streaming broker were branched on at 19 call sites, and every
consumer re-derived a container's host, key, emulator, capabilities and card
sync from the raw YAML on each call. `_containers_for_platform` re-ran host
parsing and the operator's misconfiguration warnings on every request, and
`_container_label` re-read config.yml once per listed row.
`handler/streaming/`:
- `protocol.py` gives each broker shape a class owning its route prefixes,
timeouts, response dialect, stream-URL assembly and capability flags. A call
site now asks `protocol.supports_disc_swap` or `protocol.save_state_accepted`
instead of re-testing `protocol: webstation`. Instances are interned per
subfolder so identical configs share one object.
- `capabilities.py` holds the per-platform and per-emulator slot tables and the
state transfer limits, keyed purely by platform and emulator.
- `config.py` turns the raw list into frozen `ResolvedContainer` records with
every question already answered, memoized until the config changes, so the
warnings fire once per config rather than once per lookup. A container RomM
cannot dial still resolves, with an empty key: unclaimable, but visible in
the admin fleet view where the operator can see why.
`endpoints/streaming.py` drops ~700 lines and takes records rather than dicts
throughout; `container.emulator` and `container.protocol.session_route(...)`
replace the derivations that used to run per call.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>