RAID Module¤
The RAID module provides enhanced Jira integration for incident management and external ticket creation.
Overview¤
RAID (Request And Issue Database) extends FireFighter's capabilities with:
- Automatic Jira ticket creation for incidents
- External API for ticket creation (Landbot integration)
- Smart user resolution based on email domains
- Priority mapping from P1-P5 to Jira priorities
- Attachment handling for external submissions
- Slack notifications for ticket updates
Priority Mapping¤
The RAID module supports full P1-P5 priority mapping:
| Priority | Level | Jira Priority | Use Case |
|---|---|---|---|
| P1 | Critical | 1 | System outages, complete service failures |
| P2 | High | 2 | Major functionality impaired, significant impact |
| P3 | Medium | 3 | Minor functionality affected, moderate impact |
| P4 | Low | 4 | Small issues, minimal impact |
| P5 | Lowest | 5 | Cosmetic issues, enhancement requests |
User Resolution¤
The module handles user resolution for external ticket creation:
- Internal users: Direct mapping from email to existing users
- External users: Email domain-based routing to default Jira users
- Slack fallback: Attempts to find users via Slack integration
- Default assignment: Falls back to configured default Jira user
API Reference¤
raid ¤
RAID is ManoMano's internal issue dispatcher.
It works with Slack and Jira to create, update and close issues.
It is currently not configurable.
Modules:
client ¤
Classes:
RaidJiraClient ¤
Bases: JiraClient
Methods:
-
add_attachments_to_issue–Add attachments to a Jira issue.
-
get_jira_user_from_jira_id–Look for a Jira User in DB, if not found, fetch it from Jira API.
-
get_jira_user_from_user–Fetches a Jira user from the Jira API.
-
get_watchers_from_jira_ticket–Fetch watchers for a specific Jira ticket from Jira API.
-
transition_issue_auto–Attempts to close an issue by applying transitions to it.
Source code in src/firefighter/jira_app/client.py
add_attachments_to_issue staticmethod ¤
Add attachments to a Jira issue.
Parameters:
Raises:
-
JiraAttachmentError–if there is an error while adding any attachment
Source code in src/firefighter/raid/client.py
get_jira_user_from_jira_id ¤
Look for a Jira User in DB, if not found, fetch it from Jira API.
Parameters:
-
jira_account_id(str) –Jira account id
Raises:
-
JiraUserNotFoundError–User not found in Jira nor in DB
-
JiraUserDatabaseError–Unable to create user in DB
-
ValueError–Empty jira_account_id
Returns:
-
JiraUser(JiraUser) –Jira user object
Source code in src/firefighter/jira_app/client.py
get_jira_user_from_user ¤
Fetches a Jira user from the Jira API.
Parameters:
-
user(User) –User object
Raises:
-
JiraUserNotFoundError–User not found in Jira
Returns:
-
JiraAPIUser(JiraUser) –Jira API user object
Source code in src/firefighter/jira_app/client.py
get_watchers_from_jira_ticket ¤
Fetch watchers for a specific Jira ticket from Jira API.
Parameters:
Raises:
-
ValueError–Empty issue id
Returns:
-
list(User) –List of Jira users object, or empty list if ticket doesn't exist
Source code in src/firefighter/jira_app/client.py
transition_issue_auto ¤
Attempts to close an issue by applying transitions to it.
Parameters:
-
issue_id(str | int) –Jira issue id
-
target_status_name(str) –target status name
-
workflow_name(str) –workflow name
Source code in src/firefighter/jira_app/client.py
forms ¤
Functions:
-
prepare_jira_fields–Prepare all fields for jira_client.create_issue().
prepare_jira_fields ¤
prepare_jira_fields(
*,
title: str,
description: str,
priority: int,
reporter: str,
incident_category: str,
environments: list[str],
platforms: list[str],
impacts_data: dict[str, ImpactLevel],
optional_fields: dict[str, Any] | None = None
) -> dict[str, Any]
Prepare all fields for jira_client.create_issue().
This function centralizes Jira field preparation for both P1-P3 and P4-P5 incidents, ensuring all custom fields are properly passed.
Parameters:
-
title(str) –Incident title
-
description(str) –Incident description
-
priority(int) –Priority value (1-5)
-
reporter(str) –Jira user account ID
-
incident_category(str) –Category name
-
environments(list[str]) –List of environment values (e.g. ["PRD", "STG"])
-
platforms(list[str]) –List of platform values (e.g. ["platform-FR", "platform-DE"])
-
impacts_data(dict[str, ImpactLevel]) –Dictionary of impact data for business_impact computation
-
optional_fields(dict[str, Any] | None, default:None) –Optional dictionary containing: - zendesk_ticket_id: Zendesk ticket ID (customer-specific) - seller_contract_id: Seller contract ID (seller-specific) - zoho_desk_ticket_id: Zoho Desk ticket ID (seller-specific) - is_key_account: Key account flag (seller-specific) - is_seller_in_golden_list: Golden list flag (seller-specific) - suggested_team_routing: Suggested team routing (P4-P5 only)
Returns:
Source code in src/firefighter/raid/forms.py
models ¤
serializers ¤
Classes:
Functions:
-
validate_no_spaces–Ensure the string does not contain spaces.
LandbotIssueRequestSerializer ¤
Bases: ModelSerializer[JiraTicket]
Methods:
-
validate_labels–Transform null labels to empty list.
validate_labels ¤
service ¤
Classes:
-
CustomerIssueData–Data container for customer issue creation parameters.
Functions:
-
create_issue_customer–Creates a Jira Incident issue of type Customer.
-
create_issue_documentation_request–Creates a Jira issue of type Documentation/Process Request.
-
create_issue_feature_request–Creates a Jira issue of type Feature Request.
-
create_issue_internal–Creates a Jira Incident Issue of type Internal.
-
create_issue_seller–Creates a Jira Incident issue of type Seller.
-
get_jira_user_from_user–Returns the JiraUser object for a given user, if it exists in DB or can be fetched on Jira API. Returns the default JiraUser if not found.
CustomerIssueData dataclass ¤
CustomerIssueData(
priority: int | None,
labels: list[str] | None,
platform: str,
business_impact: str | None,
team_to_be_routed: str | None,
area: str | None,
zendesk_ticket_id: str | None,
incident_category: str | None = None,
)
Data container for customer issue creation parameters.
create_issue_customer ¤
create_issue_customer(title: str, description: str, reporter: str, issue_data: CustomerIssueData) -> JiraObject
Creates a Jira Incident issue of type Customer.
Parameters:
-
title(str) –Summary of the issue
-
description(str) –Description of the issue
-
reporter(str) –Jira account id of the reporter
-
issue_data(CustomerIssueData) –Container with issue parameters
Source code in src/firefighter/raid/service.py
create_issue_documentation_request ¤
create_issue_documentation_request(
title: str, description: str, reporter: str, priority: int | None, labels: list[str] | None, platform: str
) -> JiraObject
Creates a Jira issue of type Documentation/Process Request.
Parameters:
-
title(str) –Summary of the issue
-
description(str) –Description of the issue
-
reporter(str) –Jira account id of the reporter
-
priority(int) –Priority of the issue
-
labels(list[str]) –Labels to add to the issue
-
platform(str) –Platform of the issue
Source code in src/firefighter/raid/service.py
create_issue_feature_request ¤
create_issue_feature_request(
title: str, description: str, reporter: str, priority: int | None, labels: list[str] | None, platform: str
) -> JiraObject
Creates a Jira issue of type Feature Request.
Parameters:
-
title(str) –Summary of the issue
-
description(str) –Description of the issue
-
reporter(str) –Jira account id of the reporter
-
priority(int) –Priority of the issue
-
labels(list[str]) –Labels to add to the issue
-
platform(str) –Platform of the issue
Source code in src/firefighter/raid/service.py
create_issue_internal ¤
create_issue_internal(
title: str,
description: str,
reporter: str,
priority: int | None,
labels: list[str] | None,
platform: str,
business_impact: str | None,
team_to_be_routed: str | None,
incident_category: str | None,
) -> JiraObject
Creates a Jira Incident Issue of type Internal.
Parameters:
-
title(str) –Summary of the issue
-
description(str) –Description of the issue
-
reporter(str) –Jira account id of the reporter
-
priority(int) –Priority of the issue
-
labels(list[str]) –Labels to add to the issue
-
platform(str) –Platform of the issue
-
business_impact(str) –Business impact of the issue
-
team_to_be_routed(str) –Team to be routed
-
incident_category(str) –Incident category of the issue
Source code in src/firefighter/raid/service.py
create_issue_seller ¤
create_issue_seller(
title: str,
description: str,
reporter: str,
priority: int | None,
labels: list[str] | None,
platform: str,
business_impact: str | None,
team_to_be_routed: str | None,
incident_category: str | None,
seller_contract_id: str | None,
is_key_account: bool | None,
is_seller_in_golden_list: bool | None,
zoho_desk_ticket_id: str | None,
) -> JiraObject
Creates a Jira Incident issue of type Seller.
Parameters:
-
title(str) –Summary of the issue
-
description(str) –Description of the issue
-
reporter(str) –Jira account id of the reporter
-
priority(int) –Priority of the issue
-
labels(list[str]) –Labels to add to the issue
-
platform(str) –Platform of the issue
-
business_impact(str) –Business impact of the issue
-
team_to_be_routed(str) –Team to be routed
-
incident_category(str) –Incident category of the issue
-
seller_contract_id(str) –Seller contract id
-
is_key_account(bool) –Is key account
-
is_seller_in_golden_list(bool) –Is seller in golden list
-
zoho_desk_ticket_id(str) –Zoho desk ticket id
Source code in src/firefighter/raid/service.py
get_jira_user_from_user ¤
Returns the JiraUser object for a given user, if it exists in DB or can be fetched on Jira API. Returns the default JiraUser if not found.
Source code in src/firefighter/raid/service.py
utils ¤
Functions:
-
get_domain_from_email–Returns the domain from an email address.
get_domain_from_email cached ¤
Returns the domain from an email address.
Removes any subdomain(s) and the @, applies .lower().
Parameters:
-
email(str) –The email address to extract the domain from.
Returns:
-
str–The domain part of the email address.
Raises:
-
ValueError–If the email is not well-formed.
Examples:
john.doe@example.com=>example.comalice.bob@test.example.ORG=>example.orgwebmaster@localhost=>localhost
Source code in src/firefighter/raid/utils.py
views ¤
Classes:
CreateJiraBotView ¤
Bases: CreateModelMixin, GenericAPIView[JiraTicket]
Methods:
-
post–Allow to create a Jira ticket through Landbot.
post ¤
Allow to create a Jira ticket through Landbot. Requires a valid Bearer token, that you can create in the back-office if you have the right permissions.
Source code in src/firefighter/raid/views/__init__.py
JiraCommentAlertView ¤
Bases: CreateAPIView[Any]
Methods:
-
post–Allow to send a message in Slack when a comment in a Jira ticket is created or modified.
post ¤
Allow to send a message in Slack when a comment in a Jira ticket is created or modified. Requires a valid Bearer token, that you can create in the back-office if you have the right permissions.
Source code in src/firefighter/raid/views/__init__.py
JiraUpdateAlertView ¤
Bases: CreateAPIView[Any]
Methods:
-
post–Allow to send a message in Slack when some fields ("Priority", "project", "description", "status") of a Jira ticket are updated.
post ¤
Allow to send a message in Slack when some fields ("Priority", "project", "description", "status") of a Jira ticket are updated. Requires a valid Bearer token, that you can create in the back-office if you have the right permissions.