Skip to content

feat: prevent requests before digital release - #3349

Open
h2nkm5vydg-oss wants to merge 2 commits into
seerr-team:developfrom
h2nkm5vydg-oss:codex/release-gate-core
Open

feat: prevent requests before digital release#3349
h2nkm5vydg-oss wants to merge 2 commits into
seerr-team:developfrom
h2nkm5vydg-oss:codex/release-gate-core

Conversation

@h2nkm5vydg-oss

@h2nkm5vydg-oss h2nkm5vydg-oss commented Aug 7, 2026

Copy link
Copy Markdown

Description

This is an opt-in (disabled by default) global restriction for requests involving media that has not yet been released. I've decided to intentionally focus on the smallest implementation to start addressing #1346 and can continue with any follow up MRs if needed based on feedback. This work does overlap with #1739 but I'm happy to collaborate (can wait until that PR is merged or combine the two).

When Enable Release Date Restrictions is enabled:

  • Movies become requestable after TMDB lists a Digital release dated today or earlier in any region.
  • TV seasons become requestable when their TMDB air date arrives.
  • Theatrical and physical movie releases are not considered.
  • Media without a valid Digital release date or season air date remains requestable (Can do a follow up to disable movies without a digital release date as well)
  • Users with the Manage Requests permission can bypass the restriction.
  • Exiting requests will remain unchanged.
  • Exposed through the main and public settings APIs, frontend settings defaults, General Settings, and OpenAPI.

AI Disclosure: OpenAI Codex was used for codebase analysis, implementation, test creation, documentation, and drafting this description. I reviewed the submitted changes and understand the implementation.

How Has This Been Tested?

Tested on the branch:

  • Full server test suite: 170 tests passed.
  • Unit tests cover Digital releases across multiple regions, current and future dates, theatrical and physical release exclusion, invalid or missing dates, TV season air dates, disabled restrictions, and manager bypass.
  • Request integration tests cover standard and 4K movies, mixed TV seasons, seasons: all, newly added seasons, database mutation prevention, existing request-management operations, and requests made on behalf of another user.
  • Server and client TypeScript checks passed.
  • Production client and server builds completed successfully.
  • ESLint and Prettier checks passed.
  • OpenAPI parsing passed.
  • Translation extraction completed without producing additional changes.

Screenshots / Logs

Settings -> General
Screenshot 2026-08-08 001040

Admin's Perspective (Movie):
Screenshot 2026-08-08 001648

User's Perspective (Movie):
Screenshot 2026-08-08 001528

Admin's Perspective (TV Show):
Screenshot 2026-08-07 224803
Screenshot 2026-08-07 224810
Screenshot 2026-08-07 224816

User's Perspective (TV Show - Unreleased season's button toggle will be greyed out):
Screenshot 2026-08-07 224903
Screenshot 2026-08-07 224908

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (not required)

Summary by CodeRabbit

New Features

  • Added an optional release-date restriction setting, disabled by default.
  • Blocks requests for unreleased movies and TV seasons before their digital release or air date.
  • Request-management users can bypass restrictions.
  • Existing requests and items without valid release dates remain unaffected.
  • Newly added unreleased seasons are validated when editing requests.

Documentation

  • Added guidance explaining release-date restrictions.

API

  • Documented the setting and related 403 error response.

@h2nkm5vydg-oss
h2nkm5vydg-oss requested a review from a team as a code owner August 7, 2026 13:04
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1076a956-ce90-44d5-9148-b4a4e8cf812c

📥 Commits

Reviewing files that changed from the base of the PR and between 505bb68 and c0be4a4.

📒 Files selected for processing (3)
  • seerr-api.yml
  • server/constants/error.ts
  • src/i18n/locale/en.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • server/constants/error.ts
  • src/i18n/locale/en.json
  • seerr-api.yml

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Release-date restrictions now control movie and TV requests. The setting defaults to disabled, supports manager bypasses, validates TMDB release data, returns MEDIA_NOT_RELEASED errors, and includes server, API, UI, test, and documentation updates.

Changes

Release restriction flow

Layer / File(s) Summary
Release eligibility evaluation
server/utils/releaseEligibility.ts, server/utils/releaseEligibility.test.ts
Validates dates and evaluates digital movie releases and TV season air dates.
Request enforcement
server/entity/MediaRequest.ts, server/routes/request.ts, server/constants/error.ts
Blocks restricted movie and TV requests, allows MANAGE_REQUESTS bypasses, and returns 403 MEDIA_NOT_RELEASED responses.
Request restriction validation
server/routes/request.test.ts
Tests future, unknown, disabled, bypass, 4K, mixed-season, and update-request behavior.
Settings and API surface
server/lib/settings/index.ts, server/interfaces/api/settingsInterfaces.ts, seerr-api.yml, src/components/Settings/SettingsMain/index.tsx, src/context/SettingsContext.tsx, src/pages/_app.tsx, src/i18n/locale/en.json, docs/using-seerr/settings/general.md
Adds the setting with a default of false, exposes it through public settings, adds the UI control and localization, and documents the behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to c0be4

This opt-in release-date request restriction is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant RequestRoute
  participant MediaRequest
  participant TheMovieDb
  RequestRoute->>MediaRequest: Create or update request
  MediaRequest->>TheMovieDb: Fetch release metadata
  TheMovieDb-->>MediaRequest: Return release dates
  MediaRequest->>MediaRequest: Evaluate restriction
  MediaRequest-->>RequestRoute: Return result or restriction error
  RequestRoute-->>RequestRoute: Send 403 MEDIA_NOT_RELEASED
Loading

Possibly related PRs

Suggested reviewers: fallenbagel, 0xsysr3ll

Poem

A rabbit checks each release date,

Future seasons must now wait.
Managers may pass the gate,
Unknown dates remain requestable.
The checkbox starts at false—
Tests guard every request call.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: blocking requests before media release dates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 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/using-seerr/settings/general.md`:
- Around line 76-81: Update the Release Date Restrictions documentation to
describe the existing “Allow Requests with Unknown Release Dates” setting:
unknown movie digital-release or TV season air dates remain requestable when
enabled and are blocked when disabled, while preserving the documented behavior
for valid dates and existing requests.

In `@server/utils/releaseEligibility.ts`:
- Around line 21-24: Update release restriction evaluation so unknown release
dates honor a new unknown-release-date option: add the option to
ReleaseRestrictionOptions, block unknown eligibility when disabled in
evaluateReleaseRestriction, and pass the configured setting from MediaRequest.
At server/utils/releaseEligibility.test.ts:120-132, cover both enabled and
disabled policies; at server/routes/request.test.ts:240-253, verify a movie with
an unknown date returns MEDIA_NOT_RELEASED when disabled.
- Around line 79-80: Update the digital-release check in release eligibility to
compare each validated release calendar date with today’s calendar date, rather
than rejecting based on timestamp time-of-day; allow releases occurring later on
the current day while preserving rejection of earlier dates. Add a test covering
a same-day release with a later time.

In `@src/components/Settings/SettingsMain/index.tsx`:
- Around line 65-67: Update the releaseDateRestrictionEnabledTip text in
src/components/Settings/SettingsMain/index.tsx (lines 65-67) and the
corresponding English catalog entry in src/i18n/locale/en.json (lines 1041-1042)
to say “Digital release in any region” instead of “worldwide Digital release,”
preserving the rest of the restriction description.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b6190fe-344f-4d2c-8221-fa6ff4fd1f78

📥 Commits

Reviewing files that changed from the base of the PR and between 090c659 and 629d1e6.

📒 Files selected for processing (14)
  • docs/using-seerr/settings/general.md
  • seerr-api.yml
  • server/constants/error.ts
  • server/entity/MediaRequest.ts
  • server/interfaces/api/settingsInterfaces.ts
  • server/lib/settings/index.ts
  • server/routes/request.test.ts
  • server/routes/request.ts
  • server/utils/releaseEligibility.test.ts
  • server/utils/releaseEligibility.ts
  • src/components/Settings/SettingsMain/index.tsx
  • src/context/SettingsContext.tsx
  • src/i18n/locale/en.json
  • src/pages/_app.tsx

Comment thread docs/using-seerr/settings/general.md
Comment thread server/utils/releaseEligibility.ts
Comment thread server/utils/releaseEligibility.ts Outdated
Comment thread src/components/Settings/SettingsMain/index.tsx Outdated
@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged.

@github-actions github-actions Bot added the merge conflict Cannot merge due to merge conflicts label Aug 16, 2026
@h2nkm5vydg-oss
h2nkm5vydg-oss force-pushed the codex/release-gate-core branch from 505bb68 to c0be4a4 Compare August 17, 2026 04:40
@github-actions github-actions Bot removed the merge conflict Cannot merge due to merge conflicts label Aug 17, 2026
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