Skip to content

PR to issue full sync#470

Merged
Bala-Sakabattula merged 7 commits into
release-engineering:mainfrom
Bala-Sakabattula:PR-to-issue
May 22, 2026
Merged

PR to issue full sync#470
Bala-Sakabattula merged 7 commits into
release-engineering:mainfrom
Bala-Sakabattula:PR-to-issue

Conversation

@Bala-Sakabattula
Copy link
Copy Markdown
Collaborator

Summary
Extends the existing Sync2Jira integration to support full synchronization between Pull Requests and Jira Issues by reusing the existing Issue update pipeline, eliminating code duplication and ensuring consistent behavior across both sync types using Delegation pattern.

Problem
Previously, downstream_pr.py had its own minimal update_jira_issue that only handled three operations: PR link comments, merge_transition, and link_transition. All other update capabilities available to Issues (comments, description, title, assignee, tags, GitHub project fields, on_close labels) were not available for PRs.

Solution
Unified update pipeline via updates_key parameter

The core change introduces an updates_key parameter (defaulting to "issue_updates") to the shared update functions in downstream_issue.py, allowing the same code path to serve both Issues ("issue_updates") and PRs ("pr_updates"):

  • _update_jira_issue(existing, issue, client, config, updates_key="issue_updates") — master orchestrator
  • _update_transition(client, existing, issue, updates_key="issue_updates")
  • _build_description(issue, updates_key="issue_updates")
  • _update_description(existing, issue, updates_key="issue_updates")

PR-specific operations remain separate

Functions with no Issue equivalent stay in downstream_pr.py:

format_comment / issue_link_exists / comment_exists — PR link announcement
_update_pr_transitions — merge_transition (PR merged) and link_transition (PR first linked)

PR update_jira_issue now delegates to the shared pipeline:

def update_jira_issue(existing, pr, client, config):
    _update_pr_transitions(client, existing, pr)        # PR-specific
    d_issue._update_jira_issue(                          # Shared pipeline
        existing, pr, client, config, updates_key="pr_updates"
    ) 

Files changed

  • sync2jira/downstream_issue.py — Added updates_key parameter to _update_jira_issue, _update_transition, _build_description, _update_description; extracted maybe_convert_markdown; made _build_description handle reporter as dict or string; used hasattr/getattr for Issue-only fields
  • sync2jira/downstream_pr.py — Restructured: PR-specific functions kept (format_comment, issue_link_exists, comment_exists, _update_pr_transitions, _update_pr_transition); update_jira_issue now delegates to shared pipeline; update_jira uses maybe_convert_markdown
  • fedmsg.d/sync2jira.py — Updated example config to show both issue_updates and pr_updates with inline documentation
  • tests/test_downstream_pr.py — Updated assertions for new update_jira_issue signature (added config param); added shared pipeline delegation assertions; renamed test_update_transition to test_update_pr_transition
  • tests/test_downstream_issue.py — Updated assertions for _update_description and _update_transition to include updates_key kwarg

Backward compatibility

  • All updates_key parameters default to "issue_updates" — existing Issue configs are unchanged
  • Existing pr_updates configs with merge_transition/link_transition continue to work as before

@Bala-Sakabattula Bala-Sakabattula requested review from webbnh and removed request for Zyzyx and ralphbean May 13, 2026 12:45
webbnh

This comment was marked as resolved.

webbnh

This comment was marked as resolved.

webbnh

This comment was marked as resolved.

@psss psss mentioned this pull request May 19, 2026
webbnh

This comment was marked as resolved.

@Bala-Sakabattula
Copy link
Copy Markdown
Collaborator Author

@webbnh I added test cases for transition flow with three cases scenarios as well for maybe_convert_markdown

webbnh
webbnh previously approved these changes May 20, 2026
Copy link
Copy Markdown
Collaborator

@webbnh webbnh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, but, unfortunately, you've got merge conflicts to resolve. 😬

Copy link
Copy Markdown
Collaborator

@webbnh webbnh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Bala-Sakabattula Bala-Sakabattula merged commit 39d0bd8 into release-engineering:main May 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants