From dea8180b58507e7ef2d824f51aef8a97df8e271c Mon Sep 17 00:00:00 2001 From: Avery Date: Wed, 20 Sep 2023 12:37:37 -0700 Subject: [PATCH 1/8] Appends outstanding incident tasks in tactical reports (#3798) * Appends outstanding incident tasks to the end of user input in tactical reports. * Update src/dispatch/plugins/dispatch_slack/incident/interactive.py Co-authored-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> * Update src/dispatch/static/dispatch/src/incident/store.js Co-authored-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> --------- Co-authored-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com> --- .../plugins/dispatch_slack/incident/interactive.py | 2 +- src/dispatch/static/dispatch/src/incident/store.js | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/incident/interactive.py b/src/dispatch/plugins/dispatch_slack/incident/interactive.py index eb2553022f67..f8718e7097fa 100644 --- a/src/dispatch/plugins/dispatch_slack/incident/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/incident/interactive.py @@ -1500,7 +1500,7 @@ def handle_report_tactical_command( incident = incident_service.get(db_session=db_session, incident_id=context["subject"].id) if incident.tasks: - actions = "\n".join( + actions += "\n\nOutstanding Incident Tasks:\n".join( [ "-" + task.description for task in incident.tasks diff --git a/src/dispatch/static/dispatch/src/incident/store.js b/src/dispatch/static/dispatch/src/incident/store.js index 8311fb67c639..bf57d004f858 100644 --- a/src/dispatch/static/dispatch/src/incident/store.js +++ b/src/dispatch/static/dispatch/src/incident/store.js @@ -207,12 +207,14 @@ const actions = { commit("SET_DIALOG_REPORT", true) commit("SET_SELECTED", incident) - state.report.tactical.actions = incident.tasks.reduce((result, task) => { - if (task.status == "Resolved") { - return result - } - return (result ? result + "\n" : "") + "- " + task.description - }, "") + state.report.tactical.actions += + "\n\nOutstanding Incident Tasks:\n" + + incident.tasks.reduce((result, task) => { + if (task.status == "Resolved") { + return result + } + return (result ? result + "\n" : "") + "- " + task.description + }, "") }, closeReportDialog({ commit }) { commit("SET_DIALOG_REPORT", false) From ac233a4fbc9064a9b970759a3d1053c6390f30ba Mon Sep 17 00:00:00 2001 From: kevgliss Date: Wed, 20 Sep 2023 15:04:58 -0700 Subject: [PATCH 2/8] Rework the way slack api errors are propagated (to the caller) (#3789) Co-authored-by: David Whittaker <84562015+whitdog47@users.noreply.github.com> --- .../plugins/dispatch_slack/service.py | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/service.py b/src/dispatch/plugins/dispatch_slack/service.py index 17162392bf38..6de65c05c185 100644 --- a/src/dispatch/plugins/dispatch_slack/service.py +++ b/src/dispatch/plugins/dispatch_slack/service.py @@ -38,43 +38,30 @@ def chunks(ids, n): yield ids[i : i + n] -def handle_slack_error(exception: SlackApiError, endpoint: str, kwargs: dict) -> NoReturn: - message = ( - f"SlackAPIError. Response: {exception.response}. Endpoint: {endpoint}. Kwargs: {kwargs}" - ) - error = exception.response["error"] - - if error in { - SlackAPIErrorCode.CHANNEL_NOT_FOUND, - SlackAPIErrorCode.USER_NOT_IN_CHANNEL, - SlackAPIErrorCode.USERS_NOT_FOUND, - }: - log.warn(message) - elif error == SlackAPIErrorCode.FATAL_ERROR: - # NOTE we've experienced a wide range of issues when Slack's performance is degraded - log.error(message) - time.sleep(300) - raise TryAgain from None - elif exception.response.headers.get("Retry-After"): - wait = int(exception.response.headers["Retry-After"]) - log.info(f"SlackError: Rate limit hit. Waiting {wait} seconds.") - time.sleep(wait) - raise TryAgain from None - else: - raise exception - - @retry(stop=stop_after_attempt(5), retry=retry_if_exception_type(TryAgain)) def make_call(client: WebClient, endpoint: str, **kwargs) -> SlackResponse: """Makes a Slack client API call.""" try: if endpoint in set(SlackAPIGetEndpoints): - response = client.api_call(endpoint, http_verb="GET", params=kwargs) - else: - response = client.api_call(endpoint, json=kwargs) - except SlackApiError as e: - handle_slack_error(e, endpoint, kwargs) - return response + return client.api_call(endpoint, http_verb="GET", params=kwargs) + return client.api_call(endpoint, json=kwargs) + except SlackApiError as exception: + message = ( + f"SlackAPIError. Response: {exception.response}. Endpoint: {endpoint}. Kwargs: {kwargs}" + ) + + error = exception.response["error"] + if error == SlackAPIErrorCode.FATAL_ERROR: + # NOTE we've experienced a wide range of issues when Slack's performance is degraded + log.error(message) + time.sleep(300) + raise TryAgain from None + elif exception.response.headers.get("Retry-After"): + wait = int(exception.response.headers["Retry-After"]) + log.info(f"SlackError: Rate limit hit. Waiting {wait} seconds.") + time.sleep(wait) + raise TryAgain from None + raise exception def list_conversation_messages(client: WebClient, conversation_id: str, **kwargs) -> SlackResponse: From 6b5b612334ffa2e0137f28e33c0c969f03fce2b7 Mon Sep 17 00:00:00 2001 From: David Whittaker <84562015+whitdog47@users.noreply.github.com> Date: Thu, 21 Sep 2023 11:21:02 -0700 Subject: [PATCH 3/8] Only use stable priority if set (#3803) Co-authored-by: David Whittaker --- src/dispatch/incident/service.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dispatch/incident/service.py b/src/dispatch/incident/service.py index 3c6d06d06433..5c6a70daf5af 100644 --- a/src/dispatch/incident/service.py +++ b/src/dispatch/incident/service.py @@ -289,9 +289,8 @@ def update(*, db_session, incident: Incident, incident_in: IncidentUpdate) -> In incident_severity_in=incident_in.incident_severity, ) - if incident_in.status == IncidentStatus.stable: - if incident.project.stable_priority: - incident_priority = incident.project.stable_priority + if incident_in.status == IncidentStatus.stable and incident.project.stable_priority: + incident_priority = incident.project.stable_priority else: incident_priority = incident_priority_service.get_by_name_or_default( db_session=db_session, From 488852a68314841917632285455e4f971c9a27c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:24:30 -0700 Subject: [PATCH 4/8] Bump pandas from 2.1.0 to 2.1.1 (#3801) Bumps [pandas](https://github.com/pandas-dev/pandas) from 2.1.0 to 2.1.1. - [Release notes](https://github.com/pandas-dev/pandas/releases) - [Commits](https://github.com/pandas-dev/pandas/compare/v2.1.0...v2.1.1) --- updated-dependencies: - dependency-name: pandas dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements-base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-base.txt b/requirements-base.txt index fece2b2366ae..9086b84d41e8 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -245,7 +245,7 @@ packaging==23.1 # spacy # statsmodels # thinc -pandas==2.1.0 +pandas==2.1.1 # via # -r requirements-base.in # statsmodels From 0c98860ea5aff0f871f443f4b4e66dc1ca502d7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:24:38 -0700 Subject: [PATCH 5/8] Bump faker from 19.6.1 to 19.6.2 (#3800) Bumps [faker](https://github.com/joke2k/faker) from 19.6.1 to 19.6.2. - [Release notes](https://github.com/joke2k/faker/releases) - [Changelog](https://github.com/joke2k/faker/blob/master/CHANGELOG.md) - [Commits](https://github.com/joke2k/faker/compare/v19.6.1...v19.6.2) --- updated-dependencies: - dependency-name: faker dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index d18494ecda1a..7a9bc081a7ce 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -34,7 +34,7 @@ executing==1.2.0 # stack-data factory-boy==3.3.0 # via -r requirements-dev.in -faker==19.6.1 +faker==19.6.2 # via # -r requirements-dev.in # factory-boy From b9fa0fa1f6ffe0736667f9d80d50ee1903704526 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:24:46 -0700 Subject: [PATCH 6/8] Bump numpy from 1.25.2 to 1.26.0 (#3794) Bumps [numpy](https://github.com/numpy/numpy) from 1.25.2 to 1.26.0. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.25.2...v1.26.0) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: David Whittaker <84562015+whitdog47@users.noreply.github.com> --- requirements-base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-base.txt b/requirements-base.txt index 9086b84d41e8..3e12890d1be0 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -218,7 +218,7 @@ murmurhash==1.0.9 # preshed # spacy # thinc -numpy==1.25.2 +numpy==1.26.0 # via # -r requirements-base.in # blis From 71225548ca6e237f48644a3d9c00a819dc19ddb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:24:53 -0700 Subject: [PATCH 7/8] Bump google-api-python-client from 2.99.0 to 2.100.0 (#3793) Bumps [google-api-python-client](https://github.com/googleapis/google-api-python-client) from 2.99.0 to 2.100.0. - [Release notes](https://github.com/googleapis/google-api-python-client/releases) - [Changelog](https://github.com/googleapis/google-api-python-client/blob/main/CHANGELOG.md) - [Commits](https://github.com/googleapis/google-api-python-client/compare/v2.99.0...v2.100.0) --- updated-dependencies: - dependency-name: google-api-python-client dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: David Whittaker <84562015+whitdog47@users.noreply.github.com> --- requirements-base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-base.txt b/requirements-base.txt index 3e12890d1be0..e7f2d7377c99 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -122,7 +122,7 @@ frozenlist==1.4.0 # aiosignal google-api-core==2.11.1 # via google-api-python-client -google-api-python-client==2.99.0 +google-api-python-client==2.100.0 # via -r requirements-base.in google-auth==2.22.0 # via From 985b8825f823d80ad3bc51f61bfd39633a995144 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 13:25:01 -0700 Subject: [PATCH 8/8] Bump ruff from 0.0.289 to 0.0.290 (#3792) Bumps [ruff](https://github.com/astral-sh/ruff) from 0.0.289 to 0.0.290. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.0.289...v0.0.290) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: David Whittaker <84562015+whitdog47@users.noreply.github.com> --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 7a9bc081a7ce..d15fe4be7bbd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -90,7 +90,7 @@ python-dateutil==2.8.2 # via faker pyyaml==6.0.1 # via pre-commit -ruff==0.0.289 +ruff==0.0.290 # via -r requirements-dev.in six==1.16.0 # via