Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions elliott/elliottlib/bzutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,9 @@ def _query(

@retry(reraise=True, stop=stop_after_attempt(3), wait=wait_fixed(5))
def _search(self, query, verbose=False) -> List[JIRABug]:
if query is None:
logger.warning("_search called with query=None; returning empty result set")
return []
Comment on lines +1073 to +1075

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.

if verbose:
logger.info(query)
try:
Expand Down
11 changes: 6 additions & 5 deletions elliott/elliottlib/cli/find_bugs_qe_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ def close_reconciliation_bugs(runtime, noop: bool, bug_tracker):
include_labels=['art:reconciliation'],
)
if query is None:
# All configured target versions were filtered out (e.g. not yet defined in JIRA
# for a new release). _query() already logged why; nothing to search for.
bugs = []
else:
bugs = bug_tracker._search(query, verbose=runtime.debug)
LOGGER.error(
"Skipping reconciliation bug search: no valid target versions found in Jira"
" (versions may not be set up yet)"
)
return
bugs = bug_tracker._search(query, verbose=runtime.debug)
LOGGER.info(f"Found {len(bugs)} bugs to close: {', '.join(sorted(str(b.id) for b in bugs))}")

close_comment = (
Expand Down
Loading