Skip to content

USHIFT-6933: Script fix-test-bugs PR parsing logic#175

Open
ggiguash wants to merge 3 commits into
openshift-eng:mainfrom
ggiguash:ci-doctor-check-test-bugs
Open

USHIFT-6933: Script fix-test-bugs PR parsing logic#175
ggiguash wants to merge 3 commits into
openshift-eng:mainfrom
ggiguash:ci-doctor-check-test-bugs

Conversation

@ggiguash
Copy link
Copy Markdown
Contributor

@ggiguash ggiguash commented Jun 5, 2026

Summary by CodeRabbit

  • New Features

    • Added a batch PR lookup that accepts multiple JIRA keys and returns aggregated JSON with per-PR URL and state.
  • Removed

    • Removed the previous single-key PR checker.
  • Refactor

    • Consolidated PR-checking flow into a unified CLI workflow that handles multi-key queries.
  • Documentation

    • Updated eligibility docs to describe batch processing and the new JSON output shape.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 5, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ggiguash

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 11eb1817-0b79-4800-a286-496876c1906b

📥 Commits

Reviewing files that changed from the base of the PR and between 21d0a50 and f1d8b7a.

📒 Files selected for processing (1)
  • plugins/microshift-ci/scripts/fix-test-bugs.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/microshift-ci/scripts/fix-test-bugs.sh

Walkthrough

The PR moves standalone JIRA-PR lookup logic into fix-test-bugs.sh as a new check subcommand that accepts comma-separated JIRA keys, queries open and merged PRs per key, filters by title prefix, and returns aggregated JSON; documentation is updated to describe the batch Gate 1 check.

Changes

Batch PR Check Consolidation

Layer / File(s) Summary
Batch PR check subcommand implementation
plugins/microshift-ci/scripts/fix-test-bugs.sh
New cmd_check() function parses --jira-keys, validates keys, queries gh pr list for both open and merged states per key, filters PR titles by key prefix, and outputs JSON mapping keys to arrays of { url, state }.
CLI help and dispatcher updates
plugins/microshift-ci/scripts/fix-test-bugs.sh
Header/help text documents check --jira-keys KEY1,KEY2,...; usage() and main() are extended to list and dispatch the check command.
Skill documentation for batch PR check
plugins/microshift-ci/skills/fix-test-bugs/SKILL.md
Gate 1 (“Existing PR”) is documented as a single batch pre-loop check using fix-test-bugs.sh check with comma-separated keys, specifies the per-key JSON response shape, and clarifies that Gates 2–3 apply after this batch filtering.

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels: ready-for-human-review

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@plugins/microshift-ci/scripts/fix-test-bugs.sh`:
- Line 65: The case arm handling the --jira-keys flag (the "--jira-keys)"
pattern) reads "${2}" directly which breaks under set -u if the flag is last or
missing a value; update that branch to first verify a value exists and is not
another flag (e.g., ensure "$#" >= 2 and that "$2" doesn't begin with '-') and
if the check fails emit an error and exit non‑zero, otherwise assign jira_keys
from "$2" and shift 2.

In `@plugins/microshift-ci/skills/fix-test-bugs/SKILL.md`:
- Line 58: Update the Gate 1 decision-table row that currently uses the generic
skip reason "PR already exists" (the row beginning "1. Existing PR | Checked in
batch before the per-bug loop...") so the skip reason explicitly includes the
batch PR object's state and url (e.g. "PR exists: state=<state>, url=<url>");
ensure the text matches the execution output contract described in Step 1 by
replacing the generic phrase with a state/url-specific message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: f7e6a15e-d496-435a-9ee7-7da1fdd31b2b

📥 Commits

Reviewing files that changed from the base of the PR and between e8e034e and e0e1185.

📒 Files selected for processing (3)
  • plugins/microshift-ci/scripts/check-jira-pr-links.sh
  • plugins/microshift-ci/scripts/fix-test-bugs.sh
  • plugins/microshift-ci/skills/fix-test-bugs/SKILL.md
💤 Files with no reviewable changes (1)
  • plugins/microshift-ci/scripts/check-jira-pr-links.sh

Comment thread plugins/microshift-ci/scripts/fix-test-bugs.sh Outdated
Comment thread plugins/microshift-ci/skills/fix-test-bugs/SKILL.md Outdated
@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 5, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@plugins/microshift-ci/scripts/fix-test-bugs.sh`:
- Around line 89-94: Add POSITIVE and NEGATIVE tests for the new jq
title-matching regex used when building "filtered" (the select(.title |
test("(^|\\s)" + $key + "[: ]")) expression); create one test that asserts
titles like "KEY: description", "KEY description", "some text KEY: desc",
"[release-X.Y] KEY: ..." and multi-key-containing titles DO match, and at least
one test that asserts substrings like "KEY1234" or "SOMEKEY-KEY" do NOT match;
implement these as shell/unit test cases that feed representative raw_json into
the script (using the key and state variables) and assert the filtered output
contains expected URLs/state for positives and is empty for negatives so future
changes to the regex are covered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 6e20df1f-3f96-4eae-a342-13bfccc38f8f

📥 Commits

Reviewing files that changed from the base of the PR and between e0e1185 and 21d0a50.

📒 Files selected for processing (2)
  • plugins/microshift-ci/scripts/fix-test-bugs.sh
  • plugins/microshift-ci/skills/fix-test-bugs/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • plugins/microshift-ci/skills/fix-test-bugs/SKILL.md

Comment thread plugins/microshift-ci/scripts/fix-test-bugs.sh
Copy link
Copy Markdown

@copejon copejon left a comment

Choose a reason for hiding this comment

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

Looks good overall. 1 small correction to do with input parsing, the rest is just taste-based-nits.

Comment thread plugins/microshift-ci/scripts/fix-test-bugs.sh
Comment thread plugins/microshift-ci/scripts/fix-test-bugs.sh
Comment thread plugins/microshift-ci/scripts/fix-test-bugs.sh Outdated
@ggiguash
Copy link
Copy Markdown
Contributor Author

ggiguash commented Jun 5, 2026

/label ready-for-human-review

This message is AI generated by the yolo-agent of edge-tooling.

1 similar comment
@ggiguash
Copy link
Copy Markdown
Contributor Author

ggiguash commented Jun 5, 2026

/label ready-for-human-review

This message is AI generated by the yolo-agent of edge-tooling.

@coderabbitai coderabbitai Bot removed the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 5, 2026
@ggiguash
Copy link
Copy Markdown
Contributor Author

ggiguash commented Jun 5, 2026

/label ready-for-human-review

This message is AI generated by the yolo-agent of edge-tooling.

@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants