Skip to content

Bug 1997384 - Create a mapping table in the JiraWebhookSync extension the map jira ids to bug ids#2515

Merged
dklawren merged 5 commits intomozilla-bteam:masterfrom
dklawren:1997384
Nov 13, 2025
Merged

Bug 1997384 - Create a mapping table in the JiraWebhookSync extension the map jira ids to bug ids#2515
dklawren merged 5 commits intomozilla-bteam:masterfrom
dklawren:1997384

Conversation

@dklawren
Copy link
Collaborator

@dklawren dklawren commented Nov 2, 2025

No description provided.

@dklawren dklawren requested a review from Copilot November 2, 2025 22:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to intercept Jira see_also URLs and store them in a dedicated mapping table instead of as regular see_also links. This is a workaround for JBI design choices that require the see_also value to not exist to prevent duplicate Jira tickets.

Key changes:

  • Introduces a new jira_bug_map database table to store bug-to-Jira ticket mappings
  • Adds configuration parameter jira_webhook_sync_project_keys to specify which Jira projects should use the mapping table
  • Intercepts see_also additions in bug_start_of_update hook and redirects configured Jira URLs to the mapping table
  • Modifies webhook payload to include Jira URLs from the mapping table

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
extensions/JiraWebhookSync/lib/JiraBugMap.pm New module implementing the Jira-to-bug mapping object with validators and URL extraction logic
extensions/JiraWebhookSync/Extension.pm Adds database schema, bug_start_of_update hook to intercept see_also, and webhook_before_send logic to inject mapped URLs
extensions/JiraWebhookSync/lib/Config.pm Adds new configuration parameter for project keys with JSON validation
extensions/JiraWebhookSync/template/en/default/admin/params/jirawebhooksync.html.tmpl Adds description for the new project keys parameter
extensions/JiraWebhookSync/template/en/default/global/user-error.html.tmpl New template file defining error messages for Jira mapping validation failures
t/.perlcritic-history Updates PerlCritic violation count for RequireArgUnpacking policy
Comments suppressed due to low confidence (1)

extensions/JiraWebhookSync/lib/Config.pm:1

  • The parameter description is missing a trailing comma after the closing quote, which is inconsistent with the pattern used in the jira_webhook_sync_config parameter above (line 40).
# This Source Code Form is subject to the terms of the Mozilla Public

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dklawren dklawren requested review from cgsheeh and Copilot November 5, 2025 21:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 138 to 162
# Match patterns like:
# - https://jira.example.com/PROJ-123
# - https://jira.example.com/browse/PROJ-123
# - https://jira.example.com/projects/PROJ/issues/PROJ-123

my ($project_key, $jira_id);

if ($url->path =~ m{^/?([[:upper:]]+)-\d+$}) {

# Direct format: PROJ-123
$jira_id = $url->path;
$project_key = $1;
}
elsif ($url->path =~ m{/browse/([[:upper:]]+-\d+)}) {

# URL format: /browse/PROJ-123
$jira_id = $1;
($project_key) = $jira_id =~ /^([[:upper:]]+)-/;
}
elsif ($url->path =~ m{/issues/([[:upper:]]+-\d+)}) {

# URL format: /issues/PROJ-123
$jira_id = $1;
($project_key) = $jira_id =~ /^([[:upper:]]+)-/;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: this would go well in a separate function, where we could add a unit test for it.

'/webhooks/last_payload' => sub {
my $c = shift;
my $data = $cache->{webhook_last_payload};
my $data = delete $cache->{webhook_last_payload};
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this change do?

- Removed some patterns that were invalid anyway
- Removed unnecessary deletion of last payload.
@dklawren dklawren merged commit 98b7e37 into mozilla-bteam:master Nov 13, 2025
8 checks passed
@dklawren dklawren deleted the 1997384 branch November 13, 2025 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants