Handle missing Jira target versions gracefully in find-bugs:qe - #3232
Handle missing Jira target versions gracefully in find-bugs:qe#3232redhat-chai-bot wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: openshift-eng/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. WalkthroughThe 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. ChangesJira query guards
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (10 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
/approve |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
elliott/elliottlib/cli/find_bugs_qe_cli.py (1)
82-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression test for the early exit.
Add a case where
_query()returnsNone. 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
📒 Files selected for processing (2)
elliott/elliottlib/bzutil.pyelliott/elliottlib/cli/find_bugs_qe_cli.py
| if query is None: | ||
| logger.warning("_search called with query=None; returning empty result set") | ||
| return [] |
There was a problem hiding this comment.
🩺 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.
164eb28 to
10a66a3
Compare
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
10a66a3 to
fd80cd9
Compare
|
@redhat-chai-bot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
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 returnsNone. However,close_reconciliation_bugsinfind_bugs_qe_cli.pydoesn't check forNone— it passes it directly to_search(), which sends an unbounded JQL query to Jira, resulting in:This was observed when the ocp4-konflux build ran for openshift-5.1 before target versions were set up in the OCPBUGS project.
Fix
find_bugs_qe_cli.py: AddedNonecheck after_query()inclose_reconciliation_bugs. Whenquery is None, logs an error and returns early instead of crashing.bzutil.py: Added a defensive guard inJIRABugTracker._search— ifquery is None, logs a warning and returns an empty list. This follows the existing pattern already used bysearch(),blocker_search(), andcve_tracker_search()in the same class.AI-generated. Review for accuracy.
@joepvd requested in Slack thread
Summary by CodeRabbit