feat: add Jira ticket context for Azure DevOps reviews#1
Open
dellch wants to merge 3 commits into
Open
Conversation
The ticket-analysis section of the review tool (require_ticket_analysis_review) only fetched linked Azure Boards work items on Azure DevOps. Teams that track work in Jira got no ticket context. This adds Jira ticket lookup to the Azure DevOps path. - Add extract_jira_tickets(): find Jira keys in PR title, description and branch name, fetch each via the atlassian-python-api Jira client (already a dependency), and return ticket dicts in the existing tickets_content shape. - Wire it into the AzureDevopsProvider branch of extract_tickets() additively, so linked work items still work and Jira is added when configured. No-op when [jira] is not configured. - find_jira_tickets(): match case-insensitively and normalize keys to upper case so lowercased branch names (e.g. bugfix/abc-123-x) are detected. - Add a [jira] config section and secrets-template entry using the key names from the existing docs (jira_base_url, jira_api_email, jira_api_token). - Add unit tests for key extraction (case, prefixes, URLs, multiple keys) and ticket fetching (auth modes, capping, skip-on-error, not-configured). Candidate keys are capped at 3 and non-resolving keys are skipped, matching the GitHub branch's behaviour. Credentials are read from settings/env, not committed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…et caps - Add jira_requirements_field config: an instance-specific custom field id (e.g. customfield_10127) whose value maps to the ticket "requirements" section. Empty by default. Verified against a live Jira Cloud instance (v2 API returns the field as a plain string, no ADF parsing needed). - Define MAX_TICKETS and MAX_TICKET_CHARACTERS as module constants and reuse them across extract_jira_tickets, extract_ticket_links_from_pr_description and extract_tickets instead of repeating the literals. - Add tests for the requirements field (set / unset). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Jira fetch only uses get_user_description() and get_pr_branch(), which every git provider implements, so there is nothing Azure-specific about it. Move it out of the AzureDevopsProvider branch into a shared step that runs for all providers. - Add add_jira_tickets(git_provider, tickets_content): provider-neutral Jira append, de-duplicated by ticket_url, no-op when Jira is not configured. - Add _get_pr_title(): read the title across providers (.pr for GitHub/Bitbucket, .mr for GitLab), fixing a latent AttributeError on GitLab in the old inline code. - extract_tickets() now builds tickets_content in each provider branch and runs the shared Jira step once at the end, so providers with no native ticket path (Bitbucket, Gitea, CodeCommit, Gerrit) also get Jira context. - Add tests for _get_pr_title and add_jira_tickets. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
The review tool's ticket-analysis section (
require_ticket_analysis_review) only fetched linked Azure Boards work items on Azure DevOps. Teams that track work in Jira got no ticket context. This adds Jira ticket lookup to the Azure DevOps path.extract_jira_tickets(): find Jira keys in PR title, description and branch name; fetch each via theatlassian-python-apiJira client (already a dependency); return ticket dicts in the existingtickets_contentshape.AzureDevopsProviderbranch ofextract_tickets()additively — linked work items still work, Jira is added when configured. No-op when[jira]is not configured.find_jira_tickets(): match case-insensitively and normalize keys to upper case so lowercased branch names (e.g.bugfix/abc-123-x) are detected.[jira]config section and secrets-template entry using the key names from the existing docs (jira_base_url,jira_api_email,jira_api_token).Candidate keys are capped at 3 and non-resolving keys are skipped, matching the GitHub branch. Credentials are read from settings/env, not committed.
Design notes / open questions
atlassian.Jiraclient (no new dependency) rather than a new issue-provider abstraction. Scope is deliberately small and Azure-only.jira_api_tokenunder[jira], i.e.JIRA.JIRA_API_TOKEN). The repeatedjira_prefix is redundant vs. other sections like[bitbucket_server]; worth a cleanup discussion if upstreamed.valid_project_keysis present in[jira]config but not yet used to filter key matches.Limitations
Test plan
pytest tests/unittest/test_jira_ticket_extraction.py(16 tests)test_extract_issue_from_branch.py,test_azure_devops_parsing.py,test_azure_devops_comment.py🤖 Generated with Claude Code