Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request primarily enhances the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the integration-testing and TIPCommon packages to version 2.3.6. Key changes in soar_api.py include migrating API endpoints to the external V1 structure, standardizing response parsing to use the 'items' key, and adding the resume_case_alerts_sla function. Feedback identifies a typo in a dictionary key fallback, a mismatch between the return type hint and actual return value in get_email_template, and docstring style violations where types were redundantly included in the Args and Returns sections.
|
|
||
| if case_type == "alert" and isinstance(results, dict): | ||
| alerts_data = results.pop("caseAlerts", results.pop("case_alerts", [])) | ||
| alerts_data = results.pop("caseAlerts", results.pop("case_alrets", [])) |
| ) -> EmailTemplate: | ||
| """Get email template | ||
| Args: | ||
| chronicle_soar (ChronicleSOAR): A chronicle soar SDK object. | ||
|
|
||
| Returns: | ||
| A list of email templates. | ||
| chronicle_soar (ChronicleSOAR): A chronicle soar SDK object | ||
|
|
||
| Raises: | ||
| requests.HTTPError: If the API request fails. | ||
| """ |
There was a problem hiding this comment.
The return type hint for get_email_template is incorrectly set to EmailTemplate, but the implementation returns a list of templates. Additionally, the docstring should include a Returns section as per Google style and the repository style guide (line 91).
) -> list[EmailTemplate]:
"""Get email templates.
Args:
chronicle_soar: A chronicle soar SDK object.
Returns:
A list of email templates.
"""References
- All function parameters and return types must be annotated. Docstrings should follow Google Style. (link)
| Args: | ||
| chronicle_soar (ChronicleSoar): A chronicle soar SDK object | ||
| case_id (int): Chronicle SOAR case ID | ||
| alert_identifiers (list[str]): List of Chronicle SOAR Alert Identifiers | ||
| message (str): Chronicle SOAR message | ||
|
|
||
| Returns: | ||
| tuple[list[str], list[str]]: Success and failed alert identifiers. |
There was a problem hiding this comment.
According to the repository style guide (line 91), types should not be repeated in the Args or Returns sections of the docstring as they are already defined in the function signature.
| Args: | |
| chronicle_soar (ChronicleSoar): A chronicle soar SDK object | |
| case_id (int): Chronicle SOAR case ID | |
| alert_identifiers (list[str]): List of Chronicle SOAR Alert Identifiers | |
| message (str): Chronicle SOAR message | |
| Returns: | |
| tuple[list[str], list[str]]: Success and failed alert identifiers. | |
| Args: | |
| chronicle_soar: A chronicle soar SDK object. | |
| case_id: Chronicle SOAR case ID. | |
| alert_identifiers: List of Chronicle SOAR Alert Identifiers. | |
| message: Chronicle SOAR message. | |
| Returns: | |
| Success and failed alert identifiers. |
References
- Do not repeat types in the Args or Returns sections. Types should be inferred from the function signature's type hints. (link)
Title: Add resume_case_alerts_sla to soar_api for Case Playbook support
Description
Provide a detailed description of your changes. This helps reviewers understand your work and its context.
What problem does this PR solve? It addresses the requirement of the Case Playbook feature where we need to update all alerts in a case, specifically for resuming the SLA. Previously, soar_api only had resume_alert_sla which handled a single alert. This PR allows bulk resumption of SLA for all alerts associated with a case.
How does this PR solve the problem? I added a new method resume_case_alerts_sla in soar_api.py. This function takes a case ID and a list of alert identifiers, iterates through the alerts in a loop, and calls the existing resume_alert_sla method for each one one-by-one.
Any other relevant information (e.g., design choices, tradeoffs, known issues): This change was implemented as an iterative function on top of the existing single-alert functionality to minimize risk and avoid regressions in the core API logic. It does not affect the current functionality of resume_alert_sla.
Checklist:
Please ensure you have completed the following items before submitting your PR.
This helps us review your contribution faster and more efficiently.
General Checks:
Open-Source Specific Checks:
For Google Team Members and Reviewers Only:
Screenshots (If Applicable)
If your changes involve UI or visual elements, please include screenshots or GIFs here.
Ensure any sensitive data is redacted or generalized.
Further Comments / Questions
Any additional comments, questions, or areas where you'd like specific feedback.