Skip to content

feat: add Jira ticket context for Azure DevOps reviews#1

Open
dellch wants to merge 3 commits into
mainfrom
feat/jira-ticket-context-azure
Open

feat: add Jira ticket context for Azure DevOps reviews#1
dellch wants to merge 3 commits into
mainfrom
feat/jira-ticket-context-azure

Conversation

@dellch

@dellch dellch commented May 30, 2026

Copy link
Copy Markdown
Owner

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 the atlassian-python-api Jira client (already a dependency); return ticket dicts in the existing tickets_content shape.
  • Wired into the AzureDevopsProvider branch of extract_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.
  • Added 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).
  • Added unit tests for key extraction and ticket fetching.

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

  • Uses the existing atlassian.Jira client (no new dependency) rather than a new issue-provider abstraction. Scope is deliberately small and Azure-only.
  • Config key names match the published docs (jira_api_token under [jira], i.e. JIRA.JIRA_API_TOKEN). The repeated jira_ prefix is redundant vs. other sections like [bitbucket_server]; worth a cleanup discussion if upstreamed.
  • valid_project_keys is present in [jira] config but not yet used to filter key matches.
  • Jira API v2 is assumed (description is a plain string); v3/ADF bodies are skipped rather than dumped as JSON.

Limitations

  • Mocked unit tests only — no live-API test, consistent with the rest of the provider test suite (the existing Azure work-item path has no tests either). Validate against a live Jira before relying on it.

Test plan

  • pytest tests/unittest/test_jira_ticket_extraction.py (16 tests)
  • No regressions in test_extract_issue_from_branch.py, test_azure_devops_parsing.py, test_azure_devops_comment.py
  • Live validation against a Jira Cloud instance

🤖 Generated with Claude Code

dellch and others added 3 commits May 29, 2026 17:47
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>
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.

1 participant