Skip to content

CLOUDDST-32368 : Fix FBC remove by only passing DB-backed packages to opm registry rm#1312

Open
ashwgit wants to merge 1 commit intorelease-engineering:masterfrom
ashwinifork:patch-rm-operations
Open

CLOUDDST-32368 : Fix FBC remove by only passing DB-backed packages to opm registry rm#1312
ashwgit wants to merge 1 commit intorelease-engineering:masterfrom
ashwinifork:patch-rm-operations

Conversation

@ashwgit
Copy link
Copy Markdown
Contributor

@ashwgit ashwgit commented Apr 27, 2026

opm registry rm failed when the removal list included FBC-only packages
not present in the index.db. This MR patches this bug by only passing operators which are present in DB when trying removing operators from db.

Summary by Sourcery

Filter remove-operator requests so opm registry rm is invoked only with DB-backed packages when handling FBC removals.

Bug Fixes:

  • Prevent failures in FBC removal when the operator list includes packages not present in the index database by passing only DB-backed operators to opm registry rm.

Tests:

  • Extend FBC remove-request tests to cover mixed operator lists and verify only DB-backed operators are passed to the registry removal function.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 27, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Restricts FBC operator removal to packages present in the index DB and updates the FBC removal test to assert correct filtering and argument passing to helper functions.

Sequence diagram for FBC operator removal using DB-backed operators only

sequenceDiagram
    participant HandleRmRequest
    participant IndexDB
    participant OpmRegistryRmFbc

    HandleRmRequest->>IndexDB: query_operators_in_db(operators)
    IndexDB-->>HandleRmRequest: operators_in_db

    alt operators_in_db not empty
        HandleRmRequest->>OpmRegistryRmFbc: opm_registry_rm_fbc(base_dir, from_index_resolved, operators_in_db, index_db_path)
        OpmRegistryRmFbc-->>HandleRmRequest: fbc_dir
    else operators_in_db empty
        HandleRmRequest-->>HandleRmRequest: skip FBC removal (no DB-backed operators)
    end
Loading

File-Level Changes

Change Details Files
Filter operator removal to only those present in the index DB when invoking opm_registry_rm_fbc.
  • Changed handle_rm_request to pass operators_in_db instead of the full operators list to opm_registry_rm_fbc
  • Ensured that FBC removal logic relies on DB-backed operators to avoid failures when FBC-only packages are requested for removal
iib/workers/tasks/build.py
Strengthen FBC remove test to cover operator filtering and updated helper interactions.
  • Extended test_handle_rm_request_fbc to include both DB-backed and FBC-only operators in the input operator list
  • Updated mock_voe return type from list to set to reflect current implementation
  • Asserted that opm_registry_rm_fbc is called with only DB-backed operators using kwargs inspection
  • Added expectations on calls to opm_registry_rm_fbc and opm_registry_rm_fbc-related arguments (including operator_packages and rm_operators) to validate correct filtering behavior
tests/test_workers/test_tasks/test_build.py

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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In handle_rm_request, opm_registry_rm_fbc now receives operators_in_db while rm_operators in the set_request_state call still uses the original operators list; consider passing the same filtered collection through all downstream calls so external behavior and logs stay consistent with what is actually removed from the DB.
  • The tests now treat operators as a set (e.g., mock_voe.return_value = {'some-operator'} and asserting mock_orrf receives a set); double-check that the production code and any consumers of the operators parameter consistently expect and handle sets rather than lists to avoid subtle type or ordering issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `handle_rm_request`, `opm_registry_rm_fbc` now receives `operators_in_db` while `rm_operators` in the `set_request_state` call still uses the original `operators` list; consider passing the same filtered collection through all downstream calls so external behavior and logs stay consistent with what is actually removed from the DB.
- The tests now treat `operators` as a set (e.g., `mock_voe.return_value = {'some-operator'}` and asserting `mock_orrf` receives a set); double-check that the production code and any consumers of the `operators` parameter consistently expect and handle sets rather than lists to avoid subtle type or ordering issues.

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.

@lipoja
Copy link
Copy Markdown
Contributor

lipoja commented Apr 28, 2026

Please rebase and do not forget to propagate this change to containerized version of these functions as well.

@ashwgit ashwgit force-pushed the patch-rm-operations branch from 50775ce to 616384e Compare April 29, 2026 07:09
…es in the index.db

Only pass operators which are present in db, for removal from db while performing rm operation on fbc operators.
@ashwgit ashwgit force-pushed the patch-rm-operations branch from 616384e to 5235f6d Compare April 29, 2026 11:35
@yashvardhannanavati
Copy link
Copy Markdown
Collaborator

/agentic_review

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

@yashvardhannanavati
Copy link
Copy Markdown
Collaborator

/review

@qodo-code-review
Copy link
Copy Markdown

ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

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.

3 participants