Commit Graph

11675 Commits

Author SHA1 Message Date
Georges-Antoine Assi
fbbadb7c86 refactor(scan): give the title id one resolver and one identity shape
The Tinfoil feed was left behind when `_switch_productid_format` changed
from taking a `re.Match` to taking a `str`, so `/feeds/tinfoil` raised a
TypeError for any Switch rom carrying a product id in its filename but no
titledb id. It went unnoticed because `feeds.py` sits outside the changed
files mypy sees.

That call site was reachable only because "prefer the id the scan read over
the one scraped from the filename" lived in a second helper above the lookup,
leaving each caller to remember it. The resolution now happens inside
`_switch_productid_format`, so the three providers and the feed all get it
without repeating a preamble.

Also:

- Move `SWITCH_PLATFORM_SLUGS` to the sigil adapter so `utils/switch.py`
  stops importing the metadata base handler. The cycle that import created
  was papered over with a function-local import, and `normalize_identity`
  now takes the fact it needs rather than the whole slug set.
- Merge a partial identity update onto the stored identity before
  normalizing it. Normalizing rewrites the whole triple, so a client sending
  only a title id was getting the derived base id next to its old save
  target.
- Add `RomIdentity.from_rom` so the triple has one home on the read side
  too, and drop `asdict` from `as_rom_attrs`.
- Hold the `SigilExtractionResult` on `TitleIdEmbedCandidate` instead of
  copying two of its fields.
- Drop a guard in `_rom_level_identity` that could not fire, derive once in
  `normalize_identity`, and return only the parse from `_rebuild_rom_files`,
  which already owns `fs_rom["fs_name"]`.
- Read the parsed config in the heartbeat rather than forcing a YAML
  re-parse per request, and make `SigilService.is_enabled` a classmethod
  like every other one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 10:57:36 -04:00
Georges-Antoine Assi
8db38f3322 Merge remote-tracking branch 'origin/master' into feature/sigil-title-ids-followups
# Conflicts:
#	backend/handler/filesystem/roms_handler.py
#	backend/tests/endpoints/sockets/test_scan.py
2026-09-04 10:33:45 -04:00
Georges-Antoine Assi
2c0fb08795 Merge pull request #4329 from tmgast/fix/zip-cache-readable-and-locked
fix(download): make cached zips readable by nginx and serialize their builds
2026-09-04 10:25:44 -04:00
Georges-Antoine Assi
2d89f12b1f refactor(download): tighten the zip cache comments and test typing
Cut the docstring paragraphs down to the one fact each reader cannot get
from the code, name the readability test after the helper it exercises, and
give the flock stand-in and the zip factory real signatures.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 09:58:30 -04:00
Georges-Antoine Assi
9946256301 Merge branch 'master' into fix/zip-cache-readable-and-locked 2026-09-04 09:56:59 -04:00
Georges-Antoine Assi
0a0ed62a4c refactor(download): return the stat alongside the cached ZIP path
get_cached_zip already stats the archive to decide whether it exists, so
hand that stat back instead of making head_rom_content take another one for
Content-Length. A HEAD on a cached multi-file ROM now costs one stat.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 09:49:50 -04:00
Georges-Antoine Assi
352473d28c refactor(download): share the served-file mode and slim the zip cache
Give 0o644 a single home in utils/filesystem as SERVED_FILE_MODE, used by
both the ZIP cache and FSHandler._atomic_write. Collapse the mode repair to
one call site behind a single stat per cache hit, close the temp descriptor
unconditionally, and log the build where the namespace is already in scope.

Deduplicate the test fixtures and drive the concurrency test with a barrier
on flock instead of a sleep, so the race is guaranteed rather than timed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 09:48:03 -04:00
Georges-Antoine Assi
ffb076f22e Merge pull request #4327 from rommapp/claude/rate-limit-metadata-heartbeat
Rate limit the unauthenticated metadata heartbeat endpoint
2026-09-04 09:18:14 -04:00
Georges-Antoine Assi
dcd1589a8a Collapse concurrent metadata heartbeat misses into one probe
Callers that arrived while a probe was still running all read an empty cache
and started a probe of their own, so the cache only bounded outbound traffic
once a result had landed. Serialise the miss path on a per-source lock.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 09:11:50 -04:00
Georges-Antoine Assi
62ab9eb772 Tighten heartbeat rate limit comments and test assertions
Trim the constant comments down to the non-obvious facts, and relax the two
exact-TTL assertions that would flake if a second elapsed mid-test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 08:49:26 -04:00
Georges-Antoine Assi
7ffbc258cc Cache metadata heartbeats and make the rate limit window atomic
Two review findings on the heartbeat rate limit.

The client IP comes from a forwarded header the caller controls, since the
container runs uvicorn with --forwarded-allow-ips="*", so rotating that header
defeated the per-IP cap outright; a distributed flood has no single IP to key
on either. Caching each source's result for the length of the window bounds
outbound provider probes at one per source, whatever the inbound rate. The
per-IP cap stays as the cheap first gate.

The window's INCR and EXPIRE were separate round trips, so a call interrupted
between them left a counter with no TTL that later calls never repaired,
locking that key out for good. Both now run in one transaction, with EXPIRE NX
so a live window is never extended and a counter can never lack a TTL.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 07:59:20 -04:00
Zurdi
9aea367b7f Merge pull request #4342 from rommapp/dependabot/uv/cryptography-50.0.0
chore(deps): Bump cryptography from 49.0.0 to 50.0.0
2026-09-04 09:51:25 +02:00
dependabot[bot]
b4e493cfb7 chore(deps): Bump cryptography from 49.0.0 to 50.0.0
Bumps [cryptography](https://github.com/pyca/cryptography) from 49.0.0 to 50.0.0.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/49.0.0...50.0.0)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 50.0.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-09-04 07:40:07 +00:00
Zurdi
b788170033 Merge pull request #4341 from sdornan/claude/node-20-deprecation-8a7288
Bump GitHub Actions to Node 24 runtimes
2026-09-04 09:38:49 +02:00
Sam Dornan
2539520de4 Bump GitHub Actions to Node 24 runtimes
GitHub is deprecating the Node 20 action runtime. Every third-party action
in the workflows was still pinned to a Node 20 release, so each is moved to
its latest release, all of which declare `runs.using: node24`:

- actions/checkout v4.3.x -> v7.0.1
- astral-sh/setup-uv v6.7.0 -> v10.0.1
- docker/login-action v3.5.0 -> v4.6.0
- docker/metadata-action v5.8.0 -> v6.2.0
- docker/build-push-action v6.18.0 -> v7.3.0
- docker/setup-qemu-action v3.6.0 -> v4.3.0
- docker/setup-buildx-action v3.11.1 -> v4.3.0
- actions/github-script v7.1.0 -> v9.0.0
- actions/upload-artifact v4.6.2 -> v7.0.1
- peter-evans/create-pull-request v7.0.11 -> v8.1.1
- trunk-io/trunk-action v1.2.4 -> v2.0.0 (its nested actions were on Node 20)

actions/setup-node and actions/setup-python were already on Node 24 but are
bumped to v7.0.0 as well, and the setup-node reference in the trunk
setup-ci composite action is now SHA-pinned like the rest.

None of the removed inputs, deprecated envs, or event-specific behavior
changes in the crossed major versions are used by these workflows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 21:45:49 -05:00
Georges-Antoine Assi
929e165053 Merge branch 'master' into claude/rate-limit-metadata-heartbeat 2026-09-03 22:33:14 -04:00
Georges-Antoine Assi
e186710d82 Merge pull request #4322 from sdornan/claude/github-issue-4321-54e972
fix(v2): read the date picker's value in UTC, not local time
2026-09-03 22:32:10 -04:00
Georges-Antoine Assi
5259d1dabf Merge pull request #4313 from TRusselo/fix/threaded-core-https-error-message
Show a clear message instead of the generic error for threaded cores over non-secure origins
2026-09-03 22:24:06 -04:00
Georges-Antoine Assi
0e0e4fefa9 Merge branch 'master' into fix/threaded-core-https-error-message
Conflict in the v2 EmulatorJS player was an import collision only: master
added useUnloadGuard where this branch added useSnackbar. Kept both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 22:05:10 -04:00
Georges-Antoine Assi
55a1152256 cleanup 2026-09-03 22:01:56 -04:00
Georges-Antoine Assi
97db058105 Merge pull request #4308 from rommapp/feat/confirm-before-leaving-player
feat(player): confirm before leaving a running game
2026-09-03 21:45:42 -04:00
Georges-Antoine Assi
7b3b537f22 fix(player): disarm the unload guard when a launch fails
A failed EmulatorJS loader (both attempts exhausted) or a Ruffle launch
that cannot create a player left gameRunning set, so the browser asked
for a leave confirmation with no game behind it and input stayed muted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 21:36:17 -04:00
Georges-Antoine Assi
1113387fd0 Enhance useUnloadGuard with server-side check
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-03 21:35:49 -04:00
Georges-Antoine Assi
04f3d2679c Merge pull request #4277 from rommapp/feat/files-scan-and-rom-folder-uploads
feat(scan): refresh files scan and uploads into rom folders
2026-09-03 20:59:53 -04:00
Georges-Antoine Assi
102c5737e1 fix(v2): write the ascii range with escapes so git reads the file as text
The character class held a raw NUL and a raw DEL byte, and a NUL in the
first 8000 bytes makes git treat the whole file as binary: GitHub renders
no diff for it and a merge cannot go three ways. The class is unchanged.

Also drop the second paragraph of the quick scan description.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 20:40:54 -04:00
Georges-Antoine Assi
53ac1d9711 fix(scan): announce a restored rom from the platform loop
The platform sync clears `missing_from_fs` before the batch loop runs, so
a rom being scanned can no longer tell that it was missing, and the fold
left the skip path (which could tell) unreachable for a quick scan. A rom
whose file came back byte for byte therefore emitted nothing and kept its
stale badge. Collect the restored roms from the snapshot the loop already
takes, for the ones it visits as well as the ones it skips.

Cleanups on the same paths:
- hoist the quick reconcile above the metadata prelude it never reads,
  which was a config file parse and a tag parse per rom
- drop the unreachable quick clause from `_should_hash_incrementally`:
  `refresh_rom_files` owns that policy
- drop `RomFilesRefresh.files`, which nothing reads
- take the refresh lock without a guard that had nothing to protect
- fold the single-caller upload destination helpers into one
- give "a quick scan needs no metadata source" one home, and read the
  refresh title from the key rom.json already owns

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 20:32:30 -04:00
Georges-Antoine Assi
72580fc5b2 refactor(scan): fold the files scan into the quick scan
A quick scan skipped every rom it already knew, so a file dropped into a
game folder went unnoticed until a complete or hashes rescan. This branch
answered that with a seventh scan type; letting quick reconcile the files
of the roms it knows says the same thing with less to learn.

Quick now visits every rom. New ones take the metadata pipeline as
before; existing ones only have their files reconciled against disk,
keeping the stored hashes of files whose size and mtime are unchanged. No
provider is contacted for an existing rom, so quick no longer needs a
metadata source picked, in the scan view, the platform dialog and the per
rom refresh alike.

The watcher schedules a quick scan again, and the per rom "Refresh files"
action sends quick scoped to that rom.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 20:14:46 -04:00
Georges-Antoine Assi
24b6870485 fix(v2): let a files scan start without a metadata source
A files scan contacts no provider, but the scan view and the per platform
dialog both kept their start button disabled until one was picked, so the
option they had just gained could not be used. The refresh dialog already
exempted the type.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 19:06:45 -04:00
Georges-Antoine Assi
a84ba16d0f fix(scan): make the files refresh safe under concurrent uploads
The refresh lists a rom folder and then deletes every row the listing
missed, so two uploads completing at once could let the slower listing
drop the file the faster one had just registered. Hold a per rom lock
across the listing and the sync.

Three smaller fixes on the same paths:
- honour SKIP_TITLE_ID_EXTRACTION, which the refresh read the hash flag
  but not this one for
- emit a rom that just stopped being missing even when its files did not
  change, so an open gallery drops the stale badge
- unlink the empty destination claim when the rename meant to replace it
  fails, rather than leave a zero byte file for the next scan to ingest

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 19:06:37 -04:00
Georges-Antoine Assi
cd4c8ff07e test(tasks): read the scheduled scan's providers from the task
The test named fifteen handlers by hand, so Steam, added since, was left
to the environment: a machine with STEAM_API_ENABLED set scanned with a
source the assertion does not expect. Take the list from the task module
and turn every provider off, so the next one cannot drift it either.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 18:44:50 -04:00
Georges-Antoine Assi
bf5a7a9e64 chore(review): cut the scan comments back to what the code cannot say
The per-ROM scan type list restated each option's own subtitle, and the
useScanTrigger header named two callers when four now share it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 18:06:47 -04:00
Georges-Antoine Assi
13ac6668b7 chore(review): tighten the files scan and folder upload code
Backend:
- Drop the HashPolicy enum: FULL had no caller and INCREMENTAL was the
  default, so refresh_rom_files uses the existing_files knob directly.
- Narrow RomFilesRefresh to the counters callers read.
- Build ParsedRomFiles once so the incremental return stops dropping the
  title id fields.
- Give the assembling suffix one home in config, read by both the
  assembler and the scanner's excluded extensions.
- Fold the duplicated destination collision check into one helper, and
  branch /start on the upload target itself.
- Load the lighter rom for the refresh emit and the upload endpoints,
  keep the flat file stat off the event loop, and reuse the directory
  listing for the RA hash lookup.

Frontend:
- Route the platform scan dialog and the scan view through
  useScanTrigger, so a scan started while one runs is refused rather
  than emitted and rejected by the backend.
- Rename the socket payload type to ScanRequest, away from the
  useScanProviders type of the same name.
- Drop the dead uploading prop and folder icon, reuse singleRomTitle,
  and resolve each file's relative path once per listing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 18:00:01 -04:00
Georges-Antoine Assi
82bc875dc6 test(scan): type the sigil skip cases instead of a kwargs bag
The rebase put the branch's keyword-only `existing_files` alongside
master's title id flags, and mypy resolves a `**dict[str, bool]` against
every parameter, so the bag no longer type checks. Name the two flags the
cases actually vary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 17:59:51 -04:00
zurdi
ac2980fe9f fix(v2): keep the bottom nav pinned to the bottom on short views
`.r-v2-shell__app` had no minimum height, so a view shorter than the
viewport left the BottomNav anchor short and the sticky pill floated above
the real bottom edge. Match the shell's min-height so it always reaches it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
682e06c2f6 fix(v2): tidy the files-tab selection actions and add per-row delete
The selection actions become icon-only (download, copy link, delete, clear)
so they sit on the checkbox row instead of wrapping off-screen on narrow
viewports, and each file row gains a delete button gated on the delete grant.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
d09016a485 refactor(upload): keep the start headers and take the rom target as a JSON body
`POST /api/roms/upload/start` keeps its X-Upload-* headers so existing
clients are unaffected; the new rom_id and folder travel in an optional
JSON body instead of extra headers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
452f0a41de refactor(upload): take the chunked upload start fields as a JSON body
`POST /api/roms/upload/start` reads platform_id, filename, total_size,
total_chunks and the optional rom_id and folder from a JSON payload instead
of X-Upload-* headers. Header values are limited to ISO-8859-1, which also
rejected non-Latin filenames in the browser.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
bdaee9d0f0 chore(review): apply review polish to comments and tests
Drop em-dashes from the new comments, hash with usedforsecurity=False in
tests, and replace double type assertions with typed factories.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
10e90bfc6f fix(upload): check collisions before promoting and claim the destination
A rejected upload could still promote a single-file ROM to a folder because
the collision check ran after the promotion, and two completions racing for
the same name could overwrite each other through Path.replace. The
collision is now checked first, including the lone file's own name, and
the final path is created with O_EXCL before the move.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
ad83fdd83b fix(scan): keep stored rom hashes when hashing is disabled
With SKIP_HASH_CALCULATION the listing carries no hashes, so a top-level
change would have blanked the ROM's CRC, MD5, SHA-1 and RA identity. The
stored values now outlive the refresh in that mode.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:34 -04:00
zurdi
a29d875b9d i18n: add files scan and folder upload strings
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:33 -04:00
zurdi
af57e8d574 feat(v2): refresh files scan and uploads into rom folders
Adds the files scan to the scan launchers and a direct "Refresh files"
action in the game menu, shares the socket trigger between them, refetches
the open game when a scan finishes, and routes every Files tab upload
through the chunked upload with a destination dialog for new folders.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:15:33 -04:00
zurdi
74ce1fea3b feat(upload): let chunked uploads target a rom folder
`POST /api/roms/upload/start` accepts `X-Upload-Rom-Id` and
`X-Upload-Folder`. The file is written into the ROM's folder (a single-file
ROM is promoted to a folder first), kept inside it, rejected when the
scanner would ignore it or when it already exists, and registered on
completion through the incremental file refresh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:11:03 -04:00
zurdi
fc8cfbc6f1 feat(scan): add a files scan that reconciles rom folders incrementally
Files added to an already-scanned folder ROM could only be picked up by a
complete or hashes rescan, which rehash every known file. The new `files`
scan type scans new games like quick and re-lists the files of existing
folder ROMs, hashing only new or changed files and recomputing the
ROM-level hashes only when a top-level file changed. Per-rom update and
unmatched scans reuse the same incremental mode, and the filesystem watcher
enqueues it instead of quick.

Also stores rom_files.last_modified as Double (MariaDB FLOAT rounds a
current mtime to about 128 seconds), adds the CHEAT value missing from the
PostgreSQL category enum, maps `patches/` to the patch category and
excludes upload temp files from scans.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WbesTQXohyAWWcLV5iiEN
2026-09-03 17:11:03 -04:00
Georges-Antoine Assi
682f5acfd3 Merge pull request #4275 from sdornan/claude/rq-scan-queue-split
perf(scan): give scans their own queue and worker
2026-09-03 16:59:17 -04:00
Georges-Antoine Assi
2fb77c328f fix(scan): keep a failed report and a rom scan from swallowing work
Two findings from a review pass over the branch.

`report_scan_failure` emitted with nothing around it. RQ logs and re-raises
out of `execute_failure_callback`, and the abandoned-job path calls it from
`StartedJobRegistry.cleanup` inside the pipeline, before the sweep removes
the entries and releases the maintenance lock. A socket or Redis failure
while reporting, which is the situation a dead worker tends to come with,
would leave the abandoned scans in the registry and take the worker down
with it. The report is now best effort.

The watcher counted a scan of named roms as covering the platform it names,
so a change on disk under that platform was dropped while the scan was
pending. Every client that scans named roms sends the platform alongside
them, and such a scan resolves its roms from the database without walking
the filesystem, so it covers no change there. This branch widens the window:
a rom scan is now accepted while a library scan runs, and can sit queued
behind it for hours.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 14:13:25 -04:00
Georges-Antoine Assi
e0f0cec435 style(scan): trim the comments to what the code cannot say
Cuts the rationale that had grown past two lines, and drops the wording
that described the change rather than the behaviour: a scan on one of the
other queues is one an older release enqueued, not one from "before scans
had their own queue".

The result_ttl note moves onto the argument it explains, and in the
entrypoint the log line moves next to the call it announces rather than
sitting above the function definition.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 13:42:20 -04:00
Georges-Antoine Assi
dc7d14f31d refactor(scan): let RQ discard the scan dispatch, and say the guard once
The dispatch job was hidden from the task list by a meta flag the endpoint
had to look for on every job in every queue and registry. RQ already has
the rule the flag was implementing: `result_ttl=0` deletes a job the moment
it succeeds, while a failed one still lands in the failed registry under
its own TTL. Registering the scan entry with it drops the marker, the
predicate, its four filter sites and the two Redis reads each one cost.

The concurrency guard is now one call. `get_blocking_library_scans()` says
which scans a second one has to wait for, so the socket handler no longer
assembles that rule out of two helpers in two shapes, and `ALL_QUEUES` sits
with the queues it lists rather than in the API layer.

Also merges the finished and failed registry sweeps, which were the same
loop, trims comments that explained the design rather than the code, and
drops two socket tests that duplicated their neighbours.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 12:29:58 -04:00
Georges-Antoine Assi
ac36a1a33f Merge pull request #4336 from rommapp/docs/no-full-backend-test-suite-locally
docs(agents): never run the full backend test suite locally
2026-09-03 12:20:00 -04:00
Georges-Antoine Assi
ffc8dffc20 Merge upstream master into claude/rq-scan-queue-split
Master landed #4274 with the review changes that came out of it, and those
moved the code this branch was built on. Scan job bookkeeping now lives in
`handler/scan_jobs.py`, every enqueue goes through `enqueue_task`, cron
entries carry their own name and result TTL, and the watcher builds its two
rescans from one helper.

Resolved by putting this branch's changes where that code now lives:

- The scan queue, the scoped-scan check and the second scheduled registry
  moved into `handler/scan_jobs.py`, keeping master's single-round-trip
  reads (`get_job_ids` plus one `fetch_many`, and `get_jobs_to_schedule`
  for the stale sweep) across both registries.
- `enqueue_scheduled_scan` sits next to `enqueue_task` in the registry and
  is built from it, rather than hand-rolling the same enqueue in
  `tasks/tasks.py`. Its tests moved with it.
- Cron keeps master's per-entry name and result TTL, and adds the scan
  dispatch on top: `TASK_TIMEOUT` for the dispatch, the task's own timeout
  (now `SCAN_TIMEOUT`) for the scan it enqueues.
- The watcher's `schedule_rescan` helper enqueues on the scan queue with
  the abandoned-job callback.
- `PeriodicTask.func` is gone from master, so the scheduled rescan declares
  only its timeout. `tasks.registry.enqueue_scheduled_scan` joins the func
  paths an RQ worker has to be able to import.
- The job stubs shared by the discovery tests grew the scan queue and a
  scoped-scan job; the duplicated stale-sweep tests are master's.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 12:16:44 -04:00