Skip to content

Commit ec36049

Browse files
authored
chore(hc): Remove option for routing slack requests (#97758)
Removing its usage here, defaulting to GA, then going to remove the declaration in flagpole, before removing the flag altogether.
1 parent 994a5b1 commit ec36049

File tree

5 files changed

+3
-46
lines changed

5 files changed

+3
-46
lines changed

src/sentry/hybridcloud/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@
165165
# Controls whether or not the pathway to target regions via integration request contents is enabled for the system.
166166
register(
167167
"hybrid_cloud.integration_region_targeting_rate",
168-
default=0.0,
168+
default=1.0,
169169
flags=FLAG_AUTOMATOR_MODIFIABLE,
170170
)

src/sentry/integrations/middleware/hybrid_cloud/parser.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from sentry.silo.client import RegionSiloClient, SiloClientError
3131
from sentry.types.region import Region, find_regions_for_orgs, get_region_by_name
3232
from sentry.utils import metrics
33-
from sentry.utils.options import sample_modulo
3433

3534
logger = logging.getLogger(__name__)
3635
if TYPE_CHECKING:
@@ -320,11 +319,7 @@ def get_organizations_from_integration(
320319
organization_ids=organization_ids
321320
)
322321

323-
# (1-TARGET_RATE)% of integrations will return all the organizations
324-
if not sample_modulo("hybrid_cloud.integration_region_targeting_rate", integration.id):
325-
return all_organizations
326-
327-
# (TARGET_RATE)% of integrations will attempt to target a specific organization
322+
# Integrations will attempt to target a specific organization
328323
return self.filter_organizations_from_request(organizations=all_organizations)
329324

330325
def filter_organizations_from_request(

src/sentry/integrations/slack/message_builder/help.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from sentry.integrations.slack.message_builder.base.block import BlockSlackMessageBuilder
55
from sentry.integrations.slack.message_builder.types import SlackBlock
6-
from sentry.utils.options import sample_modulo
76

87
_logger = logging.getLogger(__name__)
98

@@ -23,10 +22,6 @@
2322
"unlink": "Unlink your Slack identity from your Sentry account.",
2423
}
2524
CHANNEL_COMMANDS = {
26-
"link team": "Get your Sentry team's issue alert notifications in this channel.",
27-
"unlink team": "Unlink a team from this channel.",
28-
}
29-
CHANNEL_COMMANDS_ROUTING = {
3025
"link team [organization_slug]": "Get your Sentry team's issue alert notifications in this channel.",
3126
"unlink team [organization_slug]": "Unlink a team from this channel.",
3227
}
@@ -56,7 +51,6 @@ def list_commands(commands: Mapping[str, str]) -> str:
5651

5752
DM_COMMANDS_MESSAGE = list_commands(DM_COMMANDS)
5853
CHANNEL_COMMANDS_MESSAGE = list_commands(CHANNEL_COMMANDS)
59-
CHANNEL_COMMANDS_ROUTING_MESSAGE = list_commands(CHANNEL_COMMANDS_ROUTING)
6054
HELP_COMMANDS_MESSAGE = list_commands(HELP_COMMANDS)
6155

6256

@@ -78,18 +72,12 @@ def get_header_blocks(self) -> Sequence[SlackBlock]:
7872
return blocks
7973

8074
def get_help_message(self) -> SlackBlock:
81-
channel_commands_message = CHANNEL_COMMANDS_MESSAGE
82-
if self.integration_id and sample_modulo(
83-
"hybrid_cloud.integration_region_targeting_rate", self.integration_id
84-
):
85-
channel_commands_message = CHANNEL_COMMANDS_ROUTING_MESSAGE
86-
8775
return self._build_blocks(
8876
*self.get_header_blocks(),
8977
self.get_markdown_block(DM_COMMAND_HEADER),
9078
self.get_markdown_block(DM_COMMANDS_MESSAGE),
9179
self.get_markdown_block(CHANNEL_COMMANDS_HEADER),
92-
self.get_markdown_block(channel_commands_message),
80+
self.get_markdown_block(CHANNEL_COMMANDS_MESSAGE),
9381
self.get_markdown_block(HELP_COMMANDS_HEADER),
9482
self.get_markdown_block(HELP_COMMANDS_HEADER_MESSAGE),
9583
self.get_markdown_block(HELP_COMMANDS_MESSAGE),

tests/sentry/integrations/slack/webhooks/commands/test_help.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from sentry.integrations.slack.message_builder.types import SlackBody
55
from sentry.silo.base import SiloMode
66
from sentry.testutils.helpers import get_response_text
7-
from sentry.testutils.helpers.options import override_options
87
from sentry.testutils.silo import control_silo_test
98
from sentry.types.region import Region, RegionCategory
109
from tests.sentry.integrations.slack.webhooks.commands import SlackCommandsTest
@@ -64,26 +63,6 @@ def test_invalid_command(self) -> None:
6463
assert_unknown_command_text(data, "invalid command")
6564

6665
@responses.activate
67-
@override_options({"hybrid_cloud.integration_region_targeting_rate": 0.0})
68-
def test_help_command(self) -> None:
69-
if SiloMode.get_current_mode() == SiloMode.CONTROL:
70-
region_response = SlackHelpMessageBuilder(
71-
command="help",
72-
integration_id=self.integration.id,
73-
).as_payload()
74-
responses.add(
75-
method=responses.POST,
76-
url="http://us.testserver/extensions/slack/commands/",
77-
json=region_response,
78-
)
79-
data = self.send_slack_message("help")
80-
assert_is_help_text(data)
81-
text = get_response_text(data)
82-
assert "`/sentry link team`:" in text
83-
assert "`/sentry unlink team`:" in text
84-
85-
@responses.activate
86-
@override_options({"hybrid_cloud.integration_region_targeting_rate": 1.0})
8766
def test_help_command_with_organization_team_linking(self) -> None:
8867
if SiloMode.get_current_mode() == SiloMode.CONTROL:
8968
region_response = SlackHelpMessageBuilder(

tests/sentry/middleware/integrations/parsers/test_slack.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from sentry.integrations.slack.views import SALT
2020
from sentry.middleware.integrations.parsers.slack import SlackRequestParser
2121
from sentry.testutils.cases import TestCase
22-
from sentry.testutils.helpers.options import override_options
2322
from sentry.testutils.outbox import assert_no_webhook_payloads
2423
from sentry.testutils.silo import assume_test_silo_mode_of, control_silo_test, create_test_regions
2524
from sentry.utils import json
@@ -185,7 +184,6 @@ def test_async_request_payload(self) -> None:
185184
assert "body" in result
186185
assert result["body"] == request.body.decode("utf8")
187186

188-
@override_options({"hybrid_cloud.integration_region_targeting_rate": 1.0})
189187
def test_targeting_all_orgs(self) -> None:
190188
# Install the integration on two organizations
191189
other_organization = self.create_organization()
@@ -211,7 +209,6 @@ def test_targeting_all_orgs(self) -> None:
211209
assert self.organization.id in organization_ids
212210
assert other_organization.id in organization_ids
213211

214-
@override_options({"hybrid_cloud.integration_region_targeting_rate": 1.0})
215212
def test_targeting_specific_org(self) -> None:
216213
# Install the integration on two organizations
217214
other_organization = self.create_organization()
@@ -236,7 +233,6 @@ def test_targeting_specific_org(self) -> None:
236233
assert len(organizations) == 1
237234
assert organizations[0].id == other_organization.id
238235

239-
@override_options({"hybrid_cloud.integration_region_targeting_rate": 1.0})
240236
def test_targeting_irrelevant_org(self) -> None:
241237
# Install the integration on two organizations
242238
other_organization = self.create_organization()
@@ -263,7 +259,6 @@ def test_targeting_irrelevant_org(self) -> None:
263259
assert len(organization_ids) == 2
264260
assert irrelevant_organization.id not in organization_ids
265261

266-
@override_options({"hybrid_cloud.integration_region_targeting_rate": 1.0})
267262
def test_targeting_issue_actions(self) -> None:
268263
# Install the integration on two organizations
269264
other_organization = self.create_organization()

0 commit comments

Comments
 (0)