Skip to content

Handle missing Jira target versions gracefully in find-bugs:qe - #3232

Open
redhat-chai-bot wants to merge 1 commit into
openshift-eng:mainfrom
redhat-chai-bot:fix/handle-missing-target-versions
Open

Handle missing Jira target versions gracefully in find-bugs:qe#3232
redhat-chai-bot wants to merge 1 commit into
openshift-eng:mainfrom
redhat-chai-bot:fix/handle-missing-target-versions

Conversation

@redhat-chai-bot

@redhat-chai-bot redhat-chai-bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

When target versions (e.g. 5.1.0, 5.1.z, 5.1) don't yet exist in the OCPBUGS Jira project, _query() correctly detects this and returns None. However, close_reconciliation_bugs in find_bugs_qe_cli.py doesn't check for None — it passes it directly to _search(), which sends an unbounded JQL query to Jira, resulting in:

jira.exceptions.JIRAError: JiraError HTTP 400
text: Unbounded JQL queries are not allowed here.

This was observed when the ocp4-konflux build ran for openshift-5.1 before target versions were set up in the OCPBUGS project.

Fix

  1. find_bugs_qe_cli.py: Added None check after _query() in close_reconciliation_bugs. When query is None, logs an error and returns early instead of crashing.

  2. bzutil.py: Added a defensive guard in JIRABugTracker._search — if query is None, logs a warning and returns an empty list. This follows the existing pattern already used by search(), blocker_search(), and cve_tracker_search() in the same class.


AI-generated. Review for accuracy.

@joepvd requested in Slack thread

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of missing search criteria by returning no results instead of sending invalid requests.
    • Prevented reconciliation workflows from searching or closing issues when no valid target versions are available.
    • Added clearer warnings and errors for these conditions.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c8a80ca-85ef-41f0-a216-bb2dd471e625

📥 Commits

Reviewing files that changed from the base of the PR and between 164eb28 and fd80cd9.

📒 Files selected for processing (1)
  • elliott/elliottlib/bzutil.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • elliott/elliottlib/bzutil.py

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


Walkthrough

The change adds guards for missing Jira query data. Jira search returns an empty result for a null query. Reconciliation logs an error and exits when valid target versions are unavailable.

Changes

Jira query guards

Layer / File(s) Summary
Validate Jira query inputs
elliott/elliottlib/bzutil.py, elliott/elliottlib/cli/find_bugs_qe_cli.py
_search logs a warning and returns an empty list for a null query. close_reconciliation_bugs logs an error and returns when valid target versions are unavailable.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to fd80c

This localized change prevents missing Jira target versions from causing an unbounded-query failure; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai-Attribution ⚠️ Warning AI use is explicit: the PR says “AI-generated,” and HEAD has Co-Authored-By: Claude Opus 4.6; no Assisted-by or Generated-by trailer is present. Replace the AI Co-Authored-By trailer with the required Red Hat Assisted-by or Generated-by trailer.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: graceful handling of missing Jira target versions in find-bugs:qe.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
No-Weak-Crypto ✅ Passed The PR adds only None guards, logging, and an early return; the added lines contain no MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The commit changes only two Python files and adds no privileged, host namespace, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The added logs contain only static messages about a None query and missing Jira target versions; they do not log credentials, tokens, PII, hostnames, session IDs, or customer data.
No-Hardcoded-Secrets ✅ Passed The HEAD patch adds only None checks, log messages, and empty returns; scans found no keys, tokens, passwords, credential URLs, private keys, or long base64 strings.
No-Injection-Vectors ✅ Passed The diff adds only None guards, logging, and an early return; it introduces no SQL concatenation, shell execution, eval/exec, unsafe deserialization, unsafe YAML, os.system, or dangerouslySetInnerH...
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@joepvd

joepvd commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joepvd

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

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

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
elliott/elliottlib/cli/find_bugs_qe_cli.py (1)

82-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for the early exit.

Add a case where _query() returns None. Assert that _search() is not called and that no Jira transitions or comments occur. The current test covers only a valid query.

🤖 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 `@elliott/elliottlib/cli/find_bugs_qe_cli.py` around lines 82 - 87, Add a
regression test for the reconciliation search flow where _query() returns None;
assert _search() is not invoked and no Jira transitions or comments are
performed, while preserving the existing valid-query test coverage.
🤖 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 `@elliott/elliottlib/bzutil.py`:
- Around line 1073-1075: Update JIRABugTracker._query() to explicitly fail
closed when _get_available_target_versions() returns an empty collection: return
None or the established no-search result instead of proceeding with the original
query. Preserve the existing query=None guard in _search(), and ensure no
unconstrained search_issues call occurs for empty target-version discovery.

---

Nitpick comments:
In `@elliott/elliottlib/cli/find_bugs_qe_cli.py`:
- Around line 82-87: Add a regression test for the reconciliation search flow
where _query() returns None; assert _search() is not invoked and no Jira
transitions or comments are performed, while preserving the existing valid-query
test coverage.
🪄 Autofix

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: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 63459d38-07d0-492b-bca0-b2e8bc0adf99

📥 Commits

Reviewing files that changed from the base of the PR and between a88c697 and 164eb28.

📒 Files selected for processing (2)
  • elliott/elliottlib/bzutil.py
  • elliott/elliottlib/cli/find_bugs_qe_cli.py

Comment on lines +1073 to +1075
if query is None:
logger.warning("_search called with query=None; returning empty result set")
return []

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fail closed when target-version discovery returns no versions.

This guard skips the Jira request only for query is None. In JIRABugTracker._query(), an empty result from _get_available_target_versions() follows the “Proceeding with original query” branch. The query then reaches search_issues(..., maxResults=0) without a target-version constraint.

Return None from the empty-version branch, or use another explicit no-search result. Otherwise, the PR can still issue the broad JQL it intends to prevent.

🤖 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 `@elliott/elliottlib/bzutil.py` around lines 1073 - 1075, Update
JIRABugTracker._query() to explicitly fail closed when
_get_available_target_versions() returns an empty collection: return None or the
established no-search result instead of proceeding with the original query.
Preserve the existing query=None guard in _search(), and ensure no unconstrained
search_issues call occurs for empty target-version discovery.

@redhat-chai-bot
redhat-chai-bot force-pushed the fix/handle-missing-target-versions branch from 164eb28 to 10a66a3 Compare August 5, 2026 13:36
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
When target versions (e.g. 5.1.0, 5.1.z) don't exist in the OCPBUGS
Jira project, _query() correctly returns None. But close_reconciliation_bugs
didn't check for this, causing _search() to send an unbounded JQL query
to Jira (HTTP 400).

- Add None check in close_reconciliation_bugs after _query() call,
  matching the existing pattern in search(), blocker_search(), and
  cve_tracker_search()
- Add defensive guard in JIRABugTracker._search() to handle None query,
  protecting any future callers that might also forget the None check

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@redhat-chai-bot
redhat-chai-bot force-pushed the fix/handle-missing-target-versions branch from 10a66a3 to fd80cd9 Compare August 17, 2026 09:20
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 17, 2026
@openshift-ci

openshift-ci Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

@redhat-chai-bot: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security fd80cd9 link false /test security

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants