report_task_failure can run in the worker parent when a work horse is
killed, so it now enqueues notify_task_failure on the default queue
instead of loading the notification stack there.
enqueue_task defaults to the queue its spec names. The streaming worker
runs as PreloadingWorker, which imports the enabled scheduled tasks of
its queues, so the reaper's per-minute horse inherits its stack. Spec
tests now read config in a fresh interpreter instead of comparing a
value with itself.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Loads every model where the engine is built rather than per job, so only
processes that touch the ORM pay for it. Resolves task paths with RQ's
import_attribute, references the scan failure callback by path, hoists
the recommendations builder's registry import now that the registry
loads no task modules, and gates push-pull on its spec.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Loads every model before a job resolves its task, so the mappers
configure in a work horse that imported a single task module. Moves the
httpx2 import into RemoteFilePullTask.run, builds the push-pull job meta
from its spec, gates the scheduled scan on its spec, and widens the
loaded-modules test to cover task modules and httpx2.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ConfirmDialog focused Cancel on the next tick, but RDialog's own initial focus
ran after it and landed on the header's close button. Mark Cancel autofocus,
which RDialog already prefers, so a stray A or Enter cancels as intended.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Addresses Greptile's review on #4971: rounding reported 100 at 99.6%.
Flooring keeps the value a whole number.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Home and End go to the ends of the row, and with Ctrl to the first and
last item of the grid. A row of one cell (list view) has nowhere to go
inside it, so there Home and End move through the grid too. PageUp and
PageDown move about one viewport of rows, keeping the column. The
gallery and Missing games scroll the virtualised list to the edge row
and wait for it to load before focusing it.
The list row's click, Space and context-menu handlers move onto its
name link, which already takes every click on the row, so the row
element carries no handlers of its own.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pico8, Ruffle, JsDos and EmulatorJS each set and cleared the flag by hand next
to gameRunning, with their own unmount resets. Each now mirrors gameRunning
through usePlayingWhile, which clears the flag on dispose. JsDos hands input
back at unmount rather than in teardown; every exit from a running JsDos
replaces the document, so the difference is not observable.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Spatial nav used to bail whenever an overlay was open, and no dialog moves
focus on arrows, so a pad could only reach a dialog's first control:
ConfirmDialog's Confirm was unreachable app-wide. It now moves focus among the
controls of the topmost overlay's panel, including a dialog over a running
game, which replaces Stream's own exit-dialog arrow handler.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The gallery's rows now form a role="grid" with aria-multiselectable,
aria-rowcount and aria-rowindex. Each card sits in a gridcell carrying
aria-selected; in list view each row is a role="row" of gridcells
with aria-selected, under a header row of columnheaders that carry
aria-sort. Letter headings are rowheaders and skeleton rows are hidden.
RVirtualScroller gains bodyAttrs and a #head slot so the grid can own
the list header row without the toolbar above it. The list row's root
is now a div, and its name is the link, stretched over the row so a
click anywhere still opens the game.
useGridNav gains a roving mode that keeps a single tab stop in the
grid, including for rows mounted while scrolling. Space selects the
focused card or row and Shift+Space selects a range. This replaces the
Selected/Not selected description, whose strings are removed.
The Missing games list gets the same grid semantics and arrow keys.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
write_file saves each upload under its sanitized basename, but the
firmware lookup, scan, hash check and audit record used the raw
client filename. A name with a directory part (sub/x.bin, ../x.bin)
wrote the file, then failed the scan with a 500 and left it on disk
with no row. An overlong name raised an unhandled ValueError.
Sanitize every name before writing anything, return 400 for a bad
one, and use the sanitized name throughout.
Share one flag-mirror helper between useStageActive and usePlayingWhile, add a
deferred() test helper for Desktop's hand-answered calls, and note that players
opt into the pad exit by listening for gamepad:exitchord.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Release a desktop claim still held at unmount, mark an unstarted chord hold
with null rather than 0, and cover the Stream listener, the held-through-close
latch, and escape-stack cleanup in tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reading streaming.enabled from config.yml in the init script couples the
shell to the YAML config, and the worker's isolation is what keeps a slow
teardown or exit save pull off the shared task worker (#4632). The worker
stays always-on; its idle cost is reduced separately by slimming what RQ
worker parents import.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
Drops the separate 100ms useExitChord poller. useGamepad already reads every
pad each frame and knows when the game owns input, so it now fires a
gamepad:exitchord window event after a 1.5s Select+Start hold, only while
playing with no overlay open. Stream and Desktop listen for it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pin PairShell's foreground and border tokens to the overlay palette so
the Pair card and footer stay legible in v2-light, let the footer's
version tag wrap long branch names instead of clipping, and drop the
footer positioning comments.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The reaper test now reads HOLD_CEILING_SECONDS from handler.streaming.config,
where it is defined. Merges the duplicate handler.auth.base_handler imports
the rewrite left in two test files, and shortens the comments on the hold
ceiling, the LaunchBox spec and the registry module.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
config.yml is re-read on every request, so streaming can be turned on
without a restart, and exit save pulls queued before it was turned off
still need a worker. With streaming off at boot, the general RQ worker
now listens on the streaming queue too instead of leaving it without a
consumer; the dedicated streaming worker still starts only when
streaming is on.
The check reads the exit status inline rather than through a function
in an `if !`, which shellcheck flags (SC2310) since it disables errexit.
Adds a fresh-interpreter test that init_sentry() never imports the SDK
without a DSN, and drops a comment that restated the PR's rationale.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
The registry imported every task module to read each task's title,
schedule, queue and timeout, so `rq cron` and every RQ worker parent
loaded the whole app. Task metadata now lives in the registry as
`TaskSpec`s with a dotted path to the implementation, which `get_task`
imports only when a job runs. Cron, the tasks API, enqueueing and the
worker's failure reporting read specs only.
Every log line also imported handler.metadata.base_handler, and with
it every metadata provider, for the redaction regex. The sensitive keys
and their regex now live in logger.formatter.
A test pins that importing the cron config or the worker class loads
neither handler.database, the auth handlers nor fastapi.
Measured RSS at LOGLEVEL=INFO, master -> this branch:
- rq cron: 164 MB -> 72 MB
- idle RQ worker (x3): 133 MB -> 68 MB
- gunicorn web worker: 214 MB -> 206 MB
Each job's work horse now imports its task module itself, 0.1-0.5s
more per job on an x86 host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
The card and list row stay links. While the gallery is selecting they
describe their state (Selected / Not selected), Space toggles them, and
aria-keyshortcuts names the Ctrl/Cmd+Enter gesture that starts selecting.
The checkbox drawn on each item is now decorative: RCheckbox gains a
decorative mode that renders the box without an input or label, so it
is no longer a hidden tab stop or interactive content inside a link.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Importing any handler.auth submodule ran the package __init__, which
built the auth handlers and so loaded authlib, joserfc and Socket.IO.
models.user imports handler.auth.constants, so every process that
touched the models paid for the whole auth stack. The handler
instances now live next to their classes in handler.auth.base_handler.
utils.context imported fastapi only for annotations; that import now
sits under TYPE_CHECKING.
An idle RQ worker drops from about 118 MB to 89 MB RSS. Each job's
forked work horse now imports a little more on its own, about 0.2s
on an x86 host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
/pair only had a default view, so the v2 named router-view rendered
nothing and the QR pairing link opened a blank page. Give it a v2 view
like /pair/device and drop PairDispatcher.
Move the language selector and version tag bar into AuthFooter, used by
the sign-in layout and both pair shells.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Collapse the pair shells' footer into one flex row like AuthLayout's,
and name the list row's title and checkbox label once.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Keep the pair shells' footer out of the grid flow, label the bottom nav
landmark, name list-row checkboxes, reveal a keyboard-focused card
checkbox, drop aria-pressed from static cards that are not toggles, and
round the circular progressbar's aria-valuenow.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Skip sentry_sdk.init when no SENTRY_DSN is set. Without a DSN the SDK
reports nothing, yet init still loads every default integration (httpx,
rich, jinja2, mako, pygments...), about 10 MB per process.
Import alembic.config only in main.py's __main__ block, the one place
that uses it, instead of in every gunicorn worker (about 8 MB).
Don't start the RQ streaming worker when config.yml leaves streaming
off (the default). It only runs streaming teardowns and exit save pulls,
and costs about 115 MB idle.
Measured on a gunicorn worker importing main: 213 MB -> 193 MB RSS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh1SRMfuK7BZmf6YxMqSyT
Require a release before a held Select+Start can fire again, so cancelling
the exit dialog with the chord still held no longer reopens it. Guard the
late desktop claim with useIsAlive instead of a local unmount flag.
Add usePlayingWhile next to useStageActive so both stream views mirror
their session into the playing flag, and clear it on dispose, through one
helper instead of a hand-wired watch and unmount reset each.
useExitChord reads the shared PAD_BUTTON names and skips disconnected
phantom pads via isUsablePad. A late desktop claim goes back through
release() rather than a second hand-written release call, and the desktop
tests share one claim fixture and release assertion.
With useGamepad muted for the whole desktop session, B no longer reached
the exit confirmation, leaving a pad-only admin with no way out. Move the
player's Select+Start hold into a useExitChord composable and use it in
both views, including while the claim is loading.
A claim that answers after the view has gone is now released straight
away instead of standing unrenewed until it goes stale. Tests cover the
flag while loading, the drop on exit, the exit hold and the late claim.
The desktop view never set the global playing flag, so useGamepad kept
translating pad presses into RomM navigation behind the stream: B popped
history (prompting to end the session), the D-pad moved focus and Start
opened the user menu while an admin configured the emulator. Hold the flag
while the desktop is opening or open, as the game player does.