Skip to content

ReviewBot: consume the generator when using search_review(), and ensure the behaviour between platform is consistent#3302

Open
g7 wants to merge 3 commits intoopenSUSE:masterfrom
g7:epaolantonio/gitea-plat-search-regression
Open

ReviewBot: consume the generator when using search_review(), and ensure the behaviour between platform is consistent#3302
g7 wants to merge 3 commits intoopenSUSE:masterfrom
g7:epaolantonio/gitea-plat-search-regression

Conversation

@g7
Copy link
Copy Markdown
Member

@g7 g7 commented Feb 24, 2026

Users of search_review() expect a list, not a generator.

@g7
Copy link
Copy Markdown
Member Author

g7 commented Feb 24, 2026

Alternatively, since the only (known) user is ReviewBot.py, we can force a list there.

g7 added 3 commits February 24, 2026 16:58
Since we switched to a generator, let's consume it and store it as a
list.

Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
This follows what has been done already for the Gitea platform, to
ensure behaviour consistency between the two.

Users are now expected to always get a generator.

Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
Signed-off-by: Eugenio Paolantonio <eugenio.paolantonio@suse.com>
@g7 g7 force-pushed the epaolantonio/gitea-plat-search-regression branch from 959e3e2 to 28b165e Compare February 24, 2026 16:01
@g7
Copy link
Copy Markdown
Member Author

g7 commented Feb 24, 2026

v2:

as agreed in Slack - let's turn it the other way: turn obs's search_platform() a generator too, and ensure that ReviewBot consumes it and stores it as a list.

@g7 g7 changed the title plat: gitea: fix regression on search_review ReviewBot: consume the generator when using search_review(), and ensure the behaviour between platform is consistent Feb 24, 2026

def set_request_ids_search_review(self):
self.requests = self.platform.search_review(review_user=self.review_user, review_group=self.review_group)
self.requests = list(self.platform.search_review(review_user=self.review_user, review_group=self.review_group))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's reasonable, but is there really a hard dependency for self.requests being a list at the moment tho? If not I think maybe we can take this chance to change this to a generator and offer a chance for a small optimization. What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it would be nice, just worried about the usage elsewhere. From a rapid skimming through ReviewBot.py:

Doesn't look that bad to be honest, but perhaps that can be done later in another PR, what do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A follow up pull request later sounds good. Thanks for the investigation!

@YoukouTenhouin
Copy link
Copy Markdown
Contributor

LGTM

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.

2 participants