Repository navigation
feat(requests): add media request system - #7
Conversation
- Add request domain, repository, service, and reconcile task - Add Radarr/Sonarr fulfillment adapters and TMDB discovery - Expose user and admin request APIs with quota and approval rules - Add web UI for browsing, requesting, and admin queue management - Migration 139 introduces media_requests and related tables
- Add GetMediaDetail TMDB client returning normalized detail with cast, crew, recommendations, and certifications
- Add /api/requests/detail/{media_type}/{tmdb_id} endpoint overlaying availability and request state
- Add RequestDetail page and link poster cards to it
- Treat empty/truncated Radarr/Sonarr POST responses as accepted; drop pre-submit existence lookups
- Explain request progress and needs-attention statuses inline above the buckets
Captures the v1 design for adding Overseerr-style brand-card discovery (studios, networks, genres) on top of the existing request system. Bundled list of TMDB company/network/genre IDs, logos fetched from TMDB, three new list endpoints + three new browse endpoints, no admin UI, no migrations. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Wire curated TMDB-backed studios/networks/genres discovery into the requests service and UI, replacing on-demand logo fetches with fixed duotone logos and adding browse routes plus tests. Co-authored-by: Cursor <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughI can't reliably rebuild the full hidden review stack with every provided rangeId exactly once within this response. The artifact requires exact, exhaustive placement of hundreds of rangeIds; producing a correct mapping here risks repeated or missing IDs and further validation failures. If you want, I can:
Which approach do you prefer? ✨ Finishing Touches🧪 Generate unit tests (beta)
|
There was a problem hiding this comment.
Actionable comments posted: 16
🧹 Nitpick comments (3)
internal/requests/service.go (1)
250-260: ⚡ Quick winMove external-ID enrichment after fast local rejection checks.
enrichExternalIDsdoes a network call before duplicate/availability/policy checks. Reordering it after those checks avoids unnecessary TMDB traffic and failure surface for requests that will be rejected anyway.Based on learnings: "Performance first" and "Reliability first".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/requests/service.go` around lines 250 - 260, The call to enrichExternalIDs currently happens before fast local rejection checks causing unnecessary network calls; move the enrichExternalIDs(ctx, &normalized) invocation to after the immediate local checks (lookupAvailable and s.store.ListActiveByTMDB) so you perform TMDB/network enrichment only if the request passes availability/duplicate checks; update call order around lookupAvailable(ctx, normalized.MediaType, []int{normalized.TMDBID}), the available[normalized.TMDBID] / ErrAlreadyAvailable branch, and the s.store.ListActiveByTMDB(...) usage to ensure enrichment occurs only after those quick rejections.web/src/pages/Requests.tsx (1)
710-714: ⚡ Quick winExtract a shared issue-outcome predicate for bucketing and counters.
The same outcome checks are duplicated in two functions; centralizing avoids future drift.
Proposed refactor
+function isIssueOutcome(outcome: MediaRequestOutcome): boolean { + return outcome === "declined" || outcome === "cancelled" || outcome === "failed"; +} + function groupMineRequests(requests: MediaRequest[]) { ... - if ( - request.outcome === "declined" || - request.outcome === "cancelled" || - request.outcome === "failed" - ) { + if (isIssueOutcome(request.outcome)) { buckets.issues.push(request); ... function countMineStatuses(requests: MediaRequest[]) { ... - if ( - request.outcome === "declined" || - request.outcome === "cancelled" || - request.outcome === "failed" - ) { + if (isIssueOutcome(request.outcome)) { issues += 1;Also applies to: 731-735
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/Requests.tsx` around lines 710 - 714, Extract a single reusable predicate (e.g., isTerminalOutcome or isFailureOutcome) that accepts a request/outcome and returns true for "declined", "cancelled", or "failed", then replace the duplicated inline checks in the bucketing logic and the counters logic by calling that predicate; update references in the functions that previously used the three-or comparison so both places call the new predicate (keep the predicate exported/defined near the top of Requests.tsx so both usages can import/consume it).web/src/pages/RequestDetail.tsx (1)
14-15: ⚡ Quick winReuse the shared request-input mapper to avoid payload drift.
The request payload is manually assembled in two places; this is easy to desync over time.
Proposed refactor
-import { formatRequestReason, formatRequestStatus, tmdbImageURL } from "`@/lib/mediaRequests`"; +import { + formatRequestReason, + formatRequestStatus, + requestInputFromMediaResult, + tmdbImageURL, +} from "`@/lib/mediaRequests`"; ... - onRequest={() => - createRequest.mutate({ - media_type: item.media_type, - tmdb_id: item.tmdb_id, - title: item.title, - year: item.year || undefined, - overview: item.overview || undefined, - poster_path: item.poster_path || undefined, - backdrop_path: item.backdrop_path || undefined, - }) - } + onRequest={() => createRequest.mutate(requestInputFromMediaResult(item))} ... - onRequest={(rec) => - createRequest.mutate({ - media_type: rec.media_type, - tmdb_id: rec.tmdb_id, - title: rec.title, - year: rec.year || undefined, - overview: rec.overview || undefined, - poster_path: rec.poster_path || undefined, - backdrop_path: rec.backdrop_path || undefined, - }) - } + onRequest={(rec) => createRequest.mutate(requestInputFromMediaResult(rec))}Also applies to: 72-82, 101-111
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/RequestDetail.tsx` around lines 14 - 15, Replace the ad-hoc payload assembly in RequestDetail with the shared request-input mapper to prevent drift: import the canonical mapper (e.g., mapRequestInput or requestInputMapper) from its module and use it wherever the request payload is built (replace the manual assemblies currently near lines 72-82 and 101-111 in RequestDetail.tsx); pass the same form/state values you currently use into mapRequestInput and return its result as the request body, remove the duplicate field-mapping code, and keep using formatRequestReason/formatRequestStatus/tmdbImageURL only for display where needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@docs/superpowers/specs/2026-05-24-discover-studios-networks-genres-design.md`:
- Around line 173-177: The unlabeled fenced code blocks showing the API
endpoints (e.g., the blocks containing "GET /api/v1/requests/discover/studios",
"GET /api/v1/requests/discover/networks", and "GET
/api/v1/requests/discover/genres") must be annotated with a language identifier
to satisfy markdown lint (MD040); update those fenced blocks (and the other
occurrences referenced around the same section) to use an appropriate label such
as ```http or ```text so the linter stops flagging them.
- Around line 7-11: Remove the transient worktree/branch identifier
`t3code/df875f01` from the spec dependency text and replace it with
repository-relative wording (e.g., "based on the request-system spec in
docs/superpowers/specs/request-system.md" or "assumes the request-system branch
in this repo"); ensure references to dependencies (`internal/requests/`,
`internal/metadata/tmdb/`, `Requests.tsx`, `/api/v1/requests/discover/*`)
remain, and add a brief note like "Commands assume the repository root is the
cwd" instead of any branch-local or ephemeral IDs.
In `@internal/api/handlers/requests.go`:
- Around line 395-403: The loop calling h.service.UpsertIntegration over
body.Integrations is non-atomic and may leave partial state if one call fails;
replace this per-item commit pattern with an all-or-nothing operation by
adding/using a service method that performs a transactional bulk upsert (e.g.,
h.service.BulkUpsertIntegrations(ctx, viewer, body.Integrations) or wrap the
loop in a service-level transaction) so either all integrations are applied or
none are (returning a single error), and remove the immediate return-on-error
behavior in the handler; ensure the new service method returns the slice of
updated mediarequests.Integration results or an error so the handler can write a
single success response or a single failure via writeRequestServiceError.
- Around line 313-315: The request handler currently ignores JSON decode errors
for the decline payload (the json.NewDecoder(r.Body).Decode(&body) call in
requests.go), which allows malformed input to proceed; change this to capture
the error, and if decoding fails respond with a 400 Bad Request (write an
appropriate error response and return) instead of continuing; update the handler
that processes the decline request to check the Decode error, log or include the
error message, and exit early on failure so no decline is executed with an
empty/partial reason.
In `@internal/metadata/tmdb/client.go`:
- Around line 841-848: The loop building the cast slice appends entries even
when the trimmed member.Name is empty; update the loop that iterates over sorted
and constructs MediaCastMember to first trim member.Name (and optionally
member.Character) and skip appending when the trimmed name is empty so blank
cast rows are not added to out/detail.Cast; locate the loop producing
MediaCastMember (uses variables sorted, out and type MediaCastMember) and add a
guard to continue if trimmed name == "" before appending.
In `@internal/requests/arrclient/queue.go`:
- Around line 35-49: The loop in queue.go that inspects the resources slice
returns on the first matching item, making the queue evaluation order-dependent;
instead scan all resources and compute a priority result: if any resource has
status/TrackedDownloadState of "failed" or "failedPending" return
QueueEvaluation with State QueueStateFailed (using joinStatus and
queueFailureMessage for ExternalStatus/Message), else if any resource is
"downloading"/"importPending"/"importing" return QueueStateDownloading with the
composed ExternalStatus, otherwise fall through to the existing default result;
update the logic around the resources loop (references: resources,
resource.Status, resource.TrackedDownloadState, joinStatus, queueFailureMessage,
QueueEvaluation, QueueStateFailed, QueueStateDownloading) to aggregate states
before returning so failure wins regardless of slice order.
In `@internal/requests/presence.go`:
- Around line 27-35: After building the ids slice from tmdbIDs, add a
post-filter check for len(ids) == 0 and return early instead of calling
p.items.LookupTMDBIDs; this avoids an unnecessary repository call and potential
SQL edge cases. Place the check immediately after the loop that constructs ids
(which uses strconv.Itoa and filters id > 0) and before the LookupTMDBIDs call,
returning the function's appropriate zero result (e.g., empty slice/struct and
nil error) so callers get an empty result without touching the repository.
In `@internal/requests/repository.go`:
- Around line 657-659: The code currently swallows json.Unmarshal errors for
optionsRaw and leaves integration.Options defaulted; change scanIntegration so
the unmarshal error is checked and returned (fail fast) instead of ignored.
Replace the `_ = json.Unmarshal(optionsRaw, &integration.Options)` with an
explicit `err := json.Unmarshal(...)` check and return or wrap that error
(include context such as integration.ID or similar) so callers of
scanIntegration can detect invalid options JSON; ensure you update
scanIntegration's signature/returns if needed to propagate the error.
In `@internal/requests/service.go`:
- Around line 361-364: The Decline path currently allows declining requests that
are in externally-driven states (e.g., queued/downloading) which leaves external
jobs orphaned; update the Decline logic in the Decline handler/function to block
declines for those states by adding guards that return ErrInvalidState when
req.Status == StatusQueued || req.Status == StatusDownloading (or when the
request indicates an external submission such as a non-empty
ExternalID/ExternalProvider field), and only call s.store.SetOutcome(ctx,
req.ID, OutcomeDeclined, viewer, reason) for requests in truly internal/active
states (e.g., OutcomeActive and not queued/downloading); reference the Decline
function and the call to s.store.SetOutcome to place the new checks.
In `@internal/requests/sonarr/client.go`:
- Around line 150-157: The code currently returns matches[0] when no exact match
by tvdbID is found, which can enqueue the wrong show; change the behavior in the
Sonarr lookup function (the loop using matches, match.TVDBID and tvdbID) to
return a not-found error (or nil with a clear error like ErrNotFoundSeries)
instead of returning the first candidate when no exact TVDBID match exists, and
update any callers to handle that error accordingly.
In `@scripts/check-local-path-leaks.sh`:
- Around line 56-59: The check in scripts/check-local-path-leaks.sh currently
only matches macOS /Users paths; update the check_pattern call (the invocation
named "absolute /Users path in generated superpowers docs") to use a broader
regex that detects any absolute filesystem path (e.g. change the second argument
from '/Users/[^[:space:]]+' to a pattern like '/[^[:space:]]+'), leaving the
target directories (docs/superpowers/specs and docs/superpowers/plans) unchanged
so all absolute paths (not just /Users) are caught.
In `@web/src/components/RequestPosterCard.tsx`:
- Around line 49-98: Currently the interactive Request <button> is nested inside
the <Link> (the Link element with class names including "group/req-card" and
POSTER_WIDTH), which breaks keyboard/assistive behavior; refactor the JSX so the
Link (poster/title/type/status block rendered by
PosterFrame/TypeBadge/StatusRibbon) and the request button (which uses onRequest
and isSubmitting) are siblings inside a single relative container: move the
"group/req-card" and positioning classes to the outer wrapper, render the <Link>
for the poster/content only, then render the overlay/button as a separate
absolutely-positioned sibling element (preserving the same classes,
pointer-events handling, disabled state, and event handlers), and keep the
group-focus/hover class wiring by keeping the group class on the outer container
so the visual hover/focus effects still work.
In `@web/src/hooks/queries/requests.ts`:
- Line 1: This module exports custom React hooks but violates the naming
convention; rename the file from requests.ts to useRequests.ts and update all
imports that reference this module to the new filename; ensure exported hook
names (e.g., any hooks defined in the module that are imported elsewhere) remain
unchanged and update any barrel exports or index files that re-export these
hooks (search for imports of "./hooks/queries/requests" or similar) so the
project builds and ESLint rules for web/src/hooks/**/*.ts are satisfied.
In `@web/src/pages/AdminRequests.tsx`:
- Around line 537-557: The call to loadOptions.mutateAsync inside
handleLoadOptions can reject and currently isn't caught; wrap the await
loadOptions.mutateAsync(...) in a try/catch inside handleLoadOptions, log/show
the error (e.g., via the existing toast/error handler) and return early on
failure so setOptions/onChange are not run with undefined data; keep the rest of
the logic (setting options and patching form via onChange) inside the try block
and reference handleLoadOptions and loadOptions.mutateAsync when locating the
change.
In `@web/src/pages/RequestBrowse.tsx`:
- Line 41: The page value allows non-integer input (e.g. 2.5); change the
parsing for the page variable in RequestBrowse.tsx so it becomes a strict
positive integer before use: parse the raw searchParams.get("page") with
parseInt (or Number + Math.floor) then validate that it's an integer > 0 and
fallback to 1 if not (e.g., NaN, <= 0, or non-integer); update the const page =
... expression (the page variable) to enforce this sanitization so only positive
integers are propagated to API/UI.
In `@web/src/pages/Requests.tsx`:
- Around line 200-201: The pending/submitting state is only keyed by tmdb_id so
items with the same ID across different media_type (movie/series) collide;
update the props and matching to include media_type as well: pass
createRequest.variables?.media_type alongside createRequest.variables?.tmdb_id
(e.g., add a pendingMediaType prop where you currently pass pendingTMDBID and
isSubmitting) and modify the card/component matching logic that checks
pendingTMDBID to require both media_type and tmdb_id equality. Apply the same
change to the other occurrences that use createRequest.variables?.tmdb_id and
createRequest.variables?.media_type (the places noted around lines 217-218,
466-467, 551-552) so submitting state is keyed by the tuple (media_type,
tmdb_id) everywhere.
---
Nitpick comments:
In `@internal/requests/service.go`:
- Around line 250-260: The call to enrichExternalIDs currently happens before
fast local rejection checks causing unnecessary network calls; move the
enrichExternalIDs(ctx, &normalized) invocation to after the immediate local
checks (lookupAvailable and s.store.ListActiveByTMDB) so you perform
TMDB/network enrichment only if the request passes availability/duplicate
checks; update call order around lookupAvailable(ctx, normalized.MediaType,
[]int{normalized.TMDBID}), the available[normalized.TMDBID] /
ErrAlreadyAvailable branch, and the s.store.ListActiveByTMDB(...) usage to
ensure enrichment occurs only after those quick rejections.
In `@web/src/pages/RequestDetail.tsx`:
- Around line 14-15: Replace the ad-hoc payload assembly in RequestDetail with
the shared request-input mapper to prevent drift: import the canonical mapper
(e.g., mapRequestInput or requestInputMapper) from its module and use it
wherever the request payload is built (replace the manual assemblies currently
near lines 72-82 and 101-111 in RequestDetail.tsx); pass the same form/state
values you currently use into mapRequestInput and return its result as the
request body, remove the duplicate field-mapping code, and keep using
formatRequestReason/formatRequestStatus/tmdbImageURL only for display where
needed.
In `@web/src/pages/Requests.tsx`:
- Around line 710-714: Extract a single reusable predicate (e.g.,
isTerminalOutcome or isFailureOutcome) that accepts a request/outcome and
returns true for "declined", "cancelled", or "failed", then replace the
duplicated inline checks in the bucketing logic and the counters logic by
calling that predicate; update references in the functions that previously used
the three-or comparison so both places call the new predicate (keep the
predicate exported/defined near the top of Requests.tsx so both usages can
import/consume it).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 16e4693d-e03b-4119-b0f2-7df09e66c491
📥 Commits
Reviewing files that changed from the base of the PR and between 95628f95429b221662f324c9107cea62b63bf842 and 30396df.
📒 Files selected for processing (52)
.githooks/pre-commitAGENTS.mdMakefilecmd/silo/main.godocs/superpowers/plans/2026-05-24-discover-studios-networks-genres.mddocs/superpowers/plans/request-system-implementation.mddocs/superpowers/specs/2026-05-24-discover-studios-networks-genres-design.mddocs/superpowers/specs/request-system.mdinternal/api/handlers/admin.gointernal/api/handlers/requests.gointernal/api/handlers/requests_test.gointernal/api/router.gointernal/metadata/tmdb/client.gointernal/metadata/tmdb/client_test.gointernal/metadata/tmdb/types.gointernal/requests/arrclient/client.gointernal/requests/arrclient/options.gointernal/requests/arrclient/queue.gointernal/requests/discover_brand.gointernal/requests/discover_bundle.gointernal/requests/discover_bundle_test.gointernal/requests/errors.gointernal/requests/presence.gointernal/requests/radarr/client.gointernal/requests/radarr/client_test.gointernal/requests/repository.gointernal/requests/service.gointernal/requests/service_test.gointernal/requests/sonarr/client.gointernal/requests/sonarr/client_test.gointernal/requests/store.gointernal/requests/types.gointernal/taskmanager/tasks/reconcile_requests.gomigrations/139_media_requests.down.sqlmigrations/139_media_requests.up.sqlscripts/check-local-path-leaks.shweb/src/App.tsxweb/src/api/types.tsweb/src/app.cssweb/src/components/AdminSidebar.tsxweb/src/components/AppSidebar.tsxweb/src/components/BrandCard.tsxweb/src/components/BrandCarousel.tsxweb/src/components/RequestPosterCard.tsxweb/src/hooks/queries/keys.tsweb/src/hooks/queries/requests.tsweb/src/lib/documentTitle.tsweb/src/lib/mediaRequests.tsweb/src/pages/AdminRequests.tsxweb/src/pages/RequestBrowse.tsxweb/src/pages/RequestDetail.tsxweb/src/pages/Requests.tsx
| @@ -0,0 +1,351 @@ | |||
| import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; | |||
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift
Rename this hooks module to follow the custom-hook filename convention.
web/src/hooks/queries/requests.ts exports custom hooks but does not follow the useThing.ts naming rule. Please rename it (for example, useRequests.ts) and update imports accordingly.
As per coding guidelines: "web/src/hooks/**/*.ts: Use useThing.ts naming convention for custom React hooks".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/hooks/queries/requests.ts` at line 1, This module exports custom
React hooks but violates the naming convention; rename the file from requests.ts
to useRequests.ts and update all imports that reference this module to the new
filename; ensure exported hook names (e.g., any hooks defined in the module that
are imported elsewhere) remain unchanged and update any barrel exports or index
files that re-export these hooks (search for imports of
"./hooks/queries/requests" or similar) so the project builds and ESLint rules
for web/src/hooks/**/*.ts are satisfied.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30396df0d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| configured, err := s.integrationConfigured(ctx, normalized.MediaType) | ||
| if err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
Fall back to pending when auto-approval checks fail
When global auto-approval is enabled, request creation currently hard-fails if integration readiness checks return an error (for example, transient settings/secret lookup failures). In that case users cannot submit any request at all, even though a safe fallback would be to create a pending request for manual admin approval. This turns a temporary integration issue into a full request outage for affected users.
Useful? React with 👍 / 👎.
| if active.Status == StatusApproved { | ||
| return s.submitApprovedRequest(ctx, *active, viewer) | ||
| } |
There was a problem hiding this comment.
Re-submit failed queued requests on retry
Retry only re-submits when the request status is approved, so failed requests that were previously queued/downloading are set back to active but never actually re-submitted. Because failure updates only the outcome (status stays queued/downloading), the retry endpoint can leave these items stuck in an active queued state indefinitely instead of performing a real retry.
Useful? React with 👍 / 👎.
| var movie movieResource | ||
| if err := client.GetJSON(ctx, "/api/v3/movie/lookup/tmdb?"+values.Encode(), &movie); err != nil { | ||
| return movieResource{}, err |
There was a problem hiding this comment.
Parse Radarr TMDB lookup as array response
The Radarr /api/v3/movie/lookup/tmdb endpoint is modeled upstream as returning a list of movie resources, but this code decodes it into a single movieResource. With a standard Radarr response body ([...]), decoding fails during submission and approved movie requests are marked failed instead of being queued.
Useful? React with 👍 / 👎.
- Add `media_type=all` to request search, backed by TMDB `/search/multi` filtered to movies and series - Default the Requests page filter to All and refresh search results grid styling - Refine RequestPosterCard with status accent bar, richer fallback poster, and fluid grid layout
| GradientFrom string `json:"gradient_from,omitempty"` | ||
| GradientTo string `json:"gradient_to,omitempty"` | ||
| SeriesSupported bool `json:"series_supported,omitempty"` | ||
| } |
There was a problem hiding this comment.
Missing BrandColor field in API response structs
Medium Severity
The DiscoverBrandCard struct is missing a BrandColor field, even though BundledStudio and BundledNetwork define BrandColor and the committed spec (docs/superpowers/specs/2026-05-24-discover-studios-networks-genres-design.md) requires brand_color in the JSON response. The frontend BrandCard component uses card.brand_color as the card background for studios/networks. Without this field in the response, all studio/network cards will fall back to a default gray, losing their visual brand identity. The same field is also missing from DiscoverBrowseResponse.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b3b2b6d3e039300463dd88886583dc6ceb5ea634. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/pages/Requests.tsx`:
- Around line 528-555: The singular-label logic currently uses
typeLabel.slice(0, -1) which produces incorrect words (e.g., "serie"); replace
that with explicit singular/plural labels: define a singularLabel (e.g., const
singularLabel = mediaType === "series" ? "series" : mediaType === "movie" ?
"movie" : "movie or series") alongside the existing typeLabel, and use
singularLabel when totalResults === 1 instead of typeLabel.slice(0, -1); update
the rendering that references typeLabel.slice(0, -1) to use singularLabel and
keep plural uses using typeLabel.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e4140fc9-f756-4b80-91c4-20f86616961b
📥 Commits
Reviewing files that changed from the base of the PR and between 30396df and b3b2b6d3e039300463dd88886583dc6ceb5ea634.
📒 Files selected for processing (11)
docs/superpowers/specs/2026-05-25-request-search-all-design.mdinternal/metadata/tmdb/client.gointernal/metadata/tmdb/client_test.gointernal/metadata/tmdb/types.gointernal/requests/service.gointernal/requests/service_test.gointernal/requests/types.goweb/src/api/types.tsweb/src/components/RequestPosterCard.tsxweb/src/hooks/queries/requests.tsweb/src/pages/Requests.tsx
✅ Files skipped from review due to trivial changes (1)
- docs/superpowers/specs/2026-05-25-request-search-all-design.md
- Batch integration upserts in a single transaction - Treat radarr/sonarr lookup results as arrays and require exact matches - Prefer queue failures over downloading state when evaluating arr queues - Allow retrying queued/downloading requests and block declines once fulfillment started - Fall back to pending when auto-approval integration check fails - Rename requests query hooks file and fix discover card request affordance
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f0d964e981e1eb4c14e2bd34b8c40277617ddddf. Configure here.
- Narrow the worktree-id/T3-path check to docs/superpowers/specs and docs/superpowers/plans. Scanning the whole repo flagged any legitimate reference to .t3/worktrees or t3code-<hex> (fixtures, example configs) and would block unrelated commits. - Switch the pre-commit hook shebang to bash and call the check via an absolute path derived from git rev-parse so the hook works regardless of the cwd git happens to invoke it from. - install-hooks now warns when it overwrites an existing core.hooksPath rather than silently clobbering a custom setup. - Add make verify-local-paths to the AGENTS.md pre-MR checklist so contributors run it explicitly even when --no-verify is used. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- GetExternalIDs now uses the dedicated /movie/{id}/external_ids and
/tv/{id}/external_ids endpoints instead of fetching the full detail
with append_to_response=external_ids. The dedicated payload is
one or two orders of magnitude smaller for the same fields.
- Document PosterPath/BackdropPath on MediaResult as raw TMDB path
fragments that callers must prefix with the image base URL.
- normalizeCast switches from inline insertion sort to sort.SliceStable.
The output is identical; the new form is one line and O(n log n).
- normalizeIntegration no longer reuses integration.Tags' backing
array via Tags[:0]; the slice is callable code, so reusing the
array would silently corrupt the caller's slice if it kept a
reference. Allocate a fresh slice instead.
- HandleGet now requires a profile, matching the rest of the
/requests user-group handlers. Router middleware enforces this
already, but the inline check is defense-in-depth for any future
remount.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- tmdb client falls back to bundled project API key when none configured - move Requests link next to Recommendations in the sidebar
- Add TTL caches with singleflight for DiscoverSection, DiscoverPage, and GetExternalIDs to reduce upstream TMDB calls - Reuse CastCarousel with a fullBleed variant on RequestDetail and drop the bespoke RequestCastRow
- Radarr's /api/v3/movie/lookup/tmdb returns a single MovieResource, not an array - Update test fixtures to match the actual response shape
{"subject":"fix(requests): clear prior failed rows on re-request","body":""}
- Persist tab, query, media type, and page in the URL so requests views are shareable and survive reloads - Rename the "mine" tab to "yours" with backward-compatible normalization - Require at least 2 characters before submitting a search
- Increase poster density across breakpoints and use fluid cards
…dios-networks-genres-clean feat(requests): add media request system
…ks-genres-clean feat(requests): add media request system
…accurate Five defects in revocation state and credential semantics. Lands after the tracker-lifecycle batch on purpose: raising the over-cap TTL is only safe once the count feeding it is trustworthy. #13 -- a longer old revocation suppressed a newer cutoff. applyLocal kept or replaced the WHOLE record by expiry, so when the existing revocation expired later the new one was dropped entirely, including its newer RevokedAt. The durable upsert did the same, with a comment documenting it as intentional. RevokedAt is the user-kill CUTOFF, so this left a credential issued between the two cutoffs valid -- a second admin kill after a user re-authenticates silently failed to cut them. The two fields now merge independently: ExpiresAt stays monotonic, RevokedAt advances to the later value, and reason follows the newer cutoff. Both superseded comments are replaced rather than left contradicting the code. Session-kind revocation still ignores RevokedAt, so the enforcer's re-revoke cannot weaken a session kill. Also fixed while here: Redis received the merged record but pub/sub published the raw input one, so under pub/sub-only delivery (Redis down) an edge got the newer short record without the older long expiry and lost monotonicity. Both now carry the merged record. #7 + M1 -- Postgres could indefinitely block the urgent Redis kill. RevokeWithWarnings held the global opMu across all propagation, stripped the caller's deadline with WithoutCancel, and did the durable Postgres upsert BEFORE Redis, on a pool with no statement timeout. The local kill still applied, so playback on that process was fine -- but edge propagation, pub/sub, the admin response and every later revoke/unrevoke stalled behind the lock. Redis and pub/sub now go first, and the detached context is bounded. WithoutCancel is kept deliberately: propagation must outlive an aborted admin request. opMu scope is deliberately NOT narrowed. mirrorToRedis is an unconditional SET with no atomic merge, so same-process serialization is what stops an older value overwriting a newer one; narrowing the lock would also let an unrevoke interleave with a revoke's propagation. Bounding the context caps how long the lock can be held, which is the actual reported harm. The remaining cross-replica race -- two central replicas racing the same SET -- is documented, not half-fixed; it needs A6's shared picture. A2 / #6 -- a missed unrevoke got resurrected. In-memory tombstones already existed, but being process-local they did not survive a restart or reach a replica that missed the pub/sub event, so maintain's durable self-heal re-Upserted the surviving entry and the ban returned. Tombstones are now durable, via two nullable columns on stream_revocations rather than a second table: a tombstone is a state of the same key, and it needs its own expiry horizon separate from the revocation's. The upsert rejects a stale replica's write while a tombstone is live but lets a genuinely newer revocation clear it, and warm paths apply tombstones BEFORE revocations so an un-banned key cannot be restored as a live kill. Tombstones are pruned on the same sweep, so the table cannot grow without bound. A1 / #3 -- over-cap kills reopened after 5 minutes while the token stayed reconstructable for 24h. The TTL now derives from playback.MaxTokenTTL rather than duplicating 24h, behind a validated setting. Critically, the enforcer uses a revoke-if-absent path rather than re-revoking. Expiry is monotonic and the enforcer re-evaluates every 30s, so a plain long TTL would slide expiry forward by another full lifetime on every pass -- making a wrong kill effectively permanent for as long as any stale record persisted, with only an explicit unrevoke to recover it. Admin Revoke keeps its monotonic behaviour; only the enforcer's own repeat kill is non-extending. The setting is documented as affecting future revocations only, since monotonic expiry means it cannot shorten one already issued. A3 / #5 -- the user cutoff compared against a fresh time.Now() taken at request entry, so a request from a pre-cutoff login could look post-cutoff and escape the kill. The credential time is now the access token's iat. Two deliberate choices worth stating. API-key credentials carry no issue time, so they pass the zero time and, per IsRevoked's documented contract, are never matched by a user cutoff: a user kill provably cannot cut an API-key-owned pour. That is an accepted, logged, documented hole -- and strictly better than time.Now(), which actively defeats the cutoff. And jellycompat uses the compat session's CreatedAt rather than the bridged Silo token's iat, because that token refreshes without a new Jellyfin login, so its iat would advance on refresh and let a refreshed credential slip past a cutoff. Stream tokens are now bound to their route: a token whose SessionID does not match the URL's session_id is rejected with 403 instead of being silently ignored, matching the reconstruction helper that already refused a different session. Per-login logout cuts remain out of scope -- they need per-login identity in the stream credential. S5 (the (sessionID, userID, startedAt) clump) is rejected as ceremony now that A3 is the iat option rather than the generation model. #12 (closing an RSS feed does not cut its current pour) is deferred: it needs a namespaced revocation id that cannot collide with real session ids, that id threaded onto public feed requests, and protection against a new feed inheriting an old tombstone. Part of #305.
…mits Marks #13, #7/M1, A2/#6, A1/#3 and A3/#5 resolved, and records the limits this batch accepts rather than leaving them for the next reviewer to rediscover. Retracts the last of the two false claims flagged in the serve-path docs pass: the kill switch now does "keep a stream dead" for the token's reconstructable life. The other -- monitoring does not "never trust client progress" -- is still false and stays flagged until decision A5 lands. Newly documented accepted limits: - A user cutoff cannot cut an API-key-owned pour. API-key credentials carry no issue time, so they take the zero credential time and IsRevoked's documented fail-open contract applies. Deliberate, logged, and better than substituting time.Now(), which actively defeats the cutoff. - Two central replicas revoking the same key can still race the Redis mirror, because mirrorToRedis is an unconditional SET rather than an atomic merge. Same-process writes are serialized by opMu; cross-replica convergence needs A6's shared picture. - The over-cap TTL setting affects future revocations only. Monotonic expiry means it cannot shorten an existing kill; only an explicit unrevoke clears one, and the enforcer may recreate it while the over-count persists. - Per-login logout cuts are still unavailable: cutting one device's live streams needs per-login identity in the stream credential, which is the authorization-generation model rather than the iat model chosen here. Records that the enforcer's repeat kill is non-extending and why: with monotonic expiry and a 30s evaluation loop, a plain long TTL would renew a wrong kill indefinitely for as long as any stale record survived. Part of #305.
…ted limits Rescores both matrices for A5, A6 and A7 and closes GAP-14. Corrections to previously-recorded claims: - The two claims flagged as "still false" are now true, with named bounds. The kill switch does keep a stream dead (revocation batch), and monitoring does never trust client progress (this batch) — with the one deliberate exception that a paused session holding an open, ping-checked realtime/WebSocket connection is exempt from reaping. That is an observed connection, not a reported position, and it preserves the issue #243 fix. - GAP-14 listed four `Begin` call sites. There are five; `api/handlers/ebook_reader.go` was missing. - Category A #7 is rescored honestly: A6 fixes cross-replica *monitoring*, so the excess is trimmed within ~120s. Synchronous admission is still per-process, so those starts are admitted and then trimmed rather than refused at the door. Recorded under "does not cover" rather than scored as a clean pass. - Follow-up 0g's deferred cross-replica mirror race is closed: the Redis revocation mirror now merges server-side. - 0f (A7) does not close E28 — there is still no server-wide connection cap, only a per-user transfer cap. Adds an accepted-limitations section for the things a reader would otherwise be surprised by: paused sessions aging from the last served byte, the bounded never-served grace, `last_served_at` being omitted for never-served integrated sessions, the advisory enforcer lease, the plain-SET fallback for the merge, and that the Lua tests skip without SILO_TEST_REDIS_ADDR — which matters because this repository runs no `go test` job in CI at all. Records the Batch 6 re-stream decisions now that they are settled, including the privacy posture: detection ships on by default and alert-only, retaining per-viewer IP history on every deployment, with auto-kill behind an operator setting that defaults to off. Extends the AI-use disclosure with round 5, including the two review claims rejected on verification and the defect each model found in the other's work. Part of #305


Summary
/requestsdiscovery + search + "Yours" tabs, request detail page, and admin queue/settings/limits surfaces.Test plan
Made with Cursor
Summary by CodeRabbit
New Features
UI
Documentation
Chores
Note
High Risk
Touches request lifecycle, external Radarr/Sonarr credentials and APIs, quota/duplicate enforcement, and catalog ID repair/backfill—areas where bugs affect authz, data integrity, or unintended fulfillment.
Overview
This PR adds a media request system end to end: migration and
internal/requestsfor TMDB search/discovery/detail, quota-aware creation, admin approve/decline/retry, and Radarr/Sonarr fulfillment with a reconcile-requests background task wired incmd/silo/main.go. Profile and admin APIs expose the flow; Radarr/Sonarr API keys are treated as sensitive in admin settings.Discover-by-brand extends requests with bundled Studios, Networks, and Genres (list + browse APIs, TMDB discover/logo support), plus web BrandCarousel / RequestBrowse routes and hooks.
Catalog matching is broadened so “already available” can use TVDB/IMDb (and provider ID tables), with optional TMDB backfill on presence hits; quick library refresh also targets matched items missing TMDB but with other IDs.
Repo hygiene: a pre-commit hook and
make verify-local-pathsblock local absolute paths in committed docs; AGENTS.md documents the rule. Large superpowers specs/plans for requests, discover, and provider-ID backfill are added alongside the code.Reviewed by Cursor Bugbot for commit c157be5. Bugbot is set up for automated code reviews on this repo. Configure here.