Skip to content

test: regression suite — anonymous route sweep, write-route table, Prowlarr seam, ResetInterface sweep, failOnSkipped (review 6/7) - #140

Open
ndandan wants to merge 6 commits into
Shoshuo:mainfrom
ndandan:pr/review-1106-6-tests
Open

ndandan wants to merge 6 commits into
Shoshuo:mainfrom
ndandan:pr/review-1106-6-tests

Conversation

@ndandan

@ndandan ndandan commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Sixth PR of the review-2026-11-06 series (stacked on the hygiene PR, which adds the French strings the parity test needs).

What this adds (regression suite)

  • AuthBoundaryTest: an anonymous GET sweep over every App\Controller route (requirement-aware sample paths) asserting no 200 and no ≥ 500 — every route redirects to /login — plus the login form, a wrong password, the five-attempt throttle and logout.
  • WriteRouteTableTest: every POST route of the Media, Radarr, Sonarr, Prowlarr, Jellyseerr, qBittorrent, Deluge, Transmission and Usenet controllers — anonymous → /login; logged in, same-origin JSON → the route is wired (anything but 404/405). A renamed route or a dropped method restriction used to stay green.
  • ProwlarrClientWriteContractTest through an exec() seam in ProwlarrClient (the same shape as the Radarr/Sonarr/Jellyseerr/qBittorrent seams), covering forceSave, the legacy URL and the timeout-vs-connect-failure breaker decision.
  • ResetInterfaceSweepTest: every ResetInterface service in src/, found by scanning, is built from the container and reset twice; WorkerModeResetTest draws its provider from it, so a new resettable service is covered the day it is written.
  • phpunit.dist.xml: failOnSkipped / failOnIncomplete, so a skipped test is a red run.
  • AbstractWebTestCase clears the cache.app, cache.swr and cache.rate_limiter pools between tests and gains asAnonymous().

Notes for upstream

The fork stubs DNS for the SSRF guard inside web tests (a memoised resolver); upstream resolves live, which is why the save paths in the posture PR check shape only. The cross-site step of the route table belongs to the fork's cross-site guard and is not included.

… §1)

H1  Sonarr library import sends the scanned folder as `path` (template +
    seriesAdd) so Sonarr adopts the existing files instead of creating an
    empty folder named after its own format. AC-9: one raw lookup instead
    of two SkyHook round trips.
H2  Collection "Follow" uses the null-safe bulk endpoint; updateCollection()
    itself now GET-merge-PUTs (a partial PUT wiped profile/root/tags).
H3  Radarr queue "Import" goes through the manual-import preview by
    downloadId (RadarrClient::manualImportFromQueueItem, mirroring Sonarr),
    and the page only deletes the queue item once Radarr reports it
    imported (or removed it); otherwise it shows Radarr's state.
H4  File managers read /films/languages and /series/languages (each app's
    own /api/v3/language) instead of a literal table that mapped 7 of 12
    names to the wrong id.
H5  Every stored language / releaseType (unknown, multiSeasonPack) /
    combined indexerFlags is representable in the row, so "Save all" no
    longer rewrites untouched rows; an empty language list is never stored.
AC-10 "Move files" (default on) on films/series path edits, update-path
    buttons and bulk-edit modals → `?moveFiles=true` / editor `moveFiles`.
AC-7 Radarr/Sonarr write helpers share get()'s connected-then-timed-out
    breaker exemption, through a new protected exec() cURL seam (same
    pattern as BazarrClient) that the new contract tests drive.

Tests: ArrClientWriteContractTest, RadarrClientManualImportTest,
MediaArrWritePathsTest, ArrWriteTemplateGuardTest. PHPStan baseline:
stale curl_setopt_array/json_decode entries removed (errors gone).

(cherry picked from commit bd7d2cb)
S1  TrustedProxiesSubscriber re-resolves the REMOTE_ADDR placeholder of
    TRUSTED_PROXIES on every request (priority 1024, before the router):
    Kernel::preBoot() resolved it once per FrankenPHP worker, pinning each
    worker to whoever hit it first (the healthcheck). Default value kept so
    LAN + cloudflared-on-the-docker-network deployments keep working; README,
    .env and compose example now say what REMOTE_ADDR implies and when to
    pin a CIDR. ProfilerGuardSubscriber checks the raw peer as well as the
    forwarded client ip.
S2  Settings import: only keys the app knows (form fields, kill switches,
    display options, sidebar/dashboard families, Wokeometer switches); a
    *_url that moves to another host clears that service's stored secrets
    (flat keys and instances — ServiceInstanceProvider::clearApiKey());
    display preferences go through the same normalizer as the form (AS-10).
S3  HealthService::urlBlockedReason() refuses hosts with anything but
    hostname characters / a bracketed IPv6 literal; the settings form and
    the import refuse such *_url values; CspHeaderSubscriber::extractOrigin()
    accepts only http(s) + a syntactically valid host + numeric port, so a
    stored URL can no longer inject a script-src directive.
S4  Escaped the remaining innerHTML sinks: collections overview/poster/title,
    series episode title / history badges / add-modal tag label / lookup
    network, films tpl() banners (command messages, lookup titles, indexer
    names), films_missing command messages, Radarr library-import names and
    titles, Seerr Jellyfin username (|raw), Seerr services field values.
    TemplateEscapingGuardTest covers each sink; its header no longer claims
    'unsafe-inline'.
S5  ServiceRouteGuardSubscriber (7) and MultiInstanceBinderSubscriber (6)
    now run after the firewall (8); an unknown instance slug is no longer
    health-probed (bogus status pooled forever).
DD-15 Discover loadDetail() validates type (movie|tv) and a numeric id.

(cherry picked from commit cdd38f9)
H6  Topbar search / sidebar toggle init markers are a WeakSet on the live
    element (a Turbo snapshot clones data-init but not the listeners), and
    the search's document-level handlers are replaced per init.
H7  qBittorrent route-guard rules are URL-only (issue #10 proxy setups).
MS-3 Prowlarr Enabled/Disabled filter reads the form-switch state.
AS-5 HomeController's last-visited pre-check delegates to the route guard's
    own service list (ServiceRouteGuardSubscriber::serviceIdForRoute).
DD-1 Dashboard edit-mode Save only touches sections the client listed.
DC-3 Torrent pages skip a timer tick while a fetch is in flight.
DC-2 Usenet visibility handler bound per page instance, torn down on Turbo.
MT-6 Films: a movie leaving the queue is verified via /info before being
    painted "Downloaded"; /films/queue answers 502 on an outage.
MT-7 Command pollers end on aborted/cancelled/orphaned, cap at 240 polls,
    give up after 5 "unknown" answers, are cleared on Turbo navigation, and
    reload only while their page is still on screen.
MT-8 Films warnings poll pauses while the tab is hidden.
MT-9 Sequence tokens on the add lookups, quick-add resolve and quick-look
    open (a stale failure no longer navigates away); Clear aborts the
    in-flight search; the series Import button stays disabled mid-POST.
MT-10 series/bulk/refresh (one RefreshSeries) and series/bulk/search (one
    endpoint issuing SeriesSearch per id, counting rejections).
AS-6/HC-4 Banner Retry maps labels (Seerr, Radarr 4K) to a service id and
    HealthService::invalidate() clears the per-instance breaker keys.
AS-8 service_not_configured renders into base's `body` block.
MS-2 Seerr user creation: no password = Seerr generates one; username kept.
MS-7 Prowlarr toggle PUTs with forceSave=true and surfaces the error.
MS-8 Seerr request edit modal loads the request's own server profiles.
DD-5 Discover links carry the owning instance slug (lib_slug).
DD-7 Watchlist toggle honours an explicit add/remove, survives a race,
    rejects non-string title/notes.
DC-4 qBittorrent "200 Fails." is a failure (exec() seam on postAction).
DC-5 qBittorrent "Completed" = 100 %; DC-6 Seeds column sortable;
    DC-11 tracker seed/leech counts (Transmission real, Deluge "—").
MS-13 Seerr logs page capped at 10 000.  MS-12 Tautulli Load more counts
    rows and ignores a double-click.
Also: JellyseerrClient exec() seam + recordError() on the breaker branch
(C1), TQ-6 PollerVisibilityGuardTest no longer accepts an inverted check.

(cherry picked from commit 89f9612)
C1  ApiClientErrorTrait::clientFailed() — the clients answer [] on a
    transport failure; the torrent/usenet JSON feeds, the filtered-ids
    resolvers, the films queue and TorrentResolverService now report an
    outage (502 / "unavailable") instead of "empty". Jellyseerr's breaker
    branch records an error. MediaFilteredIdsTest / TorrentResolverService
    Test gained []+getLastError() cases next to the exception ones.
C2  App\Util\CalendarDay: "today" is the DISPLAY zone's calendar date at
    UTC midnight (DashboardController, every release/air-date comparison);
    date-only chips render with floating=true and all-day items never get a
    fabricated time; NetworkUsageChart/SpeedtestChart label in the display
    zone (dashboard + UniFi pages); the iCal feed emits episodes as all-day
    VALUE=DATE events, carries the display timezone and folds lines (RFC
    5545 §3.1). The token-authenticated feed route was not added (not
    cheap: needs a secret + UI).
HC-1 Dedicated `cache.swr` pool for StaleWhileRevalidateCache and
    AppVersion so a settings save (cache.app clear) no longer wipes the
    library/Bazarr/vocabulary datasets. Web tests start from empty pools.
DD-2/AC-8/AS-3 Discover's library index, the filtered-ids/collections
    resolvers and the About counters read the shared library cache
    (LIBRARY_TIMEOUT everywhere, incl. the resolver's Radarr branch).
MS-4 Seerr request titles go through the 6 h issue-title cache.
DD-9 TmdbClient: exec() seam + shared breaker (transport/429/5xx open it,
    404 does not); HC-2 the vocabulary build stops at the third failed page.
DD-3 A partial upcoming calendar / Houndarr wanted count is never cached.
MS-11 Houndarr widget memo lives in cache.app (survives the worker reset).
FF-2/4/5 Wokeometer: a non-string next_cursor is INVALID (never ends a
    phase); a full run that stored nothing does not count as completed;
    a non-manual run stops when automatic sync is switched off mid-run.
MT-8 films warnings poll pause is guard-tested. FF-1 (UniFi reader memos)
    deferred: moving them to cache.app needs a fetcher identity + reworked
    clock-driven reader tests.

(cherry picked from commit 927a331)
make lint exits non-zero on a syntax error; AssetMapper welcome log removed;
Seerr delete confirmation uses its real key; English errors catalog for the
profiler guard message; 13 English strings in the FR catalog translated;
README env rows (frame ancestors, Mercure CORS, DEFAULT_URI, DATABASE_URL,
Messenger, Mercure URLs/secret) and a PRISMARR_TRUSTED_ORIGINS compose row;
settings Clear flag resets when a new value is typed (AS-11); series queue
sizes honour the byte-unit preference; series history maps Sonarr v4 string
enums; films backdrop sets backgroundColor, not the shorthand; missing-films
poll regex accepts "grabbed". CatalogParityTest (EN/FR key parity + literal
keys exist) and ReviewHygieneGuardTest pin these.

(cherry picked from commit 767c53e)
Anonymous sweep of every application route (no 200/5xx, 302 to /login),
form login / wrong password / 5-attempt throttle / logout; POST route table
of the nine integration controllers (anonymous, cross-site, same-origin);
Prowlarr exec() seam + wire-contract test and the connected-then-timed-out
breaker exemption (MS-1); ResetInterface sweep over every service and a
scanned WorkerModeResetTest provider; failOnSkipped/failOnIncomplete;
HostResolver stub + cache.app/cache.swr/rate_limiter reset and
asAnonymous() in AbstractWebTestCase; BazarrFrameRenderTest clears the
cache.swr pool too.

The sweep caught the §2 listener priorities not being live on the
bind-mounted test container (Symfony tracks subscriber signatures, not
getSubscribedEvents() bodies) — var/cache/test had to be removed by hand.

(cherry picked from commit aee2e81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant