Skip to content

Support for multi-PR analysis#113

Merged
vishnuchalla merged 4 commits into
redhat-performance:mainfrom
Balatripura587:multi_pr
Jun 12, 2026
Merged

Support for multi-PR analysis#113
vishnuchalla merged 4 commits into
redhat-performance:mainfrom
Balatripura587:multi_pr

Conversation

@Balatripura587

Copy link
Copy Markdown
Collaborator

Description

  • Enables comparing multiple PRs against the periodic baseline in a single analysis request.

Example:
analyze pr: https://github.com/openshift/ovn-kubernetes/pull/3169 https://github.com/openshift/ovn-kubernetes/pull/3170, compare with 5.0

  • Each PR gets its own impact assessment and regression analysis against the baseline.
  • The metric tables show all PRs side by side (Baseline | PR #3169 | PR #3170) for easy comparison.
  • Single-PR requests work as before.

Related PRS:
Orion-mcp PR to support multi-PR analysis
Orion PR to support multi-PR analysis

Testing

Tested locally, the following is the output:
image
image
image
image

Signed-off-by: Bala Tripura Kumari Bodapati <bbodapat@redhat.com>
Signed-off-by: Bala Tripura Kumari Bodapati <bbodapat@redhat.com>

Copilot AI 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.

Pull request overview

Adds support for analyzing multiple GitHub PRs in a single “analyze pr:” request, producing per-PR impact/regression sections and side-by-side metric tables when applicable.

Changes:

  • Extend PR request parsing to accept multiple PR URLs (same org/repo) and propagate PR lists through the analysis pipeline.
  • Update the Gemini prompt to describe multi-PR tool-calling and multi-PR output/table formatting.
  • Add unit tests for multi-PR parsing and Gemini output sanitization.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/test_pr_analyzer.py Adds tests for single/multi-PR request parsing and output sanitization.
bugzooka/integrations/slack_socket_listener.py Updates logging to handle multiple PR numbers in pr_info.
bugzooka/analysis/prompts.py Updates the PR analysis prompt to include multi-PR tool-calling and output rules.
bugzooka/analysis/pr_analyzer.py Implements multi-PR parsing and updates analysis prompt construction/logging accordingly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_pr_analyzer.py Outdated
Comment thread bugzooka/analysis/prompts.py Outdated
Comment thread bugzooka/analysis/pr_analyzer.py
Signed-off-by: Bala Tripura Kumari Bodapati <bbodapat@redhat.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • PR analysis now supports analyzing multiple pull requests in a single request, with per-PR assessments and combined metrics tables for side-by-side performance comparison.
  • Improvements

    • Notifications/logging and analysis prompts updated to present and handle multiple PRs cleanly (comma-separated PR lists and URLs).
  • Tests

    • Added comprehensive tests for PR parsing and output sanitization.

Walkthrough

Adds multi-PR support: parser extracts and validates multiple GitHub PR numbers and required version; prompt template accepts {pr_numbers}/{pr_urls}; analyze_pr_with_gemini injects comma-separated PR lists and returns pr_numbers list; Slack logging updated; tests added for parsing and sanitization.

Changes

Multi-PR Performance Analysis

Layer / File(s) Summary
Multi-PR request parsing and tests
bugzooka/analysis/pr_analyzer.py, tests/test_pr_analyzer.py
Parser extracts multiple GitHub PR URLs, validates same org/repo, returns PR numbers list and required "compare with X.Y" version; tests cover single/multi PRs, URL formats, version parsing, and invalid cases.
Multi-PR analysis prompt template
bugzooka/analysis/prompts.py
Prompt constant updated to accept {pr_numbers} and {pr_urls}, includes single-vs-multiple tool-calling instructions, and defines multi-PR output structure and combined metric table layout.
Analysis orchestration for multi-PR context
bugzooka/analysis/pr_analyzer.py
Orchestration builds comma-separated PR URL and number lists, injects them into the prompt, formats multi-PR display strings for logging, and returns pr_info with pr_numbers list (including no-data responses).
Slack logging for multi-PR results
bugzooka/integrations/slack_socket_listener.py
Slack listener unpacks pr_numbers list, formats a comma-separated #<n> display string for multiple PRs, and logs the analysis destination using structured placeholders.
Output sanitization validation
tests/test_pr_analyzer.py
Tests verify _sanitize_gemini_output removes leading content before the *Performance Impact Assessment* marker and leaves output unchanged when marker is absent or at the start.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: enabling support for analyzing multiple PRs in a single request, which is the primary objective of this PR.
Description check ✅ Passed The description is well-written and directly related to the changeset, providing clear examples, explaining the feature's behavior for single and multiple PRs, and including testing evidence.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Balatripura587

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
bugzooka/analysis/pr_analyzer.py (1)

52-52: 💤 Low value

Consider more specific type hint for the return value.

The return type uses generic list instead of list[str]. Python 3.9+ supports parameterized generics in standard collections.

♻️ Suggested type hint improvement
-def _parse_pr_request(text: str) -> Optional[Tuple[str, str, list, str]]:
+def _parse_pr_request(text: str) -> Optional[Tuple[str, str, list[str], str]]:
🤖 Prompt for 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.

In `@bugzooka/analysis/pr_analyzer.py` at line 52, The return type annotation for
_parse_pr_request is too generic (uses list); change it to a parameterized
generic to reflect element types, e.g. update the signature from
Optional[Tuple[str, str, list, str]] to Optional[Tuple[str, str, list[str],
str]] (or typing.List[str] if targeting older Python versions) so callers know
the list contains strings; keep the rest of the signature and imports (Optional,
Tuple) as-is or add List from typing if you choose typing.List.
🤖 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.

Nitpick comments:
In `@bugzooka/analysis/pr_analyzer.py`:
- Line 52: The return type annotation for _parse_pr_request is too generic (uses
list); change it to a parameterized generic to reflect element types, e.g.
update the signature from Optional[Tuple[str, str, list, str]] to
Optional[Tuple[str, str, list[str], str]] (or typing.List[str] if targeting
older Python versions) so callers know the list contains strings; keep the rest
of the signature and imports (Optional, Tuple) as-is or add List from typing if
you choose typing.List.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: b005f0d1-4887-44f2-9a8b-d143e336f8ba

📥 Commits

Reviewing files that changed from the base of the PR and between 1a090c8 and 8020bbe.

📒 Files selected for processing (4)
  • bugzooka/analysis/pr_analyzer.py
  • bugzooka/analysis/prompts.py
  • bugzooka/integrations/slack_socket_listener.py
  • tests/test_pr_analyzer.py

@vishnuchalla vishnuchalla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perfect. lgtm

@vishnuchalla vishnuchalla merged commit c191416 into redhat-performance:main Jun 12, 2026
3 checks passed
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