Skip to content

add deferred orion-report step support for changepoint detection#103

Merged
vishnuchalla merged 1 commit into
redhat-performance:mainfrom
mohit-sheth:deferred-orion-report-support
Apr 24, 2026
Merged

add deferred orion-report step support for changepoint detection#103
vishnuchalla merged 1 commit into
redhat-performance:mainfrom
mohit-sheth:deferred-orion-report-support

Conversation

@mohit-sheth
Copy link
Copy Markdown
Collaborator

Support the upstream change where orion failures are reported through a consolidated orion-report step instead of individual orion steps. Adds fallback JSON discovery, scaffolding for per-test viz URL mapping, and multi-link Slack rendering. Refactors shared GCS folder-walking into a common helper.

@mohit-sheth mohit-sheth force-pushed the deferred-orion-report-support branch from 1da34eb to 5857f20 Compare April 13, 2026 04:08
@mohit-sheth mohit-sheth changed the title WIP add deferred orion-report step support for changepoint detection add deferred orion-report step support for changepoint detection Apr 20, 2026
@mohit-sheth mohit-sheth requested a review from jtaleric April 20, 2026 13:32
Thread changepoint test names from scan_orion_jsons through to Slack
rendering via ProwAnalysisResult.changepoint_tests, eliminating
fragile name-guessing between JSON filenames and viz URL keys.

Download orion JSONs into per-step subdirectories so both the
changepoint set and viz URLs use the same strip_step_prefixes'd
folder names. Falls back to flat-glob layout for older jobs.

Signed-off-by: Mohit Sheth <msheth@redhat.com>
Copy link
Copy Markdown

Copilot AI left a comment

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 the upstream “orion-report” consolidated reporting step by updating changepoint JSON discovery, visualization URL construction (single vs multi-link), and Slack rendering, while refactoring shared GCS path utilities.

Changes:

  • Add deferred orion-report handling: discover/download per-step Orion artifacts, download orion-report-summary.txt, and construct multi-link visualization URLs.
  • Refactor GCS path and naming helpers into core.utils and use a shared GCSWEB_BASE_URL.
  • Replace the removed jsonparser.py changepoint formatter with new changepoint preview logic in prow_analyzer.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
bugzooka/integrations/slack_fetcher.py Render multiple viz links (dict) with optional changepoint markers; plumb changepoint_tests through analysis.
bugzooka/core/utils.py Add shared helpers for GCS basename extraction, view URL → GCS path extraction, and step/artifact name normalization.
bugzooka/core/constants.py Introduce GCSWEB_BASE_URL constant used for visualization links.
bugzooka/analysis/prow_analyzer.py Extend analysis result with changepoint_tests; implement deferred-aware orion JSON scanning and summary fallback.
bugzooka/analysis/log_summarizer.py Add orion step discovery, per-step JSON download, report-summary download, and deferred/single viz URL construction.
bugzooka/analysis/jsonparser.py Remove legacy JSON changepoint extraction/formatting helper.
README.md Update repository tree documentation to remove jsonparser.py.

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

Comment on lines +198 to +202
# Discover orion step dirs once to avoid redundant GCS listings
all_step_dirs = list_orion_step_dirs(gcs_path)
individual_dirs = [(f, p) for f, p in all_step_dirs if "orion-report" not in f]
download_prow_orion_jsons(individual_dirs, orion_dir)
download_prow_orion_report_summary(all_step_dirs, log_dir)
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

download_prow_logs() filters out step directories containing orion-report when downloading JSONs, but scan_orion_jsons() has a deferred-mode fallback that expects junit_*.json / output_*.json to be available locally. With the current implementation, JSONs that only exist under the orion-report step’s artifacts will never be downloaded, so changepoint detection will silently fail. Consider also downloading the deferred JSON artifacts from the orion-report step (either into the job root to match the fallback glob, or into a dedicated directory that scan_orion_jsons() checks).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

individual steps have their own jsons, this is not required

Comment on lines +159 to +166
preview_results, changepoint_tests = _collect_changepoints(json_pairs)

if not changepoint_tests:
return [], [], set()

# Full results: use orion report summary if available
report_file = Path(directory_path) / "orion-report-summary.txt"
if report_file.exists():
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

scan_orion_jsons() returns early when changepoint_tests is empty (from JSON parsing), which prevents using orion-report-summary.txt even if it exists. This contradicts the docstring (“uses orion-report-summary.txt if available”) and means deferred/report-only runs can produce no orion output despite having a summary file. Move the report-summary read before the early return, and/or derive preview / changepoint_tests from the summary when JSONs aren’t present.

Copilot uses AI. Check for mistakes.
Comment thread bugzooka/core/utils.py
Comment on lines +16 to +23
def extract_gcs_path(view_url):
"""
Extract the GCS path portion from a Prow view URL.

:param view_url: e.g. https://prow.ci.../view/gs/bucket/path/123
:return: 'bucket/path/123'
"""
return view_url.split("view/gs/")[1]
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

extract_gcs_path() uses view_url.split('view/gs/')[1], which raises IndexError if the substring isn’t present and will include any querystring/fragment in the returned path. Since this helper is now reused in multiple places, it should validate the input and raise a clear ValueError, and strip ?… / #… from the extracted GCS path.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Value error is good but "and strip ?… / #… from the extracted GCS path" is not required

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.

Not sure if copilot listens to the comments like coderabbit.

changepoint_tests = set()
for test_name, json_file in json_pairs:
try:
with open(json_file, "r") as f:
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

When reading orion JSON files, open(json_file, 'r') relies on the process default encoding. Elsewhere in this module you explicitly use UTF-8; it would be more robust/consistent to open these JSON files with encoding='utf-8' as well.

Suggested change
with open(json_file, "r") as f:
with open(json_file, "r", encoding="utf-8") as f:

Copilot uses AI. Check for mistakes.
Comment on lines +230 to +237
if isinstance(viz_url, dict):
for test_name, url in viz_url.items():
if changepoint_tests is not None:
marker = ":warning:" if test_name in changepoint_tests else ":white_check_mark:"
else:
marker = ":chart_with_upwards_trend:"
header_text += f"{marker} <{url}|{test_name}>\n"
elif viz_url:
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

New behavior: when viz_url is a dict, _send_error_logs_preview() renders multiple Slack links and (optionally) uses changepoint_tests to choose markers. The existing tests/test_slack_fetcher.py assertions only validate the presence of the “Error Logs Preview” header and don’t cover this multi-link rendering, so regressions in link formatting/markers won’t be caught. Add/extend a test to pass a dict viz_url (and a changepoint_tests set) and assert the rendered header contains the expected link lines.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

@vishnuchalla vishnuchalla left a comment

Choose a reason for hiding this comment

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

lgtm

@vishnuchalla vishnuchalla merged commit f4633fc into redhat-performance:main Apr 24, 2026
6 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