Skip to content

Fix bridge bug mirroring failures in ocp4-scan-konflux - #3202

Open
joepvd wants to merge 2 commits into
openshift-eng:mainfrom
joepvd:fix-bridge-bug-mirroring
Open

Fix bridge bug mirroring failures in ocp4-scan-konflux#3202
joepvd wants to merge 2 commits into
openshift-eng:mainfrom
joepvd:fix-bridge-bug-mirroring

Conversation

@joepvd

@joepvd joepvd commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix the root cause of bridge bug mirroring failures: _build_issue_fields was setting versions to an empty list, preventing create_issue from applying the tracker's configured Affects Versions. Jira rejected the creation with HTTP 400 ("Affects versions is required").
  • Make bridge bug mirroring errors fully non-fatal in the scan pipeline by catching all exceptions (not just ChildProcessError), so failures in config loading, the elliott command, or Slack notification cannot block the scan.

Test plan

  • pytest elliott/tests/test_find_bugs_bridge_cli.py — 12 tests pass
  • pytest pyartcd/tests/pipelines/test_ocp4_scan_konflux.py — 10 tests pass (including 2 new tests for broader error handling)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved resilience of bridge bug mirroring so unexpected errors no longer interrupt the scan pipeline.
    • Prevented notification failures from causing additional pipeline failures.
    • Updated JIRA mirrored issue creation to only include versions that exist in the target project (omit the versions field when none are valid).
    • Reduced noisy log output when creating issue links on JIRA.
  • Tests
    • Added async coverage to ensure bridge bug mirroring completes without propagating configuration-loading or notification errors.

@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign rayfordj for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: Enterprise

Run ID: 4aadb1eb-c903-4528-9c5f-d065c061b040

📥 Commits

Reviewing files that changed from the base of the PR and between bd15fd0 and 8ac2a66.

📒 Files selected for processing (5)
  • elliott/elliottlib/bzutil.py
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
  • elliott/tests/test_bzutil.py
  • pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
💤 Files with no reviewable changes (1)
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
  • elliott/elliottlib/bzutil.py

Walkthrough

JIRA issue creation now validates configured versions against project versions, while bridge payloads omit empty version fields. Bridge bug mirroring contains setup, execution, and Slack notification failures, with tests covering configuration and notification errors.

Changes

JIRA and bridge issue handling

Layer / File(s) Summary
Validate JIRA versions and suppress link warnings
elliott/elliottlib/bzutil.py, elliott/tests/test_bzutil.py
Configured versions are filtered against available project versions, lookup failures preserve the original list, excluded versions are logged, and upstream link warnings are temporarily suppressed.
Omit empty bridge versions
elliott/elliottlib/cli/find_bugs_bridge_cli.py
Bridge issue payloads no longer include versions initialized to an empty list.

Bridge mirroring resilience

Layer / File(s) Summary
Contain mirroring failures and test error paths
pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py, pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
Bridge mirroring catches setup and execution exceptions, separately catches Slack notification failures, and tests configuration and notification error paths.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: thegreyd

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai-Attribution ⚠️ Warning HEAD uses Co-Authored-By: Claude Opus 4.6, and no Assisted-by/Generated-by trailer is present. Replace the AI Co-Authored-By trailer with a Red Hat Assisted-by or Generated-by trailer in the commit message.
✅ 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 is concise and accurately summarizes the main change: fixing bridge bug mirroring failures in ocp4-scan-konflux.
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 Touched code only adjusts JIRA fields and error handling; no MD5/SHA1/DES/RC4/etc., custom crypto, or secret comparisons are present.
Container-Privileges ✅ Passed No changed file adds privileged container/K8s settings; the diff only touches Python pipeline/tests and none contain privilege-related fields.
No-Sensitive-Data-In-Logs ✅ Passed No new sensitive data is logged; added bridge-mirroring error logs are generic, and the issue-field change removes a field rather than exposing one.
No-Hardcoded-Secrets ✅ Passed No hardcoded secrets, credential literals, private keys, or suspicious base64 strings were present in the modified files.
No-Injection-Vectors ✅ Passed No listed injection sinks appear in the changed code: no eval/exec/os.system/pickle/yaml.load/shell=True, and subprocess calls use arg lists plus yaml.safe_load.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@joepvd

joepvd commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@joepvd

joepvd commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Retry test build (VERSION=4.23, ART_TOOLS_COMMIT=joepvd@fix-bridge-bug-mirroring): https://art-jenkins.apps.prod-stable-spoke1-dc-iad2.itup.redhat.com/job/aos-cd-builds/job/build%252Focp4-scan-konflux/54792/

@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

🤖 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 `@pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py`:
- Around line 310-318: Update the exception handlers in the bridge bug mirroring
failure flow to stop logging raw exception messages or tracebacks that may
expose sensitive details. In the handler around the bridge mirroring operation
and the nested Slack notification handler, log only a sanitized exception type
(such as the exception class name) while preserving the existing failure
handling and notification behavior.
🪄 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: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a0518b3a-0956-4e94-a555-d754b2c1efff

📥 Commits

Reviewing files that changed from the base of the PR and between 666e957 and 7af8892.

📒 Files selected for processing (3)
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
  • pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
💤 Files with no reviewable changes (1)
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py

Comment thread pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py
@joepvd
joepvd force-pushed the fix-bridge-bug-mirroring branch from 7af8892 to f1e63b2 Compare July 27, 2026 11:20

@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)
pyartcd/tests/pipelines/test_ocp4_scan_konflux.py (1)

221-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that the injected failure paths were exercised.

These tests only assert that the handler returns. Add assert_awaited_once() for load_group_config/cmd_assert_async and assert_called_once_with() for new_slack_client; otherwise a regression that skips mirroring or notification would still pass.

🤖 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 `@pyartcd/tests/pipelines/test_ocp4_scan_konflux.py` around lines 221 - 236,
Update test_handle_bridge_bug_mirroring_does_not_fail_on_slack_error to assert
load_group_config and cmd_assert_async were each awaited once, and assert
runtime.new_slack_client was called once with its expected arguments, confirming
both mirroring and notification failure paths were exercised.
🤖 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 `@pyartcd/tests/pipelines/test_ocp4_scan_konflux.py`:
- Around line 215-220: Update
test_handle_bridge_bug_mirroring_does_not_fail_on_config_error to override the
Slack client returned by runtime.new_slack_client, using a synchronous MagicMock
for bind_channel and an async mock for say, matching the failure test setup.
Keep the config-loading RuntimeError scenario and ensure no un-awaited coroutine
is created by handle_bridge_bug_mirroring.

---

Nitpick comments:
In `@pyartcd/tests/pipelines/test_ocp4_scan_konflux.py`:
- Around line 221-236: Update
test_handle_bridge_bug_mirroring_does_not_fail_on_slack_error to assert
load_group_config and cmd_assert_async were each awaited once, and assert
runtime.new_slack_client was called once with its expected arguments, confirming
both mirroring and notification failure paths were exercised.
🪄 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: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9a848a3b-b917-45cf-b114-ba931428c524

📥 Commits

Reviewing files that changed from the base of the PR and between 7af8892 and f1e63b2.

📒 Files selected for processing (2)
  • pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py

Comment thread pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
@joepvd
joepvd force-pushed the fix-bridge-bug-mirroring branch from f1e63b2 to 68abf8a Compare July 27, 2026 11:25
@joepvd

joepvd commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

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

🧹 Nitpick comments (2)
elliott/elliottlib/bzutil.py (2)

992-993: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Cache project versions across issue creations.

create_issue performs a remote project_versions lookup for every issue with configured versions. Batch mirroring can therefore generate redundant JIRA requests and amplify latency or rate-limit failures. Cache successful lookups on JIRABugTracker, while allowing transient failures to retry.

🤖 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 992 - 993, Update JIRABugTracker’s
create_issue version-resolution flow around
self._client.project_versions(self.project) to cache successful project-version
lookups and reuse them across issue creations. Store the cache on the tracker
instance, but only populate it after a successful remote lookup so transient
failures remain retryable; preserve the existing behavior when versions are
configured.

992-996: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Do not swallow every exception as a lookup failure.

except Exception also hides programming errors such as malformed JIRA version objects, then returns the unvalidated configured list and bypasses the new allow-list. Catch only the expected JIRA/transport failures and re-raise unexpected exceptions; verify the exact exception hierarchy for jira 3.10.5.

🤖 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 992 - 996, Update the exception
handling around self._client.project_versions in the project-version lookup to
catch only the specific JIRA/transport exception types supported by jira 3.10.5.
Preserve the fallback to configured versions for those expected failures, while
allowing malformed version data and all other unexpected exceptions to propagate
instead of bypassing validation.

Source: Linters/SAST tools

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

Nitpick comments:
In `@elliott/elliottlib/bzutil.py`:
- Around line 992-993: Update JIRABugTracker’s create_issue version-resolution
flow around self._client.project_versions(self.project) to cache successful
project-version lookups and reuse them across issue creations. Store the cache
on the tracker instance, but only populate it after a successful remote lookup
so transient failures remain retryable; preserve the existing behavior when
versions are configured.
- Around line 992-996: Update the exception handling around
self._client.project_versions in the project-version lookup to catch only the
specific JIRA/transport exception types supported by jira 3.10.5. Preserve the
fallback to configured versions for those expected failures, while allowing
malformed version data and all other unexpected exceptions to propagate instead
of bypassing validation.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 5cf6cfff-50c6-4897-89e5-43c75db213ed

📥 Commits

Reviewing files that changed from the base of the PR and between f1e63b2 and 68abf8a.

📒 Files selected for processing (4)
  • elliott/elliottlib/bzutil.py
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
  • pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
💤 Files with no reviewable changes (1)
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py

@joepvd
joepvd force-pushed the fix-bridge-bug-mirroring branch from 68abf8a to bd15fd0 Compare July 27, 2026 11:46

@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: 2

🧹 Nitpick comments (1)
elliott/elliottlib/bzutil.py (1)

1184-1192: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid mutating the process-wide Jira logger for one call.

setLevel(logging.ERROR) suppresses every warning from jira.client, not just the known link-type message. If mirror tasks overlap, interleaved save/restore operations can also leave the logger at an incorrect level. Prefer filtering the specific message or verify that link creation is strictly serialized for the jira client version in use.

🤖 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 1184 - 1192, Update the
link-creation flow around self._client.create_issue_link to avoid changing the
process-wide jira.client logger level. Prefer a temporary filter that suppresses
only the known “Specified issue link type is not present” message while
preserving all other warnings; otherwise, ensure calls are strictly serialized
with safe restoration for the Jira client version in use.
🤖 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 993-997: Update _filter_valid_versions to catch only the specific
Jira client or network exception types that represent recoverable
project-version fetch failures, rather than broad Exception. Preserve returning
the configured versions for those handled failures, and include traceback
details in the logger.warning call; allow unexpected errors and malformed
responses to propagate.
- Around line 968-970: Cache the filtered project-version names on
JIRABugTracker before bridge issue creation, then update create_issue’s versions
handling to reuse that cache instead of calling project_versions() for each
issue when version is configured. Preserve the existing filtering and
fields['versions'] construction, and ensure the cache is populated once per
relevant Jira project.

---

Nitpick comments:
In `@elliott/elliottlib/bzutil.py`:
- Around line 1184-1192: Update the link-creation flow around
self._client.create_issue_link to avoid changing the process-wide jira.client
logger level. Prefer a temporary filter that suppresses only the known
“Specified issue link type is not present” message while preserving all other
warnings; otherwise, ensure calls are strictly serialized with safe restoration
for the Jira client version in use.
🪄 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: openshift-eng/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ec06bea0-91b3-4e34-86f3-4018022eca0d

📥 Commits

Reviewing files that changed from the base of the PR and between 68abf8a and bd15fd0.

📒 Files selected for processing (4)
  • elliott/elliottlib/bzutil.py
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
  • pyartcd/pyartcd/pipelines/ocp4_scan_konflux.py
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py
💤 Files with no reviewable changes (1)
  • elliott/elliottlib/cli/find_bugs_bridge_cli.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyartcd/tests/pipelines/test_ocp4_scan_konflux.py

Comment thread elliott/elliottlib/bzutil.py
Comment on lines +993 to +997
try:
project_versions = {v.name for v in self._client.project_versions(self.project)}
except Exception:
logger.warning("Could not fetch project versions for %s; using configured versions as-is", self.project)
return versions

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant file around the reported lines
sed -n '930,1035p' elliott/elliottlib/bzutil.py

# Find where project_versions is defined or used
rg -n "project_versions\(" elliott -S

# Find create_issue call path / version handling around this helper
rg -n "create_issue|_filter_valid_versions|versions as-is|using configured versions" elliott -S

# Show nearby definitions and imports for exception handling context
sed -n '1,140p' elliott/elliottlib/bzutil.py

Repository: openshift-eng/art-tools

Length of output: 12960


🌐 Web query:

python-jira project_versions exceptions JIRAError requests.exceptions documentation

💡 Result:

In the python-jira library, project versions are accessed via the project_versions method, which belongs to the JIRA client class [1][2][3]. The primary exception raised by the library is JIRAError, which is defined in the jira.exceptions module [4][5][6]. JIRAError is a general exception raised for problems encountered during client operations [4]. It contains attributes such as status_code, text, url, request, and response, which can be useful for debugging when an API request fails [4]. Because the python-jira library uses the requests library under the hood for HTTP communication, you may also encounter exceptions from requests (e.g., requests.exceptions.RequestException or connection-related errors) [4][6][7]. It is best practice to handle these exceptions separately if you need to distinguish between library-specific logic errors (JIRAError) and underlying transport or network issues (requests.exceptions) [6][7]. Example usage: from jira import JIRA from jira.exceptions import JIRAError import requests jira = JIRA('https://your-jira-instance.com', auth=('user', 'pass')) try: versions = jira.project_versions('PROJECT_KEY') for version in versions: print(version.name) except JIRAError as e: print(f"JIRA API error: {e.status_code} - {e.text}") except requests.exceptions.RequestException as e: print(f"Network or request error: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")

Citations:


Narrow the fallback in _filter_valid_versions Catch only the Jira client/network exceptions you can recover from instead of Exception, and include the traceback in the warning so unexpected bugs and malformed responses still surface.

🧰 Tools
🪛 Ruff (0.15.21)

[warning] 995-995: Do not catch blind exception: Exception

(BLE001)

🤖 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 993 - 997, Update
_filter_valid_versions to catch only the specific Jira client or network
exception types that represent recoverable project-version fetch failures,
rather than broad Exception. Preserve returning the configured versions for
those handled failures, and include traceback details in the logger.warning
call; allow unexpected errors and malformed responses to propagate.

Source: Linters/SAST tools

joepvd and others added 2 commits July 27, 2026 14:18
The _build_issue_fields method was explicitly setting versions to an
empty list, which prevented bzutil.create_issue from applying the
tracker's configured default versions. Jira's OCPBUGS project requires
a non-empty Affects Versions field, causing issue creation to fail with
HTTP 400.

Remove the explicit empty assignment so create_issue fills in the
tracker's configured versions automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Broaden the exception handling in handle_bridge_bug_mirroring to catch
all exceptions, not just ChildProcessError from the elliott subprocess.
This prevents failures in config loading or Slack notification from
blocking the scan pipeline. The Slack notification is also wrapped in
its own try/except to avoid masking the original error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joepvd
joepvd force-pushed the fix-bridge-bug-mirroring branch from bd15fd0 to 8ac2a66 Compare July 27, 2026 12:19
@openshift-ci

openshift-ci Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@joepvd: The following tests 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/art-pre-commit-check 8ac2a66 link false /test art-pre-commit-check
ci/prow/security 8ac2a66 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.

@thegreyd thegreyd added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jul 28, 2026
if versions and 'versions' not in fields:
fields['versions'] = [{'name': version} for version in versions]
versions = self._filter_valid_versions(versions)
if versions:

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.

_filter_valid_versions() can return an empty list, after which create_issue() simply omits versions. Since Affects Version is required, this can still result in HTTP 400—just with “Affects versions is required.” It could fail early with an actionable ValueError, or deliberately select a valid fallback.

# upstream jira library — it fires even when the link type name is correct.
jira_logger = logging.getLogger("jira.client")
prev_level = jira_logger.level
jira_logger.setLevel(logging.ERROR)

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.

create_issue_link() temporarily changes the global jira.client logger level. Concurrent calls can restore levels in the wrong order, potentially leaving Jira logging permanently suppressed. This could be replaced with a narrowly scoped logging filter.

mock_issue = flexmock(key="OCPBUGS-1")
mock_jira_client = flexmock()
mock_version = flexmock(name="4.23")
mock_jira_client.should_receive("project_versions").with_args("OCPBUGS").and_return([mock_version])

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.

The existing default-field test was adjusted, but there are no tests covering partially invalid versions, all-invalid versions, project_versions() failure, or cache behavior. These cases could be added as regression coverage.

except ChildProcessError as e:

except Exception as e:
self.logger.error("Bridge bug mirroring failed for %s: %s", self.version, e)

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.

handle_bridge_bug_mirroring() now catches every Exception, but records only logger.error(... %s, e). Because the error is intentionally non-fatal, the log is the primary diagnostic evidence. It could use logger.exception(...) to preserve the traceback.

fields['versions'] = [{'name': version} for version in versions]
if target_releases is None:
target_releases = self.target_release()
if target_releases and self.field_target_version not in fields:

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.

Target Version validation currently uses the values available to Jira’s Bug issue type, while bridge mirrors preserve the source issue type and may create a Story or another type. Since Jira field contexts can vary by issue type, a target version can pass Elliott’s initial validation but still be rejected during creation. This is visible in ocp4-scan-konflux build 54792, where 4.23.z is excluded from the query but issue creation subsequently fails with Version name '4.23.z' is not valid. Could we extend this change to validate target_releases against the Target Version values allowed for the actual issue type in fields?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants