Skip to content

feat(api): restore ratingscombined and add overrideRule/advancedRequest - #45

Merged
selmant merged 2 commits into
developfrom
feat/seerr-missing-endpoints
Nov 3, 2026
Merged

selmant merged 2 commits into
developfrom
feat/seerr-missing-endpoints

Conversation

@selmant

@selmant selmant commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Description

Two upstream Seerr /api/v1 operations were missing from Foreseerr. This PR adds both, so Foreseerr is back to matching upstream's API at the operation level.

GET /api/v1/movie/{movieId}/ratingscombined (restored)

  • The spec entry is copied verbatim from upstream/develop:seerr-api.yml. It was removed in 7e8a6a5c5.
  • Rust handler movie::combined_ratings: any signed-in user can call it. It reuses Ratings::combined, the same RT + IMDb ratings that movie details already return. Statuses: 200; 404 No ratings found.; 500 Unable to retrieve movie ratings. when TMDB or RT/IMDb fail.
  • Deviation from upstream: the response is a superset of upstream's. It adds a provider key, and when MDBList is configured the ratings come from MDBList (with extra metacritic/trakt keys), matching what Foreseerr's own Node route did before it was removed. Upstream's rt/imdb shapes are unchanged.

POST /api/v1/overrideRule/advancedRequest (new, ported from seerr-team#2164)

  • The spec entry is copied verbatim from upstream.
  • New routes/overriderule.rs:
    • Override-rule evaluation now lives in this one module, and both request creation and the new route use it.
    • The route requires REQUEST_ADVANCED or MANAGE_REQUESTS.
    • Request checks follow upstream:
      • 404 Request not found.
      • 403 You do not have permission to modify this request.
      • 403 You do not have permission to modify the request user. (choosing another requester needs both MANAGE_USERS and MANAGE_REQUESTS)
    • 404 Media not found when TMDB fails.
    • 500 Unable to evaluate override rules.
    • Response: {rootFolder, profileId, tags}.
  • Also from feat(overriderules): apply override rules to advanced requests seerr-team/seerr#2164: empty genre/language/keyword values no longer count toward a rule's specificity.
  • Also from feat(overriderules): apply override rules to advanced requests seerr-team/seerr#2164: the /overrideRule mount guard drops ADMIN (standalone/fallback.rs). Every existing override-rule route already checks ADMIN itself.
  • Deviations, all in input handling:
    • A missing requestUser gives a 500, matching upstream's findOneOrFail path rather than the spec's 404.
    • serviceId: null means the default server. Upstream passes null to TypeORM, which drops it from the where and would match every rule.
    • Non-integer ids or tags get a 400, which is the Rust port's existing body convention.
  • fix(override-rules): keep values set by advanced requesters seerr-team/seerr#3539 ("keep values set by advanced requesters" during request creation) is deliberately left out. It is being ported separately on fix/upstream-backend-sync.

Frontend (seerr-team#2164)

  • AdvancedRequester gets tmdbId/requestId props. It asks the new route for the rules' folder, profile and tags, and preselects them unless the request being edited already set them. On failure it shows the generic error toast.
  • The movie and TV modals now pass tmdbId/requestId.
  • The movie, TV and collection modals use hasPermission([...], { type: 'or' }) instead of two separate checks.
  • OverrideRulesResult moves to shared/interfaces/api/overrideRuleInterfaces.ts.
  • seerr-api.yml changed, so backend-rs/src/standalone/apiroutes.rs was regenerated.

How Has This Been Tested?

  • backend-rs: cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings and cargo test --locked all pass. 707 passed: 698 on develop, plus 9 new tests. The rule_numbers test moved to the new module and is not counted.
    • overriderule.rs, 6 tests: permission gate (plain user and anonymous refused, manager and advanced user allowed); default server's most specific rule with tags merged once; chosen server, serviceId: null, and anime TV only matching anime-keyword rules; picking another requester (refused for advanced users and for managers without MANAGE_USERS, 500 for an unknown user); existing requests (404, 403 on someone else's, managers allowed, user change refused without both permissions); bad bodies get 400.
    • movie.rs, 3 tests: ratingscombined refuses anonymous callers; RT + IMDb happy path; 404 No ratings found.
    • The tests call the handlers directly through a new routes::testkit, against a scratch SQLite DB with TMDB/RT/IMDb answers pre-cached, so no network is used.
  • Frontend: bun run typecheck, bun run lint (0 errors; the 5 warnings are in files this PR doesn't touch), bun run test (68 pass), bun run format:check. bun run i18n:extract gives no en.json change.
  • No manual testing in a running instance; no bun run build.

Checklist:

  • I have read and followed the contribution guidelines.
  • I tested this change manually (see our AI policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build bun run build
  • Translation keys bun run i18n:extract
  • Database migration (if required)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between da223b0 and a1889a4.

Files selected for processing: 14
  • backend-rs/src/ratings.rs
  • backend-rs/src/routes/mod.rs
  • backend-rs/src/routes/movie.rs
  • backend-rs/src/routes/overriderule.rs
  • backend-rs/src/routes/requestcreate.rs
  • backend-rs/src/standalone/apiroutes.rs
  • backend-rs/src/standalone/fallback.rs
  • backend-rs/src/tmdb.rs
  • seerr-api.yml
  • shared/interfaces/api/overrideRuleInterfaces.ts
  • src/components/RequestModal/AdvancedRequester/index.tsx
  • src/components/RequestModal/CollectionRequestModal.tsx
  • src/components/RequestModal/MovieRequestModal.tsx
  • src/components/RequestModal/TvRequestModal.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@selmant
selmant force-pushed the feat/seerr-missing-endpoints branch from ff0677b to ab11602 Compare November 3, 2026 20:41
@selmant
selmant changed the base branch from develop to fix/upstream-backend-sync November 3, 2026 20:41
@selmant

selmant commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto #46 and retargeted to its branch (stack: develop ← #46 ← #45 ← #44), because both change the override-rule code.

Resolution: the rule matching stays in routes/overriderule.rs (shared with /overrideRule/advancedRequest, with seerr-team#2164's "blank values don't count" specificity), split into matching_rule and evaluate. Request creation keeps #46's semantics on top: an advanced user's requested server picks the rules (seerr-team#3538), rules apply to admins too and only fill in what an advanced requester left unset (seerr-team#3539), and routing needs the advanced permission (seerr-team#3674).

cargo test: 722 on this branch (698 + 15 from #46 + 9 here); clippy clean. The full stack plus #43 was also merged and checked together.

🤖 Generated with Claude Code

@selmant
selmant deleted the branch fix/upstream-backend-sync November 3, 2026 20:46
@selmant selmant closed this Nov 3, 2026
selmant and others added 2 commits November 3, 2026 23:47
Two Seerr /api/v1 operations were missing from Foreseerr:

- GET /movie/{movieId}/ratingscombined, documented again as upstream
  documents it and answered from the combined ratings Foreseerr already
  serves with movie details (RT and IMDb, MDBList when configured);
  404 "No ratings found." when no source knows the title.
- POST /overrideRule/advancedRequest: what the override rules would set
  for a title, server and requester, for advanced requesters and request
  managers, with the request and request-user permission checks of
  upstream. Rule evaluation moves out of request creation into
  routes/overriderule.rs so both use it; empty genre/language/keyword
  values no longer count toward a rule's specificity. The /overrideRule
  mount no longer requires ADMIN for unknown subpaths, as each route
  checks its own permission.

Ported from seerr-team#2164.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The advanced requester asks /overrideRule/advancedRequest for the root
folder, quality profile and tags the rules pick for the title, server
and requester, and preselects them unless the edited request already
set them.

Ported from seerr-team#2164.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@selmant selmant reopened this Nov 3, 2026
@selmant
selmant changed the base branch from fix/upstream-backend-sync to develop November 3, 2026 20:47
@selmant
selmant force-pushed the feat/seerr-missing-endpoints branch from ab11602 to a1889a4 Compare November 3, 2026 20:47
@selmant
selmant merged commit 6a6a0c7 into develop Nov 3, 2026
20 checks passed
@selmant
selmant deleted the feat/seerr-missing-endpoints branch November 3, 2026 20:53
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