Skip to content

feat(sonarr): monitor new seasons when latest is requested#3157

Open
u61d wants to merge 1 commit into
seerr-team:developfrom
u61d:fix/sonarr-monitor-latest-season
Open

feat(sonarr): monitor new seasons when latest is requested#3157
u61d wants to merge 1 commit into
seerr-team:developfrom
u61d:fix/sonarr-monitor-latest-season

Conversation

@u61d

@u61d u61d commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a third option to the Sonarr Monitor New Seasons setting: Latest Season Requested.

Future seasons are monitored only when the request includes the latest regular season. Older-only requests use No New Seasons, while the existing All and None behavior remains unchanged.

How Has This Been Tested?

  • Ran eslint, prettier check, typecheck, production build, translation extraction, full test suite, and git diff --check
  • Added tests for All, None, latest-season selection, older-season selection, and specials
  • Tested against Sonarr 4.0.17.2952
  • Requested seasons 1 and 2 of The Simpsons and verified Sonarr used No New Seasons
  • Requested the first and latest seasons of S.W.A.T. and verified Sonarr used All Seasons
  • Confirmed only the selected seasons were monitored
  • Confirmed automatic searches and downloads were not started

Screenshots / Logs (if applicable)

The Simpsons with only older seasons requested:
simpsons

S.W.A.T. with the latest season included:
SWAT

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 (if required)

Summary by CodeRabbit

  • New Features

    • Added "Latest Season Requested" option to Sonarr's monitor new seasons setting, allowing selective monitoring of only the latest requested season.
  • Documentation

    • Updated Sonarr settings help text and added translations for new monitoring options.
  • Tests

    • Added test coverage for the new season monitoring logic.

@u61d u61d requested a review from a team as a code owner June 13, 2026 01:50
@coderabbitai

coderabbitai Bot commented Jun 13, 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

Run ID: 3ccc2ab6-42da-4dbb-bb45-a312575979b2

📥 Commits

Reviewing files that changed from the base of the PR and between 784faa9 and 6a807df.

📒 Files selected for processing (6)
  • server/lib/settings/index.ts
  • server/subscriber/MediaRequestSubscriber.ts
  • server/utils/sonarr.test.ts
  • server/utils/sonarr.ts
  • src/components/Settings/SonarrModal/index.tsx
  • src/i18n/locale/en.json

📝 Walkthrough

Walkthrough

This PR adds a new 'latest' option to Sonarr's monitorNewItems setting. When selected, it intelligently monitors new seasons only if the user's request includes the latest available season, preventing unnecessary season monitoring for partial-season requests.

Changes

Sonarr 'latest' season monitoring feature

Layer / File(s) Summary
Monitor behavior logic: type contract and resolution utility
server/lib/settings/index.ts, server/utils/sonarr.ts, server/utils/sonarr.test.ts
SonarrSettings.monitorNewItems expands to include 'latest' alongside 'all' and 'none'. New resolveMonitorNewItems utility resolves 'latest' by checking if the maximum available season is in the requested seasons—returning 'all' if yes, 'none' if no—with comprehensive test coverage.
Series creation integration
server/subscriber/MediaRequestSubscriber.ts
Sonarr addSeries now calls resolveMonitorNewItems with the configured setting, requested season numbers, and available season data from the series, computing the final monitoring mode based on seasonal scope.
Settings UI and localization
src/components/Settings/SonarrModal/index.tsx, src/i18n/locale/en.json
Modal dropdown refactored to use localized option labels and adds new "Latest Season Requested" option. Help text updated and translations added for all three monitoring modes.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SonarrModal
  participant MediaRequestSubscriber
  participant resolveMonitorNewItems
  participant Sonarr
  
  User->>SonarrModal: Select 'Latest Season Requested'<br/>& request show with selected seasons
  SonarrModal->>MediaRequestSubscriber: Create media request with seasons
  MediaRequestSubscriber->>resolveMonitorNewItems: Pass setting='latest',<br/>requestedSeasons, availableSeasons
  alt Latest season in request
    resolveMonitorNewItems-->>MediaRequestSubscriber: return 'all'
  else Latest season not in request
    resolveMonitorNewItems-->>MediaRequestSubscriber: return 'none'
  end
  MediaRequestSubscriber->>Sonarr: addSeries with computed<br/>monitorNewItems value
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • fallenbagel
  • 0xSysR3ll

Poem

🐰 A rabbit hops through seasons new,
Monitoring only what users choose,
When latest's picked, watch all unfold,
But partial requests? We're not so bold!

🚥 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 accurately describes the main feature added: a new 'latest' option for monitoring new seasons in Sonarr when the latest season is requested.
Linked Issues check ✅ Passed All coding requirements from issue #3152 are met: new 'latest' option added to monitorNewItems, resolveMonitorNewItems function implements the logic to monitor only when latest season is included, UI updated with new dropdown option, and tests validate the behavior.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the 'latest' monitor option for Sonarr. No unrelated modifications to other features or components were detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we want tests for Sonarr yet.
@fallenbagel wdyt? Maybe we should do add all *arr tests at once in another PR?

If so, the whole PR could be simplified without that resolveMonitorNewItems helper function.

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.

Only add monitorNewItems to Sonarr if request includes latest season

2 participants