fix(requests): reset orphaned season statuses when a request is deleted#3279
fix(requests): reset orphaned season statuses when a request is deleted#3279Knat-Dev wants to merge 5 commits into
Conversation
Seasons left PENDING/PROCESSING after their request was deleted could never be re-requested ("No
seasons available to request"). Mirrors the existing decline-path season reset.
fix seerr-team#3278
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesTV season status recalculation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
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. Comment |
fallenbagel
left a comment
There was a problem hiding this comment.
Also needs tests, since there aren't any in this PR. request.test.ts's delete-restoration suite is movie-only, which is how this bug shipped in the first place. At minimum:
- request-covered season at PROCESSING, delete, reset to UNKNOWN, re-request succeeds
- season NOT covered by the deleted request at PROCESSING, delete, untouched
- second active request covering the season, delete the first, stays PROCESSING
- delete a non-4K request, status4k untouched
|
Sounds good, I'll add them later today once I'm free 👍🏻 |
|
Thanks for the review btw! I'll fix everything after work |
…uest The reset swept every PENDING/PROCESSING season with no remaining active request, including seasons an arr scan had set that were unrelated to the deleted request. Scope it to the seasons the request covered and batch the season saves into one manager.save call.
Covered season resets to UNKNOWN and is re-requestable, uncovered season untouched, season kept while a second active request covers it, and status4k untouched on a non-4K delete. Three of the four fail on develop without the fix.
…-statuses-on-request-delete
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@server/routes/request.test.ts`:
- Around line 665-689: Extend the request cleanup test around the existing
“resets a request-covered PROCESSING season” case to also exercise
MediaStatus.PENDING, preferably by parameterizing the status inputs. For each
status, verify deletion resets the season to UNKNOWN and the same season can be
successfully re-requested.
- Around line 727-745: Add a complementary test alongside the existing non-4K
deletion case that seeds distinct `status` and `status4k` values, deletes a 4K
request, and asserts `status4k` resets while `status` remains unchanged.
Exercise the 4K request setup so the dynamic status-key branch is covered.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b26baa2e-773e-4d51-9701-1bea440fc341
📒 Files selected for processing (2)
server/routes/request.test.tsserver/subscriber/MediaRequestSubscriber.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- server/subscriber/MediaRequestSubscriber.ts
Parameterize the covered-season reset over PENDING and PROCESSING, and add the inverse 4K case: deleting a 4K request resets status4k and leaves status untouched, proving the status key is selected per request type.
|
Done, all applied :) |
Description
Once a user deletes a request the season rows of the request stay PENDING/PROCESSING forever, so the show's seasons can not be re-requested.
In this change we make sure to reset those season rows back to UNKNOWN.
Disclosure: I used AI tooling to help investigate the root cause and draft the patch, though I reviewed it myself and questioned it heavily. I hit the bug myself on my own instance and verified both the reproduction and the fix by hand.
How Has This Been Tested?
I ran the reproduction which has been stated under #3278 with 3.3.0 as well as this branch, on my own live instance with real Sonarr.
Stock 3.3.0: after deleting the request the season row stayed PROCESSING in the db and the UI disabled the season toggle.
On this branch: after deleting the request the season toggle was off and enabled.
Also ran typecheck, lint and the full test suite on this branch (133/133)
Screenshots / Logs (if applicable)
Stock 3.3.0:

^ Stuck in PROCESSING
This branch:

^ Back to UNKNOWN
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit