Skip to content

Fix disabled arr instances being processed in some cases#554

Merged
Flaminel merged 1 commit into
mainfrom
fix_disabled_instance_processing
Apr 9, 2026
Merged

Fix disabled arr instances being processed in some cases#554
Flaminel merged 1 commit into
mainfrom
fix_disabled_instance_processing

Conversation

@Flaminel

@Flaminel Flaminel commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Bug Fixes:

  • Prevent disabled Arr instances from being processed during job execution.

@Flaminel

Flaminel commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@sourcery-ai review

@Flaminel

Flaminel commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@sourcery-ai

sourcery-ai Bot commented Apr 9, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Ensure only enabled Arr instances are processed when handling Arr configurations by iterating over the pre-filtered enabledInstances collection instead of all configured instances.

Class diagram for updated Arr processing in GenericHandler

classDiagram
    class GenericHandler {
        +Task ProcessArrConfigAsync(ArrConfig config, bool throwOnFailure)
        -IEnumerable~ArrInstance~ enabledInstances
    }

    class ArrConfig {
        +IEnumerable~ArrInstance~ Instances
    }

    class ArrInstance {
        +bool Enabled
        +string Name
    }

    GenericHandler --> ArrConfig : processes
    ArrConfig --> ArrInstance : contains
    GenericHandler --> ArrInstance : iterates_enabledInstances
Loading

Flow diagram for filtering and processing enabled Arr instances

flowchart TD
    A[Start ProcessArrConfigAsync] --> B[Validate ArrConfig]
    B --> C[Determine enabledInstances from config.Instances]
    C --> D{Are there any enabledInstances?}
    D -- No --> E[Return without processing]
    D -- Yes --> F[Foreach arrInstance in enabledInstances]
    F --> G[Process arrInstance]
    G --> H{More enabledInstances?}
    H -- Yes --> F
    H -- No --> I[End ProcessArrConfigAsync]
Loading

File-Level Changes

Change Details Files
Use the pre-filtered set of enabled Arr instances when processing Arr configurations.
  • Replace iteration over the full config.Instances collection with iteration over enabledInstances in ProcessArrConfigAsync.
  • Aligns the processing loop with prior checks that determine which instances are enabled, preventing disabled instances from being processed.
code/backend/Cleanuparr.Infrastructure/Features/Jobs/GenericHandler.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@greptile-apps

greptile-apps Bot commented Apr 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes a bug in GenericHandler.ProcessArrConfigAsync where the loop variable referenced config.Instances (all instances) instead of the already-computed enabledInstances list, causing disabled arr instances to be processed despite the earlier enabled-only filter and early-exit guard.

Confidence Score: 5/5

Safe to merge — targeted one-line bug fix with no risk of regression.

The change is minimal and correct: it replaces config.Instances with the already-computed enabledInstances list in the loop, which is exactly what the surrounding filter logic intended. No new logic is introduced, no other paths are affected, and all existing guards remain intact.

No files require special attention.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
code/backend/Cleanuparr.Infrastructure/Features/Jobs/GenericHandler.cs Single-line bug fix: loop now iterates over enabledInstances instead of config.Instances, ensuring disabled arr instances are never processed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ProcessArrConfigAsync called] --> B[Filter: enabledInstances = config.Instances.Where x.Enabled]
    B --> C{enabledInstances.Count == 0?}
    C -- Yes --> D[Log debug: No enabled instances\nreturn early]
    C -- No --> E[foreach arrInstance in enabledInstances]
    E --> F[ProcessInstanceAsync arrInstance]
    F --> G{Exception thrown?}
    G -- No --> H{More instances?}
    G -- Yes --> I[Log error]
    I --> J{throwOnFailure?}
    J -- Yes --> K[re-throw]
    J -- No --> H
    H -- Yes --> E
    H -- No --> L[Done]
Loading

Reviews (1): Last reviewed commit: "fixed disabled arr instances being proce..." | Re-trigger Greptile

@codecov

codecov Bot commented Apr 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Flaminel Flaminel merged commit 69fa09e into main Apr 9, 2026
14 of 15 checks passed
@Flaminel Flaminel deleted the fix_disabled_instance_processing branch April 9, 2026 11:41
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