INTEROP-9373: fix(jira): handle epic lookup failure gracefully in create_issue - #280
Merged
Merged
Conversation
Review: Changes look great 👍I've reviewed both commits and the changes fully address the prior feedback. Here's my assessment: Production code (
|
| Test | Scenario | Key assertions |
|---|---|---|
test_epic_lookup_jira_error_does_not_crash |
search_issues raises JIRAError(404) |
Issue created, add_issues_to_epic never called, warning logged |
test_epic_lookup_empty_results_warns_without_error |
search_issues returns [] |
Issue created, no epic link, warning logged |
test_add_issues_to_epic_jira_error_does_not_crash |
add_issues_to_epic raises JIRAError(403) |
Issue created, add_issues_to_epic was called (and failed), warning logged |
The third test is exactly the scenario from the prior review — a permission failure during the epic link step, not during the search step. Nice.
One optional suggestion (non-blocking)
The test_add_issues_to_epic_jira_error_does_not_crash test could additionally verify that exc_info=True was passed to the logger:
assert mock_logger.warning.call_args[1].get("exc_info") is TrueThis would confirm the traceback inclusion is tested, not just present in the source. But this is minor — the current assertions on the message content are the more important checks.
Verdict
No remaining concerns. LGTM — ready to merge once CI is green. 🚀
AI-generated. Review for accuracy.
amp-rh
force-pushed
the
fix-epic-lookup-resilience
branch
from
August 10, 2026 18:13
74746a6 to
f14e7c9
Compare
When the configured epic is inaccessible (404/403), the unhandled JIRAError crashes the entire create_issue method. Because the @ignore_exceptions decorator wraps the full method, this also causes duplicate ticket creation on retry (the issue is already created before the epic lookup runs). Wrap the epic search and link in try/except JIRAError so the issue is still returned successfully when the epic cannot be reached. Downgrade the existing LOGGER.error to LOGGER.warning with exc_info=True to preserve chained transport exception tracebacks for debugging.
amp-rh
force-pushed
the
fix-epic-lookup-resilience
branch
from
August 10, 2026 18:15
f14e7c9 to
0f7b5ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Epic lookup failure in
create_issue()no longer crashes the report run. The issue is filed successfully; only the epic link is skipped.Problem
When the Firewatch SA cannot access the configured epic (HTTP 404/403, e.g. project permissions or a stale epic key),
search_issues()raises aJIRAErrorthat propagates up unhandled. This has two consequences:@ignore_exceptions(retry=3, raise_final_exception=True)decorator retries the entirecreate_issue()method, re-creating the issue that was already filed before the epic lookup failedFix
One file changed:
src/objects/jira_base.pyThe epic link is a nice-to-have for ticket organization; the critical function is filing the ticket itself. This change:
add_issues_to_epicblock intry/except JIRAErrorLOGGER.errortoLOGGER.warning(non-fatal)exc_info=Trueto preserve chained transport exception tracebacks for debuggingThe happy path (epic accessible) is unchanged.
Test plan
One file changed:
tests/unittests/objects/jira/test_jira.pytest_epic_lookup_jira_error_does_not_crashsearch_issuesraisesJIRAError(404)test_epic_lookup_empty_results_warns_without_errorsearch_issuesreturns[]test_add_issues_to_epic_jira_error_does_not_crashadd_issues_to_epicraisesJIRAError(403)test_epic_lookup_uses_unquoted_issue_key_for_cloud_compatibilityFull Jira test suite: 52/52 passing.