You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(requests): send each requested season's air date and episode count to request routers - #4484
Merge order: Silo-Server/silo-plugin-sdk#72 must merge and be released first. This branch uses RequestDescriptor.season_details from that pull request, so it does not build against the SDK version go.mod requires today (v0.31.0), and CI fails until then. Once the SDK release is tagged, this branch gets one more commit that bumps github.com/Silo-Server/silo-plugin-sdk to it; nothing else changes. Silo-Community/silo-plugins-requests-arr has a matching pull request that waits on the same release.
Problem
Closes#4483
Related issue: discussion #4454
Validation tasks: changes #1202 C4 (not run yet)
Other clients: Apple N/A (no client-visible change); Android N/A (no client-visible change); Roku N/A (no client-visible change)
Season requests download the wrong episodes when the download service numbers a series differently from TMDB. Requesting season 1 of DAN DA DAN, which TMDB lists as one season of 24 episodes, makes the Sonarr plugin monitor Sonarr's season 1 of 12 and leave the other 12 alone. This hits anyone who requests series through a router plugin, mostly for anime. The request carries only TMDB's season numbers, so the plugin cannot tell which episodes were meant.
This change stores each requested season's TMDB first air date and episode count with the request and sends them to the router plugin, so the plugin can find the same episodes in its own service by air date.
Approach
When a series request is created, CreateRequest already has TMDB's detail for the title. It now keeps each requested season's first air date and episode count in a new media_requests.season_details jsonb column (Goose migration). routerDescriptor sends them as RequestDescriptor.season_details on every Fulfill and CheckStatus call, so later submits and status checks get the same snapshot.
Whole-series requests and requests made before this change store none, and plugins match those by season number as before. A season TMDB lists without an air date yet (an announced season) is sent with neither value, which tells the plugin to use the number. docs/architecture/media-requests.md describes the field.
The episode count is TMDB's count when the request is made. Episodes a still-airing season gains later are not counted. The proto comment in the SDK documents this limit.
Out of scope: offering TMDB's episode groups on the request screen (the discussion's first proposal), and the availability mismatch in the discussion's follow-up comment, where season progress compares the library's season numbers with TMDB's.
Validation
make test-go: passes, apart from internal/uploads, which fails only under this machine's group-writable umask and passes with umask 022.
Database contract test for the new column, listed in scripts/ci/db-contracts.txt: passes against a migrated Postgres.
make lint-changed (run as golangci-lint --new-from-merge-base on internal/requests, since the local SDK replace made the make target analyze the whole tree), make lint-router-recovery, go vet, gofmt: clean.
make verify-local-paths, make verify-case-collisions, make verify-size-ratchet: pass.
Web checks not run; no web files change.
go mod tidy -diff not run: go.mod is unchanged until the SDK release (see the note at the top).
No user-visible change in Silo: the request screen, request records and API responses are the same. What changes is what the router plugin receives and does.
Checked end to end against a real Sonarr 4.0.20, using the router plugin's Fulfill with the descriptor this branch sends (the plugin side is the linked Silo-Community/silo-plugins-requests-arr pull request). Sonarr's seasons afterwards, as season(episodes)=monitored:
DAN DA DAN, TMDB season 1 (24 episodes), before: S0(4)=false S1(12)=true S2(12)=false S3(1)=false
DAN DA DAN, TMDB season 1 (24 episodes), after: S0(4)=false S1(12)=true S2(12)=true S3(1)=false
The Apothecary Diaries, TMDB season 1 (60), after: S0(58)=false S1(24)=true S2(24)=true S3(24)=true
On the server side, tests cover that a season request's details reach the router in request order, with an announced season carrying no date or count, and that the details survive the database round trip.
Risks
Migration: adds one jsonb NOT NULL DEFAULT '[]' column to media_requests; existing rows read as having no details.
Compatibility: additive on the plugin contract. Plugins built before the field ignore it.
Release: cannot merge before the SDK release (see the note at the top).
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
AI Disclosure
Harness: Claude Code
Tool(s): Claude Code; Codex CLI (review only)
Model(s): claude-opus-5-5 (implementation and review); claude-fable-5-2, gpt-6.2-sol, gpt-6.2-astra (review)
Involvement: Fully AI-generated, human verified
Adversarial review: four independent model reviews (the models above) of the full SDK, server and plugin change, then of the fixes, on correctness, repository standards and the discussion's request. Server-side findings were limited to test scope and a lint fix; the substantive findings were in the plugin and are fixed there.
Note
Send season air dates and episode counts to request routers
Series requests now capture each requested season's TMDB number, first air date, and episode count via requests.seasonDetails in seasons.go, set in CreateRequest and carried on CreateRequestRecord and Request
The new SeasonDetails field is stored as a non-null JSONB column with an empty-array default (migration 20261118093612_request_season_details.sql); scanRequest decodes it and insertRequest writes it
Router descriptors in provider.go now include SeasonDetails as plugin RequestedSeason entries; whole-series requests and older rows without stored details have it empty
Risk: invalid season_details JSON in a row now fails request scanning with a season-details error; Request.SeasonDetails is excluded from JSON serialization
A season request reaches the router plugin as TMDB's season numbers only.
Download services such as Sonarr split some series differently, so a
request for TMDB's 24-episode season 1 of DAN DA DAN monitored only
Sonarr's 12-episode season 1.
Requests now store each requested season's TMDB first air date and
episode count and send them as RequestDescriptor.season_details, so a
plugin can find the same episodes by air date.
No actionable comments were generated in the recent review.
Walkthrough
Season requests now retain each requested TMDB season’s first-air date and episode count. The repository stores and loads these details. Series router descriptors send them alongside the existing season numbers.
Changes: Season detail flow
Layer / File(s)
Summary
Capture requested season details internal/requests/seasons.go, internal/requests/store.go, internal/requests/types.go, internal/requests/service.go, internal/requests/seasons_test.go, internal/requests/service_test.go
SeasonDetail represents a season’s TMDB number, first-air date, and episode count. Request creation derives details for normalized requested seasons and adds them to the request record. Tests check the derived details and router descriptor values.
Persist and load season details migrations/sql/20261118093612_request_season_details.sql, internal/requests/repository.go, internal/requests/routing_facts_test.go, scripts/ci/db-contracts.txt
The migration adds a JSONB season_details column. The repository encodes details when inserting requests and decodes them when reading requests. The database contract test checks round-trip values and requests without details.
Build router descriptors and document matching internal/requests/provider.go, docs/architecture/media-requests.md
Series descriptors include requested season numbers, first-air dates, and episode counts. The architecture documentation describes matching by episode count and air date, with fallback to season number when details are missing.
sequenceDiagram
participant RequestService
participant RequestRepository
participant RouterDescriptor
participant Plugin
RequestService->>RequestRepository: Store requested season details
RequestRepository->>RouterDescriptor: Load request with season details
RouterDescriptor->>Plugin: Send season numbers, first-air dates, and episode counts
Loading
Merge Risk: High · up to 58119
This change stores each requested season's TMDB air date and episode count and sends them to request plugins. It does not compile against the currently pinned plugin SDK, so every Go CI check fails and merging now would break the build. It should wait for the SDK release and the dependency bump. A small documentation ambiguity about same-day season boundaries also remains.
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — internal (service) was modified; 9 changed files map to changed impact.
observed — docs (service) was modified; 1 changed file maps to changed impact.
observed — migrations (service) was modified; 1 changed file maps to changed impact.
observed — scripts (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in internal/requests/provider.go: For series requests, routerDescriptor now converts each Request.SeasonDetails entry into a protobuf RequestedSeason, carrying its number, first-air date, and episode count. Other media types do not populate season details.
observed — Modified behavior in internal/requests/provider.go: The returned RequestDescriptor now includes the collected SeasonDetails alongside the existing season numbers.
observed — Modified behavior in internal/requests/repository.go: insertRequest now inserts and passes encoded season details as the season_details column, in addition to the existing request data.
observed — Modified behavior in internal/requests/repository.go: Added encodeSeasonDetails, which converts nil details to an empty slice and JSON-encodes the result.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: series season requests now send each requested season's TMDB air date and episode count to request routers. The changeset adds storage (migration, repository, types), …
Description check
The description explains the problem (season requests download wrong episodes when numbering differs from TMDB), the approach (storing and sending season first air date and episode count via a new sea…
Linked Issues check
[#4483] The issue's Technical notes assign the server part to this pull request. That part is: store each requested season's details with the request, and send them on every submit and status check. T…
Out of Scope Changes check
Every changed area supports storing or delivering season details. The changes cover the migration, the repository column handling, the CreateRequestRecord, Request, and SeasonDetail types, the `…
Full details: Title check
Explanation
The title names the main change: series season requests now send each requested season's TMDB air date and episode count to request routers. The changeset adds storage (migration, repository, types), computes season details in CreateRequest, and passes them to routers through routerDescriptor, which matches the title.
Full details: Description check
Explanation
The description explains the problem (season requests download wrong episodes when numbering differs from TMDB), the approach (storing and sending season first air date and episode count via a new season_details column and RequestDescriptor field), validation, risks, and dependencies. It matches the changeset in internal/requests, the migration, and the docs.
Full details: Linked Issues check
Explanation
[#4483] The issue's Technical notes assign the server part to this pull request. That part is: store each requested season's details with the request, and send them on every submit and status check. The whole-PR summary shows these changes. The migration 20261118093612_request_season_details.sql adds a non-null jsonbseason_details column to media_requests. CreateRequest (internal/requests/service.go, seasons.go) fills CreateRequestRecord.SeasonDetails with each requested season's TMDB number, first air date, and episode count. insertRequest and scanRequest (repository.go) persist and read the column. routerDescriptor (provider.go) maps each entry to pluginv1.RequestedSeason, and the previous review confirmed this mapping in the merge-base diff. Tests cover descriptor order, the announced-season case (no date, zero count), and the database round trip. Whole-series and older requests send no details, so the plugin falls back to season number, as the issue requires. The SDK field (Silo-Server/silo-plugin-sdk#72) and the plugin matching (Silo-Community/silo-plugins-requests-arr) are in other repositories and cannot be reviewed here. The Sonarr end-to-end result depends on that plugin change. Evidence for the CheckStatus path rests on the shared routerDescriptor construction in the summary. Excluded items (episode groups, season-progress availability mismatch) are not required.
Full details: Out of Scope Changes check
Explanation
Every changed area supports storing or delivering season details. The changes cover the migration, the repository column handling, the CreateRequestRecord, Request, and SeasonDetail types, the routerDescriptor population, the docs/architecture/media-requests.md field description, the database contract test with its scripts/ci/db-contracts.txt entry, and the test fakes. The PR description and summary state that the request screen, request records, and API responses do not change. Request.SeasonDetails is excluded from JSON serialization, which keeps API output unchanged. The go.mod SDK bump is deferred and is not in this diff. No unrelated feature, UI, or API change appears in the summary. Evidence is the whole-PR summary and the previous merge-base diff of provider.go. The other files were assessed from the summary only.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: e6b22ec6-df06-4b6e-aedc-bc9181fb8c90
Commits
Reviewing files that changed from the base of the PR and between 00c343c and 5811935.
Files selected for processing: 1
docs/architecture/media-requests.md
Files skipped from review as they are similar to previous changes: 1
docs/architecture/media-requests.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
New router descriptor fields are unavailable in the pinned SDK
The server and its tests cannot compile because the pinned SDK lacks RequestedSeason and RequestDescriptor.SeasonDetails. Update the SDK dependency in go.mod to a released version containing those definitions.
Prompt for LLM
File internal/requests/provider.go, line 111:
New router descriptor fields are unavailable in the pinned SDK
The required SDK version is still v0.31.0, which does not provide `RequestedSeason` or `RequestDescriptor.SeasonDetails`, so the server and its tests cannot compile. Update the SDK dependency to the released version containing those protobuf definitions before merging.
The reason will be displayed to describe this comment to others. Learn more.
Expected: this pull request depends on Silo-Server/silo-plugin-sdk#72, as the note at the top of the description says. It can't build against the pinned v0.31.0 until that merges and is released; the branch then gets one commit bumping the SDK in go.mod. The CI failures here are all this missing-type error.
The reason will be displayed to describe this comment to others. Learn more.
Understood. The missing SDK types and resulting CI failures are expected until silo-plugin-sdk#72 is merged and released. The planned go.mod bump will address the build failure before this PR merges.
My suggestion repeated a dependency and merge-order requirement already documented in the PR, rather than identifying a new issue. No changes have been made.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Critical · Functional Correctness · Quick win
Update the SDK dependency before merging.
The reviewed revision declares silo-plugin-sdk v0.31.0. CI cannot compile pluginv1.RequestedSeason or RequestDescriptor.SeasonDetails. The new test also cannot resolve GetSeasonDetails. Once SDK PR #72 ships, pin a release that provides these APIs and rerun the Go validation gate. (github.com)
Also applies to: 135-135
Tools
GitHub Actions: CI / 1_ci _ Go vet and contracts.txt
[error] 111-117: go vet ./... failed: undefined: pluginv1.RequestedSeason.
GitHub Actions: CI / 2_ci _ Go integration.txt
[error] 111-135: Go compilation failed during go test -p 2 -race -c: pluginv1.RequestedSeason is undefined at lines 111 and 117, and SeasonDetails is an unknown field in pluginv1.RequestDescriptor at line 135.
GitHub Actions: CI / 3_ci _ Go test.txt
[error] 111-135: Go tests failed during make -f .ci-tools/.github/actions/ci-tools/go-checks.mk tests (go test): pluginv1.RequestedSeason is undefined at lines 111 and 117, and SeasonDetails is not a field of pluginv1.RequestDescriptor at line 135.
GitHub Actions: CI / 4_ci _ Go DB external auth.txt
[error] 111-111: Go compilation failed during go test -p 2 -race -c for the listed packages: undefined: pluginv1.RequestedSeason.
GitHub Actions: CI / 6_ci _ Go DB pins.txt
[error] 111-111: The make test-db-pins step failed to compile: pluginv1.RequestedSeason is undefined.
GitHub Actions: CI / 7_ci _ Go lint.txt
[error] 111-111: Go typecheck failed during make -f .ci-tools/.github/actions/ci-tools/go-checks.mk --keep-going lint: undefined: pluginv1.RequestedSeason.
GitHub Actions: CI / ci _ Go DB external auth
[error] 111-111: go test -p 2 -race -c failed to compile: undefined: pluginv1.RequestedSeason.
GitHub Actions: CI / ci _ Go DB pins
[error] 111-135: The make test-db-pins command failed to compile: pluginv1.RequestedSeason is undefined at lines 111 and 117, and SeasonDetails is not a field of pluginv1.RequestDescriptor at line 135.
GitHub Actions: CI / ci _ Go integration
[error] 111-111: Go compilation failed during go test -p 2 -race -c: undefined pluginv1.RequestedSeason.
GitHub Actions: CI / ci _ Go lint
[error] 111-111: Go typecheck failed during make -f .ci-tools/.github/actions/ci-tools/go-checks.mk --keep-going lint: undefined: pluginv1.RequestedSeason.
GitHub Actions: CI / ci _ Go test
[error] 111-135: Go tests failed during make -f .ci-tools/.github/actions/ci-tools/go-checks.mk tests (via make test-go). Compilation errors: pluginv1.RequestedSeason is undefined at lines 111 and 117, and SeasonDetails is an unknown field in pluginv1.RequestDescriptor at line 135.
GitHub Actions: CI / ci _ Go vet and contracts
[error] 111-117: go vet ./... failed: undefined: pluginv1.RequestedSeason (reported at lines 111 and 117).
The reason will be displayed to describe this comment to others. Learn more.
Known and intended: this pull request waits on Silo-Server/silo-plugin-sdk#72 (see the note at the top of the description). Once that is merged and released, this branch gets one commit bumping silo-plugin-sdk in go.mod to the new version, and CI builds.
The reason will be displayed to describe this comment to others. Learn more.
@Rhainland Thanks for the context. I understand the SDK dependency is intentional at this stage.
The reported CI failures remain a merge blocker. After Silo-Server/silo-plugin-sdk#72 is released, the planned dependency bump and a passing Go validation run are needed to verify the fix. I’m not marking the finding as addressed yet.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 5 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Retain distributed firing claims through their own validity windows
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 4c8cdbce-2034-46e5-9c9f-855840428b8f
Commits
Reviewing files that changed from the base of the PR and between ab6c52f and 00c343c.
Files selected for processing: 1
docs/architecture/media-requests.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Specify how matching handles earlier-season episodes that air on the requested season's first-air date.
The rule takes the first episode_count regular episodes that air on or after first_air_date. It does not limit them to the requested season. When the previous season's finale airs on that date and precedes the requested premiere in airing order, the window includes the finale and omits the requested season's last episode. This section defines no other tie-break or season-boundary rule. Define the required behavior for this case so that a plugin following the rule selects exactly the requested season's episodes.
The reason will be displayed to describe this comment to others. Learn more.
Leaving this one as is. A previous season's finale airing on the same day as the next season's premiere is rare for weekly seasons, and this section only summarizes the contract; the exact selection, including how a plugin weighs episodes from neighbouring seasons, is defined in the SDK (Silo-Server/silo-plugin-sdk#72) and implemented by each plugin. The Sonarr plugin, for example, only adds a later Sonarr season when at least three requested episodes fall in it.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 5 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Retain distributed firing claims through their own validity windows
No defects found in the server change. Its only blocker is the declared merge order: the branch builds once Silo-Server/silo-plugin-sdk#72 is released and go.mod is bumped to that release. Every red Go check on this head is that missing-type error.
How it was checked. I merged current main into this head locally and pointed the SDK at #72 merged with v0.33.0 (the version main now pins), so the check covers what will land after the bump. go build ./..., go vet ./internal/requests/, and go test ./internal/requests/... pass. The package's database tests, including TestSeasonDetailsRoundTripDatabase, pass on a freshly migrated Postgres 18. The new tests can't build on the base because they use the new types. I checked them instead by removing the code they cover: dropping the SeasonDetails assignment in CreateRequest makes TestSeasonRequestDescribesItsSeasonsToTheRouter fail, and breaking the column scan makes the round-trip test fail.
What else was checked, with nothing to fix:
Every request goes through Service.CreateRequest, including the native API and watchlist auto-requests. Every read goes through requestColumns(), so seasons and season_details can't drift apart. Replacing a failed request, retries, and status checks reuse the stored snapshot.
The migration adds a NOT NULL DEFAULT '[]' column, which Postgres applies without rewriting the table. Backups copy whole tables, so they keep the column.
An API node still on the old version that submits a request during a rolling upgrade sends season numbers only. That matches today's behavior, so it isn't a regression.
A request created while TMDB is unreachable stores no details and is matched by number, as before.
Known limits, for the maintainers to weigh (no change requested):
Details are captured when the request is made. A pending request approved weeks later still sends the episode count from creation. The description and the SDK comment both state this. The Sonarr plugin (feat(sonarr): match requested seasons by air date Silo-Community/silo-plugins-requests-arr#31) monitors whole Sonarr seasons and always includes the one holding the first matched episode, so a low count does not shrink a normally numbered season.
The SDK comment calls episode_count = 0 "unknown" but doesn't say what a plugin does with a dated season whose count is 0, or when no episode matches. This PR's architecture doc says to fall back to the season number in both cases, and the Sonarr plugin does. It would help to write the same in silo-plugin-sdk#72 so other router plugins follow it.
Adversarial round: gpt-6.2-sol (xhigh) reviewed 5811935 and raised four points. Its counterexample for a one-day air-date offset doesn't apply to the Sonarr plugin, which allows a day either way and needs three episodes before it adds a later season. Its stale-count, rolling-upgrade, and missing-detail points describe the limits and fallbacks above, none of which is worse than today's behavior. The fallback wording went into the SDK note above.
Validated features: none affected. Requests — Server (#1202) C4 hasn't been run, and no other passed case touches season routing.
User manual: unaffected. The requests page doesn't describe how seasons are matched, and nothing a user sets or sees changes.
Other clients and jellycompat: no client-visible change; the new field is json:"-" on the native API, and jellycompat doesn't create router requests.
Fit: 8/10 · Readiness: 7/10 — conditional
Fit: it fixes wrong downloads in a 1.0 feature at the plugin boundary, which is where download-service differences belong. It adds a stored column and a contract field, and both are kept small and additive.
Readiness: the code and its tests hold up. The condition is the SDK release and go.mod bump, after which CI needs to pass on the bumped head. I haven't seen the end-to-end behavior in a running Silo; the author's Sonarr check covers the plugin side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workinggoPull requests that update go codepriority: P2Limited scope, workaround exists, or polishsize/M50–199 added + deleted lines (all files); change volume, not priority.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Merge order: Silo-Server/silo-plugin-sdk#72 must merge and be released first. This branch uses
RequestDescriptor.season_detailsfrom that pull request, so it does not build against the SDK versiongo.modrequires today (v0.31.0), and CI fails until then. Once the SDK release is tagged, this branch gets one more commit that bumpsgithub.com/Silo-Server/silo-plugin-sdkto it; nothing else changes. Silo-Community/silo-plugins-requests-arr has a matching pull request that waits on the same release.Problem
Closes #4483
Related issue: discussion #4454
Validation tasks: changes #1202 C4 (not run yet)
Other clients: Apple N/A (no client-visible change); Android N/A (no client-visible change); Roku N/A (no client-visible change)
Season requests download the wrong episodes when the download service numbers a series differently from TMDB. Requesting season 1 of DAN DA DAN, which TMDB lists as one season of 24 episodes, makes the Sonarr plugin monitor Sonarr's season 1 of 12 and leave the other 12 alone. This hits anyone who requests series through a router plugin, mostly for anime. The request carries only TMDB's season numbers, so the plugin cannot tell which episodes were meant.
This change stores each requested season's TMDB first air date and episode count with the request and sends them to the router plugin, so the plugin can find the same episodes in its own service by air date.
Approach
When a series request is created,
CreateRequestalready has TMDB's detail for the title. It now keeps each requested season's first air date and episode count in a newmedia_requests.season_detailsjsonb column (Goose migration).routerDescriptorsends them asRequestDescriptor.season_detailson every Fulfill and CheckStatus call, so later submits and status checks get the same snapshot.Whole-series requests and requests made before this change store none, and plugins match those by season number as before. A season TMDB lists without an air date yet (an announced season) is sent with neither value, which tells the plugin to use the number.
docs/architecture/media-requests.mddescribes the field.The episode count is TMDB's count when the request is made. Episodes a still-airing season gains later are not counted. The proto comment in the SDK documents this limit.
Out of scope: offering TMDB's episode groups on the request screen (the discussion's first proposal), and the availability mismatch in the discussion's follow-up comment, where season progress compares the library's season numbers with TMDB's.
Validation
make test-go: passes, apart frominternal/uploads, which fails only under this machine's group-writable umask and passes withumask 022.scripts/ci/db-contracts.txt: passes against a migrated Postgres.make lint-changed(run asgolangci-lint --new-from-merge-baseoninternal/requests, since the local SDKreplacemade the make target analyze the whole tree),make lint-router-recovery,go vet,gofmt: clean.make verify-local-paths,make verify-case-collisions,make verify-size-ratchet: pass.go mod tidy -diffnot run:go.modis unchanged until the SDK release (see the note at the top).go.modpointing at the SDK branch from feat(proto): send each requested season's air date and episode count to request routers silo-plugin-sdk#72.Evidence
No user-visible change in Silo: the request screen, request records and API responses are the same. What changes is what the router plugin receives and does.
Checked end to end against a real Sonarr 4.0.20, using the router plugin's Fulfill with the descriptor this branch sends (the plugin side is the linked Silo-Community/silo-plugins-requests-arr pull request). Sonarr's seasons afterwards, as
season(episodes)=monitored:On the server side, tests cover that a season request's details reach the router in request order, with an announced season carrying no date or count, and that the details survive the database round trip.
Risks
jsonb NOT NULL DEFAULT '[]'column tomedia_requests; existing rows read as having no details.Checklist
AI Disclosure
Note
Send season air dates and episode counts to request routers
requests.seasonDetailsin seasons.go, set inCreateRequestand carried onCreateRequestRecordandRequestSeasonDetailsfield is stored as a non-null JSONB column with an empty-array default (migration 20261118093612_request_season_details.sql);scanRequestdecodes it andinsertRequestwrites itSeasonDetailsas pluginRequestedSeasonentries; whole-series requests and older rows without stored details have it emptyseason_detailsJSON in a row now fails request scanning with a season-details error;Request.SeasonDetailsis excluded from JSON serializationMacroscope summarized 5811935.